Skip to content

Commit f31c53d

Browse files
committed
improve constraints and system diagram
- rework constraints to work with static metrics - add (temporary) local metrics for all valves - add manual interactions to toggle all valves - connect valve metrics to display state - add unknown display state to all all valves except burst discs
1 parent a49d905 commit f31c53d

28 files changed

+735
-325
lines changed

gui/src/backend/storage/event_series.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ impl DataType for EventSeries {
2020
}
2121

2222
fn append<M: MetricTrait>(&mut self, value: M::Value, time: f64) -> Result<(), &'static str> {
23-
println!("Appending value {}", value.to_string());
2423
self.data.push(DataPoint::new(time, value));
2524
Ok(())
2625
}

gui/src/backend/storage/static_metrics.rs

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,12 +98,67 @@ make_static_metric_with_storage_type!(ApogeeError, f64, SampleSeries);
9898

9999
// ------------- Local Nested Metrics -------------
100100

101-
make_static_local_metric_with_storage_type!(MaxPressureN2Tank, f64, Constant);
102101
make_static_local_metric_with_storage_type!(
103-
N2ReleaseValveState,
102+
N2BottleValve,
103+
crate::backend::storage::storeable_value::ValveState,
104+
EventSeries
105+
);
106+
make_static_local_metric_with_storage_type!(
107+
N2OBottleValve,
108+
crate::backend::storage::storeable_value::ValveState,
109+
EventSeries
110+
);
111+
make_static_local_metric_with_storage_type!(
112+
N2ReleaseValve,
113+
crate::backend::storage::storeable_value::ValveState,
114+
EventSeries
115+
);
116+
make_static_local_metric_with_storage_type!(
117+
N2OReleaseValve,
118+
crate::backend::storage::storeable_value::ValveState,
119+
EventSeries
120+
);
121+
make_static_local_metric_with_storage_type!(
122+
N2QuickDisconnect,
123+
crate::backend::storage::storeable_value::ValveState,
124+
EventSeries
125+
);
126+
make_static_local_metric_with_storage_type!(
127+
N2OQuickDisconnect,
128+
crate::backend::storage::storeable_value::ValveState,
129+
EventSeries
130+
);
131+
make_static_local_metric_with_storage_type!(
132+
N2PurgeValve,
133+
crate::backend::storage::storeable_value::ValveState,
134+
EventSeries
135+
);
136+
make_static_local_metric_with_storage_type!(
137+
N2PressureRegulator,
104138
crate::backend::storage::storeable_value::ValveState,
105139
EventSeries
106140
);
141+
make_static_local_metric_with_storage_type!(
142+
N2OVentValve,
143+
crate::backend::storage::storeable_value::ValveState,
144+
EventSeries
145+
);
146+
make_static_local_metric_with_storage_type!(
147+
N2OBurstDisc,
148+
crate::backend::storage::storeable_value::ValveState,
149+
EventSeries
150+
);
151+
make_static_local_metric_with_storage_type!(
152+
N2OFillAndDumpValve,
153+
crate::backend::storage::storeable_value::ValveState,
154+
EventSeries
155+
);
156+
make_static_local_metric_with_storage_type!(
157+
N2OMainValve,
158+
crate::backend::storage::storeable_value::ValveState,
159+
EventSeries
160+
);
161+
make_static_local_metric_with_storage_type!(MaxPressureN2Tank, f64, Constant);
107162

108163
// ------------- Other Nested Metrics (currently do not work via macro) -------------
109164

