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 12-06-2012
Esteban Echeverry Esteban Echeverry is offline
Flexsim User
 
Join Date: May 2012
Posts: 2
Downloads: 1
Uploads: 0
Thanks: 1
Thanked 6 Times in 2 Posts
Rep Power: 0
Esteban Echeverry is on a distinguished road
Default 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!
Attached Thumbnails
Click image for larger version
Name:	Layout_Model.jpg
Views:	208
Size:	20.2 KB
ID:	1999   Click image for larger version
Name:	Layout_Model_2.jpg
Views:	163
Size:	20.4 KB
ID:	2000  
Attached Files
File Type: fsm Layout_Experimenter.fsm (86.0 KB, 130 views)
The Following User Says Thank You to Esteban Echeverry For This Useful Post:
brett forbes (02-17-2013)
  #2  
Old 12-07-2012
Anthony Johnson's Avatar
Anthony Johnson Anthony Johnson is offline
Manager of Product Development
 
Join Date: Jul 2007
Posts: 440
Downloads: 86
Uploads: 4
Thanks: 171
Thanked 899 Times in 288 Posts
Rep Power: 735
Anthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond reputeAnthony Johnson has a reputation beyond repute
Default

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  
Old 12-10-2012
Esteban Echeverry Esteban Echeverry is offline
Flexsim User
 
Join Date: May 2012
Posts: 2
Downloads: 1
Uploads: 0
Thanks: 1
Thanked 6 Times in 2 Posts
Rep Power: 0
Esteban Echeverry is on a distinguished road
Default changelayout

Quote:
Originally Posted by Anthony Johnson View Post
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.
Thank you Anthony! I just did what you said and made a user command called "changelayout(layout)" which takes the number of layout and runs the code in the update node of the views trigger. The code of the changelayout is:

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  
Old 08-10-2014
sagar bolisetti's Avatar
sagar bolisetti sagar bolisetti is offline
Flexsim User
 
Join Date: Aug 2013
Location: Hyderabad,India
Posts: 160
Downloads: 145
Uploads: 0
Thanks: 124
Thanked 99 Times in 63 Posts
Rep Power: 150
sagar bolisetti is a jewel in the roughsagar bolisetti is a jewel in the roughsagar bolisetti is a jewel in the roughsagar bolisetti is a jewel in the rough
Default

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  
Old 08-10-2014
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

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);
Then in the experimenter, if the scenario corresponds to layout you can try adding code to the replication start:

Code:
changelayout(scenario);
Don't test if replication is 1. The experiment threads can start at any replication.
The Following User Says Thank You to Jason Lightfoot For This Useful Post:
sagar bolisetti (08-10-2014)
  #6  
Old 08-10-2014
sagar bolisetti's Avatar
sagar bolisetti sagar bolisetti is offline
Flexsim User
 
Join Date: Aug 2013
Location: Hyderabad,India
Posts: 160
Downloads: 145
Uploads: 0
Thanks: 124
Thanked 99 Times in 63 Posts
Rep Power: 150
sagar bolisetti is a jewel in the roughsagar bolisetti is a jewel in the roughsagar bolisetti is a jewel in the roughsagar bolisetti is a jewel in the rough
Default

Thanks Jason!Now its working.
  #7  
Old 08-26-2014
sagar bolisetti's Avatar
sagar bolisetti sagar bolisetti is offline
Flexsim User
 
Join Date: Aug 2013
Location: Hyderabad,India
Posts: 160
Downloads: 145
Uploads: 0
Thanks: 124
Thanked 99 Times in 63 Posts
Rep Power: 150
sagar bolisetti is a jewel in the roughsagar bolisetti is a jewel in the roughsagar bolisetti is a jewel in the roughsagar bolisetti is a jewel in the rough
Default 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


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.