reda_sp/model/control/
meas.rs1use reda_unit::{Number, Time};
2
3#[derive(Debug, Clone)]
4pub enum MeasureCommand {
5 Rise(MeasureRise),
6 BasicStat(MeasureBasicStat),
7 FindWhen(MeasureFindWhen),
8}
9
10#[derive(Debug, Clone)]
13pub struct MeasureRise {
14 pub name: String,
15 pub analysis: AnalysisType,
16 pub trig: TrigTargCondition,
17 pub targ: TrigTargCondition,
18}
19
20#[derive(Debug, Clone)]
22pub struct MeasureBasicStat {
23 pub name: String,
24 pub analysis: AnalysisType,
25 pub stat: MeasureFunction,
26 pub variable: OutputVariable,
27 pub from: Time,
28 pub to: Time,
29}
30
31#[derive(Debug, Clone)]
33pub struct MeasureFindWhen {
34 pub name: String,
35 pub analysis: AnalysisType,
36 pub variable: OutputVariable,
37 pub when: FindWhenCondition,
38}
39
40#[derive(Debug, Clone)]
41pub struct TrigTargCondition {
42 pub variable: OutputVariable,
43 pub value: Number,
44 pub edge: EdgeType, pub number: usize, }
47
48#[derive(Debug, Clone, Copy, PartialEq, Eq)]
49pub enum EdgeType {
50 Rise,
51 Fall,
52}
53
54#[derive(Debug, Clone, Copy, PartialEq, Eq)]
55pub enum MeasureFunction {
56 Avg,
57 Rms,
58 Min,
59 Max,
60 Pp, Deriv,
62 Integrate,
63}
64
65#[derive(Debug, Clone)]
66pub struct FindWhenCondition {
67 pub variable: OutputVariable,
68 pub value: Number,
69}
70
71#[derive(Debug, Clone)]
72pub struct ExpressionCondition {
73 pub variable: OutputVariable,
74 pub expression: String, }
76
77#[derive(Debug, Clone, Copy, PartialEq, Eq)]
78pub enum AnalysisType {
79 Dc,
80 Ac,
81 Tran,
82}
83
84#[derive(Debug, Clone)]
85pub enum OutputVariable {
86 Voltage {
87 node1: String, node2: Option<String>, suffix: Option<OutputSuffix>,
90 },
91 Current {
92 element_name: String, suffix: Option<OutputSuffix>,
94 },
95}
96
97#[derive(Debug, Clone)]
98pub enum OutputSuffix {
99 Magnitude,
100 Decibel,
101 Phase,
102 Real,
103 Imag,
104}