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 10-15-2012
mearjun mearjun is offline
Flexsim User
 
Join Date: Feb 2012
Posts: 123
Downloads: 5
Uploads: 0
Thanks: 27
Thanked 19 Times in 11 Posts
Rep Power: 118
mearjun will become famous soon enough
Default Is there a way to add dynamic labels on an item or a machine ?

Is there a way to add dynamic labels on items ???
For example I am modeling an ED (emergency department for a hospital) in flexsim. After the patient is Triaged (Initial assessment at front desk) a few tests are ordered and a patients criticality is determined.. So technically a critical score of 2 would get admission before 3. But if the results for the tests ordered have arrived for 3 but not for 2 then he would be admitted first.
So, I planned that I would put a label called test-times on a patient. this would generate a value as to how long would the results takes to come. Plus I will mark the patient's arrival time on the waiting queue and if possible I would put a dynamic label which keeps track of as to how long has he waited. Now when a Bed needs to be allotted, those patients whose waiting time label value is greater than the test times label value are eligible for being sent to the bed and others would have to wait longer..Out of those eligible the patient with the lowest critical score would be allotted the bed first.
Does anyone have an idea how this can be modeled if there are indeed no dynamic labels in flexsim ??
Reply With Quote
  #2  
Old 10-16-2012
Kris Geisberger Kris Geisberger is offline
Flexsim Canada, Forum Moderator
 
Join Date: Aug 2007
Location: Canada
Posts: 209
Downloads: 54
Uploads: 1
Thanks: 99
Thanked 389 Times in 133 Posts
Rep Power: 450
Kris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud of
Default

time() is dynamic

If you want to determine the present wait time of an item:
double waittime = time() - getentrytime(item);
or
double waittime = time() - getlabelnum(item,"MyTimeStamp");

This post should give you some ideas for how you can control the flow: http://www.flexsim.com/community/for...ead.php?t=2314
Reply With Quote
  #3  
Old 10-20-2012
mearjun mearjun is offline
Flexsim User
 
Join Date: Feb 2012
Posts: 123
Downloads: 5
Uploads: 0
Thanks: 27
Thanked 19 Times in 11 Posts
Rep Power: 118
mearjun will become famous soon enough
Default

If there are 'n' items in my queue how will I evaluate it for all 'n' of them. As I said I have 2 decisions on the outcome of which it is decided as to which item would release. First condition is eligibility and second is priority. Lets say the downstream destination sends a message to the queue when it is available.
Now on the on-message trigger of the queue how will it evaluate which items have become eligible.
Items become eligible when they have already waited for a certain time. Now if 'n' items are waiting how can I check which have become eligible when the on-message trigger is executed.
Second part is out of all the eligible items I have to check their priority score. If the priority score are same, then the item that has been waiting longer will have to be released first.
Now since n is dynamic I have no idea as to how a code for this can be written. What commands can be used to refer to different items at the same time that are waiting in the queue.
Reply With Quote
  #4  
Old 10-20-2012
Kris Geisberger Kris Geisberger is offline
Flexsim Canada, Forum Moderator
 
Join Date: Aug 2007
Location: Canada
Posts: 209
Downloads: 54
Uploads: 1
Thanks: 99
Thanked 389 Times in 133 Posts
Rep Power: 450
Kris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud of
Default

I have posted a v5.1.2 model on the other thread so you can look at the logic in the OnMessage of the queue. The model is doing exactly what you ask.

The command you were missing is content()

The OnEntry sends a delayed message that represents the wait time to become eligible. Once eligible, the item is given a Priority value which is stored on a label (on the item), which up to that point was 0 as initialized in the Source. When I evaluate the items, I ignore any that don't have a Priority greater than 0.

You will not see a waittime variable in the logic as I defined in my previous post because I evaluate the items in chronological order, so I know the first I find of a given priority has been waiting longer than the rest.
Reply With Quote
  #5  
Old 10-22-2012
mearjun mearjun is offline
Flexsim User
 
Join Date: Feb 2012
Posts: 123
Downloads: 5
Uploads: 0
Thanks: 27
Thanked 19 Times in 11 Posts
Rep Power: 118
mearjun will become famous soon enough
Default

Thanks for the reply.. The picture is getting clearer now but I still did not get the complete code ..
First what does this line in code mean and do..
When msgtype is 1
if(getstatenum(thisdestination)==STATE_IDLE && getvarnum(thisdestination,"nroftransportsin")==0) (I am asking about the second part in particular the one in bold)

