hydr_structures/structures/control/
trial.rs1use super::{ControlCommandOutput, ControlState, ControlStepDiagnostics, OperatingControlBatch};
4use crate::structures::StructureError;
5use numr::dtype::DType;
6use numr::runtime::Runtime;
7
8#[derive(Debug)]
10pub struct OperatingControlTrial<R: Runtime<DType = DType>> {
11 pub(crate) next: OperatingControlBatch<R>,
12}
13impl<R: Runtime<DType = DType>> OperatingControlTrial<R> {
14 pub fn commands(&self) -> Result<Vec<ControlCommandOutput>, StructureError> {
16 self.next.commands()
17 }
18 pub fn states(&self) -> Result<Vec<ControlState>, StructureError> {
20 self.next.states()
21 }
22 pub fn diagnostics(&self) -> Result<ControlStepDiagnostics, StructureError> {
24 self.next.last_step()?.ok_or_else(|| {
25 StructureError::numerical("control trial lacks its immediate step witness")
26 })
27 }
28 pub fn into_next(self) -> OperatingControlBatch<R> {
30 self.next
31 }
32}