Creating a timer to show cycle time

Creating a timer to show cycle time

jacob_leto1
Not applicable
27 Views
2 Replies
Message 1 of 3

Creating a timer to show cycle time

jacob_leto1
Not applicable

[ FlexSim 17.0.0 ]

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

0 Likes
Accepted solutions (1)
28 Views
2 Replies
Replies (2)
Message 2 of 3

jacob_leto1
Not applicable

@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
Message 3 of 3

sam_stubbsYXX86
Community Manager
Community Manager
Accepted solution

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

0 Likes