How to obtain the current acceleration or deceleration of specific AGV?

How to obtain the current acceleration or deceleration of specific AGV?

jouky_d
Not applicable
263 Views
6 Replies
Message 1 of 7

How to obtain the current acceleration or deceleration of specific AGV?

jouky_d
Not applicable

[ FlexSim 23.1.3 ]

Hello everyone,

Is there a way in FlexScript to obtain the current acceleration of an AGV? I want to know if it's accelerating, decelerating, in regime state, or idle.

Thank you!

0 Likes
Accepted solutions (1)
264 Views
6 Replies
Replies (6)
Message 2 of 7

moehlmann_fe
Advocate
Advocate
Accepted solution

You can iterate through the AGV's kinematics until you find the one that is currently active based on the start and end times of the kinematics.

You then further compare the current model time to the timespans the AGV spends accelerating in that kinematic. If you find that the AGV is currently accelerating, you can get the used acceleration value from the kinematic as well.

double curAccel = 0;
Object agvObj = Model.find("TaskExecuter1"); // As an example AGV agv = AGV(agvObj); treenode kinematics = agv.kinematics; int rank = 1; int numKinematics = getkinematics(kinematics, KINEMATIC_NR); while(rank <= numKinematics) {     double kinEndTime = getkinematics(kinematics, KINEMATIC_ENDTIME, rank);     double kinStartTime = getkinematics(kinematics, KINEMATIC_STARTTIME, rank);     if(kinEndTime >= Model.time && kinStartTime <= Model.time)     {         double accTime1 = getkinematics(kinematics, KINEMATIC_ACC1TIME, rank);         if(Model.time < kinStartTime + accTime1)         {             curAccel = getkinematics(kinematics, KINEMATIC_ACC1, rank);             break;         }         double accTime2 = getkinematics(kinematics, KINEMATIC_ACC2TIME, rank);         if(Model.time > kinEndTime - accTime2)         {             curAccel = getkinematics(kinematics, KINEMATIC_ACC2, rank);             break;         }     }     rank++; } return curAccel;
Message 3 of 7

jouky_d
Not applicable

Thank you for your answer @Felix Möhlmann ! I saw there was a "acceleration" state. However, the AGV never is on that state and my trigger doesn't activate. Do you know why? Or another way to activate a ProcessFlow when the AGV starts accelerating or decelerating? (I accept your answer, however I still have this problem 😞 ).

0 Likes
Message 4 of 7

moehlmann_fe
Advocate
Advocate

The "accelerate" state is not used by task executers (I can't actually tell you any object that does).

There is no event associated with the AGV starting to accelerate. You would have to extract those times from the kinematics node as is done in the code above. New kinematics are generally added when an AGV allocates the next control point (or fails to do so). So if you react to those events, you should be able to extract all accelation times from the kinematics. (As long as you don't use accumulation behaviour, then you would also have to react to events corresponding to that).

0 Likes
Message 5 of 7

jouky_d
Not applicable
Thank you @Felix Möhlmann , I've got a state if AGV is blocked by another AGV, however, I can't trigger an event if the AGV changes to accelerating, regime or decelerating, because without this trigger, how can I differentiate the acceleration, regime and deceleration (without an Activity Scanning of time intervals). If I do not understood it wrong, is there a way to do so?
0 Likes
Message 6 of 7

moehlmann_fe
Advocate
Advocate

Like I (at least tried to) have said. You'd need to get the information about when the AGV will be accelerating from the kinematics node.

In the attached model, whenever a token is inside the delay activity marked in green, the corresponding AGV is changing its velocity.

acceleration-trigger-fm.fsm

0 Likes
Message 7 of 7

jouky_d
Not applicable

Thank you Felix! 😄

0 Likes