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 11-08-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 Use a variable for a hotlink

Hi,

I'm trying to use a global variable a a part of a hotlink like this:

MAIN:/project/model/ProcessorX>variables/cycletime

To specify the number X of the chosen Processor the user should type a number in a textbox which updates a global variable called recent_processor_number.

And how can I integrate this global variable into the hotlink? I've tried it like this but it didn't work:

concat("MAIN:/project/model/Processor",numtostring(recent_processor_number),"> variables/cycletime")

the command numtostring(recent_processor_number) should deliver the number X of the chosen processor.

Thanks a lot!
  #2  
Old 11-08-2010
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

Attached is a model that shows how you can link an edit field in a GUI to a global variable. It uses a coldlinkx, but you could also use hotlinkx if you wanted a hot link instead.
Attached Files
File Type: zip globalvariablecoldlink.zip (30.8 KB, 218 views)
The Following 4 Users Say Thank You to Phil BoBo For This Useful Post:
Stefan Trabut (06-22-2011)
  #3  
Old 11-09-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

Thanks for the code, I used it for a text box to update the global variable.

Now I'm trying the integer value of a global variable (that I can now update from a textbox) for a hotlink from a script window to a chosen node. The global variable like recent_processor_number should be part of the path in the hotlink.

Thanks
  #4  
Old 11-09-2010
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

You can use a hotlinkx instead of a normal hotlink. Write code in your hotlinkx to return the node you want to point to.

such as:

switch(recent_processor_number)
{
case 1: return node("/Processor1",model());
case 2: return node("/Combiner7",model());
}

or

return node(concat("/Processor",numtostring(recent_processor_number,0,0 )),model());
The Following User Says Thank You to Phil BoBo For This Useful Post:
Congshi Wang (11-10-2010)


Thread Thread Starter Forum Replies Last Post
global variable in DLL (UserFuncs.h) Esther Bennett Q&A 7 09-12-2012 07:02 PM
Variable for Flexsim Object Congshi Wang Q&A 3 08-03-2010 09:01 AM
Variable variable name Congshi Wang Q&A 4 08-03-2010 08:01 AM
Global variable as experiment variable Matthias Hofmann Q&A 3 09-08-2009 09:42 AM
Variable Operator Michael Hartlieb Q&A 2 07-06-2009 03:53 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.