question

Daniel Klemm avatar image
0 Likes"
Daniel Klemm asked Daniel Klemm commented

Railway Crossing Control by current Location

Hi,

in my program's logic I try to control a railway crossing by the last wagon's location. A 700m Train (AVG Network: Loco+36 coupled trailers) crosses the intersection. A control loop in the ProcessFlow looks into the x-Location of the last wagon and assigns a label. After reaching a specific value of x, an event is being triggered to open the intersection again for. Works for normal simulation run perfectly. As the model runs "Fast Forwards" the last wagon's x-Location in the label is not current x-Location anymore. Function "updateLocation()" before asking for the location doesn't work.

How to get the current wagon's location all the time? Do you have any suggestions to solve the problem?

Thanks

Daniel

FlexSim 22.2.0
agvlocationintersections
· 2
5 |100000

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

Andrew O avatar image Andrew O commented ·

Hi @Daniel Klemm, was Jason Lightfoot's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always unaccept and comment back to reopen your question.

0 Likes 0 ·
Jeanette F avatar image Jeanette F ♦♦ commented ·

Hi @Daniel Klemm,

We haven't heard back from you. Were you able to solve your problem? If so, please add and accept an answer to let others know the solution. Or please respond to the previous comment so that we can continue to help you.

If we don't hear back in the next 3 business days, we'll assume you were able to solve your problem and we'll close this case in our tracker. You can always comment back at any time to reopen your question, or you can contact your local FlexSim distributor for phone or email help.

0 Likes 0 ·

1 Answer

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered Daniel Klemm commented

First of all - the Control Area should allow you to detect allocation and deallocation but it does not currently - only the head of the train is correctly detected - I will send the attached example in for the developers to consider fixing. At time 37.55 the area is about to be allocated by the lead trailer which is correct as shown here just after the allocation event with the train approaching from the left.

1671810890655.png

But at time 73.29 the area is about to be deallocated by the driver AGV (blue) which is in the middle of the train as shown below, before and after the event. This is incorrect as the last trailer should be the trigger for the deallocation to be consistent with the lead trailer.

1671810919767.png1671810938940.png

In the meantime you can use the AGV class to access the trailer objects and therefore the positions. In the attached model I show this on a visual tool in the model using this code:

textnode.value="RearX:";
AGV agv=AGV(current.agv);
if (agv.trailers.length){
    AGV.Trailer trailer=agv.trailers[agv.trailers.length];
    Vec3 loc=trailer.object.location;
    textnode.value+=loc.x;
}

testTrainEndDetection.fsm


· 3
5 |100000

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

Daniel Klemm avatar image Daniel Klemm commented ·

Thank you for help!

Accessing the trailer object's location by using your code helps, but you cannot detect the location currently (while moving the train). Only with opened 3D-Model view the location of an trailer is trackable. The modified model attached logs the x-Position of the leading trailer.

See results below:

Run Speed: Fast Forward (max.)

1672749170383.png

Run Speed: 2x (3D Model View)

1672749450054.png

Using this value in the logic is not helpful, while running the model fast (experimenter).

Do you have any other suggestions how to solve this problem?

testtrainenddetection_xposition.fsm

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Daniel Klemm commented ·

At which events are you trying to detect it? I just used the text draw code as an example and that doesn't fire without a view.

You probably need to add:

updatelocations(agv.object);
0 Likes 0 ·
Daniel Klemm avatar image Daniel Klemm Jason Lightfoot ♦♦ commented ·
works! Thanks a lot..
0 Likes 0 ·