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
|
|||
|
|||
Layout Change in Experimenter
Hello everybody,
I´m trying to change a model layout in the experimenter but I´m having some trouble with it. My first attempt was to set the layout node at MAIN:/project/model/Tools/Layouts as an experimenter variable, but this didn´t. work. Then, I realized, by exploring the tree structure of the Model Layouts windows that there´s a function called "Update" that is called every time the layout is changed. This function replaces the spatial node of every object in the model with the corresponding layout node. I executed the "Update" function from a script using: treenode ModLayouts = node("/active/palettewindows526092976/tabcontrol/Model Layouts", views()); nodefunction(node(">Update", ModLayouts), num_layout); Where num_layout is the rank of the Layout (in my case, 1 or 2). This works perfectly! I´m able to change the layout from script with no problem. However, when I try to use this same code in one of the experimenter triggers (on start of replication) nothing seems to happen. Start of Replication /**Custom Code*/ double replication = parval(1); double scenario = parval(2); if(replication == 1) { treenode ModLayouts = node("/active/palettewindows526092976/tabcontrol/Model Layouts", views()); nodefunction(node(">Update", ModLayouts), scenario); } The body of the if statements is exactly the same one I run succesfully from the script window, but now this doesn´t work. Does anybody know how can I set the layout configuration of my model as an experimenter variable, where each scenario has it´s own layout?. Is there an easier approach than what I´m trying to do? Thanks a lot! |
The Following User Says Thank You to Esteban Echeverry For This Useful Post: | ||
brett forbes (02-17-2013) |
#2
|
||||
|
||||
If you're using version 6, experiments are run on sub-processes. In those sub-processes, the view tree is not loaded, so there is no valid path anywhere in views. You'll have to copy the code out of the update script and execute it manually.
|
The Following 3 Users Say Thank You to Anthony Johnson For This Useful Post: | ||
RalfGruber (12-12-2012) |
#3
|
|||
|
|||
changelayout
Quote:
changelayout(layout): int layoutnr = parval(1); treenode layouts = node("/Tools/Layouts", model()); setnodenum(layouts, layoutnr); string layoutname = getname(rank(layouts, layoutnr)); iterate(2, content(model()), 1) { treenode obj = rank(model(), count); treenode objlayout = node(concat(">Layouts/", layoutname), obj); if(objectexists(objlayout)) { forobjectlayerunder(objlayout) { setnodenum(rank(node(">spatial", obj), getrank(a)), getnodenum(a)); } } forobjecttreeunder(rank(model(), count)) { treenode obj = a; treenode objlayout = node(concat(">Layouts/", layoutname), a); if(objectexists(objlayout)) { forobjectlayerunder(objlayout) { setnodenum(rank(node(">spatial", obj), getrank(a)), getnodenum(a)); } } } } repaintall(); It was just a matter of copying and pasting this code in a user command and then using it in the replication trigger of the experimenter. regards, Esteban. |
The Following 5 Users Say Thank You to Esteban Echeverry For This Useful Post: | ||
RalfGruber (08-11-2014) |
#4
|
||||
|
||||
Hi,
I am collecting statistics of each layout with the above approach .When i run the experiment I am getting the same result for each scenario.Am I missing any thing or anything that has changed in version 7? Please help Last edited by sagar bolisetti; 12-24-2014 at 08:08 PM. Reason: Lost attachment |
#5
|
|||
|
|||
You're still referencing the views() in your model and using the scripts from the first post which won't work.
You need to use the function "changelayout" as described, and add 'num layoutnr' to the parameters of the usercommand. Check it works by running a test in the script window. Code:
changelayout(1); Code:
changelayout(scenario); |
The Following User Says Thank You to Jason Lightfoot For This Useful Post: | ||
sagar bolisetti (08-10-2014) |
#7
|
||||
|
||||
Network nodes in model layouts
With the above approach of collecting statistics of each layout.When I connect two network nodes(ex NN1 to NN2) in one model layout1.And again i want to give another connection from same network node in other layout(ex NN1 to NN3). And when I reverted back to layout1 the connection no longer exists(NN1 to NN2) but only (NN1 to NN3).I want network nodes to be connected in each model layout as they were.I have network nodes connected to the objects in the Userlibrary.
I could do in the experimenter with changing locations of objects but it would become really cumbersome when you have a large layout.Does anyone experienced this kind of problem before? PS.Give unique names for each network nodes in the model layouts. Last edited by sagar bolisetti; 08-26-2014 at 03:56 AM. |
Tags |
experimenter, flexsim 6, layout, scenarios |
Thread | Thread Starter | Forum | Replies | Last Post |
AutoCAD layout import problem | Clement Schaller | Q&A | 1 | 05-22-2012 12:59 PM |
using layout with visual tool | naveenkumar | Tips and Tricks | 1 | 02-10-2012 01:29 PM |
optimization of layout | naveenkumar | Tips and Tricks | 7 | 02-02-2012 06:00 AM |
WALLS IN A LAYOUT | naveenkumar | Tips and Tricks | 4 | 12-06-2011 05:46 AM |
Change Layout from GUI | Nico Zahn | Q&A | 4 | 12-24-2009 07:42 AM |