ATTENTIONThis FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices. |
flexsim.com |
#1
|
||||
|
||||
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 Last edited by Cliff King; 09-20-2007 at 08:48 AM. |
The Following User Says Thank You to Tom David For This Useful Post: | ||
Jeanzhao (07-16-2012) |