question

Jelle B avatar image
0 Likes"
Jelle B asked Mischa Spelt commented

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

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

FlexSim 17.0.1
textrun timeonmessage
5 |100000

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

1 Answer

Mischa Spelt avatar image
1 Like"
Mischa Spelt answered Mischa Spelt commented

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.

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

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

· 3
5 |100000

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