Skip to main content

nominal_api/conjure/objects/scout/compute/api/
bode.rs

1/// Returns the bode magnitude and phase of a system's frequency response.
2#[derive(
3    Debug,
4    Clone,
5    conjure_object::serde::Serialize,
6    conjure_object::serde::Deserialize,
7    conjure_object::private::DeriveWith
8)]
9#[serde(crate = "conjure_object::serde")]
10#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
11#[conjure_object::private::staged_builder::staged_builder]
12#[builder(crate = conjure_object::private::staged_builder, update, inline)]
13pub struct Bode {
14    #[builder(custom(type = super::NumericSeries, convert = Box::new))]
15    #[serde(rename = "input")]
16    input: Box<super::NumericSeries>,
17    #[builder(custom(type = super::NumericSeries, convert = Box::new))]
18    #[serde(rename = "output")]
19    output: Box<super::NumericSeries>,
20    #[builder(
21        default,
22        custom(
23            type = impl
24            Into<Option<super::AlignmentConfiguration>>,
25            convert = |v|v.into().map(Box::new)
26        )
27    )]
28    #[serde(
29        rename = "alignmentConfiguration",
30        skip_serializing_if = "Option::is_none",
31        default
32    )]
33    alignment_configuration: Option<Box<super::AlignmentConfiguration>>,
34    #[builder(
35        default,
36        custom(
37            type = impl
38            Into<Option<super::StftOptions>>,
39            convert = |v|v.into().map(Box::new)
40        )
41    )]
42    #[serde(rename = "stftOptions", skip_serializing_if = "Option::is_none", default)]
43    stft_options: Option<Box<super::StftOptions>>,
44    #[builder(default, into)]
45    #[serde(
46        rename = "magnitudeScaling",
47        skip_serializing_if = "Option::is_none",
48        default
49    )]
50    magnitude_scaling: Option<super::MagnitudeScaling>,
51    #[builder(default, into)]
52    #[serde(
53        rename = "outputFrequencyType",
54        skip_serializing_if = "Option::is_none",
55        default
56    )]
57    output_frequency_type: Option<super::OutputFrequencyType>,
58    #[builder(default, into)]
59    #[serde(rename = "unwrapPhase", skip_serializing_if = "Option::is_none", default)]
60    unwrap_phase: Option<bool>,
61}
62impl Bode {
63    /// Constructs a new instance of the type.
64    #[inline]
65    pub fn new(input: super::NumericSeries, output: super::NumericSeries) -> Self {
66        Self::builder().input(input).output(output).build()
67    }
68    #[inline]
69    pub fn input(&self) -> &super::NumericSeries {
70        &*self.input
71    }
72    #[inline]
73    pub fn output(&self) -> &super::NumericSeries {
74        &*self.output
75    }
76    /// When present, aligns one Bode input to the other using the configured interpolation and driver series
77    /// before estimating the frequency response. When absent, Bode preserves the existing strict behavior and
78    /// requires the input and output value arrays to have equal length. For Bode, FIRST uses the input
79    /// timestamps and SECOND uses the output timestamps.
80    #[inline]
81    pub fn alignment_configuration(&self) -> Option<&super::AlignmentConfiguration> {
82        self.alignment_configuration.as_ref().map(|o| &**o)
83    }
84    #[inline]
85    pub fn stft_options(&self) -> Option<&super::StftOptions> {
86        self.stft_options.as_ref().map(|o| &**o)
87    }
88    /// The scaling to apply to the output magnitude. Defaults to MAGNITUDE_DB_20 if not specified.
89    #[inline]
90    pub fn magnitude_scaling(&self) -> Option<&super::MagnitudeScaling> {
91        self.magnitude_scaling.as_ref().map(|o| &*o)
92    }
93    /// The type of the output frequency. Defaults to LINEAR if not specified.
94    #[inline]
95    pub fn output_frequency_type(&self) -> Option<&super::OutputFrequencyType> {
96        self.output_frequency_type.as_ref().map(|o| &*o)
97    }
98    /// Unwrap the phase of the output. Defaults to true if not specified.
99    #[inline]
100    pub fn unwrap_phase(&self) -> Option<bool> {
101        self.unwrap_phase.as_ref().map(|o| *o)
102    }
103}