reda_spice/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
11#[derive(Debug, Clone)]
14pub struct MeasureRise {
15 pub name: String,
16 pub analysis: AnalysisType,
17 pub trig: TrigTargCondition,
18 pub targ: TrigTargCondition,
19}
20
21#[derive(Debug, Clone)]
23pub struct MeasureBasicStat {
24 pub name: String,
25 pub analysis: AnalysisType,
26 pub stat: MeasureFunction,
27 pub variable: OutputVariable,
28 pub from: Time,
29 pub to: Time,
30}
31
32#[derive(Debug, Clone)]
34pub struct MeasureFindWhen {
35 pub name: String,
36 pub analysis: AnalysisType,
37 pub variable: OutputVariable,
38 pub when: FindWhenCondition,
39}
40
41#[derive(Debug, Clone)]
42pub struct TrigTargCondition {
43 pub variable: OutputVariable,
44 pub value: Number,
45 pub edge: EdgeType, pub number: usize, }
48
49#[derive(Debug, Clone, Copy, PartialEq, Eq)]
50pub enum EdgeType {
51 Rise,
52 Fall,
53}
54
55#[derive(Debug, Clone, Copy, PartialEq, Eq)]
56pub enum MeasureFunction {
57 Avg,
58 Rms,
59 Min,
60 Max,
61 Pp, Deriv,
63 Integrate,
64}
65
66#[derive(Debug, Clone)]
67pub struct FindWhenCondition {
68 pub variable: OutputVariable,
69 pub value: Number,
70}
71
72#[derive(Debug, Clone)]
73pub struct ExpressionCondition {
74 pub variable: OutputVariable,
75 pub expression: String, }
77
78#[derive(Debug, Clone, Copy, PartialEq, Eq)]
79pub enum AnalysisType {
80 Dc,
81 Ac,
82 Tran,
83}
84
85#[derive(Debug, Clone)]
86pub enum OutputVariable {
87 Voltage {
88 node1: String, node2: Option<String>, suffix: Option<OutputSuffix>,
91 },
92 Current {
93 element_name: String, suffix: Option<OutputSuffix>,
95 },
96}
97
98#[derive(Debug, Clone)]
99pub enum OutputSuffix {
100 Magnitude,
101 Decibel,
102 Phase,
103 Real,
104 Imag,
105}