sunspec/models/
model64020.rs

1//! Mersen GreenString
2/// Mersen GreenString
3#[derive(Debug)]
4#[cfg_attr(feature = "serde", derive(::serde::Serialize, ::serde::Deserialize))]
5pub struct Model64020 {
6    /// Aux 0 temperature
7    pub aux0_tmp: Option<i16>,
8    /// Aux 1 temperature
9    pub aux1_tmp: Option<i16>,
10    /// Aux 2 temperature
11    pub aux2_tmp: Option<i16>,
12    /// Aux 3 temperature
13    pub aux3_tmp: Option<i16>,
14    /// Aux 4 temperature
15    pub aux4_tmp: Option<i16>,
16    /// Probe Temperature
17    pub probe_tmp: i16,
18    /// Main Temperature
19    pub main_tmp: i16,
20    /// Voltage scale factor for the sensors
21    pub sensor_v_sf: i16,
22    /// Current scale factor for the sensors
23    pub sensor_a_sf: i16,
24    /// Frequency scale factor for the sensors
25    pub sensor_hz_sf: i16,
26    /// Sensor1 Voltage
27    ///
28    /// scale of 0-10V
29    pub sensor1_voltage: Option<i16>,
30    /// Sensor2 Voltage
31    ///
32    /// scale of 0-10V
33    pub sensor2_voltage: Option<i16>,
34    /// Sensor3 Voltage
35    ///
36    /// scale of 0-10V
37    pub sensor3_voltage: Option<i16>,
38    /// Sensor4 Voltage
39    ///
40    /// scale of 0-10V
41    pub sensor4_voltage: Option<i16>,
42    /// Sensor5 Voltage
43    ///
44    /// scale of 0-10V
45    pub sensor5_voltage: Option<i16>,
46    /// Sensor6 Voltage
47    ///
48    /// scale of 0-10V
49    pub sensor6_voltage: Option<i16>,
50    /// Sensor7 Voltage
51    ///
52    /// scale of 0-10V
53    pub sensor7_voltage: Option<i16>,
54    /// Sensor1 Current
55    ///
56    /// scale of 4-20mA
57    pub sensor1_current: Option<i16>,
58    /// Sensor2 Current
59    ///
60    /// in 4-20mA or 4-20mA
61    pub sensor2_current: Option<i16>,
62    /// Sensor3 Current
63    ///
64    /// in 4-20mA or 4-20mA
65    pub sensor3_current: Option<i16>,
66    /// Sensor4 Current
67    ///
68    /// in 4-20mA or 4-20mA
69    pub sensor4_current: Option<i16>,
70    /// Sensor5 Current
71    ///
72    /// in 4-20mA or 4-20mA
73    pub sensor5_current: Option<i16>,
74    /// Sensor6 Current
75    ///
76    /// in 4-20mA or 4-20mA
77    pub sensor6_current: Option<i16>,
78    /// Sensor7 Current
79    ///
80    /// in 4-20mA or 4-20mA
81    pub sensor7_current: Option<i16>,
82    /// Sensor8 frequency
83    ///
84    /// frequency in Hz
85    pub sensor8: Option<u16>,
86    /// Relay 1 state
87    pub relay1: Option<u16>,
88    /// Relay 2 state
89    pub relay2: Option<u16>,
90    /// Relay 3 state
91    pub relay3: Option<u16>,
92    /// Reset the accumulators
93    ///
94    /// always 0 in reading, used the code 0xC0DA during the writing for resetting them
95    pub reset_accumulators: Option<u16>,
96    /// Reset the system
97    ///
98    /// always 0 in reading, used the code 0xC0DA during the writing for resetting the system
99    pub reset: Option<u16>,
100}
101#[allow(missing_docs)]
102impl Model64020 {
103    pub const AUX0_TMP: crate::Point<Self, Option<i16>> = crate::Point::new(0, 1, false);
104    pub const AUX1_TMP: crate::Point<Self, Option<i16>> = crate::Point::new(1, 1, false);
105    pub const AUX2_TMP: crate::Point<Self, Option<i16>> = crate::Point::new(2, 1, false);
106    pub const AUX3_TMP: crate::Point<Self, Option<i16>> = crate::Point::new(3, 1, false);
107    pub const AUX4_TMP: crate::Point<Self, Option<i16>> = crate::Point::new(4, 1, false);
108    pub const PROBE_TMP: crate::Point<Self, i16> = crate::Point::new(5, 1, false);
109    pub const MAIN_TMP: crate::Point<Self, i16> = crate::Point::new(6, 1, false);
110    pub const SENSOR_V_SF: crate::Point<Self, i16> = crate::Point::new(7, 1, false);
111    pub const SENSOR_A_SF: crate::Point<Self, i16> = crate::Point::new(8, 1, false);
112    pub const SENSOR_HZ_SF: crate::Point<Self, i16> = crate::Point::new(9, 1, false);
113    pub const SENSOR1_VOLTAGE: crate::Point<Self, Option<i16>> = crate::Point::new(10, 1, false);
114    pub const SENSOR2_VOLTAGE: crate::Point<Self, Option<i16>> = crate::Point::new(11, 1, false);
115    pub const SENSOR3_VOLTAGE: crate::Point<Self, Option<i16>> = crate::Point::new(12, 1, false);
116    pub const SENSOR4_VOLTAGE: crate::Point<Self, Option<i16>> = crate::Point::new(13, 1, false);
117    pub const SENSOR5_VOLTAGE: crate::Point<Self, Option<i16>> = crate::Point::new(14, 1, false);
118    pub const SENSOR6_VOLTAGE: crate::Point<Self, Option<i16>> = crate::Point::new(15, 1, false);
119    pub const SENSOR7_VOLTAGE: crate::Point<Self, Option<i16>> = crate::Point::new(16, 1, false);
120    pub const SENSOR1_CURRENT: crate::Point<Self, Option<i16>> = crate::Point::new(17, 1, false);
121    pub const SENSOR2_CURRENT: crate::Point<Self, Option<i16>> = crate::Point::new(18, 1, false);
122    pub const SENSOR3_CURRENT: crate::Point<Self, Option<i16>> = crate::Point::new(19, 1, false);
123    pub const SENSOR4_CURRENT: crate::Point<Self, Option<i16>> = crate::Point::new(20, 1, false);
124    pub const SENSOR5_CURRENT: crate::Point<Self, Option<i16>> = crate::Point::new(21, 1, false);
125    pub const SENSOR6_CURRENT: crate::Point<Self, Option<i16>> = crate::Point::new(22, 1, false);
126    pub const SENSOR7_CURRENT: crate::Point<Self, Option<i16>> = crate::Point::new(23, 1, false);
127    pub const SENSOR8: crate::Point<Self, Option<u16>> = crate::Point::new(24, 1, false);
128    pub const RELAY1: crate::Point<Self, Option<u16>> = crate::Point::new(25, 1, false);
129    pub const RELAY2: crate::Point<Self, Option<u16>> = crate::Point::new(26, 1, false);
130    pub const RELAY3: crate::Point<Self, Option<u16>> = crate::Point::new(27, 1, false);
131    pub const RESET_ACCUMULATORS: crate::Point<Self, Option<u16>> = crate::Point::new(28, 1, false);
132    pub const RESET: crate::Point<Self, Option<u16>> = crate::Point::new(29, 1, false);
133}
134impl crate::Model for Model64020 {
135    const ID: u16 = 64020;
136    fn from_data(data: &[u16]) -> Result<Self, crate::DecodeError> {
137        Ok(Self {
138            aux0_tmp: Self::AUX0_TMP.from_data(data)?,
139            aux1_tmp: Self::AUX1_TMP.from_data(data)?,
140            aux2_tmp: Self::AUX2_TMP.from_data(data)?,
141            aux3_tmp: Self::AUX3_TMP.from_data(data)?,
142            aux4_tmp: Self::AUX4_TMP.from_data(data)?,
143            probe_tmp: Self::PROBE_TMP.from_data(data)?,
144            main_tmp: Self::MAIN_TMP.from_data(data)?,
145            sensor_v_sf: Self::SENSOR_V_SF.from_data(data)?,
146            sensor_a_sf: Self::SENSOR_A_SF.from_data(data)?,
147            sensor_hz_sf: Self::SENSOR_HZ_SF.from_data(data)?,
148            sensor1_voltage: Self::SENSOR1_VOLTAGE.from_data(data)?,
149            sensor2_voltage: Self::SENSOR2_VOLTAGE.from_data(data)?,
150            sensor3_voltage: Self::SENSOR3_VOLTAGE.from_data(data)?,
151            sensor4_voltage: Self::SENSOR4_VOLTAGE.from_data(data)?,
152            sensor5_voltage: Self::SENSOR5_VOLTAGE.from_data(data)?,
153            sensor6_voltage: Self::SENSOR6_VOLTAGE.from_data(data)?,
154            sensor7_voltage: Self::SENSOR7_VOLTAGE.from_data(data)?,
155            sensor1_current: Self::SENSOR1_CURRENT.from_data(data)?,
156            sensor2_current: Self::SENSOR2_CURRENT.from_data(data)?,
157            sensor3_current: Self::SENSOR3_CURRENT.from_data(data)?,
158            sensor4_current: Self::SENSOR4_CURRENT.from_data(data)?,
159            sensor5_current: Self::SENSOR5_CURRENT.from_data(data)?,
160            sensor6_current: Self::SENSOR6_CURRENT.from_data(data)?,
161            sensor7_current: Self::SENSOR7_CURRENT.from_data(data)?,
162            sensor8: Self::SENSOR8.from_data(data)?,
163            relay1: Self::RELAY1.from_data(data)?,
164            relay2: Self::RELAY2.from_data(data)?,
165            relay3: Self::RELAY3.from_data(data)?,
166            reset_accumulators: Self::RESET_ACCUMULATORS.from_data(data)?,
167            reset: Self::RESET.from_data(data)?,
168        })
169    }
170    fn addr(models: &crate::Models) -> crate::ModelAddr<Self> {
171        models.m64020
172    }
173}