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 01-12-2011
Nischith Kashyap's Avatar
Nischith Kashyap Nischith Kashyap is offline
Flexsim User
 
Join Date: Nov 2010
Location: Wollongong, Australia
Posts: 51
Downloads: 26
Uploads: 0
Thanks: 19
Thanked 0 Times in 0 Posts
Rep Power: 118
Nischith Kashyap is on a distinguished road
Default Automated Tree Traversal in node() command?

Hello.

Currently, we are trying to model train movements throughout a series of network nodes. The trains are allowed to 'look ahead' to future segments of track, check their availability, and take corrective action if necessary (change tracks, slow down, etc.). To achieve this, we read the state (Passing, No connection) of a network node's outgoing link and send that information back to the train before it arrives at the node in question.

We can do this manually, by including the following code in a network node's (NN3 in this case) trigger;

treenode outgoinglinkstate=node(">connections/connectionsout/To NN4/type",current);
and sending that information back to the train, currently exiting NN1 and heading towards NN2 (these nodes are currently connected in series).

We were wondering if there was a way to make the bolded segment of the tree traversal instructions generic so as to replicate this across a large network of nodes automatically?

Are there attributes that can be used to help traverse the tree structure automatically within the node() command?

Thanks
  #2  
Old 01-13-2011
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

In the node() command's relativepath parameter, you can use ranks as well as names:

treenode outgoinglinkstate=node(">connections/connectionsout/2/type",current);

In this example, it will get the type of the second output connection.


You can also use a special keyword "LAST" to get the last node:

treenode outgoinglinkstate=node(">connections/connectionsout/LAST/type",current);
  #3  
Old 01-31-2011
Nischith Kashyap's Avatar
Nischith Kashyap Nischith Kashyap is offline
Flexsim User
 
Join Date: Nov 2010
Location: Wollongong, Australia
Posts: 51
Downloads: 26
Uploads: 0
Thanks: 19
Thanked 0 Times in 0 Posts
Rep Power: 118
Nischith Kashyap is on a distinguished road
Default Algorithm to read availability

Hi

We are reading a database through flexsim which has the following format

Time Availability ..... ..... .......
0.00 0 ..... .... .....
0.01 0
0.02 0
0.03 0
0.04 1
0.05 1
0.06 1 ....... ....... .......
and so on...... ( Where 0 is not available, and 1 is available )

