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 03-05-2010
juan alberto juan alberto is offline
Flexsim User
 
Join Date: May 2009
Location: Valencia, Spain
Posts: 74
Downloads: 14
Uploads: 0
Thanks: 19
Thanked 3 Times in 2 Posts
Rep Power: 138
juan alberto is on a distinguished road
Default Global variables

Hello!! I want to create automatically global variables by source code. But I don't know how to do it. Can I do it by creating nodes in the Tools node? (Inside this node is the node GlobalVariables and I thought on creating nodes there with the specified data of each global variable).

Thanks.
  #2  
Old 03-08-2010
juan alberto juan alberto is offline
Flexsim User
 
Join Date: May 2009
Location: Valencia, Spain
Posts: 74
Downloads: 14
Uploads: 0
Thanks: 19
Thanked 3 Times in 2 Posts
Rep Power: 138
juan alberto is on a distinguished road
Default

Quote:
Originally Posted by juan alberto View Post
Hello!! I want to create automatically global variables by source code. But I don't know how to do it. Can I do it by creating nodes in the Tools node? (Inside this node is the node GlobalVariables and I thought on creating nodes there with the specified data of each global variable).

Thanks.
Any ideas please???
  #3  
Old 03-08-2010
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 right - you can edit the tree structure in tools - then from the GUI's OnApply you can see it calls refreshglobalvariables(); and then buildnodeflexscript(model()); which you'll need to do as well.

The first column is the variable name; 2nd is the data type (see below) and the third is the value. Note the 3rd column is DATATYPE_STRING even when the variable is numeric, and if it's an array type that cell will need to have subnodes containing the array data.

Global variable datatypes:
1: Integer
2: Double
3: Treenode
4: String
5: Integer array
6: Double array
7: Treenode array
8: String array
The Following 2 Users Say Thank You to Jason Lightfoot For This Useful Post:
juan alberto (03-09-2010)
  #4  
Old 03-09-2010
juan alberto juan alberto is offline
Flexsim User
 
Join Date: May 2009
Location: Valencia, Spain
Posts: 74
Downloads: 14
Uploads: 0
Thanks: 19
Thanked 3 Times in 2 Posts
Rep Power: 138
juan alberto is on a distinguished road
Smile

Quote:
Originally Posted by Jason Lightfoot View Post
You're right - you can edit the tree structure in tools - then from the GUI's OnApply you can see it calls refreshglobalvariables(); and then buildnodeflexscript(model()); which you'll need to do as well.

The first column is the variable name; 2nd is the data type (see below) and the third is the value. Note the 3rd column is DATATYPE_STRING even when the variable is numeric, and if it's an array type that cell will need to have subnodes containing the array data.

Global variable datatypes:
1: Integer
2: Double
3: Treenode
4: String
5: Integer array
6: Double array
7: Treenode array
8: String array
Ok, I needed to "refreshglobalvariables()"

Thanks !!!
  #5  
Old 11-10-2010
Congshi Wang Congshi Wang is offline
Student
 
Join Date: May 2010
Location: Germany
Posts: 58
Downloads: 2
Uploads: 0
Thanks: 48
Thanked 0 Times in 0 Posts
Rep Power: 124
Congshi Wang is on a distinguished road
Default

Hi Jason,

can you please explain how to use the buildnodeflexscript command to create a global variable by code?

I thought it maybe could be like this:

buildnodeflexscript("MAIN:/project/model/Tools/GlobalVariables", new global variable(column1, column2, column3));

Thanks!
  #6  
Old 11-10-2010
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

It isn't buildnodeflexscript(model()) that adds the variables - I think that call is just something that should be done after you add a new global variable (maybe to update any references ?)

So you just need to look at the tree and create the nodes yourself as outlined above.
The Following User Says Thank You to Jason Lightfoot For This Useful Post:
Congshi Wang (11-11-2010)


Thread Thread Starter Forum Replies Last Post
Update of global variables BenjaminBuecklein Q&A 4 11-18-2008 03:43 AM
Limit in the completion hints? Global Tables, Global Variables, etc.? Tom David Gripes and Goodies 6 09-09-2008 04:05 PM
Experimenter variables Xavier Jackson Gripes and Goodies 4 09-09-2008 10:00 AM
State files and global variables Markus Bans Q&A 3 07-08-2008 12:22 PM
GUI & linked variables Iulian Marin Ion Q&A 2 11-27-2007 10:23 PM


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.