question

Tomi Kosunen avatar image
0 Likes"
Tomi Kosunen asked Lars Christian J2 answered

Elevator bank entry/exit time

Hi. How can I set "traveler based" entry/exit time for elevator bank.?

The FlexScript code has only current as parameter, not the traveler.

FlexSim 21.2.0
flexsim 21.2.0elevator bank
· 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.

Joerg Vogel avatar image Joerg Vogel commented ·

If you print current.name into an output console from a trigger, what name do you see?

EDIT: “current”, “traveler” or “ts” are just names. More important is, how they are declared. “current” is most often a reference to the owner of an object trigger. This means if you see ”current” in an elevator trigger or function it is pointing to the elevator. In a network node you get a reference to the involved taskexecuter as “traveler”. “current” is pointing to the network node. In process flow “current” points to the process flow and if the process flow is an instance of an object, then “current” references to this object. I suggest you explore what a declared pointer references to. It is better to know, than to assume what a source code does. There are different approaches to read source code variables values while a model runs. But you should know what a variable value is while a code is executed. print(current.name) is one method to get those values. I prefer this method, because it was once the only way to understand a code. And I stick with it. There are better methods like debugging console, but it is your choice, how to achieve knowledge over your code.

0 Likes 0 ·
Lars Christian J2 avatar image
0 Likes"
Lars Christian J2 answered

Using Event-triggered Source and listning for for "OnTravelerArrival" combined with setvarnum could be useful. There is still some issues concerning detecting when an elevator is full and the operator have to wait for the next elevator car. I hope it can give you some inspiration.

1631256539890.png

1631256484967.png


elebank-question2.fsm


5 |100000

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

Tomi Kosunen avatar image
0 Likes"
Tomi Kosunen answered Lars Christian J2 commented

Thanks @Joerg Vogel , I understand that . current points to the Elevator (Bank) object. I tried to find the traveler from the ElevatorBank/Elevator (car) tree and couldn't find it. Do you know if there is a way to get pointer to the traveler or find the traveler from the tree?

I also noticed that current points to the current elevatorbank object. If I want to get statistics from the elevator car (elevator bank contains for example 2 cars), I have to put ElevatorBank elebank = current.as(ElevatorBank);

· 5
5 |100000

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

Joerg Vogel avatar image Joerg Vogel commented ·

Elevator is a taskexecuter. Then any objects on or in him is a subnode. If you need his content, you get it by current.subnodes.length If you need the statistical value then you have to cast a treenode direct into an object current.as(object).stats.content.value

0 Likes 0 ·
Tomi Kosunen avatar image Tomi Kosunen Joerg Vogel commented ·
Elevator is a TaskExecuter but ElevatorBank is not. It is Elevator in People class. Travellers are not subnodes of ElevatorBank (like they are for Elevator). I'm quite sure the travelers are somewhere under ElevatorBank tree but I cannot find them.
0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Tomi Kosunen commented ·

The travelers can be found as subnodes of the following node in the tree:

treenode Travelers = <ElevatorBankObject>.find(">stats/activeTravelers");

This includes all TaskExecuters that are currently entering or exiting an elevator, inside (one of) the elevator(s) or waiting in front. Maybe you can use the "OnAStarElevatorEntry" and "OnAStarElevatorBankArrival" events (on the TaskExecuters, weirdly only in event triggered sources in process flow) to set labels to distinguish between them.

Also note, that the "Entry/Exit Time" is only evaluated once per exit/entry cycle. So you would have to use the average value for all TaskExecuters that are involved, if there are multiple ones waiting to enter/exit. Assigning individual times is currently not possible to my knowledge.

See also the section on the Entry/Exit-algorithm in the documentation:

https://docs.flexsim.com/en/21.2/Reference/PropertiesPanels/PeoplePanels/ElevatorBank/ElevatorBank.html

You can suggest this as an idea in the forum though. Seems like this would be a useful functionality to add.

1 Like 1 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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