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 05-09-2008
Vinay Mehendiratta Vinay Mehendiratta is offline
Flexsim User
 
Join Date: Aug 2007
Posts: 13
Downloads: 7
Uploads: 0
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 155
Vinay Mehendiratta is on a distinguished road
Default draw network nodes using data from an excel sheet

I saw a thread some time about getting and printing information about existing network nodes in a model.

now i have a need to create network nodes based on data from an excel sheet. Excel sheet has node id, x, y, and z coordinates. has some body done it before ?
thanks,
Vinay
  #2  
Old 05-09-2008
Brandon Peterson's Avatar
Brandon Peterson Brandon Peterson is offline
The Flexsim Consultant
 
Join Date: Jul 2007
Location: Salt Lake City, Utah
Posts: 382
Downloads: 29
Uploads: 6
Thanks: 192
Thanked 516 Times in 235 Posts
Rep Power: 490
Brandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant futureBrandon Peterson has a brilliant future
Default

Vinay,

I have written this code many times but am having trouble finding some that doesn't have a lot of other stuff built into it also. So, try the following code:

treenode nnobj = node("/NetworkNode", library()); //This gets a pointer to the network nodes
treenode tnode; //Create a pointer to use later to point to new nodes

for(int row = 1; row <= gettablerows("Nodes"); row++)
{
tnode = createinstance(nnobj, model()); //Create the new node
setname(tnode, gettablestr("Nodes", row, 1)); //Set the name of the node
setloc(tnode, gettablenum("Nodes", row, 2), gettablenum("Nodes", row, 3), gettablenum("Nodes", row, 4)); //Set the location of the node
}

That code requires that you import the Data in Excel into a Flexsim global table called Nodes. The first column of the table needs to be text.

Good Luck,
Brandon
__________________
thats not normal.
  #3  
Old 01-23-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 Connect the Netwrok nodes

Hi Brandon

We are working on a project which has a similar kind of structure. We would like to know how to modify the code above, to get the network nodes connected to each other, like for instance, i would like to read this table as a globular table and get the network nodes connected .

Station X coord Y coord No: of tracks Predecessor
NN1 10 12 1 NN2
NN2 13 11 2 NN3, NN4
NN3 15 14 2 NN1, NN5

and so on.......

Your code above helped us in displaying the nodes, but is it possible to get them connected........
  #4  
Old 01-24-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

You should be able to connect them using the contextdragconnection command
The Following 2 Users Say Thank You to Jason Lightfoot For This Useful Post:
Nischith Kashyap (01-24-2011)
  #5  
Old 10-13-2014
Thomas vandeSande Thomas vandeSande is offline
Flexsim User
 
Join Date: Jan 2014
Posts: 1
Downloads: 1
Uploads: 0
Thanks: 1
Thanked 0 Times in 0 Posts
Rep Power: 0
Thomas vandeSande is on a distinguished road
Default

Hi Jason,

Thanks for your reply. Is this code still applicable to the current FlexSim 7.3?

Where should I implement the code on the OnModelOpen trigger??

Thanks a lot,

Thomas
  #6  
Old 10-13-2014
michaelsmith michaelsmith is offline
TMN Simulation -Australia
 
Join Date: Aug 2007
Location: Hobart Tasmania
Posts: 62
Downloads: 7
Uploads: 0
Thanks: 31
Thanked 19 Times in 12 Posts
Rep Power: 170
michaelsmith will become famous soon enough
Default

There is a small change to the create instance code as the address of the network node has changed
Quote:
createinstance(node("/travelnetworks/NetworkNode",library()),model());
I'd probably avoid putting it explicitly in the On Model Open as you will have a lot of trouble if it doesn't work etc. I have something similar and it's all held in a user command that I can launch from a trigger so you could include it within an If Statement based on a label/table switch so that you can turn it off and have a "Safe" version of your model.
  #7  
Old 10-13-2014
Carsten Seehafer's Avatar
Carsten Seehafer Carsten Seehafer is offline
FlexSim Geek
 
Join Date: Oct 2008
Location: Ritterhude, Deutschland
Posts: 230
Downloads: 45
Uploads: 1
Thanks: 474
Thanked 320 Times in 143 Posts
Rep Power: 379
Carsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud ofCarsten Seehafer has much to be proud of
Default

I would suggest to put your code into a user command because it's more convenient
A good place to use this command could be the "Post Import Code" in the "Excel Interface". This will execute the command if you import a new Excel table.

Greetings,


Carsten
The Following 2 Users Say Thank You to Carsten Seehafer For This Useful Post:
Phil BoBo (10-14-2014)
  #8  
Old 10-14-2014
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

Quote:
Originally Posted by michaelsmith View Post
There is a small change to the create instance code as the address of the network node has changed
You can use the ? character in a node path to recursively find a subnode. You should use that to get the path to the NetworkNode in the library:

Code:
createinstance(node("?NetworkNode",library()),model());
The Following 5 Users Say Thank You to Phil BoBo For This Useful Post:
Steven Hamoen (10-14-2014)


Thread Thread Starter Forum Replies Last Post
Excel Data Import Sung Kim Q&A 2 07-16-2010 10:41 AM
Accessing Data of a Recorder and Referencing Nodes in the Tree Jan Brandau Q&A 5 04-22-2008 07:05 AM
Find all nodes toggled as C++ Brandon Peterson Tips and Tricks 0 04-18-2008 03:36 PM
Expertfit cannot find network key - Flexsim Network License Kris Geisberger Q&A 0 02-05-2008 05:10 PM
Excel and global tables Bill Nordgren Q&A 2 10-15-2007 04:36 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.