matsim-org / matsim-code-examples

A repository containing code examples around MATSim
GNU General Public License v3.0
82 stars 180 forks source link

Some questions about the simulation of electric cars. #278

Closed tozlucaglar closed 4 years ago

tozlucaglar commented 4 years ago

Hi all,

I want to simulate the long and short distance trips of private electric cars in MATSim, but I have some questions about extension packages.

Which extension would you recommend to use for long and short distance electrified trips? The EV extension or the TranEnergySim extension?

Is it possible to integrate different EV types (battery electric vehicles or hybrid electric vehicles) and charging styles?

I couldn't find a lot of sources to understand the difference between these extensions. Is there basic documentation to understand their features?

Best Regards Caglar

jfbischoff commented 4 years ago

Hi Caglar, TransEnergySim has been replaced by the EV contrib, so my recommendation would be to use the latter, if you want to run the latest MATSim version. As a starting point, I would suggest using https://github.com/matsim-org/matsim/blob/master/contribs/ev/src/main/java/org/matsim/contrib/ev/example/RunEvExample.java This provides an example that you can afterwards extend. To simulate HEVs, you would need to write your own Consumption Model. Besides the code examples, there is not too much documentation. I would suggest having a look at VSP-working papers 19-07 and 19-13 to see what has been done with the extensions (https://www.vsp.tu-berlin.de/menue/forschung/publications/vspwp/ ).

Good luck!

tozlucaglar commented 4 years ago

Thanks a lot for your help and quick reply! We have developed a toy model that utilizes the EV extension to understand its features. You mentioned that the EV extension has an ability to simulate pure electric cars, but the outcomes from our toy model are not as expected. The agents continue their trip even after their battery gets completely discharged (that is, the cars act as if they were hybrid cars). The state-of-charge graph and file, as well as the events file from our simulation, are attached below. Eight agents whose home and work location are the same are modeled. Agent id 16 gets discharged before 11 o'clock, but still continues. Another query I have is that, even if the charging stations are not totally occupied, why do some agents make a decision to charge their cars, while the others do not?

5 individual_soc_time_profiles_Line

5.events.xml.gz

5.individual_soc_time_profiles.txt

Could you also explain how agents make a decision regarding when and where to charge? In particular, could you guide us to where, in the code, can we modify the agents' utility function for determining charging behavior?

jfbischoff commented 4 years ago

Indeed, with the current setup, undercharging does not have any effect and thus agents simply continue their journey. Depending on what you want to achive with your model you could either accept this behavior, punish undercharging with a scoring penalty (relatively easy to program) or try to code something more intelligent, such as a dynamic route adaption (more complicated). For what we have required so far, the first option has been sufficient.

Charging location and charging times are so far determined by the routing module, more precisely in https://github.com/matsim-org/matsim/blob/master/contribs/ev/src/main/java/org/matsim/contrib/ev/routing/EvNetworkRoutingModule.java

As you can see there, there is a little bit of randomness applied: Some vehicles might therefore charge earlier than others.