question

Jim Montgomery avatar image
0 Likes"
Jim Montgomery asked Jim Montgomery answered

More problems with unbounded distributions

hot-seat-queue-7.fsm

In this model, the activity times assigned to the label, “a_Reading_Time” are taken from theoretical distributions within a global table, “GT_Dictation_Time_wMin” based on hour of day and PCI. The “min” command, as I have written it (see Fig 1), had no effect on the values assigned to the labels.

Fig 1:

See results below from Patient History Exported Results (Fig 2).The value assigned label "a_Reading_Time" (column Y) should never go above 60 min, yet it does.

Fig 2:

I also attempted to solve the problem using a custom User Command that seeks a value less than the minimum (See Fig 3), but I got the same results.

Fig 3:

Can you please tell me how to prevent my activity times from getting values higher than the prescribed minimums?

Thanks,

Jim

lou.keller@flexsim

cliff.king@flexsim

FlexSim HC 5.1.0
min commandmin command not workingunbounded distributions
3fso8.png (191.9 KiB)
bqdvf.png (12.6 KiB)
og1jx.png (129.4 KiB)
hot-seat-queue-7.fsm (890.2 KiB)
5 |100000

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

Matthew Gillespie avatar image
1 Like"
Matthew Gillespie answered Mischa Spelt edited

*The main issue was using the min command. The min and max commands are deprecated and you should use minof or maxof instead. Look at the comments below if you want further explanation.*

In Activity 110, where you set the readingTime label, you are pulling the value from the GT_Dictation_Time table and not the GT_Dictation_Time_wMin table.

· 6
5 |100000

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

Jim Montgomery avatar image Jim Montgomery commented ·

hot-seat-queue-8.fsm

Hi Matthew.

Why do I get the same results (minimums are not being met) in the Patient History exported table after substituting the global table, "GT_Dictation_Time_wMin" ? See below label "a_Reading_Time":

0 Likes 0 ·
9fkbo.png (16.5 KiB)
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Jim Montgomery commented ·

I don't know how you're getting those numbers. This is what I see:

Are you using custom fields?

Also if I display a Milestone-Milestone chart for Start_Read_Imaging_Study - Dication Signed then the average time is around 3.5. (You use the reading label for the processing time of activity 130)

0 Likes 0 ·
labels.png (14.1 KiB)
milestone.png (4.1 KiB)
Jim Montgomery avatar image Jim Montgomery commented ·

Yes, but did you sort the Patient History by a_Reading_Time and filter for specific PCIs?

Thanks,

Jim

0 Likes 0 ·
Matthew Gillespie avatar image Matthew Gillespie ♦♦ Jim Montgomery commented ·

You are using a deprecated function that has a known error. You should use minof instead of min. The issue with the min command is that the way C++ defines it is problematic when you pass it a function that changes value every time you evaluate it.

Instead of doing this:

double value1 = 10;
double value2 = random();

if(value1 < value2)
	return value1;
else
	return value2;

It does this:

if(10 < random())
	return 10;
else
	return random();

So even if the random number generated in the first comparison is less than 10, the number it returns is a new random number that may or may not be less than 10.

So use minof instead of min and save yourself a headache.

1 Like 1 ·
Mischa Spelt avatar image Mischa Spelt Matthew Gillespie ♦♦ commented ·

Although it is convenient to cut off the distribution using minof, also be aware that this may skew your statistics. A better way of doing it is usually something like

double r;
do {
  r = random();
} while(r > 10);

return r;

although you may be willing to accept this slight error in favor of being able to easily put the whole thing into a table cell.

0 Likes 0 ·
Jim Montgomery avatar image Jim Montgomery commented ·

Thanks, Matthew. Substituting the command, "minof" in place of "min" in my global table fixed the problem.

Thanks,

Jim

0 Likes 0 ·
Jim Montgomery avatar image
0 Likes"
Jim Montgomery answered

Thanks, Mischa. I will experiment with your recommendation also.

5 |100000

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