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-03-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 Questions on coding

In my model, I try to record the time an item go through the whole system. In real case, the procrossors will have random breakdown, so I hope to record the breakdown start time and end time if the item is in procrossing in the server by using labels. However, I don't know how to get the item's label in the coding in the timetable[onDown] tigger, does anyone have help on the coding?

My coding in timetable[onDown] tigger now:

treenode current = ownerobject(c);
treenode members = var_s(current,"members");
double tablerow = parval(1);
{ //************* PickOption Start *************\\
/**Set Label*/
setlabelnum(
/** \nObject: */ /**/current/**/,
/** \nLabel: */ /**/"breakdown start time"/**/,
/** \nValue: */ /**/duniform(1,3)/**/
);
/**\n\n*/
} //******* PickOption End *******\\
Attached Thumbnails
Click image for larger version

Name:	time table and global table output.jpg
Views:	110
Size:	143.1 KB
ID:	1641  
Attached Files
File Type: fsm add and get label code.fsm (43.5 KB, 81 views)
Reply With Quote
  #2  
Old 02-03-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

Hello Jack,

you can copy the code to the Down and Resume function or OnDown and OnResume. The trick is to find the pointer to the Flowitem in the Processor, since it isn't declared in the functions. As long as a flowitem exists in the Processor, it will be the first object in the processor.

Code:
treenode item = first(downobject);// pointer to a possible flowitem in the Processor
if (objectexists(item)) // test, if there is a flowitem
{
    setlabelnum(item,"breakdown start time",time()); //write the value "start time" or "end time" 
}
Further on check the row you write your end time in the sink. It should be the second column, i think.

Jörg
Reply With Quote
The Following User Says Thank You to Jörg Vogel For This Useful Post:
Jack Lai (02-06-2012)
  #3  
Old 02-06-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 your reply. However, my program is still wrong, an error message [unknown variable downobject] is occurred. Can you show me the whole coding of your program.

Actually, I don't understand the code[treenode item = first(downobject)] How this code can point to flowitem?

Also, I hope the program can get the value of start time and end time. Can you show me an example of how to get the value from a label in the ondown function.

Many thanks!

Jack
Reply With Quote
  #4  
Old 02-06-2012
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: 313
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

If your Code shows this error message, please share the complete text with us. Maybe we can figur out, what is wrong ;-)
For questions about commands you allways can have a look in Help -> Commands.
"first" creates a reference to the first object, which is in the object you name in the braces.

I understand this is really hard, if you don´t got any experience with programming. Maybe you just start with having a look on whats happening while using some options of picklists;-)
__________________
Hemmi
Reply With Quote
  #5  
Old 02-06-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

Hello Jack,

the Triggers OnDown and OnResume don't work with my code. In those functions it is not so easy to get a pointer to the involved member.

Jörg
Reply With Quote
  #6  
Old 02-06-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

Hello Jack,

in the Down Function or Resume Function you find in the code a pointer to the downobject. In your model is the Processor3 the downobject. A processing flowitem is the content of the processor. Therefore the processor is the container for the flowitem. first(container) is a reference to the first object in the container. Other commands to reference objects in the container are, last(container) and rank(container, list number).

Jörg
Reply With Quote
The Following User Says Thank You to Jörg Vogel For This Useful Post:
Jack Lai (02-06-2012)
  #7  
Old 02-07-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 the suggestions. I can run the program now.
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
Two questions that are raised David Chan Container Terminal (CT) Library 6 01-22-2010 09:23 AM
Questions of TrafficControl ? Li Chin Q&A 0 01-15-2009 07:32 AM
Need help for coding on lifts. chrisquek Q&A 5 11-25-2008 03:00 AM
A pitfall in Flexsim coding AlanZhang Gripes and Goodies 7 05-16-2008 03:37 PM


All times are GMT -6. The time now is 05:01 AM.


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