Hello, I have a problem I don’t quite understand relating to the booking of jobs for the crane depending on its state (waituntil portal.state=”idle” etc.)
In my model I have a crane which moves parts from storage (marked in orange). These parts are moved to stations along the top part of the portal track (some stations are marked in red, green and blue). Also other stations are involved in the bottom of the model, but these are unrelated to the issue I am having. Only the highlighted areas are for understanding and debugging of the problem.
To get to my problem area, open the model and ignore all breakpoints. Press play and the model should stop at around 37:46 minutes. Enable all breakpoints, set the simulation speed to 1x real time and press play. The first breakpoint will activate shortly thereafter which is the start of my problem sequence described below.
Pick_Stn3_HF (marked in red) exit control is called first. It is the first to execute “waituntil portal.state=”idle” prio 1;”
Second station to execute the same line is Pick_Stn7 (marked in blue)
Third station to execute the same line is Pick_Stn4 (marked in green)
Note that Pick_Stn4 and Pick_Stn7 share the same exit control method, but it is different (as an object) from the exit control method Pick_Stn3_HF is using.
The sequence so far of all three stations waiting for the portal to become idle seems correct so far. But here comes the part I don’t understand.
The first station to finish waiting is Pick_Stn3_HF (red) and commences its crane sequence. When executing line 28 in its exit control (motionOK := portal.moveToObject( ? ) ), Pick_Stn7 also finishes waiting as it detects that the portal is idle. This is incorrect, as the portal state should be “driving” after the “moveToObject” command was executed in Pick_Stn3_HF. This is where the conflict begins. The crane has two jobs running at the same time when Pick_Stn7 should actually wait for Pick_Stn3_HF to finish its sequence. Is this because everything is happening in the same event – i.e. the crane’s state does not have a chance to change before the next event?
Am I misunderstanding how the crane is “booked” for jobs according to its state? All methods are waiting for the crane to be idle, but in a certain order. If all methods would continue their sequence I would expect to see Pick_Stn7 to start executing its sequence right after Pick_Stn3_HF stopped waiting and started executing its own sequence. But this does not happen until I move the crane in line 28 of Pick_Stn3_HF.
I hope you can understand.
The description was written as a basis for attaching the model to this post, but I am unable to attach the model publicly. Hopefully it is understandable without the model, but if the model is required for debugging please say so and I can attach it in a private way.
Solved! Go to Solution.
Wow, sometimes I amaze myself. I managed to solve my problem.
The reason for the strange behavior was because i was trying to move the crane directly to Pick_Stn3_HF which happens to be outside the bounds of the portal tracks and accessible area, instead of my dummy-object which is supposed to represent the actual loading/unloading area for the crane in reality (which is inside the accessible area for the crane).
All is well now.