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 > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 06-24-2008
Xavier Jackson's Avatar
Xavier Jackson Xavier Jackson is offline
Flexsim User
 
Join Date: Jun 2008
Posts: 20
Downloads: 11
Uploads: 0
Thanks: 21
Thanked 4 Times in 3 Posts
Rep Power: 147
Xavier Jackson is on a distinguished road
Lightbulb 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  
Old 06-24-2008
Phil BoBo's Avatar
Phil BoBo Phil BoBo is offline
Flexsim Development
 
Join Date: Jan 2008
Posts: 756
Downloads: 109
Uploads: 18
Thanks: 385
Thanked 1,483 Times in 525 Posts
Rep Power: 1174
Phil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond repute
Default

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  
Old 06-30-2008
Xavier Jackson's Avatar
Xavier Jackson Xavier Jackson is offline
Flexsim User
 
Join Date: Jun 2008
Posts: 20
Downloads: 11
Uploads: 0
Thanks: 21
Thanked 4 Times in 3 Posts
Rep Power: 147
Xavier Jackson is on a distinguished road
Default

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  
Old 06-30-2008
Phil BoBo's Avatar
Phil BoBo Phil BoBo is offline
Flexsim Development
 
Join Date: Jan 2008
Posts: 756
Downloads: 109
Uploads: 18
Thanks: 385
Thanked 1,483 Times in 525 Posts
Rep Power: 1174
Phil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond repute
Default

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  
Old 06-30-2008
Xavier Jackson's Avatar
Xavier Jackson Xavier Jackson is offline
Flexsim User
 
Join Date: Jun 2008
Posts: 20
Downloads: 11
Uploads: 0
Thanks: 21
Thanked 4 Times in 3 Posts
Rep Power: 147
Xavier Jackson is on a distinguished road
Default

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  
Old 06-30-2008
Phil BoBo's Avatar
Phil BoBo Phil BoBo is offline
Flexsim Development
 
Join Date: Jan 2008
Posts: 756
Downloads: 109
Uploads: 18
Thanks: 385
Thanked 1,483 Times in 525 Posts
Rep Power: 1174
Phil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond reputePhil BoBo has a reputation beyond repute
Default

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  
Old 07-04-2008
Jörg Vogel's Avatar
Jörg Vogel Jörg Vogel is offline
Flexsim User
 
Join Date: Sep 2007
Location: Hannover, Germany
Posts: 643
Downloads: 35
Uploads: 0
Thanks: 802
Thanked 665 Times in 410 Posts
Rep Power: 642
Jörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond repute
Default 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  
Old 07-04-2008
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

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  
Old 07-11-2008
Jens Mühlheimer Jens Mühlheimer is offline
Flexsim User
 
Join Date: Jul 2008
Location: Stuttgart, Germany
Posts: 140
Downloads: 8
Uploads: 0
Thanks: 40
Thanked 35 Times in 27 Posts
Rep Power: 174
Jens Mühlheimer will become famous soon enoughJens Mühlheimer will become famous soon enough
Default

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  
Old 07-11-2008
Anthony Timmiss Anthony Timmiss is offline
Flexsim User
 
Join Date: Aug 2007
Location: Sunderland - UK
Posts: 78
Downloads: 41
Uploads: 0
Thanks: 65
Thanked 45 Times in 28 Posts
Rep Power: 187
Anthony Timmiss will become famous soon enoughAnthony Timmiss will become famous soon enough
Default

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  
Old 07-11-2008
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

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);
Then display the value of the label divided by getinput(<object>) to show the avg 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... )
Attached Files
File Type: zip avgLifespan.zip (44.6 KB, 364 views)
  #12  
Old 07-11-2008
Xavier Jackson's Avatar
Xavier Jackson Xavier Jackson is offline
Flexsim User
 
Join Date: Jun 2008
Posts: 20
Downloads: 11
Uploads: 0
Thanks: 21
Thanked 4 Times in 3 Posts
Rep Power: 147
Xavier Jackson is on a distinguished road
Default

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  
Old 07-11-2008
Pablo Concha Pablo Concha is offline
Flexsim User
 
Join Date: Aug 2007
Posts: 104
Downloads: 100
Uploads: 1
Thanks: 103
Thanked 52 Times in 37 Posts
Rep Power: 232
Pablo Concha is just really nicePablo Concha is just really nicePablo Concha is just really nicePablo Concha is just really nice
Default

Quote:
Originally Posted by Xavier Jackson View Post
I have a queue connected to a custom GUI but now I want to disconnect it and get the old GUI back. ?
Xavier,
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  
Old 07-16-2008
Jens Mühlheimer Jens Mühlheimer is offline
Flexsim User
 
Join Date: Jul 2008
Location: Stuttgart, Germany
Posts: 140
Downloads: 8
Uploads: 0
Thanks: 40
Thanked 35 Times in 27 Posts
Rep Power: 174
Jens Mühlheimer will become famous soon enoughJens Mühlheimer will become famous soon enough
Default 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  
Old 07-16-2008
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

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)
  #16  
Old 07-16-2008
Jens Mühlheimer Jens Mühlheimer is offline
Flexsim User
 
Join Date: Jul 2008
Location: Stuttgart, Germany
Posts: 140
Downloads: 8
Uploads: 0
Thanks: 40
Thanked 35 Times in 27 Posts
Rep Power: 174
Jens Mühlheimer will become famous soon enoughJens Mühlheimer will become famous soon enough
Default

Danke

Works great!
  #17  
Old 07-16-2008
Tyson Nordgren Tyson Nordgren is offline
Flexsim Technical Support
 
Join Date: Nov 2007
Posts: 6
Downloads: 46
Uploads: 35
Thanks: 7
Thanked 5 Times in 3 Posts
Rep Power: 0
Tyson Nordgren is on a distinguished road
Default

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  
Old 07-22-2008
Lin Jincong Lin Jincong is offline
Flexsim User
 
Join Date: Jul 2008
Posts: 7
Downloads: 15
Uploads: 0
Thanks: 7
Thanked 5 Times in 4 Posts
Rep Power: 0
Lin Jincong is on a distinguished road
Default

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  
Old 07-22-2008
Jason Lightfoot Jason Lightfoot is offline
Flexsim Consultant
 
Join Date: Aug 2007
Location: Somerset, UK
Posts: 719
Downloads: 20
Uploads: 0
Thanks: 123
Thanked 953 Times in 446 Posts
Rep Power: 773
Jason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond reputeJason Lightfoot has a reputation beyond repute
Default

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  
Old 08-02-2008
Lin Jincong Lin Jincong is offline
Flexsim User
 
Join Date: Jul 2008
Posts: 7
Downloads: 15
Uploads: 0
Thanks: 7
Thanked 5 Times in 4 Posts
Rep Power: 0
Lin Jincong is on a distinguished road
Default

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


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.