NREL / altrios

https://nrel.github.io/altrios/
Other
15 stars 2 forks source link

Param path function #77

Open robinsteuteville opened 2 weeks ago

robinsteuteville commented 6 days ago

@calbaker I have updated altrios and fastsim based on your comments, but I found a bug which will need to be fixed before it can be merged.

calbaker commented 4 days ago

@robinsteuteville, I found an example of a missing path:

train_sim.loco_con.loco_vec.tolist()[0].edrv.history.pwr_mech_prop_out_watts

You can see this by running to this line: https://github.com/NREL/altrios/blob/98f098d88bf6fd568848806c73816ec7fc050a1d/python/altrios/demos/speed_limit_simple_corr_demo.py#L94

I'm not sure this same edge case will come up in fastsim, but it may be worth looking a bit. I think I'd propose checking for this type:

In [11]: type(train_sim.loco_con.loco_vec)
Out[11]: altrios.Pyo3VecLocoWrapper

or checking for the presence if a tolist method.

See if you can figure something out. I'd also recommend benchmarking the test against something at the train_sim level.

calbaker commented 4 days ago

@robinsteuteville , I'm also not sure whether to include the tolist() method call in the path. If it's a path for someone to copy/paste, then I'm thinking tolist should be retained.