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
|
||||
|
||||
The "Simple Question" Thread
This is a thread that will hopefully streamline the process of finding answers to simpler questions. Instead of making some questions their own thread, if you anticipate your question being answered in one or two posts from other users you can post it here. The result will be less threads in total but no less information throughout them.
My First simple question is: Is there code I can use to specify the numbers 1 to 50 without typing 1||2||3||4||...? Last edited by Xavier Jackson; 06-24-2008 at 09:10 AM. Reason: Question mark |
#2
|
||||
|
||||
int x = duniform(1,100);
if(x <= 50 && x >= 1) { ;//do something } |
The Following User Says Thank You to Phil BoBo For This Useful Post: | ||
Xavier Jackson (06-24-2008) |
#3
|
||||
|
||||
How do I view the full c++ code output so that I can look for errors with the information from the compiler console. This would be helpful as I have a model that will not compile but I cannot find the coding error and the compiler console tells which line of code in the C++ is incorrect as well as what type of error it is.
__________________
Each morning after drudging through his morning routine the mild-mannered Xavier Jackson arrives at work and when he sits down at his computer it powers up and he becomes the great Flexavier Jacksim Optimizer Extraordinaire
|
#4
|
||||
|
||||
The compiler console tells you errors in your Flexscript code. If you are using C++ code, you have to compile using a Visual Studio compiler and it prompts you to open Visual Studio to check the errors when you try to compile.
The compiler console tells you where the errors are in your Flexscript code so you can look at that code and go directly to the line where the mistake is. Example: Flexscript Error MAIN:/project/model/Processor1>variables/entrytrigger line 6 unknown variable "maxindex" The error is in Processor1's entrytrigger. So in this example, you open Processor1's parameters, go to OnEntry, and fix the error in line 6 by declaring the variable maxindex. |
#5
|
||||
|
||||
this was the output of the compiler console and I am completely lost when it comes to visual studio.
building... deleting file: all.obj ------------------------------ compiling functions ------------------------------ execute(cl /W0 /MT /EHa /c /nologo "all.cpp"); all.cpp all.cpp(7696) : error C2317: 'try' block starting on line '7663' has no catch handlers all.cpp(7696) : error C2059: syntax error : 'catch' all.cpp(7696) : error C2143: syntax error : missing ';' before '{' all.cpp(7696) : error C2447: '{' : missing function header (old-style formal list?) all.cpp(7697) : error C2059: syntax error : '}' all.cpp(7697) : error C2143: syntax error : missing ';' before '}' all.cpp(7697) : error C2059: syntax error : '}' all.cpp(7702) : error C2143: syntax error : missing ';' before '{' all.cpp(7702) : error C2447: '{' : missing function header (old-style formal list?) ------------------------------ linking ------------------------------ creating file: C:\Program Files\Flexsim4\program\flexsimRTb.exe LINK : fatal error LNK1181: cannot open input file 'all.obj' ------------------------------ binding ------------------------------
__________________
Each morning after drudging through his morning routine the mild-mannered Xavier Jackson arrives at work and when he sits down at his computer it powers up and he becomes the great Flexavier Jacksim Optimizer Extraordinaire
|
#6
|
||||
|
||||
You can't compile unless you have some version of Visual Studio (2008 express or 2005/2008 full) on your computer. If you do, and it is configured correctly using the Flexsim Compiler Configurator from the windows start menu, then when you try to compile, Flexsim should ask if you want to open Visual Studio to check the errors. You can click OK and that will open Visual Studio. From Visual Studio, you can go to the Build > Build Solution menu option and it will compile it and show you the errors in the Output window (usually at the bottom). You can double-click the errors in the Output window to jump straight to them in the code (all.cpp). Then you can see where the errors are by looking at the function name. For my last example, it says "visible double ObjectFunction312__project_model_Processor1_variab les_entrytrigger(FLEXSIMINTERFACE)" as the function name above where my error is, so I know that my error is in Processor1's entrytrigger. I can fix the error in Visual Studio directly, build solution again, and go back to Flexsim where it will prompt me if I want to load my changes into Flexsim, or I can just close Visual Studio and go fix the errors in Flexsim and try to compile again.
|
The Following 2 Users Say Thank You to Phil BoBo For This Useful Post: | ||
Xavier Jackson (06-30-2008) |
#7
|
||||
|
||||
write and read a value to/from a label
Hi,
I know the way with getlabelnum and setlabelnum, but is there another way to realise it. for example set(label(so(),1),24); set the value of the first label to 24. so() is the reference to an object in the model. In the past I have learned much from the code under the commands in the commandlist-tree, but there aren't any commands for labels in the list. Jörg |
#8
|
|||
|
|||
Just to be clear the best way to set the label is :
setlabelnum(so(),1,24); Where 1 is the rank of the label in so()'s "labels" node. you can also get to the labels node using labels(so()) in your example setnodenum(rank(labels(so()),1),24) but there's no reason to do this given that setlabelnum does it for you. The setlabelnum commands will I guess be overloaded to account for different parameter types (label name or rank), but you're right there are no label commands listed in the exec 'commandslist' node to look at. Last edited by Jason Lightfoot; 07-04-2008 at 06:15 AM. Reason: Misunderstood question and error in post |
#9
|
|||
|
|||
How can I add a graph or a stauts text which says me the average time which is needed for one flowitem to run thru the whole process?
I could use the output node of the ASRS vehicle which puts all the processed items in a rack. Divide that number by the total run time and you get the average time per piece. But how to I realize that? |
#10
|
|||
|
|||
If I was going to do this I would want to know the exact time each item spent in the process. You could log the time the item entered on a label on the item and then use this to calculate the exact time the item has been in the process when the item leaves. Add all of these values together and divide by the total number of parts processed.
|
#11
|
|||
|
|||
On an entry trigger (to the sink for example) you can increment a label with the lifespans of the items.
Code:
double lifespan=time()-getnodenum(stats_creationtime(item)); inc(label(current,"cumLifespan"),lifespan); Attached is a model showing this. Note that in the visual tool's code, it tests if the number of items input is zero. It looks like dividing anything by zero in Flexscript gives '1' but it should be infinity (-ve infinity if 'anything' is negative Chris says) . I'll add this to the dev list to return the maximum float value we can have and not 1 (unless its 0/0 maybe... ) |
#12
|
||||
|
||||
I have a queue connected to a custom GUI but now I want to disconnect it and get the old GUI back. ?
__________________
Each morning after drudging through his morning routine the mild-mannered Xavier Jackson arrives at work and when he sits down at his computer it powers up and he becomes the great Flexavier Jacksim Optimizer Extraordinaire
|
#13
|
|||
|
|||
Quote:
in the tree view, go to the queue you want to change back, and look for the node special/guifocusclass and set it back to VIEW:/pages/QueueParameters regards, Pablo Concha E. |
The Following 3 Users Say Thank You to Pablo Concha For This Useful Post: | ||
Xavier Jackson (07-11-2008) |
#14
|
|||
|
|||
Switch visibility of NN and connections
Hello everybody,
have been working on my first real big model for a couple of days now and everything loooks quite nice. There is just one litte thing I'm concerned about. Because of the many NetworkNodes and Connections I used in the model the simulation slows down quite heavy. Is there a way to switch the visibilty of the NetworkNodes to get rid of that problem and to improve the overview of the model. Thanks a lot! Jens Last edited by Jens Mühlheimer; 07-16-2008 at 03:05 AM. Reason: misspelles |
#15
|
||||
|
||||
Jens,
There is an option by pressing/holding the “X” key and clicking on a network node which changes the visualization of the NetworkNodes. If you “loose” your NetworkNodes you can still click on a NetworkNode in the tree to make the X-Switch. Good Success!
__________________
tom the (A)tom: "We have solved our problems ... now we have to fight the solutions." |
The Following 3 Users Say Thank You to Tom David For This Useful Post: | ||
Jens Mühlheimer (07-16-2008) |
#17
|
|||
|
|||
Jens,
There is another option, just as easy and effective, if your interested in knowing how to do things in more than one way. Put all of the network nodes inside of a visual tool, then hide the contents in the VT's Parameters window. I do this a lot. If you leave the visual tool visible, it becomes easy to move all of the network nodes at once, or make them completely invisible. I hope this helps. |
The Following 3 Users Say Thank You to Tyson Nordgren For This Useful Post: | ||
Leandro Filippi (02-08-2013) |
#18
|
|||
|
|||
Hi, for the flow of one of my queues I'm modifying the "cases by value" function to work together with "shortest queue". My objective is to call the shortest queue function for cases 1-3 but I keep getting syntax error, please help.
This is my code: treenode item = parnode(1); treenode current = ownerobject(c); /**Cases by Value*/ string labelname = //PARAMSTART "To Location" //PARAMEND ; /** \nValue: */ int value = /**/getlabelnum(item, labelname)/**/; /** \nCases:*/ switch(value){ /**/ case 1: check_shortest_queue(); case 2: return 4; case 3: return 5; case 4: return 6; case 5: return 7; default: return 0;/**/ } /** \nNotes: Case instances must integers greater than zero. Additional cases may be added as needed. */ double check_shortest_queue() { treenode tempobject; int curmincontent = 1000000000; // this sets the integer to the largest possible value that an integer can hold. //curmincontent stores the value of the lowest number of objects double curminindex = 0; for(int index = 1; index <= 3; index++) //Check in port 1 to 3 only { tempobject = outobject(current, index); //Loop through all ouput port objects and check which is shortest queue if(objectexists(tempobject) && content(tempobject) < curmincontent) { curmincontent = content(tempobject); curminindex = index; } } return curminindex ; } |
The Following User Says Thank You to Lin Jincong For This Useful Post: | ||
rouchdiyakine (11-24-2008) |
#19
|
|||
|
|||
The function cannot be declared in the trigger in this way. You should move the function code to within Case 1 or to a user command (found under the Tools menu item ) called check_shortest_queue and pass in the current object as the first parameter (and then access it as parnode(1) ).
|
The Following 2 Users Say Thank You to Jason Lightfoot For This Useful Post: | ||
Lin Jincong (08-02-2008) |
#20
|
|||
|
|||
Regarding importing source schedules through an excel sheet, is there any way to make the fields I want into labels? The way I'm doing things now is importing the data, creating new labels, then copy the data over manually. Reason I need the labels is because my downstream objects based their actions on certain fields, particularly destination. Without labels, I can't read any fields from the source schedule.
|
The Following User Says Thank You to Lin Jincong For This Useful Post: | ||
rouchdiyakine (11-24-2008) |
Thread | Thread Starter | Forum | Replies | Last Post |
Can coordinated task sequence and "break to requirement" be used together? | qin tian | Q&A | 1 | 05-26-2008 10:44 AM |
error message "Clock overflow, running stopped" | Martin Kooijman | Q&A | 11 | 04-17-2008 10:29 AM |
about "no select" and "show parameter window from side bar" | qin tian | Gripes and Goodies | 3 | 03-21-2008 08:10 AM |
Which variable stores "Properties -> General ->Flags -> Protected" information? | KelvinHo | Q&A | 1 | 03-06-2008 06:18 AM |
"Getting Started" and "Tutorial" models for v4.01 | Cliff King | Product Announcements | 0 | 12-10-2007 07:34 PM |