I have a production line composed of 30 SingProcess and 29 buffers alternated. The cycle times in each SingProcess are firstly recorded to a table and then (endsim method) written into a .txt file using the FileInterface object. I all the situations I used worked correctly, whereas now, in this model, it works for all the stations, except for station 11, where instead of writing on the .txt it deletes it. I really can't figure out why it is doing that. Attached there is my model, however I have an Educational Licence and thus I do not know if others can open it. If it is the case I will post the code.
Solved! Go to Solution.
The data is not written to TS11.txt file, because
there is no data logged in the corresponding TS11 table.
If you look to the corresponding m111 entry method,
you (accidentally) set the TS10 table instead of TS11.
With following code it will work
-- lookup if eventcontroller.simtime < eventcontroller.startstat return end var str :string str:=?.name +"_" + to_str(@) --TS10.writeRow(0,TS10.ydim+1,str) --TS10.writeRow(1,TS10.ydim+1,to_str(eventcontroller.absSimtime)) TS11.writeRow(0,TS11.ydim+1,str) TS11.writeRow(1,TS11.ydim+1,to_str(eventcontroller.absSimtime))
@ model structure
I guess you have spent quiete a long time creating and renaming 30 X (MSx1 + MSx2 +TSx + writex + FileInterfacex) = 150 objects, which all contain the same code.
Object orientated modeling will reduce the 150 objects to 5 !
Therefore I strongly recommend to simplify and reduce the objects (with same code) in the model.
Tomorrow I'll send you an example on how, which you should follow.
As posted yesterday, I have tuned the model structure (parameters have not been set!)
The dedicated methods and tables have been placed into a station class object
The stations in the models.frame are all inherited from this class object
with the following improvements:
1. objects reduced from 279 to 139
The methods were optimized with :
code lines in init method reduced from 62 to 6
code lines in reset method reduced from 31 to 1
code lines in endSim method reduced from 67 to 29
For future simulations with models likes yours, you should
use a similiar structure as shown in the attached model.