How to model input sequencing on a server based on labels and label based output constraints?

All topics on coding 4Dscript in Enterprise Dynamics.
Post Reply
masihmolavyzada
Posts: 7
Joined: Tuesday 02 July, 2024 - 17:24

How to model input sequencing on a server based on labels and label based output constraints?

Post by masihmolavyzada »

Hello,

I'm building a model of a surgery process in a hospital.
In my model I have an arrival list that creates 3 patients each day with different labels:
- BMI
- Diabetes
- SDK
- Cemented

After the arrival, the patients will enter a multi-server representing the pre-surgery process and afterwards they will enter a single server representing the surgery room.

I want to replicate some of the patient sequencing considerations they make:

If any patient has the "Diabetes" label:
  • That patient should be scheduled first, regardless of any other labels.
    If this first patient has "Diabetes" and one of the remaining two patients has a "BMI" > 40, then the patient with "BMI" > 40 should be scheduled second. For the third patient, choose someone with the "SDK" label and a "BMI" < 40, or with the "Cemented" label and a "BMI" < 40. If neither of these conditions is met, select any patient with a "BMI" < 40.
    If the first patient has "Diabetes," and neither of the other two patients has a "BMI" > 40, then schedule the patient with the "SDK" label second. If no patient has the "SDK" label, select one with the "Cemented" label. If neither of these labels is present, choose any patient with a "BMI" < 40 for both the second and third slots.
If two patients have the "Diabetes" label:
  • Choose one of them to be the first patient of the day and the other as the second.
    If one of these two patients also has a "BMI" > 40, that patient should be scheduled first, with the other "Diabetes" patient second.
    For the third patient, choose any remaining patient with a "BMI" < 40.
If none of the patients have the "Diabetes" label:
  • Schedule the patient with a "BMI" > 40 first.
    For the second patient, choose one with the "SDK" label.
    For the third, pick another patient with the "SDK" label or any remaining patient.
If none of the patients have the "Diabetes" label or a "BMI" > 40:
  • Schedule a patient with the "SDK" label first.
    For the second patient, choose another patient with the "SDK" label. If there are no more "SDK" patients, select any available patient.
    For the third patient, choose any remaining patient.
I have no experience with this, and despite searching through various tutorials and previously asked questions in this forum, I haven't had any luck finding a solution. I'm really hoping someone here can help me code this, even if it might be complex.

Also I would like to put some constraints on the model as a whole such as:
  • Maximum 3 patients a day with the label “Cemented” in total.
    Maximum one patient with label “BMI” > 40
So I want to block patients, from entering the pre-surgery process, with the label "Cemented" if there have already been picked 3, while still being able to accept other types of patients, and I want to block patients with the label "BMI" > 40 if there have already been picked 1.
I have experimented with the condition control atom for this, but I cannot seem to close input of one type of patients while allowing the others.
User avatar
Deena
Posts: 11
Joined: Monday 21 November, 2022 - 10:22

Re: How to model input sequencing on a server based on labels and label based output constraints?

Post by Deena »

Hello Masihmolavyzada,
Thank you for your question. There are several approaches to implement the scenario you've described. I recommend adding a Queue block before the multi-server. This will allow you to adjust the 'Queue discipline' settings.

1. You can sequence the patients by selecting the appropriate option from the queue discipline dropdown menu.
2. Alternatively, On the entry of the queue you can entre the logic based on the label "Diabetes" and label "BMI" you can make "i" i.e. the patient as First(c) to put the patient in front of the queue.

Please let me know if this solution works for you. Additionally, if you could share your current model, I can provide more detailed assistance.
Kind Regards,
Deena
masihmolavyzada
Posts: 7
Joined: Tuesday 02 July, 2024 - 17:24

Re: How to model input sequencing on a server based on labels and label based output constraints?

Post by masihmolavyzada »

Hi Deena,

I apologize for my delayed response. Since I asked my original question, I've made some changes to my model, which I’ve attached below for you to review. However, I’m having trouble adding a queue block. I attempted a logic-based sequencing approach, but it doesn’t seem to be working correctly—possibly because I don’t have a queue block?

Additionally, when I try to type comments using {}, they keep disappearing in the code window, even after clicking the apply button and following the usual steps. I’m not sure if I may have accidentally changed some settings. Do you have any insights on this?

Best regards,
Masih Molavyzada
Attachments
MMOSIMFARSOEny.mod
(178.9 KiB) Downloaded 25 times
Post Reply