How can i display the current run time in my text display when it gets a message

How can i display the current run time in my text display when it gets a message

jelle_bauters
Not applicable
147 Views
4 Replies
Message 1 of 5

How can i display the current run time in my text display when it gets a message

jelle_bauters
Not applicable

[ FlexSim 17.0.1 ]

Hi guys

I have a little problem with my simulation. I recently started using Flexsim for an internship and I need to simulate a proces. I have uploaded the simulation that I have so far. simulated-process.fsm

I need to display the current Run Time in the text displays when they receive a Message.

The first one needs to display the current Run Time when it receives a Message from the Photo Eye, The PE should send a Message when it is blocked for more than 3 seconds. The second one needs to display the current Run Time when it receives a Message from the Decision Point, the DP should send a Message when there are no more boxes blocking it (but not in the first seconds when there are no boxes).

I figured I should do it with the 'SendMessage' and 'OnMessage' triggers but I haven't figured out how to display the current Run Time.

Any help would be appreciated. Thank you

0 Likes
Accepted solutions (1)
148 Views
4 Replies
Replies (4)
Message 2 of 5

mischa_spelt
Advisor
Advisor
Accepted solution

You can get the current run time in model time units using the time() command.

If you need it in text format, use the numtostring function, e.g.

string message = "The current run time is " 
	+ numtostring( time(), 4, 4 ) + " " + getmodelunit( TIME_PLURAL_NAME );
msg( "Model stopped", message );

The arguments to numtostring specify the number of decimals you want to see in the text representation.

Message 3 of 5

jelle_bauters
Not applicable

@Mischa Spelt

I have managed to get the messagebox with the current time when the Photo Eye gets blocked. But how do I get it when the decision point isn't being blocked by boxes.

And how can I make sure it only gives me that messagebox once when it gets unblocked and then again when it was blocked and gets unblocked again?

(sorry if my English is a little bit broken, not my mother language)

0 Likes
Message 4 of 5

jelle_bauters
Not applicable

@Mischa Spelt

nevermind, I got it!

Thank you very much for your help!

0 Likes
Message 5 of 5

mischa_spelt
Advisor
Advisor
(sorry if my English is a little bit broken, not my mother language)

We are the distributor for The Netherlands and Belgium so if you have a question that is better explained in Dutch, feel free to e-mail us directly at support@talumis.com.

0 Likes