we would like our transporter when passing through nodes to use an algorithm, to find the next slot ( group of 1's in the DB ) in time where it has enough time to travel from one node to the other..........maybe some slots might be short and hence our transporter would need a slot with a bit more availability.......
any ideas ???
  #4  
Old 02-02-2011
Nischith Kashyap's Avatar
Nischith Kashyap Nischith Kashyap is offline
Flexsim User
 
Join Date: Nov 2010
Location: Wollongong, Australia
Posts: 51
Downloads: 26
Uploads: 0
Thanks: 19
Thanked 0 Times in 0 Posts
Rep Power: 118
Nischith Kashyap is on a distinguished road
Default Help in code

Hi

We have been trying to sort a transporter logic and we need help please..
Attached is a word document of the table we are trying to read named as Table1.
Basically our transporter has 2 tracks to pass through, and depending upon the availability of the track, it moves forward.A track will be available when it is 1 and will not be available when it 0. Availability1, is for track 1, and availability2 is for track 2.

We are trying to write a user event that happens every tick of time to check if track 1 is available, if not check if track 2 is available, if not check when track 1 will be available and for how long will the track be available ( that is shown by the number of 1's in the table ) and simiilarly check when will track 2 be available, and for how long.
Finally our transporter should choose the next available track and move.

This is the code we tried to use, but we are getting errors in our code and not the desired output.

1. what we are doing is defining a user event happening every tick of the simulation run

for(int row =1; row<=gettablerows("Table1"); row++)
{
treenode stateofnextsegment;
if(gettablenum("Table1", row, 2)==0.000)
{
stateofnextsegment=node(">connections/connectionsout/2/type", current);
//we are trying to set the type as 1, so that there is no connection and the transporter cannot pass through.

if(gettablenum("Table1", row, 2)==1.000)
stateofnextsegment=node(">connections/connectionsout/2/type", current);
//we are trying to set the type as 2, so that there is passing and the transporter can pass through.
}
}
//We have just tried this for one column, and it didnt work, Could you please help us with this, and for both the columns availability1 and availability2 also as mentioned above.

2What we are doing next is creating an on arrival trigger for NN1 and sending a message to the transporter. this is the code we used.

treenode traveler = parnode(1);
treenode current = ownerobject(c);
int toedge = parval(2); //the number of the edge that the traveler is going to next
int fromedge = parval(3); // the number of the edge the traveler came from

treenode stateofnextsegment=node(">connections/connectionsout/2/type", current);

senddelayedmessage(node("/Transporter27",model()),0 ,current,1,2,3);

//Basically we are sending a message to the transporter if the link ahead is available or not which is what we must be getting from the user event.

3 We are creating a On message trigger for the transporter with the following code

treenode current = ownerobject(c);


treenode outgoinglink = node("/NN1", model());
treenode outgoinglinkstate = node(">connections/connectionsout/2/type", outgoinglink);

int outgoinglinkstatenum = getnodenum(outgoinglinkstate);


if (outgoinglinkstatenum == 1)
{
setstate(current,STATE_BLOCKED);
}
if (outgoinglinkstatenum == 2)
{
setstate(current,STATE_IDLE);
}
//what we are trying to achieve from this is, if the connection nn1 to nn2 is 1, the transporter stays there until the next available link opens up. If the connection nn1 to nn2 is 2, the the transporter can pass the link.

Please could you guide us through this...

Thanks in advance..
Attached Files
File Type: doc Time.doc (178.0 KB, 235 views)

Last edited by Nischith Kashyap; 02-02-2011 at 11:42 PM. Reason: Screen Shot not clear enough
  #5  
Old 02-02-2011
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

Have you tried closing and opening the node edges according to your schedule and letting the network navigator take care of the decisions automatically? You could try using two timetables and replace the standard code.

Last edited by Jason Lightfoot; 02-03-2011 at 02:09 AM.
  #6  
Old 02-03-2011
Nischith Kashyap's Avatar
Nischith Kashyap Nischith Kashyap is offline
Flexsim User
 
Join Date: Nov 2010
Location: Wollongong, Australia
Posts: 51
Downloads: 26
Uploads: 0
Thanks: 19
Thanked 0 Times in 0 Posts
Rep Power: 118
Nischith Kashyap is on a distinguished road
Default closing and opening the node edges according to your schedule

Hi

Sorry but we are actually just beginners in flexsim. We didnt get what needs to be done when you mentioned closing and opening the node edges according to your schedule. How do we make all the nodes to read the schedule, and close and open automatically as the time ticks by.
We have around 500 Network nodes, and each Network node acts like a junction, so they have a particular time during the simulation which they will be available or not and this is read from the database, which we have imported as a global table into flexsim. Please find the word document of Table 1, which has the format for 1 network node, and how would a network node close and open by reading that table.

Thanks for your help...
  #7  
Old 02-04-2011
Sebastian Hemmann's Avatar
Sebastian Hemmann Sebastian Hemmann is offline
Flexsim User
 
Join Date: Sep 2009
Location: Braunschweig (Germany)
Posts: 439
Downloads: 52
Uploads: 0
Thanks: 472
Thanked 217 Times in 154 Posts
Rep Power: 319
Sebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to behold
Default

Sounds as if you have to create a regularly event (Ticker) for setting the needed time. Because Flexsim is event orientated.
With the Trigger of the regularly event, you can read your DB. But this will run very slow, I´m sure.
__________________
Hemmi

Last edited by Sebastian Hemmann; 02-04-2011 at 05:19 AM.
  #8  
Old 02-06-2011
Nischith Kashyap's Avatar
Nischith Kashyap Nischith Kashyap is offline
Flexsim User
 
Join Date: Nov 2010
Location: Wollongong, Australia
Posts: 51
Downloads: 26
Uploads: 0
Thanks: 19
Thanked 0 Times in 0 Posts
Rep Power: 118
Nischith Kashyap is on a distinguished road
Default How to choose the next arriving transporters from a huge group ??

Hi

We have around 500 Network Nodes, which we consider as stations for a rail network. We are planning to trigger a send message from the node to the transporter stating if the link ahead is available or not. We have around 100 transporters, and so we are wondering how do we define the code in the on arrival trigger for NN1. We basically dont know which transporter is going to come to NN1, it can be any one, but if the track ahaed of NN1 is not available, we must stop only the transporter to NN1, and all the other transporters must continue their journey. How is this possible ?? We are putting triggers for each NN, on arrival to send a message to the upcoming transporter but how to choose the next transporter is what we are stuck with ??

Thanks
  #9  
Old 02-07-2011
Sebastian Hemmann's Avatar
Sebastian Hemmann Sebastian Hemmann is offline
Flexsim User
 
Join Date: Sep 2009
Location: Braunschweig (Germany)
Posts: 439
Downloads: 52
Uploads: 0
Thanks: 472
Thanked 217 Times in 154 Posts
Rep Power: 319
Sebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to beholdSebastian Hemmann is a splendid one to behold
Default

I´m not sure if I understood what you trying to do. For me it sounds, as if you could solve this by using traffic controls and setting some network nodes as stop points between your actuall network nodes. So you can set the exact point of your TE to stop.
Another solution in my mind is to use the spacing value in the NN´s. We spoke about this in some Threads, like this one http://www.flexsim.com/community/for...ead.php?t=1640
There are some more, I can´t search them now.
__________________
Hemmi


Thread Thread Starter Forum Replies Last Post
Colors in Tree luis quinones Q&A 2 08-18-2010 08:43 AM
Conect ports in the tree Sebastian Hemmann Q&A 3 01-14-2010 08:41 AM
Automated creation of connections between ports Matthias Hofmann Q&A 3 06-25-2008 03:04 AM
Access to the tree variables Iulian Marin Ion Q&A 2 02-06-2008 09:15 AM
Automated runs / Exporting mdb file.. Nico Zahn Q&A 14 12-17-2007 11:26 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.