Cancel
Showing results for 
Search instead for 
Did you mean: 

How to export the stock list of a store into a table?

Pioneer
Pioneer

Hello everyone,

 

I want to export the stock list of an store into a table, which contains the name and the number of MUs.

 

And is it possible to have a real time stock list?

 

Thank you very much!

5 REPLIES 5

Re: How to export the stock list of a store into a table?

Legend
Legend

Hello, 

 

Thanks to "ContentsList" attribute you can get the list of all the MUs stocked in your object (store, buffer ...) 

But you can also create your own stock list. 

You should create a table and attach a EntranceMethod in your object (Buffer, Store ...), this method will fill your table with all the informations you want. 

 

for example : 

local index : integer := table.ydim + 1 ; 
table["Name", index] := @.name ;  -- MU's name
table["Time",index] := eventController.Simtime;  -- the time when the Mus has been stocked 
etc ... 

 

Afterwards you can export your table to an excel file thanks you "WriteExcelFile".
Here is an example of this function :

-- SimTalk 1.0 notation
MyStackFile.writeExcelFile("C:\users\nelly\factory_a.xls");
MyTableFile.writeExcelFile("C:\temp\factory_a.xls","Engines",true);
if MyCardFile.writeExcelFile("C:\temp\data.xls") then 
   -- data written successfully
else -- take appropriate measures
end;

 

Re: How to export the stock list of a store into a table?

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor
if you want a list with the number of the MU-types, than you need to register/unregister the MUs,
you can do this in an entrance control and in your "unstore" method. (from 12.1 you have also an exit control in the store).
The easiest way: insert a tableFile into your frame, activate the row index an type into the row index all your MU-names; first column: integer;

to register an MU:
stockList[1,@.name]:=stockList[1,@.name]+1;
unregister:
stockList[1,@.name]:=stockList[1,@.name]-1;

You need to delete the values e.g. in an init.method at the beginning of an experiment.

Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: How to export the stock list of a store into a table?

Pioneer
Pioneer
If my version is 12.0, am I still be able to unregister the MUs? (Because the store in this version has no exit control)

Re: How to export the stock list of a store into a table?

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

I guess. you have some kind of method to remove the MUs from the store, you could use this method also for unregister the MUs.

Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: How to export the stock list of a store into a table?

Pioneer
Pioneer
Thank you very much Steffen! I've just finished my project with your help. Smiley Very Happy