1use crate::{AemoFile, FileKeyable, GetFromRawAemo, RawAemoFile, Result};
2use serde::{Deserialize, Serialize};
3
4#[derive(Clone, Debug, Deserialize, Serialize)]
5pub struct File {
6 header: crate::AemoHeader,
7 price_sensitivities: Vec<PriceSensitivities>,
8 interconnector_sensitivities: Vec<InterconnectorSensitivities>,
9}
10
11impl AemoFile for File {
12 fn from_raw(RawAemoFile { header, mut data }: RawAemoFile) -> Result<Self> {
13 Ok(Self {
14 header,
15 price_sensitivities: PriceSensitivities::from_map(&mut data)?,
16 interconnector_sensitivities: InterconnectorSensitivities::from_map(&mut data)?,
17 })
18 }
19}
20
21#[derive(Deserialize, Serialize, Debug, Clone)]
22pub struct InterconnectorSensitivities {
23 predispatchseqno: String,
24 runno: i32,
25 interconnectorid: String,
26 periodid: String,
27 intervention: i32,
28 #[serde(deserialize_with = "crate::au_datetime_deserialize")]
29 datetime: chrono::NaiveDateTime,
30 intervention_active: i32,
31 mwflow1: f64,
32 mwflow2: f64,
33 mwflow3: f64,
34 mwflow4: f64,
35 mwflow5: f64,
36 mwflow6: f64,
37 mwflow7: f64,
38 mwflow8: f64,
39 mwflow9: f64,
40 mwflow10: f64,
41 mwflow11: f64,
42 mwflow12: f64,
43 mwflow13: f64,
44 mwflow14: f64,
45 mwflow15: f64,
46 mwflow16: f64,
47 mwflow17: f64,
48 mwflow18: f64,
49 mwflow19: f64,
50 mwflow20: f64,
51 mwflow21: f64,
52 mwflow22: f64,
53 mwflow23: f64,
54 mwflow24: f64,
55 mwflow25: f64,
56 mwflow26: f64,
57 mwflow27: f64,
58 mwflow28: f64,
59 mwflow29: f64,
60 mwflow30: f64,
61 mwflow31: f64,
62 mwflow32: f64,
63 mwflow33: f64,
64 mwflow34: f64,
65 mwflow35: f64,
66 mwflow36: f64,
67 mwflow37: f64,
68 mwflow38: f64,
69 mwflow39: f64,
70 mwflow40: f64,
71 mwflow41: f64,
72 mwflow42: f64,
73 mwflow43: f64,
74 #[serde(deserialize_with = "crate::au_datetime_deserialize")]
75 lastchanged: chrono::NaiveDateTime,
76}
77
78impl FileKeyable for InterconnectorSensitivities {
79 fn key() -> crate::FileKey {
80 ("PREDISPATCH".into(), "INTERCONNECTR_SENS".into(), 1)
81 }
82}
83
84impl GetFromRawAemo for InterconnectorSensitivities {
85 type Output = Self;
86}
87
88#[derive(Deserialize, Serialize, Debug, Clone)]
89pub struct PriceSensitivities {
90 predispatchseqno: String,
91 runno: i32,
92 regionid: String,
93 periodid: String,
94 intervention: i32,
95 rrpeep1: f64,
96 rrpeep2: f64,
97 rrpeep3: f64,
98 rrpeep4: f64,
99 rrpeep5: f64,
100 rrpeep6: f64,
101 rrpeep7: f64,
102 rrpeep8: f64,
103 rrpeep9: f64,
104 rrpeep10: f64,
105 rrpeep11: f64,
106 rrpeep12: f64,
107 rrpeep13: f64,
108 rrpeep14: f64,
109 rrpeep15: f64,
110 rrpeep16: f64,
111 rrpeep17: f64,
112 rrpeep18: f64,
113 rrpeep19: f64,
114 rrpeep20: f64,
115 rrpeep21: f64,
116 rrpeep22: f64,
117 rrpeep23: f64,
118 rrpeep24: f64,
119 rrpeep25: f64,
120 rrpeep26: f64,
121 rrpeep27: f64,
122 rrpeep28: f64,
123 #[serde(deserialize_with = "crate::au_datetime_deserialize")]
124 datetime: chrono::NaiveDateTime,
125 #[serde(deserialize_with = "crate::au_datetime_deserialize")]
126 lastchanged: chrono::NaiveDateTime,
127 rrpeep29: f64,
128 rrpeep30: f64,
129 rrpeep31: f64,
130 rrpeep32: f64,
131 rrpeep33: f64,
132 rrpeep34: f64,
133 rrpeep35: f64,
134 intervention_active: i32,
135 rrpeep36: f64,
136 rrpeep37: f64,
137 rrpeep38: f64,
138 rrpeep39: f64,
139 rrpeep40: f64,
140 rrpeep41: f64,
141 rrpeep42: f64,
142 rrpeep43: f64,
143}
144
145impl FileKeyable for PriceSensitivities {
146 fn key() -> crate::FileKey {
147 ("PREDISPATCH".into(), "PRICESENSITIVITIES".into(), 1)
148 }
149}
150
151impl GetFromRawAemo for PriceSensitivities {
152 type Output = Self;
153}