eclipse-sumo / sumo

Eclipse SUMO is an open source, highly portable, microscopic and continuous traffic simulation package designed to handle large networks. It allows for intermodal simulation including pedestrians and comes with a large set of tools for scenario creation.
https://eclipse.dev/sumo
Eclipse Public License 2.0
2.57k stars 1.43k forks source link

extend carFollowModel "Rail" with custom configuration via XML #14258

Closed ritzerp closed 8 months ago

ritzerp commented 9 months ago

Introduction

Theory and assumptions

A: Train dynamics from equations

requires trainType custom and the following parameters

XML example

<vType id="tractionFromEquation" vClass="rail" carFollowModel="Rail" trainType="custom" accel="1" decel="1" >

    <!-- existing attributes -->
    <param key="maximumPower" value="2350000"/>
    <param key="vehicleMass" value="114000"/>

    <!-- new attributes -->
    <param key="maximumTraction" value="150"/>
    <param key="massFactor" value="1.05"/>
    <param key="constantResistanceCoefficient" value="1670"/>
    <param key="linearResistanceCoefficient" value="0.03"/>
    <param key="quadraticResistanceCoefficient" value="0.28"/>

</vType>

Equations for traction and resistance forces

equation for traction force in N

traction = min(maximumPower/speed*3.6, maximumTraction)

equation for resistance force in N

resistance = quadraticResistanceCoefficient*speed**2 + linearResistanceCoefficient*speed + constantResistanceCoefficient

B:Train dynamics from tables

requires trainType custom and the following parameters

speed values inbetween are interpolated

XML example

<vType id="tractionFromTable" vClass="rail" carFollowModel="Rail" trainType="custom" accel="1" decel="1" >

    <!-- existing attributes -->
    <param key="vehicleMass" value="114000"/>

    <!-- new attributes -->
    <param key="massFactor" value="1.05"/>

    <param key="speedTable" value="0"/>
        <param key="traction" value="150000"/>
        <param key="resistance" value="2600"/>
    <param key="speedTable" value="50"/>
        <param key="traction" value="150000"/>
        <param key="resistance" value="4900"/>
    <param key="speedTable" value="100"/>
        <param key="traction" value="84000"/>
        <param key="resistance" value="9700"/>

</vType>

Units

Proposed physical units

Notes on implementation

Discussion

The accel value could be used to estimate maximumTraction:

maximumTraction = vehicleMass*massFactor*accel

The speed could be given in m/s instead of km/h, but this seems more uncommon.

m-kro commented 9 months ago

AFAIK param keys have to be unique within the entity for which they are defined. The example shows multiple use of "speedTable", "traction", "resistance". The easy and ugly solution would be to concatenate all values of the same key to a single value.

ritzerp commented 9 months ago

So you mean something like this?

<param key="speedValues" value="0 50 100"/>
<param key="tractionValues" value="150000 150000 84000"/>
<param key="resistanceValues" value="2600 4900 9700"/>
m-kro commented 9 months ago

@behrisch @ritzerp needs somebody for the C++ part of the work but wants to contribute by writing tests or similar.

namdre commented 9 months ago

@bcoueraud87 you were assigned to #13489, do you still want to work on this?

namdre commented 9 months ago

Loading all the new values from <param> might speed up implementation a bit but has the disadvantage of preventing schema validation. Since its already common for carFollowModels to have plenty of parameters (i.e. 17 for EIDM) we could easily add 6 for the equation style (mass already exists) and another 3 for the value tables.

bcoueraud87 commented 9 months ago

@bcoueraud87 you were assigned to #13489, do you still want to work on this?

No thank you.

namdre commented 8 months ago

by convention, the value tables for resistance and traction use speed in km/h whereas sumo uses m/s almost everywhere. @behrisch , @ritzerp Should we rather break convention or consistency here?

namdre commented 8 months ago

@ritzerp, it looks as if your example gives maximumTraction in kN rather than N. I actually find this more practical (also using kW for maximumPower instead of W). For consistency, this would also imply scaling the resistance coefficients so that the formula returns kN.

@behrisch would your rather have the pure SI units though?

namdre commented 8 months ago

some implementation notes:

behrisch commented 8 months ago

After a short discussion the current preference is m/s and kN everywhere

ritzerp commented 8 months ago

Sorry for late reply. I think I prefer consistency within SUMO and use m/s. I also support the decision to use kN, since forces are quite high for trains. As long as it is documented, this should be fine.