NREL / altrios

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

Fix/speed trace from slts in ssts #63

Open calbaker opened 2 months ago

calbaker commented 2 months ago

To verify that the loco_con and other objects are the same between the two simulations, you can:

  1. run pip install deepdiff
  2. run speed_limit_train_sim_demo.py interactively
  3. do something like loco_con_slts = loco_con
  4. run set_speed_train_sim_demo.py interactively in the same session
  5. run
    from deepdiff import DeepDiff
    import json
    DeepDiff(
    json.loads(loco_con.to_json()),
    json.loads(loco_con_slts.to_json()),
    )

    and this will show that they're equal or specifically what's not equal if they're not. I have not checked everything exhaustively yet but am working on it.

You can now run debugging plots to produce:

image

This shows that the train resistance is different between the ssts and slts. I'm working on tracking this down.

calbaker commented 2 months ago

I believe I found the culprit:

image

Generated in e02ccf0ce122875f8517f87b0f5f71fef15c100a

calbaker commented 2 months ago
image
calbaker commented 2 months ago

https://github.com/NREL/altrios/blob/5ca23831588f15584f2f37a6010e20027ba87952/rust/altrios-core/src/train/speed_limit_train_sim.rs#L563 is making me suspicious

calbaker commented 2 months ago

@SWRIganderson , e87bdc8d is where I generated the plots convince myself that I've fixed the problem in the set_speed_train_sim_demo.py and speed_limit_train_sim_demo.py files.

Could you run these in the context of this branch (after rebuilding the code) and let me know if they make sense?

calbaker commented 1 month ago

@SWRIganderson , seeing this line that Geordie wrote was my inspiration for the change. Also, I think we could prove that the two simulations produce identical results by making a variant for the traction-dependent component of the aux load so that this can be turned off during regen and/or dynamic braking, which should remove the only difference I know of.

calbaker commented 3 days ago

@SWRIganderson , this PR sure could use some love