altrios-core 0.2.0

ALTRIOS Core model for train simulation
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use crate::imports::*;
use crate::train::TrainState;

#[derive(Debug, Clone, Copy, Serialize, Deserialize, Default, PartialEq, SerdeAPI)]
#[altrios_api]
pub struct Basic {
    davis_b: si::InverseVelocity,
}
impl Basic {
    pub fn new(davis_b: si::InverseVelocity) -> Self {
        Self { davis_b }
    }
    pub fn calc_res(&mut self, state: &TrainState) -> si::Force {
        self.davis_b * state.speed * state.weight_static
    }
}