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.

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.

· 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.

Jelle B avatar image Jelle B commented ·

@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 0 ·
Mischa Spelt avatar image Mischa Spelt Jelle B commented ·
(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 [email protected].

0 Likes 0 ·
Jelle B avatar image Jelle B commented ·

@Mischa Spelt

nevermind, I got it!

Thank you very much for your help!

0 Likes 0 ·