01-09-2024 05:41 PM
@Somarita wrote:
I've made event structure (with proper button "value change" - if I can name it like that 😜 ), then I put the time condition in case structure. .
Assuming you programmed proper simulation of the elevator movement, an event structure seems inappropriate for this, because reaching a floor is determined by time, not user interaction. Also it should only go to the target floor if nobody remains in the elevator. Right? Events are for user interactions!
01-09-2024 05:53 PM
Okay let me clarify 🙂 It has interaction with user. User can choose where to go (buttons 0,1,2,3) but I wanted to make kind of optimisation. Like during the peak hours (7-9 when people start work) elevator shoudl wait for them always on the ground floor.
condition:
ad. 2 people who work on level 1 finish between 3 and 4 so elevator will be waiting for them
ad. 3 people who work on level 2, finish between 4 and 5 etc 🙂
This is why I needed time condition in my application.
01-10-2024 10:21 AM
So far you have not really defined what should happen during the times not mentioned.
01-10-2024 10:30 AM
I would do something like this:
01-10-2024 10:31 AM
@Somarita wrote:
Here is the list of my conditions:
1. When it's between 7am and 9am eleavtor after reaching each floor (1,2,3) is going back to level 0.
2. When it's between 3pm and 4pm elevator after reaching each floor (0,2,3) is going back to level 1.
3. When it's between 4pm and 5pm elevator after reaching each floor (0,1,3) is going back to level 2.4. When it's between 5pm and 6pm elevator after reaching each floor (0,1,2) is going back to level 3.
Note that you can take advantage of the polymorphism and do all comparisons at once, then just check which (if any) of the booleans is true.