question

Jouky D avatar image
0 Likes"
Jouky D asked Jouky D commented

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

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!

FlexSim 23.1.3
agvagvnetworkacceleration
5 |100000

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

1 Answer

Felix Möhlmann avatar image
2 Likes"
Felix Möhlmann answered Jouky D commented

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.

  1. double curAccel = 0;
  2. Object agvObj = Model.find("TaskExecuter1"); // As an example
  3. AGV agv = AGV(agvObj);
  4. treenode kinematics = agv.kinematics;
  5.  
  6. int rank = 1;
  7. int numKinematics = getkinematics(kinematics, KINEMATIC_NR);
  8. while(rank <= numKinematics)
  9. {
  10.     double kinEndTime = getkinematics(kinematics, KINEMATIC_ENDTIME, rank);
  11.     double kinStartTime = getkinematics(kinematics, KINEMATIC_STARTTIME, rank);
  12.     if(kinEndTime >= Model.time && kinStartTime <= Model.time)
  13.     {
  14.         double accTime1 = getkinematics(kinematics, KINEMATIC_ACC1TIME, rank);
  15.         if(Model.time < kinStartTime + accTime1)
  16.         {
  17.             curAccel = getkinematics(kinematics, KINEMATIC_ACC1, rank);
  18.             break;
  19.         }
  20.         double accTime2 = getkinematics(kinematics, KINEMATIC_ACC2TIME, rank);
  21.         if(Model.time > kinEndTime - accTime2)
  22.         {
  23.             curAccel = getkinematics(kinematics, KINEMATIC_ACC2, rank);
  24.             break;
  25.         }
  26.     }
  27.     rank++;
  28. }
  29. return curAccel;
· 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.