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
FAQ Downloads Calendar Search Mark Forums Read

Q&A Using Flexsim and building models

Reply
 
Thread Tools Display Modes
  #1  
Old 02-22-2012
Jack Lai Jack Lai is offline
Flexsim User
 
Join Date: Nov 2011
Posts: 32
Downloads: 17
Uploads: 0
Thanks: 22
Thanked 0 Times in 0 Posts
Rep Power: 100
Jack Lai is on a distinguished road
Default How to get label of a processor?

In my model, I set a label to decide the breakdown time of the server, I hope the server check is it will breakdown every 8 hours. And The breakdown percentage will change monthly. I set a label called "breakdown" in the processor, and I want to call and update it in the MTBF MTTR table, I write the code in onDown function in the table as:

Code:
if(randomNumber <= check){
return/**/0.00001/**/;
setlabelnum(current,"breakdown",0.00001);
}
else
{
return/**/8/**/;
setlabelnum(current,"breakdown",8);


But it doesn't work as the label doesn't change.Can anyone teach me the coding of this? Thanks in advance.
Attached Files
File Type: fsm test oprtating hour.fsm (42.8 KB, 97 views)
Reply With Quote
  #2  
Old 02-22-2012
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: 767
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

Try replacing current with 'involved' (which is assigned the parameter that is passed into the trigger in the header). If you accessed this through the Processor GUI, I know that's a little confusing, but the MTTR is actually an object that is stored elsewhere and current refers to that object.
Reply With Quote
The Following User Says Thank You to Jason Lightfoot For This Useful Post:
Jack Lai (02-22-2012)
  #3  
Old 02-22-2012
Jörg Vogel's Avatar
Jörg Vogel Jörg Vogel is offline
Flexsim User
 
Join Date: Sep 2007
Location: Hannover, Germany
Posts: 643
Downloads: 35
Uploads: 0
Thanks: 802
Thanked 665 Times in 410 Posts
Rep Power: 636
Jörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond repute
Default

Maybe it is a good idea to place the return command after setlabelnum(..) instead of before. Return finish the further execution of code.

Jörg
Reply With Quote
The Following 2 Users Say Thank You to Jörg Vogel For This Useful Post:
Jack Lai (02-22-2012), Steven Hamoen (02-23-2012)
  #4  
Old 02-22-2012
Jack Lai Jack Lai is offline
Flexsim User
 
Join Date: Nov 2011
Posts: 32
Downloads: 17
Uploads: 0
Thanks: 22
Thanked 0 Times in 0 Posts
Rep Power: 100
Jack Lai is on a distinguished road
Default

Thanks for advice. I use "involved" and then can update the label now. Can I know more how it works? Waht is the meaning of "trigger in the header", will "involved" also affect the flowitem in the server? Thanks.
Reply With Quote
  #5  
Old 02-23-2012
Jörg Vogel's Avatar
Jörg Vogel Jörg Vogel is offline
Flexsim User
 
Join Date: Sep 2007
Location: Hannover, Germany
Posts: 643
Downloads: 35
Uploads: 0
Thanks: 802
Thanked 665 Times in 410 Posts
Rep Power: 636
Jörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond reputeJörg Vogel has a reputation beyond repute
Default

involved is a pointer parsed as a parameter, when the function is called. The parameter is accessed by the command parnode(num index). Some values are parsed as numbers, too. Those values can you get with the function parval(num index). Please have a look at the online help > Users Manual, Commands.

Jörg
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cannot use label Jack Lai Flexsim Student Forum 7 11-24-2011 03:41 AM
Problem with the value of a label Clement Schaller Q&A 3 03-15-2011 09:44 AM
Add Label Nischith Kashyap Q&A 4 03-14-2011 07:16 PM
Record label manuel fernandez Q&A 1 03-21-2010 12:29 PM
how to set preempt by label? Vic Li Q&A 4 10-19-2008 01:51 AM


All times are GMT -6. The time now is 06:23 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.