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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
pub struct JsonEngine {
pub speed: f64,
pub eccentricity: f64,
pub conrod: f64,
pub displacement: f64,
pub bore: f64,
pub firing_order: String,
pub combustion: Option<JsonCombustion>,
pub injector: Option<JsonInjector>,
pub cylinders: Vec<JsonCylinder>,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct JsonCylinder {
pub name: String,
pub compression_ratio: f64,
pub wall_temperature: f64,
pub store_species: Option<bool>,
pub intake_valves: Vec<JsonValve>,
pub exhaust_valves: Vec<JsonValve>,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct JsonValve {
pub name: String,
pub opening_angle: f64,
pub closing_angle: f64,
pub diameter: f64,
pub max_lift: f64,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct JsonCombustion {
pub model: String,
pub comb_ini: f64,
pub wiebe: JsonWiebe,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct JsonInjector {
pub inj_type: String,
pub air_fuel_ratio: f64,
pub fuel: JsonFuel,
}
#[derive(Serialize, Deserialize, Debug)]
pub struct JsonFuel {
pub name: String,
pub state: String,
pub lhv: Option<f64>,
pub heat_vap: Option<f64>,
}
#[derive(Serialize, Deserialize, Debug, Clone)]
pub struct JsonWiebe {
pub a: f64,
pub m: f64,
pub comb_duration: f64,
}