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 |
#101
|
||||
|
||||
I'm glad to hear you got it worked out. The description of your problem sounds exactly like what the TrafficControl object was built for though, and all your code seems pretty unnecessary and hard to maintain to me. I thought I'd post a sample model that shows how you can use the TrafficControl to create this kind of flow in case others want to do it in a simpler way or in case this might help you as you continue in your project.
So here it is: an example of untimed traffic modes for the TrafficControl object following your description as best as I could understand it. |
#102
|
|||
|
|||
Hi Phil.
Thanks for that. To be honest the traffic control is a bit of a mystery to me! How did you control the following distance? The solution to my problem was fairly straightforward but you're right the code may be difficult to maintain. |
#103
|
||||
|
||||
You can specify the following distance on the network node in the Spacing edit field on the Paths tab. This only works if the path is nonpassing (yellow).
|
#104
|
|||
|
|||
Sorry Phil one more thing. I have tried your suggestion in your model and it works perfectly other than the fact that it no longer allows the route to be "First Come First Serve". i.e. Is there any way I can switch between traffic modes if an operator arrives to move in the opposite direction to the current movement once the route has been emptied? At the moment it will continuously let operators onto the route until the route emties itself (irrespective of whether an operator arrives at the queue before the other operators).
|
#105
|
||||
|
||||
After messing with a few other things, this seems to work.
OnArrival of each of the nodes, I close the opposite node edge and reopen it OnContinue. This allows it to become FIFO because it keeps any travelers that want in from the opposite direction from entering the TrafficControl while one from earlier wants in. If this doesn't do exactly what you want, it appears as though you may have to go back to doing complicated logic that you started with, or some mixture of the two. I hope these examples have helped you understand more of how the TrafficControl works and how you can manipulate the network traffic using it and the other tricks you already know. |
The Following User Says Thank You to Phil BoBo For This Useful Post: | ||
Duncan Pascoe (10-20-2008) |
#106
|
||||
|
||||
Blegh. Something's wrong with that model. It's getting confused and not reopening closed node edges correctly.
So I guess this doesn't exactly fix your problem. Perhaps it gives you more ideas of ways to model your situation though and how the TrafficControl works. If I can figure out how to fix it, I'll let you know. |
#107
|
|||
|
|||
Hi Phil,
Your suggestion does work but it is not effective in all situations, especially when a number of operators are waiting to enter the queue. I think I may just have to battle on with the more complicated stuff. Thanks for your suggestions though, the traffic control is far more useful than I gave it credit for! |
#108
|
||||
|
||||
Duncan,
Here is a pinch point test model that I build for the mining industry. It may give you some hints as to how to tackle your problem. Essentially there are four nodes involved on a single road. Traffice can only flow one direction at a time between the outside nodes. If you imagine the nodes labeled A, B, C, D then traffic is one way between A and D. If traffic is waiting at D for traffic to clear going in the opposite direction then once there are no operators between A and C the traffic controllers will not allow any more opperators to enter node A until the other direction gets a chance. I know this sounds a little vague but the model should clear things up. Good Luck, Brandon
__________________
thats not normal. |
The Following 2 Users Say Thank You to Brandon Peterson For This Useful Post: | ||
Phil BoBo (10-17-2008) |
#109
|
|||
|
|||
Data on itemtype
Is there any way that I can get data on every item that passes through my system? I would need to know in particular how long it takes each item to flow through certain parts of the system in an attempt to find problem areas in it.
|
#110
|
|||
|
|||
Hi Duncan,
you can add a label and set the number of this label at a specific point to the entrytime of the conveyor and after leaving the specific area set the number of this label to time()-getlabelnum(label). With this you have the throughfeedtime for the specific area. To get different times, you can add more labels for the specific areas or you make a labeltable. On Entry from the Sink at the end of the model, copy the data in a GlobalTable and you find all the collected data of the different items in it. Hope this helps you a little. Regards Tobias |
The Following User Says Thank You to tobias.biemueller For This Useful Post: | ||
Duncan Pascoe (10-20-2008) |
#111
|
|||
|
|||
Thanks Tobias. I had something along those lines in mide, I just wasn't sure how to collect the data! One more question:
I need to know how long an item waits at one of 2 nodes in my system but when I try to assign a value to the item at these nodes nothing happens. This is the code I used: setlabelnum(item,"EntryNN35",time()); I assume that I am referencing the item incorrectly as it is not the item but the operator entering the node? |
#112
|
|||
|
|||
Hi Duncan,
if you are trying to write the data on a trigger of a networknode...and if the label is on a item carried by the operator, the code should be something like setlabelnum(last(traveler),"test",time()); if it's on the operator setlabelnum(traveler,"test",time()); last(traveler) is a reference to the last node (the flowitem in this case) contained on the operator, you could use the first() or rank() commands too ... hope this helps... regards Pablo Concha E. |
The Following 3 Users Say Thank You to Pablo Concha For This Useful Post: | ||
Phil BoBo (10-20-2008) |
#113
|
|||
|
|||
Ok I apologise but I have one last question (hopefully!).
Is there any way to set an operator which is empty to move freely through the network (without adhearing to any traffic rules, following distances etc). Thanks! |
#114
|
|||
|
|||
Limit to Number of User Commands?
Is there a limit to the number of User Commands that can exist in a Flexsim Model?
I'm about to write some code that loops through a global table filled with Flexscript and generates User Commands out of the Flexscript from the global table. There will be 75 or so user commands after this is is done. I just want to make sure that I'm not about to run into an unforeseen constraint. |
#115
|
|||
|
|||
Dynamically Add/Remove User Commands
OK. I would like to go to this location in the tree:
Tools/GlobalVarGen/variables/commands/ and start using destroynode and nodeinsertinto commands to remove and recreate nodes for user commands. However, when I looked into the Flexscript that gets executed when you use the GUI to add and remove User Commands I realized there was a lot more going on. When adding the nodes I plan to mimic the code that gets executed when you click on the "Add" button in the User Commands GUI. The only thing I need is to be able to correctly execute the last 3 lines of code: setitem(node("@/ChooseCommand",c)); nodefunction(node(">apply",item)); nodefunction(node(">refresh",item), content(current)); I'm having trouble understanding (quickly since I'm extremely time pressed) what is done by these 3 lines. Can anyone help with this? |
#116
|
||||
|
||||
That is calling node functions on the listbox. ChooseCommand is the listbox in the GUI.
setitem(node("@/ChooseCommand",c)); // this sets the listbox to local variable item nodefunction(node(">apply",item)); // this fires the apply flexscript node on the listbox nodefunction(node(">refresh",item), content(current)); // this fires the refresh node on the listbox The apply node function on the listbox has code that applies the text in all the various edit fields in the GUI (name, parameters, description, example, code) to the tree where it should be and then calls the addcommand() command which takes care of the magic of turning that tree information into a functional usercommand. If you've successfully set all the values in the tree for your command with your own code, the addcommand() command is probably all that you are missing to get it to work right. The refresh node function on the listbox has code that adds the information for the selected item to the various edit fields in the GUI. You probably don't need to worry about this for your purpose. |
The Following User Says Thank You to Phil BoBo For This Useful Post: | ||
Joe Allen (11-10-2008) |
#117
|
|||
|
|||
Phil - forgive me but I'm still confused after reading your post. I think I should explain what I'm trying to do a little better. I would like to write a user command that dynamically creates other user commands. When I write the code it will know what the values of the Command, Description, Code, etc. are. I planned on just copying and pasting the code found from the User Command GUI that gets executed when the "Add" button gets clicked. I'm unsure about 2 things though:
1) Since the code that gets executed when the User Command GUI button "Add" gets clicked during the time that the User Command GUI window is the active window I'm unsure if commands like setcurrent(node("@>focuspath+", c)); will work the same when being executed without the button click and 2) I'm not sure where the appropriate place(s) to insert my string variables that contain the values for Command, Code, etc. would be. If you have time, could you provide me with a little more direction or maybe a code example if you have it? |
#118
|
||||
|
||||
Best I can figure, this is how you should do it (I was doing this from a script window. Haven't tried making a command to make other commands):
treenode commands = node("/1/GlobalVarGen>variables/commands",model()); nodeinsertinto(commands); treenode mycommand = last(commands); setname(mycommand,"joe"); nodeinsertinto(mycommand); treenode code = last(mycommand); setname(code,"code"); nodeadddata(code,DATATYPE_STRING); setnodestr(code,"msg(\"joe\",\"\");"); switch_flexscript(code,1); buildnodeflexscript(code); nodeinsertinto(mycommand); treenode desc = last(mycommand); setname(desc,"description"); nodeadddata(desc,DATATYPE_STRING); setnodestr(desc,"joe allen"); nodeinsertinto(mycommand); treenode params = last(mycommand); setname(params,"parameters"); nodeadddata(params,DATATYPE_STRING); setnodestr(params,"()"); nodeinsertinto(mycommand); treenode example = last(mycommand); setname(example,"example"); nodeadddata(example,DATATYPE_STRING); setnodestr(example,"joe()"); refreshmodelcommands(); |
The Following User Says Thank You to Phil BoBo For This Useful Post: | ||
Joe Allen (11-10-2008) |
#119
|
||||
|
||||
Good job on looking at the GUI to figure out what it does to make it work, but user commands are pretty complicated and the GUI is even more complicated then they are by themselves. Hopefully you can tweak the above code to get Flexsim to do what you want it to do. Good luck.
|
#120
|
|||
|
|||
That was what I was originally going to do but after looking at all the things that are done when clicking on "Add" in the GUI I got concerned that if I just modified what was in the tree under GlobalVarGen>variables/commands the GUI wouldn't have everything it needed. Your example works like a charm and when I go into the User Commands GUI everything is there.
THANKS! |
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 |