FlexSim Community Forum

FlexSim Community Forum (https://archive.flexsim.com/index.php)
-   Tips and Tricks (https://archive.flexsim.com/forumdisplay.php?f=67)
-   -   Stop message with information (Debugging) (https://archive.flexsim.com/showthread.php?t=108)

Tom David 09-20-2007 01:10 AM

Execute a stop message (e.g. msg) with information (Debugging)
Sometimes if you run a model you like to have some specific information in special situations during your model run. In most cases this is for debugging reasons to check your logic.
I figured out, that sometimes I just like the model run to continue but sometimes I like to stop the model run to have a deeper look into the current situation.

What I use for this is showing a screen message with some information and by pressing OK or Cancel I can continue the model run or stop in the current situation.

stop(); if(msg(getname(current),concat("Label tomtheAtom: ",numtostring(getlabelnum(current,"tomtheAtom"),0, 4), strascii(13), "Label tomdavid: ",numtostring(getlabelnum(current,"tomdavid"), 0,4) )) == 1) {go();} else {stop();}

First I stop the model run, because otherwise the model run will continue during showing the message. Depending on the user input the model will go() or stop().
In the message I always display the name of the object, to make it easier to find the code. Sometimes I also write in the Message the Trigger where the code is fired:

concat(getname(current), " – Entry Trigger")

With strascii(13) which is a return CR you start a new line to organize the message box a bit. Sometimes strascii(9) which is a tab TAB is also very useful.

I always have the code in one line, to make it easy to make it to a comment (not execute the code any longer) by just putting // in front of the line.
Normally if I take the code out I do it by e.g. //***TD to make it easy to find this code later.

If you like to get information from the model, but do not want to stop the model run and press the OK button several times, please see my thread “Print information into output console (Debugging)”in the Technical Support Forum - Consoles.

Have fun
tom the (A)tom

All times are GMT -6. The time now is 11:56 PM.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.