use reda_unit::{Number, Time};
#[derive(Debug, Clone)]
pub enum MeasureCommand {
Rise(MeasureRise),
BasicStat(MeasureBasicStat),
FindWhen(MeasureFindWhen),
}
#[derive(Debug, Clone)]
pub struct MeasureRise {
pub name: String,
pub analysis: AnalysisType,
pub trig: TrigTargCondition,
pub targ: TrigTargCondition,
}
#[derive(Debug, Clone)]
pub struct MeasureBasicStat {
pub name: String,
pub analysis: AnalysisType,
pub stat: MeasureFunction,
pub variable: OutputVariable,
pub from: Time,
pub to: Time,
}
#[derive(Debug, Clone)]
pub struct MeasureFindWhen {
pub name: String,
pub analysis: AnalysisType,
pub variable: OutputVariable,
pub when: FindWhenCondition,
}
#[derive(Debug, Clone)]
pub struct TrigTargCondition {
pub variable: OutputVariable,
pub value: Number,
pub edge: EdgeType, pub number: usize, }
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum EdgeType {
Rise,
Fall,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum MeasureFunction {
Avg,
Rms,
Min,
Max,
Pp, Deriv,
Integrate,
}
#[derive(Debug, Clone)]
pub struct FindWhenCondition {
pub variable: OutputVariable,
pub value: Number,
}
#[derive(Debug, Clone)]
pub struct ExpressionCondition {
pub variable: OutputVariable,
pub expression: String, }
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum AnalysisType {
Dc,
Ac,
Tran,
}
#[derive(Debug, Clone)]
pub enum OutputVariable {
Voltage {
node1: String, node2: Option<String>, suffix: Option<OutputSuffix>,
},
Current {
element_name: String, suffix: Option<OutputSuffix>,
},
}
#[derive(Debug, Clone)]
pub enum OutputSuffix {
Magnitude,
Decibel,
Phase,
Real,
Imag,
}