aemo_rs/
predispatch_is.rs

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    case_solution: Vec<CaseSolution>,
8    local_price: Vec<LocalPrice>,
9    region_prices: Vec<RegionPrices>,
10    region_solution: Vec<RegionSolution>,
11    interconnector_soln: Vec<InterconnectorSolution>,
12    constraint_solution: Vec<ConstraintSolution>,
13}
14
15impl AemoFile for File {
16    fn from_raw(RawAemoFile { header, mut data }: RawAemoFile) -> Result<Self> {
17        Ok(Self {
18            header,
19            case_solution: CaseSolution::from_map(&mut data)?,
20            local_price: LocalPrice::from_map(&mut data)?,
21            region_prices: RegionPrices::from_map(&mut data)?,
22            region_solution: RegionSolution::from_map(&mut data)?,
23            interconnector_soln: InterconnectorSolution::from_map(&mut data)?,
24            constraint_solution: ConstraintSolution::from_map(&mut data)?,
25        })
26    }
27}
28
29#[derive(Deserialize, Serialize, Debug, Clone)]
30pub struct CaseSolution {
31    predispatchseqno: String,
32    runno: i32,
33    solutionstatus: Option<i32>,
34    spdversion: Option<String>,
35    nonphysicallosses: Option<i32>,
36    totalobjective: Option<f64>,
37    totalareagenviolation: Option<f64>,
38    totalinterconnectorviolation: Option<f64>,
39    totalgenericviolation: Option<f64>,
40    totalramprateviolation: Option<f64>,
41    totalunitmwcapacityviolation: Option<f64>,
42    total5minviolation: Option<f64>,
43    totalregviolation: Option<f64>,
44    total6secviolation: Option<f64>,
45    total60secviolation: Option<f64>,
46    totalasprofileviolation: Option<f64>,
47    totalenergyconstrviolation: Option<f64>,
48    totalenergyofferviolation: Option<f64>,
49    #[serde(deserialize_with = "crate::au_datetime_deserialize")]
50    lastchanged: chrono::NaiveDateTime,
51    intervention: Option<i32>,
52}
53
54impl FileKeyable for CaseSolution {
55    fn key() -> crate::FileKey {
56        ("PREDISPATCH".into(), "CASE_SOLUTION".into(), 1)
57    }
58}
59
60impl GetFromRawAemo for CaseSolution {
61    type Output = Self;
62}
63
64#[derive(Deserialize, Serialize, Debug, Clone)]
65pub struct LocalPrice {
66    predispatchseqno: String,
67    #[serde(deserialize_with = "crate::au_datetime_deserialize")]
68    datetime: chrono::NaiveDateTime,
69    duid: String,
70    periodid: i32,
71    local_price_adjustment: f64,
72    locally_constrained: i32,
73    #[serde(deserialize_with = "crate::au_datetime_deserialize")]
74    lastchanged: chrono::NaiveDateTime,
75}
76
77impl FileKeyable for LocalPrice {
78    fn key() -> crate::FileKey {
79        ("PREDISPATCH".into(), "LOCAL_PRICE".into(), 1)
80    }
81}
82
83impl GetFromRawAemo for LocalPrice {
84    type Output = Self;
85}
86
87#[derive(Deserialize, Serialize, Debug, Clone)]
88pub struct RegionPrices {
89    predispatchseqno: String,
90    runno: i32,
91    regionid: String,
92    periodid: String,
93    intervention: i32,
94    rrp: f64,
95    eep: f64,
96    rrp1: Option<f64>,
97    eep1: Option<f64>,
98    rrp2: Option<f64>,
99    eep2: Option<f64>,
100    rrp3: Option<f64>,
101    eep3: Option<f64>,
102    rrp4: Option<f64>,
103    eep4: Option<f64>,
104    rrp5: Option<f64>,
105    eep5: Option<f64>,
106    rrp6: Option<f64>,
107    eep6: Option<f64>,
108    rrp7: Option<f64>,
109    eep7: Option<f64>,
110    rrp8: Option<f64>,
111    eep8: Option<f64>,
112    #[serde(deserialize_with = "crate::au_datetime_deserialize")]
113    lastchanged: chrono::NaiveDateTime,
114    #[serde(deserialize_with = "crate::au_datetime_deserialize")]
115    datetime: chrono::NaiveDateTime,
116    raise6secrrp: f64,
117    raise60secrrp: f64,
118    raise5minrrp: f64,
119    raiseregrrp: f64,
120    lower6secrrp: f64,
121    lower60secrrp: f64,
122    lower5minrrp: f64,
123    lowerregrrp: f64,
124}
125
126impl FileKeyable for RegionPrices {
127    fn key() -> crate::FileKey {
128        ("PREDISPATCH".into(), "REGION_PRICES".into(), 1)
129    }
130}
131
132impl GetFromRawAemo for RegionPrices {
133    type Output = Self;
134}
135
136#[derive(Deserialize, Serialize, Debug, Clone)]
137pub struct RegionSolution {
138    predispatchseqno: String,
139    runno: i32,
140    regionid: String,
141    periodid: String,
142    intervention: i32,
143    totaldemand: f64,
144    availablegeneration: f64,
145    availableload: f64,
146    demandforecast: f64,
147    dispatchablegeneration: f64,
148    dispatchableload: f64,
149    netinterchange: f64,
150    excessgeneration: f64,
151    lower5mindispatch: Option<f64>,
152    lower5minimport: Option<f64>,
153    lower5minlocaldispatch: f64,
154    lower5minlocalprice: Option<f64>,
155    lower5minlocalreq: Option<f64>,
156    lower5minprice: Option<f64>,
157    lower5minreq: Option<f64>,
158    lower5minsupplyprice: Option<f64>,
159    lower60secdispatch: Option<f64>,
160    lower60secimport: Option<f64>,
161    lower60seclocaldispatch: f64,
162    lower60seclocalprice: Option<f64>,
163    lower60seclocalreq: Option<f64>,
164    lower60secprice: Option<f64>,
165    lower60secreq: Option<f64>,
166    lower60secsupplyprice: Option<f64>,
167    lower6secdispatch: Option<f64>,
168    lower6secimport: Option<f64>,
169    lower6seclocaldispatch: f64,
170    lower6seclocalprice: Option<f64>,
171    lower6seclocalreq: Option<f64>,
172    lower6secprice: Option<f64>,
173    lower6secreq: Option<f64>,
174    lower6secsupplyprice: Option<f64>,
175    raise5mindispatch: Option<f64>,
176    raise5minimport: Option<f64>,
177    raise5minlocaldispatch: f64,
178    raise5minlocalprice: Option<f64>,
179    raise5minlocalreq: Option<f64>,
180    raise5minprice: Option<f64>,
181    raise5minreq: Option<f64>,
182    raise5minsupplyprice: Option<f64>,
183    raise60secdispatch: Option<f64>,
184    raise60secimport: Option<f64>,
185    raise60seclocaldispatch: f64,
186    raise60seclocalprice: Option<f64>,
187    raise60seclocalreq: Option<f64>,
188    raise60secprice: Option<f64>,
189    raise60secreq: Option<f64>,
190    raise60secsupplyprice: Option<f64>,
191    raise6secdispatch: Option<f64>,
192    raise6secimport: Option<f64>,
193    raise6seclocaldispatch: f64,
194    raise6seclocalprice: Option<f64>,
195    raise6seclocalreq: Option<f64>,
196    raise6secprice: Option<f64>,
197    raise6secreq: Option<f64>,
198    raise6secsupplyprice: Option<f64>,
199    #[serde(deserialize_with = "crate::au_datetime_deserialize")]
200    lastchanged: chrono::NaiveDateTime,
201    #[serde(deserialize_with = "crate::au_datetime_deserialize")]
202    datetime: chrono::NaiveDateTime,
203    initialsupply: f64,
204    clearedsupply: f64,
205    lowerregimport: Option<f64>,
206    lowerreglocaldispatch: f64,
207    lowerreglocalreq: Option<f64>,
208    lowerregreq: Option<f64>,
209    raiseregimport: Option<f64>,
210    raisereglocaldispatch: f64,
211    raisereglocalreq: Option<f64>,
212    raiseregreq: Option<f64>,
213    raise5minlocalviolation: Option<f64>,
214    raisereglocalviolation: Option<f64>,
215    raise60seclocalviolation: Option<f64>,
216    raise6seclocalviolation: Option<f64>,
217    lower5minlocalviolation: Option<f64>,
218    lowerreglocalviolation: Option<f64>,
219    lower60seclocalviolation: Option<f64>,
220    lower6seclocalviolation: Option<f64>,
221    raise5minviolation: Option<f64>,
222    raiseregviolation: Option<f64>,
223    raise60secviolation: Option<f64>,
224    raise6secviolation: Option<f64>,
225    lower5minviolation: Option<f64>,
226    lowerregviolation: Option<f64>,
227    lower60secviolation: Option<f64>,
228    lower6secviolation: Option<f64>,
229    raise6secactualavailability: f64,
230    raise60secactualavailability: f64,
231    raise5minactualavailability: f64,
232    raiseregactualavailability: f64,
233    lower6secactualavailability: f64,
234    lower60secactualavailability: f64,
235    lower5minactualavailability: f64,
236    lowerregactualavailability: f64,
237    decavailability: f64,
238    lorsurplus: Option<f64>,
239    lrcsurplus: Option<f64>,
240    totalintermittentgeneration: f64,
241    demand_and_nonschedgen: f64,
242    uigf: f64,
243    semischedule_clearedmw: f64,
244    semischedule_compliancemw: f64,
245}
246
247impl FileKeyable for RegionSolution {
248    fn key() -> crate::FileKey {
249        ("PREDISPATCH".into(), "REGION_SOLUTION".into(), 4)
250    }
251}
252
253impl GetFromRawAemo for RegionSolution {
254    type Output = Self;
255}
256
257#[derive(Deserialize, Serialize, Debug, Clone)]
258pub struct InterconnectorSolution {
259    predispatchseqno: String,
260    runno: i32,
261    interconnectorid: String,
262    periodid: String,
263    intervention: i32,
264    meteredmwflow: f64,
265    mwflow: f64,
266    mwlosses: f64,
267    marginalvalue: f64,
268    violationdegree: f64,
269    #[serde(deserialize_with = "crate::au_datetime_deserialize")]
270    lastchanged: chrono::NaiveDateTime,
271    #[serde(deserialize_with = "crate::au_datetime_deserialize")]
272    datetime: chrono::NaiveDateTime,
273    exportlimit: f64,
274    importlimit: f64,
275    marginalloss: f64,
276    exportgenconid: String,
277    importgenconid: String,
278    fcasexportlimit: f64,
279    fcasimportlimit: f64,
280    local_price_adjustment_export: f64,
281    locally_constrained_export: i32,
282    local_price_adjustment_import: f64,
283    locally_constrained_import: i32,
284}
285
286impl FileKeyable for InterconnectorSolution {
287    fn key() -> crate::FileKey {
288        ("PREDISPATCH".into(), "INTERCONNECTOR_SOLN".into(), 3)
289    }
290}
291
292impl GetFromRawAemo for InterconnectorSolution {
293    type Output = Self;
294}
295
296#[derive(Deserialize, Serialize, Debug, Clone)]
297pub struct ConstraintSolution {
298    predispatchseqno: String,
299    runno: i32,
300    constraintid: String,
301    periodid: String,
302    intervention: i32,
303    rhs: f64,
304    marginalvalue: f64,
305    violationdegree: f64,
306    #[serde(deserialize_with = "crate::au_datetime_deserialize")]
307    lastchanged: chrono::NaiveDateTime,
308    #[serde(deserialize_with = "crate::au_datetime_deserialize")]
309    datetime: chrono::NaiveDateTime,
310    duid: Option<String>,
311    #[serde(deserialize_with = "crate::au_datetime_deserialize")]
312    genconid_effectivedate: chrono::NaiveDateTime,
313    genconid_versionno: i64,
314    lhs: f64,
315}
316
317impl FileKeyable for ConstraintSolution {
318    fn key() -> crate::FileKey {
319        ("PREDISPATCH".into(), "CONSTRAINT_SOLUTION".into(), 5)
320    }
321}
322
323impl GetFromRawAemo for ConstraintSolution {
324    type Output = Self;
325}