ATTENTION

This 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

Go Back   FlexSim Community Forum > FlexSim Software > Tips and Tricks
Downloads

Tips and Tricks Share helpful modeling ideas

  #1  
Old 09-20-2007
Tom David's Avatar
Tom David Tom David is offline
Flexsim User
 
Join Date: Aug 2007
Location: Schwaebisch Gmuend, Germany
Posts: 430
Downloads: 157
Uploads: 47
Thanks: 486
Thanked 450 Times in 233 Posts
Rep Power: 520
Tom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant futureTom David has a brilliant future
Default 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)



All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.