Skip to main content

StartRunRequest

Struct StartRunRequest 

Source
pub struct StartRunRequest {
Show 27 fields pub tagname: String, pub template: String, pub process_type: ProcessType, pub controller_type: ControllerType, pub relay_amp: f32, pub cycles_skip: Option<u32>, pub cycles_count: Option<u32>, pub noise_protection_secs: Option<u32>, pub driver: TuneDriver, pub bridge_host: Option<String>, pub server: Option<String>, pub sim_gain: f32, pub sim_tau: f32, pub sim_dead_time: f32, pub sim_noise: f32, pub sim_seed: u64, pub sim_initial_pv: f32, pub sim_initial_mv: f32, pub pv_range_high: Option<f32>, pub pv_range_low: Option<f32>, pub mv_range_high: Option<f32>, pub mv_range_low: Option<f32>, pub direction: Option<ControllerDirection>, pub tag_overrides: Option<TagOverrides>, pub notes: Option<String>, pub yes: bool, pub write_pid: Option<ResponseLevel>,
}
Expand description

The body of POST /api/runs contains the per-run tune inputs. Operational timing values are intentionally absent: they are resolved from the global [tuning] configuration by prepare(), just as they are for a CLI invocation. Every field that has a CLI default (--sim-gain, etc.) repeats that exact default here via #[serde(default = "...")], so an HTTP caller that omits a field gets identical behavior to a CLI invocation that omits the matching flag. Option<T> fields need no #[serde(default)] of their own – serde already treats a missing key as None for an Option field.

Also derives Serialize so the exact same type can serve as GET /api/runs/last-request’s response (ui-prefill-last-run, in routes::history::last_request): that endpoint parses a run’s stored request_json straight into a StartRunRequest rather than duplicating its ~30 fields into a second struct, giving a “what you GET is exactly what you’d POST to repeat it” symmetry in both the Rust types and the generated OpenAPI schema. This is safe precisely because request_json is already built to this exact shape – bhtune-cli’s RequestSnapshot doc comment describes the two as kept in sync by convention.

Fields§

§tagname: String

PV tag prefix; ignored for driver: "simulator". See TuneArgs::tagname.

§template: String

DCS/PLC template name (see GET /api/templates).

§process_type: ProcessType§controller_type: ControllerType§relay_amp: f32

Relay amplitude, as a percentage of the MV range.

§cycles_skip: Option<u32>

Relay cycles to skip before counting begins (default: looked up per process_type).

§cycles_count: Option<u32>

Relay cycles to count once the skip period ends (default: looked up per process_type).

§noise_protection_secs: Option<u32>

Seconds a switch must persist before it’s accepted (default: looked up per process_type).

§driver: TuneDriver

Which driver drives this tune. "replay" is rejected – that driver exists only for offline golden-trace validation, not for starting a live/simulated run.

§bridge_host: Option<String>

opcda-bridge gateway address. Only meaningful with driver: "opcda" (default: resolved the same way the CLI resolves --bridge-host, via this process’s own config/env).

§server: Option<String>

OPC DA server ProgID. Required with driver: "opcda".

§sim_gain: f32

Simulator process gain (driver: "simulator" only).

§sim_tau: f32

Simulator process time constant, in seconds (driver: "simulator" only).

§sim_dead_time: f32

Simulator dead time, in seconds (driver: "simulator" only).

§sim_noise: f32

Simulator measurement noise amplitude (driver: "simulator" only).

§sim_seed: u64

Simulator RNG seed, for reproducible noise (driver: "simulator" only).

§sim_initial_pv: f32

Simulator initial PV (driver: "simulator" only).

§sim_initial_mv: f32

Simulator initial MV (driver: "simulator" only).

§pv_range_high: Option<f32>

Fixed PV range high, overriding a live tag read. Required for driver: "simulator", which has no range tags at all.

§pv_range_low: Option<f32>

Fixed PV range low, overriding a live tag read.

§mv_range_high: Option<f32>

Fixed MV range high, overriding a live tag read.

§mv_range_low: Option<f32>

Fixed MV range low, overriding a live tag read.

§direction: Option<ControllerDirection>

Fixed controller direction, overriding a live tag read.

§tag_overrides: Option<TagOverrides>

Per-tune replacements for template-derived OPC tag names. Blank or missing fields use the template-derived tag.

§notes: Option<String>

Operator notes to attach to this run. Notes can be edited or cleared later through the run-history endpoints.

§yes: bool

Confirm an unattended PID write-back. Required alongside write_pid – the request is rejected otherwise, identically to --write-pid without --yes on the CLI.

§write_pid: Option<ResponseLevel>

Non-interactively write this response level’s calculated PID parameters back to the DCS. Requires yes: true.

Trait Implementations§

Source§

impl ComposeSchema for StartRunRequest

Source§

fn compose(generics: Vec<RefOr<Schema>>) -> RefOr<Schema>

Source§

impl Debug for StartRunRequest

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for StartRunRequest

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for StartRunRequest

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl ToSchema for StartRunRequest

Source§

fn name() -> Cow<'static, str>

Return name of the schema. Read more
Source§

fn schemas(schemas: &mut Vec<(String, RefOr<Schema>)>)

Implement reference [utoipa::openapi::schema::Schema]s for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> PartialSchema for T
where T: ComposeSchema + ?Sized,

§

fn schema() -> RefOr<Schema>

Return ref or schema of implementing type that can then be used to construct combined schemas.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more