question

Jacob Leto avatar image
0 Likes"
Jacob Leto asked Sam Stubbs answered

Creating a timer to show cycle time

I am trying to create a visual timer that will show the amount of time it takes for a robot to load, unload and load another item. As it stands, I have set up a number label ("Cycle Time Start") on the robot that gets set to the current simulation time when it loads an itemtype 1, and then another label ("Cycle Time End") that gets set when a robot loads an itemtype 2. I then reference and subtract these times using the getlabelnum() command to get a number for the robots cycle time. This method is capable of calculating cycle time, however, I thought it would be more visual for a timer to start when a robot loads an itemtype 1 and end when it loads an itemtype 2. Does anyone know how to do this? I will attach a model of what I currently have now.

cycle-time-example.fsm

FlexSim 17.0.0
cycle timetimer
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jacob Leto avatar image Jacob Leto commented ·

@Jeff Nordgren any ideas on how to do this? I'm basically trying to create a timer that is started when a robot loads a part of type 1 and then stopped when it loads a part of type 2.

0 Likes 0 ·

1 Answer

Sam Stubbs avatar image
0 Likes"
Sam Stubbs answered

Sorry it took us a while to respond. So here's what we did to get your label to visually increment during the run time. (So far it works really with just item 1 but you can tweak it as you need for the rest of your model.)

First we created a label on the Robot called "starttimer" which is set at 0, and we make sure that the Reset labels box is checked.

Then we added a set label command inside your if statements in the OnLoad trigger of the robot. We set the number of the label to 1 and 2 respectively.

Then in the Cycle Time text display we added this code at the end of your Text Display code

double displaytime = 0;


if (involved.labels["starttimer"].value==1)  {
	displaytime = time() - involved.labels["ProcessStartTime"].value;
}
else if (involved.labels["starttimer"].value==2)  {
	displaytime = involved.labels[labelname].value;
}


setnodestr(textnode, concat(starttext, numtostring(displaytime,0,1)));

As you can see it's just a matter of displaying the time() command in the model subtracted by the process time labels you already have created previously.

I've attached the model below for you to see:

5892-cycle-time-example.fsm


5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.