ATTENTIONThis 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 |
|
Downloads |
Q&A Using Flexsim and building models |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
||||
|
||||
Quote:
"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:
Quote:
Quote:
|
The Following 2 Users Say Thank You to Kris Geisberger For This Useful Post: | ||
mearjun (10-23-2012) |
#7
|
|||
|
|||
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 |