question

Maryam H2 avatar image
0 Likes"
Maryam H2 asked Maryam H2 commented

Conditioning the Quantity in the Arrival Table

Hi -

In the Arrival table ⇾ Source in the quantity column how I can define if the person has shown up on previous day/time, then the Quantity should be 0 otherwise it should be 1?

To put it another way, considering a weekly schedule, I want the person to show up 3 days per week randomly from Monday to Friday, how can I do that in the Arrival table?

*Each person is unique, and I label them with their names in the table.


Thanks

FlexSim 22.1.3
quantityarrival tableconditioning
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Maryam H2, was Felix Möhlmann's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Maryam H2 commented

I would schedule all visits at the beginning of the week. Create one 'main' token per patient, then determine how often and when the patient will arrive for that week and create one token per arrival. These then wait in a delay activity until the scheduled times are reached and then create the patient.

Similar to how I described it in this answer.

· 7
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Maryam H2 avatar image Maryam H2 commented ·
@Felix Möhlmann Thanks for the answer!


Since I've already created my Arrival table and collected the data in that format, I'm really looking if there is a way to condition the quantity in the Arrival table. So, if one people coming is scheduled for an appointment 5 days a week and if the person shows up on the first three won't show up on the last two, is there any way to define an IF statement is the quantity tied to previous quantity for that person?


0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Maryam H2 commented ·

Here's a bit of code that will do this for you but if you probably still want the arrival times

Table schedule = Table("FullSchedule");
Array names;
string name;
int newname;
for (int n=1;n<=schedule.numRows;n++){
    name=schedule[n]["Name"];
    newname=names.indexOf(name)==-1;
    schedule[n]["Quantity"]=newname;
    if (newname)
        names.push(name);
}


QuantityOnFirstArrival.fsm

In the model I've also added a table to show how you can get the creation schedule from the original data using the script:

Table.query("SELECT Name, Min(Time) AS CreationTime FROM FullSchedule GROUP BY Name").cloneTo(Table("CreationSchedule"));
0 Likes 0 ·
Maryam H2 avatar image Maryam H2 Jason Lightfoot ♦♦ commented ·

Thanks, @Jason Lightfoot


Is the creation Time shows how many times over the week people show up? I can't run the code and see what happens.

If we consider the model attached here, Jim quantity in the "Arrival Table" is adding up to 3 since he can come Monday, Tuesday, and Wednesday. However, I want to let him choose between these days and just show up 2 out of three days.

Model_Elective_Arrivals.fsm

I was thinking even to use Bernoulli distribution so one of the days Jim will show up with a 50% probability, but I'm not sure how accurate that is.


screenshot-248.png



0 Likes 0 ·
Show more comments