PDA

View Full Version : Tips & Tricks: Set run speed in Flexsim HC


Tom David
03-25-2010, 10:22 PM
I am not sure if someone else needs it, but it took me a while to figure out how to set the run speed in Flexsim HC and update the main panel. Thanks to Cliff for giving me a hint how to update the scroll bar and develop such a nice piece of software which is called Flexsim HC.

I like if my models always start with the same run speed, that’s why I use this code in nearly every model.

Here is the code I use if I set the run speed to 12, which I do normally in a User Event at OnReset:

// SET RUNSPEED
double dRunspeed = 12.00;
treenode ScrollBar = node("/active/Main Panel/bar2/runspeedpanel/ScrollBarPanel/ScrollBar",views());
treenode RunSpeed = node("/active/Main Panel/bar2/runspeedpanel/ScrollBarPanel/RunSpeed",views());
set(node("MAIN:/project/exec/step"), dRunspeed / 60);
int iDecimals = 2;
if(dRunspeed > 10) iDecimals = 1;
if(dRunspeed > 100) iDecimals = 0;
sets(node(">value", RunSpeed), numtostring(dRunspeed, 0, iDecimals));
setnodenum(node(">itemcurrent", ScrollBar), dRunspeed / 60);
setnodenum(node(">value", ScrollBar), dRunspeed / 60);
applylinks(ScrollBar, 1);
applylinks(RunSpeed, 1);

Cliff King
04-09-2010, 09:42 AM
Version 2.7 (currently released in BETA form to a select group of users) has a command setrunspeed() command to handle the setting of the model runspeed, and updating the related toolbar information as well. On a related note, the new version has the following shortcut keys which you might be interested in as well:

Ctrl+Up arrow to increase runspeed (rounds off to the nearest reasonable speed, so it's easy to stick on 1 if desired)
Ctrl+Down arrow to decrease runspeed (also rounds)
Ctrl+Left arrow to reset the model
Ctrl+Right arrow to step through events of model
Ctrl+Space bar to toggle between run and stop the model run
Ctrl+T to open the Track Manager
Ctrl+R to open the Flowcharting tool (R for "Routes")