Thank you for the answer.
After leaving this problem for a few months I had to recently get back at it and it is still unsolved. However, I found out that:
1) The headway problem at the moment of loading a saved state only happens for vehicles of type "rl"
2) The 'rl' vehicle is added to the simulation via the self.k.vehicle.add command, calling the kernel_api.vehicle.addFull inside
3) The other vehicles (of type "other") are added with an inflow - from the saved state
<flowState id="flow_00" type="other" begin="1.00" departLane="0" departSpeed="25.64" probability="0.410184827871" end="200000000.000000000000" route="routehwy_rear_0" done="11" index="11"/>
4) Looking at the saved state, all vehicles of type "other" have indeed the type listed, while the same does not happen for the rl vehicle - example:
<vehicle id="flow_00.9" type="other" depart="16.30" departLane="0" departSpeed="25.64" color="100,100,100" route="routehwy_rear_0" distance="0 0" speedFactor="1.035700000000" state="2615 16300 0 5.10 0 0.85 20100 0 0" pos="83.334363758822 78.334363758822 1.944504118608" speed="19.445041186084 19.456978560735" angle="90.000000000000" posLat="0.000000000000" waitingTime="100000 0"/>
<vehicle id="rl_0" depart="0.10" departLane="0" departPos="0.00" departSpeed="20.00" color="red" route="routeramp_0" distance="379.59 0" speedFactor="1.026700000000" state="29 100 1 0.00 0 4.81 20100 0 0" pos="20.410000000000 15.410000000000 2.000000000000" speed="20.000000000000 20.000000000000" angle="90.000000000000" posLat="0.000000000000" waitingTime="100000 0"/>
<flowState id="flow_00" type="other" begin="1.00" departLane="0" departSpeed="25.64" probability="0.410184827871" end="200000000.000000000000" route="routehwy_rear_0" done="11" index="11"/>
I tried to manually modify the saved state file (after saving it, but before loading it), adding the correct type to the "rl_0", as
<vehicle id="rl_0" type="rl" depart="0.10" departLane="0" ....
and after loading, the correct headway appears within the simulation -> it seems this is the problem.
From the add.xml file, everything seems ok:
<?xml version='1.0' encoding='UTF-8'?>
<additional xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="
http://sumo.dlr.de/xsd/additional_file.xsd">
<vType id="rl" accel="3.0" decel="5.5" sigma="0.0" tau="0.1" minGap="2.0" maxSpeed="35.0" speedFactor="1.0" speedDev="0.1" impatience="0.5" carFollowModel="IDM" laneChangeModel="SL2015" lcStrategic="1.0" lcCooperative="1.0" lcSpeedGain="1.0" lcKeepRight="1.0" lcLookaheadLeft="2.0" lcSpeedGainRight="1.0" lcSublane="1.0" lcPushy="1" lcPushyGap="0" lcAssertive="1" lcAccelLat="10"/>
<vType id="other" accel="3.0" decel="5.5" sigma="0.0" tau="0.1" minGap="2.0" maxSpeed="35.0" speedFactor="1.0" speedDev="0.1" impatience="0.5" carFollowModel="IDM" laneChangeModel="SL2015" lcStrategic="1.0" lcCooperative="1.0" lcSpeedGain="1.0" lcKeepRight="1.0" lcLookaheadLeft="2.0" lcSpeedGainRight="1.0" lcSublane="1.0" lcPushy="1" lcPushyGap="0" lcAssertive="1" lcAccelLat="10"/>
</additional>
It seems to me the solution is to have the type specified also for the 'rl' vehicle in the saved state, but I could not find a nice way to have it besides writing it in the saved state after the saveState command.
Do you have a nicer solution to have the state specified naturally right after the saveState command?
Thank you in advance for your time and answer.
Stefano