ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
|
Downloads |
Q&A Using Flexsim and building models |
#1
|
||||
|
||||
different simulation time by using different run speeds
Hi,
I build a small and simple model. a crane transport a flowitem from a source to a queue. all items will be placed to a zero z-position in the queue. the queue has a maximum content of 100 and uses the vertical stack option. Therefore I use a custom draw code at the properties window. for (int i=1;i <= content(current); i++) setloc(rank(current,i),1,-0.45,0); return 1; With a run speed below 300 all works fine. With run speeds above 300 (e.g. 500) the simulation lasts longer. It seems the model doesn't executes sometimes the custom draw code anymore and the flowitems are stacked to a vertical increasing column. How can I place all items at a zero z-position with an unlimited runspeed, not using a custom draw code. Joerg |
#3
|
||||
|
||||
Hi Lars-Olof and ambitiuos flexsim users,
probably I didn't ask my question with the whole details, I should have. I'm sorry for that. The standard option places the item in a vertical stack. This stack or column is in the centre of the queue. This is the same position my items should delivered to. The queue itself controlls the placing and picking by a taskexecuter (TE) in the centre. Therefore there are existing two functions: pickoffset and placeoffset. I find that in the library tree. These functions are responsible for the behaviour of the TE and call another function: setlocation. All these function are depending from the draw code and they all work fine. But if I write my own code the described problem in the post above happens. It is a miracle for me that the simulation time is depending from the run speed. The different simulation times occure also by changing the view angle und view position during the simulation and the same effect takes also place with a transporter. The simpliest solution is to use two queues. the first queue gets the item transported by a taskexecuter. This queue has a maximum content of one. the second queue has the rest maximum content of the previous queue with the strange behaviour. But now I have to write new code to get the right statistic information. This is an approach I would avoid. But the miracle exists further. Jörg Last edited by Jörg Vogel; 12-03-2014 at 02:03 AM. Reason: Reloading Attachement |
#4
|
|||
|
|||
Hi Jörg,
The problem you have with is that Flexsim calculate the drop position from how many you have in the queue. For example if you stack the item vertical and the item is 1 unit height, the first drop position is 1, the second is 2 etc. I would remove your code in OnDraw and use Do Nothing on Item Placemnet. I set the location for the item in OnEntry and I also have changed the queue placement using Edit under Properties for the queue. See attached model. Hope this gives you some ideas. Lars-Olof |
The Following 2 Users Say Thank You to Lars-Olof Leven For This Useful Post: | ||
RalfGruber (09-19-2008) |
#5
|
||||
|
||||
The danger of doing result relevant calculations (in your case the position of the items) in CustomDraw code is that you never know exactly, when it will be executed, especially with high simulation run speeds.
So you should only put animation relevant code into the CustomDraw trigger which doesn´t have any impact on simulation results and leave everything leading into results on triggers which will be fired at well defined points of time... e.g.: using "updatekinematics" in the CustomDraw trigger leads to updating an objects position with every screenrefresh, but doesn´t change the calculation of the objects position itself. But if you need the objects position for a calculation e.g. in OnEntry, you should call "updatekinematics" in that code right before you start to get location information from the object because you don´t know, when CustomDraw has been called the last time. Best regards Ralf aka ralle |
The Following 2 Users Say Thank You to RalfGruber For This Useful Post: | ||
Tom David (09-19-2008) |
#6
|
||||
|
||||
"Therefore there are existing two functions: pickoffset and placeoffset. I find that in the library tree. These functions are responsible for the behaviour of the TE and call another function: setlocation. All these function are depending from the draw code and they all work fine." - Jörg Vogel
Jörg, None of the objects in the library rely on the draw code for their calculations. Flexsim will run a regular model with regular library objects doing regular things with all the windows closed just fine. OnDraw only gets called if there is a window open to paint. It gets called less on higher run speeds because your cpu is busy calculating simulation results instead of busy calculating paint messages. |
The Following User Says Thank You to Phil BoBo For This Useful Post: | ||
Jörg Vogel (09-19-2008) |
Thread | Thread Starter | Forum | Replies | Last Post |
Displaying the simulation time with the various date/time formats. | Regan Blackett | Tips and Tricks | 12 | 11-12-2012 08:01 AM |
Inter Arrival Time by Time of Day Mod | Brandon Peterson | Tips and Tricks | 0 | 04-23-2008 11:13 AM |