@@ -1112,8 +1167,19 @@ macro_rules! call_static_metric {
11121167
telemetry::Metric::ApogeeError => $($func)::+::<$crate::storage::static_metrics::ApogeeError $(, $generics)*>($($args),*),
11131168
telemetry::Metric::LocalMetric(local_metric) =>
11141169
match local_metric {
1170+
telemetry::LocalMetric::N2BottleValve => $($func)::+::<$crate::storage::static_metrics::N2BottleValve $(, $generics)*>($($args),*),
1171+
telemetry::LocalMetric::N2OBottleValve => $($func)::+::<$crate::storage::static_metrics::N2OBottleValve $(, $generics)*>($($args),*),
1172+
telemetry::LocalMetric::N2ReleaseValve => $($func)::+::<$crate::storage::static_metrics::N2ReleaseValve $(, $generics)*>($($args),*),
1173+
telemetry::LocalMetric::N2OReleaseValve => $($func)::+::<$crate::storage::static_metrics::N2OReleaseValve $(, $generics)*>($($args),*),
1174+
telemetry::LocalMetric::N2QuickDisconnect => $($func)::+::<$crate::storage::static_metrics::N2QuickDisconnect $(, $generics)*>($($args),*),
1175+
telemetry::LocalMetric::N2OQuickDisconnect => $($func)::+::<$crate::storage::static_metrics::N2OQuickDisconnect $(, $generics)*>($($args),*),
1176+
telemetry::LocalMetric::N2PurgeValve => $($func)::+::<$crate::storage::static_metrics::N2PurgeValve $(, $generics)*>($($args),*),
1177+
telemetry::LocalMetric::N2PressureRegulator => $($func)::+::<$crate::storage::static_metrics::N2PressureRegulator $(, $generics)*>($($args),*),
1178+
telemetry::LocalMetric::N2OVentValve => $($func)::+::<$crate::storage::static_metrics::N2OVentValve $(, $generics)*>($($args),*),
1179+
telemetry::LocalMetric::N2OBurstDisc => $($func)::+::<$crate::storage::static_metrics::N2OBurstDisc $(, $generics)*>($($args),*),
1180+
telemetry::LocalMetric::N2OFillAndDumpValve => $($func)::+::<$crate::storage::static_metrics::N2OFillAndDumpValve $(, $generics)*>($($args),*),
1181+
telemetry::LocalMetric::N2OMainValve => $($func)::+::<$crate::storage::static_metrics::N2OMainValve $(, $generics)*>($($args),*),
11151182
telemetry::LocalMetric::MaxPressureN2Tank => $($func)::+::<$crate::storage::static_metrics::MaxPressureN2Tank $(, $generics)*>($($args),*),
1116-
telemetry::LocalMetric::N2ReleaseValveState => $($func)::+::<$crate::storage::static_metrics::N2ReleaseValveState $(, $generics)*>($($args),*),
11171183
},
11181184
_ => unreachable!()
11191185
}

gui/src/backend/storage/store.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ impl DataStore {
138138
schema
139139
.receive(time, message, |metric, repr, reader: &mut TelemetryMessageReader<N>| {
140140
let _ = reader.read_value(repr).and_then(|bits| {
141-
call_static_metric!(Self::ingest_value, <metric, >, self, bits, t).map_err(|s| print!("{s}"))
141+
call_static_metric!(Self::ingest_value, <metric, >, self, bits, t).map_err(|s| println!("{s}"))
142142
});
143143
})
144144
.unwrap();
@@ -309,7 +309,7 @@ impl DataStore {
309309
.map(|(metric, data_points)| {
310310
call_static_metric!(Data::from_file_entry, <metric, >, data_points)
311311
.map(|data| (metric, data))
312-
.map_err(|s| print!("{s}"))
312+
.map_err(|s| println!("{s}"))
313313
})
314314
.flatten()
315315
.collect();

gui/src/backend/storage/storeable_value.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ pub enum ValveState {
5353
Closed,
5454
}
5555

56+
impl Default for ValveState {
57+
fn default() -> Self {
58+
Self::Open //TODO Hans: This is not good
59+
}
60+
}
61+
5662
impl StorableValue for ValveState {
5763
fn to_bits(&self) -> u64 {
5864
match self {

0 commit comments

Comments
 (0)