question

Chun-Ju C avatar image
0 Likes"
Chun-Ju C asked tannerp commented

Electric Car

I want to simulate something about electric cars,

but there are some questions that cause difficulty.

A car need an attribute to record the electricity,

and the consumption of electricity depends on the distance between stations,

so how can I do about this question.

FlexSim 18.1.0
electric car
· 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.

David Seo avatar image David Seo commented ·

@Chun-Ju C

If your electric car means vehicle like AGV, AGV Network library has the property of Battery Capa. (AH), Idle Use(A) and Recharge(A).

Below is the control screen.

2 Likes 2 ·
Chun-Ju C avatar image Chun-Ju C commented ·

my electric car means a car can be borrowed by anyone, and you can go where you want to go.

I don't know if AGV can do this,

If I don't use AGV, does it have any method to solve?

0 Likes 0 ·
David Seo avatar image David Seo Chun-Ju C commented ·

if your car do not mean AGV, I think you can make a script to record the electricity of the car according to the travel distance of the car.

FlexSim has the feature of calculating the travel distance. So you can make you logic to calculate the battery usage of the car.

0 Likes 0 ·

1 Answer

Joshua S avatar image
0 Likes"
Joshua S answered

You can use 2 different lines of code to get what you want

getvarnum(Car, "totaltraveldist")

This line gets the total distance the Car has/will travel. It gets the total distance it has traveled to its last destination and adds the distance it has to travel to its current destination.

distancetotravel(Car, destination)

This line of code returns the distance from the traveler at it's current location to the next destination, so you can check if it has enough energy to complete the journey.

5 |100000

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