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-19-2011
shashanktrivedi shashanktrivedi is offline
Flexsim User
 
Join Date: Apr 2011
Posts: 59
Downloads: 26
Uploads: 0
Thanks: 26
Thanked 16 Times in 3 Posts
Rep Power: 122
shashanktrivedi will become famous soon enough
Default GlobalVariables & Processing Time

I want to use global variable to calculate processing time. The variable i have defined in global variable is Proctime, double in type.

Now i am trying to access it in processor process time script through

getvarnum(model,"Proctime")

above command is giving value zero, little bit clueless how should i access it.

Attaching model for reference.
Attached Files
File Type: zip Test_GlobalVariables.zip (67.0 KB, 152 views)
  #2  
Old 05-19-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

If it's a global variable, you just write the name in the script/template/trigger. getvarnum is just for retrieving values of nodes in the variables part of the tree.

If you want to test your code just write the expression in the "script window" (button on the Flexsim 'ribbon') and press Execute to see what it returns.
  #3  
Old 05-19-2011
shashanktrivedi shashanktrivedi is offline
Flexsim User
 
Join Date: Apr 2011
Posts: 59
Downloads: 26
Uploads: 0
Thanks: 26
Thanked 16 Times in 3 Posts
Rep Power: 122
shashanktrivedi will become famous soon enough
Default

Thanks a lot

When i am printing global variable in this case Proctime to output console through pf(Proctime); it print 0.00000 that's the main reason i have not used it earlier.

Infact system does work with using global variable name directly. In my case i am controlling global variable value through gui, strange thing whatever new value i give get modified (get in the operations) in the system in the second run not in the first run, although value of global variable changes immediately.

Look forward to your reply
  #4  
Old 05-19-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

In the model you posted earlier the "pf(Proctime);" comand prints a 80.0000 to the Output Console. And this value don´t changes.
Tried to change your value by using "Proctime++;" and got no problems at all.

Maybe you want to post the actual model once more!?

For your other questions, without seeing the actual model, I only can give you the hint, that I often got problems while testing different ways in models with old code. Sometimes there happen strange things because of don´t deeply erasing all old testcode.
Sorry that I can´t spend you more help.
__________________
Hemmi

Tags
globalvariables


Thread Thread Starter Forum Replies Last Post
Custom GUI processing time input & script control shashanktrivedi Q&A 2 05-19-2011 10:28 AM
how could I get opeartors move during processing? zoeygollum Q&A 4 07-17-2010 01:06 AM
Setup/processing order problems Derrick Serbonich Q&A 2 07-09-2009 01:27 AM
Robot processing Sung Kim Q&A 7 08-27-2008 06:48 AM
Using a Variable number of Operators for Processing Brandon Peterson Tips and Tricks 4 07-16-2008 09:16 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.