Hi Team,
in my project, I need to move the item from an AGV to a conveyor with a certain delay: from the time when the AGV stops to when the item arrives at the station (located in the middle of the conveyor), a well-defined amount of time (Ttot) must pass. Passing the item directly from the AGV to the entry transfer, however, takes less time (Tconv) than I need (Tconv < Ttot). Therefore, I added a delay (Tdel) which equals: Tdel = Ttot - Tconv.
So, since the item as soon as it enters the conveyor has its front edge coincident with the beginning of the conveyor, and since the station is set to interact with the center of the item, let's better define Tconv:
- staLoc = position of the station along the conveyor
- itemLength = length of the item on the axis parallel to the direction of travel of the conveyor
- convSpeed = speed of the conveyor
Tconv = [staLoc + (itemLength / 2)] / convSpeed
No problems so far.
At this point I wanted to better parameterize this delay so that it would dynamically adjust as the size of the item (itemLength) changed.
I struggled a bit to find a way to retrieve the exact length of the item based on the "entry orientation" setup of the entry transfer. I eventually came to the following conclusion:
int direction = entryTransfer.find(">variables/entryOrientation").evaluate(); if ((direction >= 1) && (direction <= 8)) itemLength = item.size.x; else if ((direction >= 9) && (direction <= 16)) itemLength = item.size.y; else if ((direction >= 17) && (direction <= 24)) itemLength = item.size.z;
This is where my problem begins.
The function entryTransfer.find(“>variables/entryOrientation”).evaluate() would execute the following code:
But at the time I run this code, the item has entered neither the entry transfer nor the conveyor (it is still in the AGV), so an error comes up (even though the item variable is useless).
I currently solved it by modifying that entry transfer code as follows:
Now the code works, but if I add a new conveyor to my project, the related entry transfer is created with that part of the code unmodified.
Is there any way to modify the FlexSim library itself so that every time it creates a new entry transfer, it generates the transfer with that portion of code already modified?
I found that code in the library: Main/project/library/conveyor/EntryTransfer>variables/entryOrientation
but if I edit it and then close and reopen FlexSim it comes back unedited as before.
If what I am asking is impossible, is there any other way to find which orientation the item will enter the conveyor before the item actually enters it?