question

mattias avatar image
0 Likes"
mattias asked mattias commented

AGV comsumption per meter

Hello!

How do I create an AGV where its battery consumption/production is based on which path it drives on? For example, if it drives on a straight path, consumption is 1 Wh/m, uphill consumption is 20 Wh/m, and downhill consumption is -5 Wh/m (production 5 Wh/m). Likewise, it would be sufficient to pull these numbers from an Excel sheet.

FlexSim 24.1.0
excelcustom agv consumption
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

Arun Kr avatar image
0 Likes"
Arun Kr answered mattias commented

Flexsim records the total travel distance by a task executor using the method.

TaskExecRef.as(TaskExecuter).stats.totalTravelDistance;

You can store this info into a tracked variable. And by using process flow you can listen to the tracked variable changes every 1 metre. Depending on the path that the agv is traveling, for every 1 m deduct the different battery consumption rates. In this case, since the battery charge depends on the distance traveled, the battery charge level can be a tracked variable label on the AGV.

To update the tracked variable as the travel distance updates. Add the total travel distance dashboard from the statistics toolbar. Install the statistics collector corresponding to it. Then add the abovementioned code in the statistics collector for updating the tracked variable. [ Note: When you do this method of tracked variable updation always keep the dashboard chart open, then only the tracked variable value gets updated. You can also try this kind of tracked variable updation in the OnDraw trigger of the agv.]


1711165474028.pngAdd Chart

Create the process flow for listening to the tracked variable changes and deduct the battery level depending on the path. Create a global table that lists the battery consumption levels based on the path. Access this table in the process flow for deduction.

Here's the code.

Table BatteryInfo = Table("BatteryInfo_DistanceBased")
AGV agv = AGV(current);
Object Path = agv.currentTravelPathSection.path;// Gets the current path
int PathNum = Path.find(">variables/pathType").value;
string PathName = Model.find("AGVNetwork>variables/pathTypes").subnodes[PathNum].name;
double RateValue = Table.query("SELECT * FROM BatteryInfo_DistanceBased WHERE PathType = $1",PathName)[1][2];
current.labels["BatteryLevel"].value = current.labels["BatteryLevel"].value - RateValue;

When the battery level reaches a threshold value or zero, add a recharge logic by adding additional process flow activities. agvSupport.fsm

Regards,

Arun KR



agvsupport.fsm (50.1 KiB)
1711165474028.png (215.9 KiB)
· 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.

Jason Lightfoot avatar image Jason Lightfoot ♦♦ commented ·

Note that this method will not work in an experiment and possibly is run-speed dependent.

0 Likes 0 ·
mattias avatar image mattias commented ·
Thank you @Arun Kr! I will test the model and see how it works :)
0 Likes 0 ·