next when msgtype == 2
if(getitemstate(thisitem)==FRSTATE_INQUEUE) I could not find the mentioned state in any of the listed states in the manual..
Basically I am not able to get what the second part of the code is doing..
For any item whose priority > 0 and < 1000, u set the item as bestitem and then set the bestitempriority (which earlier was set to 1000) = thisitempriority (the priority of the item that the code is checking)
the next line says if bestitempriority < 1000 then release the item .. this is where I get lost.. I could not see the purpose of setting the bestitempriority = thisitempriority..

As I told you out of the eligible items, I have to take another decision and that is not just which item came first but also which item has a lower CTAS score (basically higher priority).. so basically I have to see the CTAS (priority) first and then see the rank.. If the CTAS score is same then I have to release the item in rank order..

Could u help me with this?

Last edited by Kris Geisberger; 10-22-2012 at 10:49 PM.
Reply With Quote
  #6  
Old 10-22-2012
Kris Geisberger Kris Geisberger is offline
Flexsim Canada, Forum Moderator
 
Join Date: Aug 2007
Location: Canada
Posts: 209
Downloads: 54
Uploads: 1
Thanks: 99
Thanked 389 Times in 133 Posts
Rep Power: 450
Kris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud of
Default

Quote:
First what does this line in code mean and do..
When msgtype is 1
if(getstatenum(thisdestination)==STATE_IDLE && getvarnum(thisdestination,"nroftransportsin")==0) (I am asking about the second part in particular the one in bold)
msgtype 1 comes from the queue OnEntry and marks the beginning of eligibility of an item. After giving the item a priority value, I check all possible destinations to see if there is one available to receive the item... that is where the IF is used.
"nroftransportsin" is a variable that is managed by flexsim that tells you how many taskexecuters are incoming (assigned a job to carry an item to the station). I don't have any transporters in my model, so it is there just in case you do.
I don't have to check any other items in the queue since they would have left already if they could, because of the way msgtype 2 is triggered.


Quote:
next when msgtype == 2
if(getitemstate(thisitem)==FRSTATE_INQUEUE) I could not find the mentioned state in any of the listed states in the manual..
Under Help>Commands you can find the getitemstate command, the description says: "FRSTATE_INQUEUE: The flowitem is in-process; it has not been released yet."

Quote:
Basically I am not able to get what the second part of the code is doing...
msgtype 2 is the signal coming from one of the destinations to announce it is available to take another item. This is the reverse of msgtype 1, in that I know the destination but I don't know which item to release. I use a FOR loop to check each item in the order they arrived. First I make sure the item has not already been released (getitemstate), because I don't want to get caught releasing the same item twice... this probably only a danger if you used a transport to escort the patient. Then I check the priority value. I only want to consider an item if its priority is greater than 0 (eligible) AND is less than the lowest priority I have found so far as I check each item. I made-up variables called bestitem and bestitempriority to remember a pointer to the best candidate item and its priority respectively. Each time I find a better candidate, I overwrite these 2 variables.

Quote:
the next line says if bestitempriority < 1000 then release the item .. this is where I get lost.. I could not see the purpose of setting the bestitempriority = thisitempriority..
I originally set the bestitempriority to 1000 expecting that you would not have a CTAS that high. So if the bestitempriority is still 1000 following the search that means I did not find anything to release.
Reply With Quote
The Following 2 Users Say Thank You to Kris Geisberger For This Useful Post:
Jörg Vogel (10-23-2012), mearjun (10-23-2012)
  #7  
Old 10-23-2012
mearjun mearjun is offline
Flexsim User
 
Join Date: Feb 2012
Posts: 123
Downloads: 5
Uploads: 0
Thanks: 27
Thanked 19 Times in 11 Posts
Rep Power: 118
mearjun will become famous soon enough
Default

Thanks a ton Kris.. I think I would add your name in the people I acknowledge when I finish my thesis.. really thanks a lot for explaining in such detail and for being so patient..
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
Running Flexsim on a Virtual machine Kenny Macleod Pre-sales Questions 5 08-30-2013 01:24 AM
Using probability to indicate machine/operator availbility David Chan Q&A 13 02-18-2011 02:03 AM
Installing Flexsim on a Virtual Machine Francois Perron Installation 6 08-28-2009 05:41 AM
Preempting for machine breakdown Martijn van Oostenbrugge Q&A 4 10-15-2008 01:49 AM
Machine breakdown using Operators Nico Zahn Q&A 8 07-13-2008 03:07 AM


All times are GMT -6. The time now is 08:53 PM.


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