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 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: 119
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 ??
  #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: 451
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
  #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: 119
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.
  #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: 451
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.
  #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: 119
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.
  #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: 451
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.
The Following 2 Users Say Thank You to Kris Geisberger For This Useful Post:
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: 119
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..


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.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.