I am modeling a large production environment and create a huge number of entities. The source names them according to their main part and also adds some attributes via the mechanisms of delivery tables.
Along the production line there are three scenarios at every station:
I tried this code as entrance control to the different stations:
(vProductionArea is a variable inherent to every station (which are all subframes))
var tTableA, tTableB : table tTableA := ~.ImportMethods.tLeadTimes_raw[1,1][2,1] tTableB := ~.ImportMethods.tLeadTimes_raw[1,1][1,1] if pos("TL", vProductionArea)>0 and vLastHandledEntityName /= "" switch vProductionArea case "A Testing1" if @.name = vLastHandledEntityName if @.InjectorType = vLastHandledInjectorType --same main part and same attribute ?.SetupTime := 0 else --same main part but different attribute ?.SetupTime := str_to_time(tTableA[4,1][1,1]) end else --main part type is different ?.SetupTime := str_to_time(tTableA[4,1][2,1]) end case "A Testing2" ..same logic.. case "A Testing3" ..same logic.. case "B Testing1" ..same logic.. case "B Testing2" ..same logic.. case "B Testing3" ..same logic.. else print "mSetupTime: Thats strange. Found in the table and part of testing line but no C/O time available? " + current.name EventController.stop(false) end end vLastHandledEntityName := @.name vLastHandledInjectorType := @.InjectorType
However, it turned out to be extremely unperformant. I already brought down the routine from >85% according to the Profiler, but it still makes up for >30% of the simulation time. Converting the table columns into time-format to avoid conversion during actual simulation seems logic but I doubt that it brings enough benefit. 30 days simulation time produce ~3.6 million calls.
Moreover, since activating this method every now and then I receive an "Access violation error" which shuts down Plant Simulation(14.0).
Do you have any recommendations how this task can be accomplished in a more efficient way?
Thanks a lot in advance!
Edit: Sorry for the repost, but somehow my previously created thread disappeared.
Solved! Go to Solution.
There are several suggestions to simplify your model. My first suggestion involves two parts:
I think this would be the fastest and most robust approach, provided that you are able to combine the attributes.
thanks for your suggestion.
I haven't thought this through in every detail, but if I manage to combine the attributes it would lead to a matrix which at least had the size 200x200. As I don't know how Plant Simulation handles this internally, do you think it would lead to improvements which are worth the effort?
Plant Simulation can easily handle this 200x200 matrix and you only have to create it once.
But there is another thing: you have 2 parameters that determine the set-up time. If you can put this in a formula, you can also determine the set-up times during the simulation in an efficient way.