Require regulators to have valid specifications

When an invalid specification is entered into a regulator input, keep it
confined to that input. Reset a regulator input by pressing *escape*.
This commit is contained in:
Aaron Fenyes 2025-02-18 01:27:11 -08:00
parent fef4127f69
commit 302d93638d
3 changed files with 49 additions and 26 deletions

View file

@ -111,6 +111,7 @@ impl Element {
}
}
// `set_point_spec` must always be a valid specification of `set_point`
#[derive(Clone, Copy)]
pub struct Regulator {
pub subjects: (ElementKey, ElementKey),
@ -119,12 +120,6 @@ pub struct Regulator {
pub set_point_spec: Signal<String>
}
impl Regulator {
pub fn has_no_set_point_spec(&self) -> bool {
self.set_point_spec.with(|spec| spec.is_empty())
}
}
// the velocity is expressed in uniform coordinates
pub struct ElementMotion<'a> {
pub key: ElementKey,