-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathrolling_resistance.rs
54 lines (51 loc) · 2 KB
/
rolling_resistance.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
use derivative::Derivative;
use editoast_common::units::*;
use serde::Deserialize;
use serde::Serialize;
use utoipa::ToSchema;
editoast_common::schemas! {
RollingResistance,
RollingResistancePerWeight,
}
#[editoast_derive::annotate_units]
#[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize, ToSchema, Derivative)]
#[derivative(Hash)]
#[serde(deny_unknown_fields)]
#[allow(non_snake_case)]
pub struct RollingResistance {
#[serde(rename = "type")]
pub rolling_resistance_type: String,
/// Solid friction in N
#[derivative(Hash(hash_with = "editoast_common::hash_force::<5,_>"))]
#[serde(with = "newton")]
pub A: Force,
/// Viscosity friction in N/(m/s) - N = kg⋅m⋅s−2 => viscosity friction kg/s
#[derivative(Hash(hash_with = "editoast_common::hash_mass_rate::<5,_>"))]
#[serde(with = "kilogram_per_second")]
pub B: MassRate,
/// Aerodynamic drag in N/(m/s)² => kg·m⁻¹
#[derivative(Hash(hash_with = "editoast_common::hash_linear_mass_density::<5,_>"))]
#[serde(with = "kilogram_per_meter")]
pub C: LinearMassDensity,
}
#[editoast_derive::annotate_units]
#[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize, ToSchema, Derivative)]
#[derivative(Hash)]
#[serde(deny_unknown_fields)]
#[allow(non_snake_case)]
pub struct RollingResistancePerWeight {
#[serde(rename = "type")]
pub rolling_resistance_type: String,
/// Solid friction in N/kg -- N = kg⋅m⋅s⁻²
#[derivative(Hash(hash_with = "editoast_common::hash_acceleration::<5,_>"))]
#[serde(with = "meter_per_second_squared")]
pub A: Acceleration,
/// Viscosity friction in (N/kg)/(m/s) — N = kg⋅m⋅s−2 => 1/s
#[derivative(Hash(hash_with = "editoast_common::hash_frequency::<5,_>"))]
#[serde(with = "hertz")]
pub B: Frequency,
/// Aerodynamic drag per kg in (N/kg)/(m/s)² => m⁻¹
#[derivative(Hash(hash_with = "editoast_common::hash_linear_number_density::<5,_>"))]
#[serde(with = "per_meter")]
pub C: LinearNumberDensity,
}