Page 1 of 1

Matching results in time

Posted: Fri Oct 27, 2017 9:08 pm
by Phill
In the attached simple extract from a model, I am trying to show the accumulation of bookings for a hotel over a month, for accommodation on the last day of the month. It’s a 31-day month, so there are 32 daily time steps to complete the run. During the month, overbooking is allowed, so the stock of bookings can exceed the number of rooms available by 10, but on the last day, the number of bookings must be reduced to match the number of rooms available. The reduction in numbers is split between ‘no shows’ (guests who simply don’t show up) and ‘walked’ guests (those who need to be accommodated elsewhere).

When I run this model, it correctly books up to a ‘Bookings’ stock of 135 (125 rooms, plus 10 overbooked) then this is reduced to the actual number of rooms (125) on Day=32. But to achieve this, the variable calculating the reduction in bookings has to be run when Time=31, the day before. The results then show that the 10 extra guests were removed the day before the date of booking. Is there a way to place these two results on the same time step, on Day=32?

Re: Matching results in time

Posted: Sun Oct 29, 2017 4:20 pm
by tomfid
If it's strictly a display alignment issue, switching from Euler to Diff integration might do the trick (this just changes the storage alignment of stocks and flows).

Re: Matching results in time

Posted: Mon Oct 30, 2017 6:29 am
by Phill
Thank you for your answer Tom. I tried it, but it isn't just a question of display, as I actually need a slightly different formula on the last time step to the previous ones and I'm trying to avoid nested 'IF, THEN, ELSE' statements. I need the stock to increase to an 'over inventory' level (if there is sufficient demand) during the run, then be corrected on the last time step so that the end value does not exceed the actual capacity. I think I might just have to love with the result that the adjustments and the final stock value appear at different time steps.

Re: Matching results in time

Posted: Mon Oct 30, 2017 10:05 am
by Administrator
I'm finding it difficult to actually work out what is going on in this model. The IF THEN ELSE embedded within the Bookings means the diagram is very misleading as "booking rate" and "cancellations per day" are not actually the flows in/out of the stock.

Am I right in saying that this is looking at bookings over a month period? And there can be up to 125 rooms booked during that period? Or is it 125 maximum bookings per day?

Re: Matching results in time

Posted: Mon Oct 30, 2017 12:06 pm
by Phill
Yes, the maximum stock is effectively 125, but can 'overstock' to 135, then needs to be corrected at the last time step. But why are incoming bookings not the flow to the bookings total?

Re: Matching results in time

Posted: Mon Oct 30, 2017 2:56 pm
by tomfid
How about this?
Test bookings stock 2.mdl
(5.04 KiB) Downloaded 215 times

Re: Matching results in time

Posted: Mon Oct 30, 2017 3:31 pm
by Phill
Thank you both for taking the time to reply, you have been very helpful and certainly helped me to improve my modelling skills! I see now that my example was not 'clean' and I shouldn't try to cram the IF, THEN, ELSE statement into the stock but, instead, take the values of the accumulating stock as a 'feed' for the end of month 'Staying guests' and 'Walked guests' variables. This seems to work very well, Tom, thank you again.

Re: Matching results in time

Posted: Mon Oct 30, 2017 4:17 pm
by tomfid
Glad it's helpful! These discrete things are always tricky.

Another option would be to go to a sub-day time step (hourly?), but that might add a lot of computational burden.