ConOpSys V2970  P004.07
ANVILEX control operating system
P005_03_V2_0_AI_2V.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file P005_03_V2_0_AI_2V.h
3 //! @brief Analog input board P005.03 V2.0 hardware driver header file.
4 //! @attention No special attention requered.
5 //! @copyright (C) 2015-2020 ANVILEX LLC
6 //! $HeadURL: https://192.168.3.4:8443/svn/P004_07/ConOpSys/Hardware/P005_03_V2_0_AI/P005_03_V2_0_AI_2V.h $
7 //! $Revision: 2395 $
8 //! $Date: 2021-02-23 13:21:03 +0500 (Di, 23 Feb 2021) $
9 //! $Author: minch $
10 //------------------------------------------------------------------------------
11 //
12 // Redistribution and use in source and binary forms, with or without
13 // modification, are permitted provided that the following conditions are met:
14 //
15 // 1. Redistributions of source code must retain the above copyright notice,
16 // this list of conditions and the following disclaimer.
17 //
18 // 2. Redistributions in binary form must reproduce the above copyright notice,
19 // this list of conditions and the following disclaimer in the documentation
20 // and/or other materials provided with the distribution.
21 //
22 // 3. Neither the name of ANVILEX nor the names of its contributors may be
23 // used to endorse or promote products derived from this software without
24 // specific prior written permission.
25 //
26 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
30 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 // POSSIBILITY OF SUCH DAMAGE.
37 //
38 //------------------------------------------------------------------------------
39 
40 #pragma once
41 
42 //------------------------------------------------------------------------------
43 // Include standard libraries header files
44 //------------------------------------------------------------------------------
45 
46 //------------------------------------------------------------------------------
47 // Include thrid party header files
48 //------------------------------------------------------------------------------
49 
50 //------------------------------------------------------------------------------
51 // Include ConOpSys header files
52 //------------------------------------------------------------------------------
53 
54 #include "Function_Block_Base.h"
55 
56 //------------------------------------------------------------------------------
57 // Include ConOpSys application header files
58 //------------------------------------------------------------------------------
59 
60 //------------------------------------------------------------------------------
61 // Macros
62 //------------------------------------------------------------------------------
63 
64 //! @brief Analog input P005.03 V2.0 board TP005_03_V2_0_AI_2V class
66 {
67 
68  //----------------------------------------------------------------------------
69  // Public defines, methods and variables
70  //----------------------------------------------------------------------------
71 
72  public:
73 
74  // Register structure for generic access
75  typedef struct
76  {
77 
78  // Analog value registers
79  U16 u16_Analog_Input_Status; //!< 0x00 : Status register
80  I16 i16_Analog_Input_Data_1; //!< 0x01 : Analog input channel 1 data register as I16 value
81  I16 i16_Analog_Input_Data_2; //!< 0x02 : Analog input channel 2 data register as I16 value
82  I16 i16_Analog_Input_Data_3; //!< 0x03 : Analog input channel 3 data register as I16 value
83  U16 u16_Reserve_0x04; //!< 0x04 : Reserved
84  I16 i16_Analog_Input_Filtered_Data_1; //!< 0x05 : Analog input channel 1 filtered data register as I16 value
85  I16 i16_Analog_Input_Filtered_Data_2; //!< 0x06 : Analog input channel 2 filtered data register as I16 value
86  I16 i16_Analog_Input_Filtered_Data_3; //!< 0x07 : Analog input channel 3 filtered data register as I16 value
87 
89 
90  //--------------------------------------------------------------------------
91  // Public methods
92  //--------------------------------------------------------------------------
93 
94  // Constructor and destructor
95  TP005_03_V2_0_AI_2V(); //!< Constructor method
96  virtual ~TP005_03_V2_0_AI_2V(); //!< Destructor method
97 
98  VOID Map( TP005_03_V2_0_AI_V_Registers *struct_Registers_Base_Address );
99  virtual VOID Init();
100  virtual VOID Execute();
101  virtual VOID Send_Information( TProtocol_Base *object_Protocol );
102 
103  // Block parameters
104 
105  TBlock_Input_Connector object_f32_Analog_Input_Full_Scale_1; //!< Analog input channel 1 fill scale value. Also used for channel total gain adjustment.
106  TBlock_Input_Connector object_f32_Analog_Input_Full_Scale_2; //!< Analog input channel 1 fill scale value. Also used for channel total gain gain adjustment.
107 
108  TBlock_Input_Connector object_f32_Analog_Input_Offset_1; //!< Analog input channel 1 offset
109  TBlock_Input_Connector object_f32_Analog_Input_Offset_2; //!< Analog input channel 2 offset
110 
111  // Block inputs
112 
114 
115  // Block outputs
116 
117  U16 u16_Analog_Input_Status; //!< Analog input status
118  I16 i16_Analog_Input_Data_1; //!< Analog input channel 1 block output as I16
119  I16 i16_Analog_Input_Data_2; //!< Analog input channel 2 block output as I16
120 
121  TBlock_Output_Connector object_f32_Analog_Input_Data_1; //!< Analog input channel 1 block output
122  TBlock_Output_Connector object_f32_Analog_Input_Data_2; //!< Analog input channel 2 block output
123  TBlock_Output_Connector object_f32_Analog_Input_Data_3; //!< Analog input channel 3 block output
124 
125  TBlock_Output_Connector object_f32_AN; //!< Analog input channel 1 block output
126  TBlock_Output_Connector object_f32_BN; //!< Analog input channel 2 block output
127  TBlock_Output_Connector object_f32_CN; //!< Analog input channel 3 block output
128 
129  TBlock_Output_Connector object_bool_Hardware_Error; //!< Critical hardware error flag
130  TBlock_Output_Connector object_bool_Symmenty_Error; //!< Signal symmery error flag
132  TBlock_Output_Connector object_bool_Magnitude_Software_Level_Error; // !< Software magnitude limit reached error flag
133 
134  //----------------------------------------------------------------------------
135  // Protected defines, methods and variables
136  //----------------------------------------------------------------------------
137 
138  protected:
139 
140  //----------------------------------------------------------------------------
141  // Private defines, methods and variables
142  //----------------------------------------------------------------------------
143 
144  private:
145 
146  typedef union
147  {
149  struct
150  {
154  U16 :1;
155  U16 :1;
156  U16 :1;
157  U16 :1;
164  U16 :1;
165  U16 :1;
166  U16 :1;
167  };
168  } TStatus;
169 
170  volatile TP005_03_V2_0_AI_V_Registers *struct_Registers; //!< Hardware mapped registers
171 
172  F32 f32_Gain_1; //!< Effective gain of the channel 1
173  F32 f32_Gain_2; //!< Effective gain of the channel 2
174 
175  F32 f32_Offset_1; //!< Effective offset of the channel 1
176  F32 f32_Offset_2; //!< Effective offset of the channel 2
177 
178 };
179 
180 //------------------------------------------------------------------------------
181 
182 //! @brief Analog input P005.03 V2.0 board TP005_03_V2_0_AI_2V_E1 class
184 {
185 
186  //----------------------------------------------------------------------------
187  // Public defines, methods and variables
188  //----------------------------------------------------------------------------
189 
190  public:
191 
192  //--------------------------------------------------------------------------
193  // Public methods
194  //--------------------------------------------------------------------------
195 
196  // Constructor and destructor
197  TP005_03_V2_0_AI_2V_E1(); //!< Constructor method
198  virtual ~TP005_03_V2_0_AI_2V_E1(); //!< Destructor method
199 
200  VOID Map();
201  virtual VOID Init();
202  virtual VOID Execute();
203  virtual VOID Send_Information( TProtocol_Base *object_Protocol );
204 
205  // Block parameter signals
206 
215 
216  TBlock_Input_Connector object_f32_Analog_Input_Full_Scale_1; //!< Analog input channel 1 fill scale value. Also used for channel total gain adjustment.
217  TBlock_Input_Connector object_f32_Analog_Input_Full_Scale_2; //!< Analog input channel 1 fill scale value. Also used for channel total gain gain adjustment.
218 
219  TBlock_Input_Connector object_f32_Analog_Input_Offset_1; //!< Analog input channel 1 offset
220  TBlock_Input_Connector object_f32_Analog_Input_Offset_2; //!< Analog input channel 2 offset
221 
222  // Block input signals
223 
225 
227 
228  // Block output signals
229 
230  U16 u16_Analog_Input_Status; //!< Analog input status
231  I16 i16_Analog_Input_Data_1; //!< Analog input channel 1 block output as I16
232  I16 i16_Analog_Input_Data_2; //!< Analog input channel 2 block output as I16
233 
234  TBlock_Output_Connector object_f32_Analog_Input_Data_1; //!< Analog input channel 1 block output
235  TBlock_Output_Connector object_f32_Analog_Input_Data_2; //!< Analog input channel 2 block output
236  TBlock_Output_Connector object_f32_Analog_Input_Data_3; //!< Analog input channel 3 block output
237 
238  TBlock_Output_Connector object_f32_AN; //!< Analog input channel 1 block output
239  TBlock_Output_Connector object_f32_BN; //!< Analog input channel 2 block output
240  TBlock_Output_Connector object_f32_CN; //!< Analog input channel 3 block output
241 
242  TBlock_Output_Connector object_bool_Hardware_Error; //!< Critical hardware error flag
243  TBlock_Output_Connector object_bool_Symmenty_Error; //!< Signal symmery error flag
245  TBlock_Output_Connector object_bool_Magnitude_Software_Level_Error; // !< Software magnitude limit reached error flag
246 
247  //----------------------------------------------------------------------------
248  // Protected defines, methods and variables
249  //----------------------------------------------------------------------------
250 
251  protected:
252 
253  //----------------------------------------------------------------------------
254  // Private defines, methods and variables
255  //----------------------------------------------------------------------------
256 
257  private:
258 
261 
262 };
263 
264 //------------------------------------------------------------------------------
265 // End Of File
266 //------------------------------------------------------------------------------
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
float F32
IEEE-754 32-Bit single presession floating point numbers datatype defenition.
Definition: Defines.h:324
short I16
2s Compliment 16-Bit signed integer datatype defenition
Definition: Defines.h:196
unsigned short U16
Binary 16-Bit unsigned integer datatype defenition.
Definition: Defines.h:193
Function block base class header file.
Function block input connector class.
Definition: Block_Input_Connector.h:83
Function block output connector class.
Definition: Block_Output_Connector.h:59
Function block base class for device.
Definition: Function_Block_Base.h:96
Analog input P005.03 V2.0 board TP005_03_V2_0_AI_2V_E1 class.
Definition: P005_03_V2_0_AI_2V.h:184
TBlock_Input_Connector object_f32_Voltage_Frequency
Definition: P005_03_V2_0_AI_2V.h:208
TBlock_Output_Connector object_f32_Analog_Input_Data_2
Analog input channel 2 block output.
Definition: P005_03_V2_0_AI_2V.h:235
TBlock_Output_Connector object_f32_Analog_Input_Data_3
Analog input channel 3 block output.
Definition: P005_03_V2_0_AI_2V.h:236
TBlock_Output_Connector object_f32_AN
Analog input channel 1 block output.
Definition: P005_03_V2_0_AI_2V.h:238
TBlock_Input_Connector object_bool_Sag_Enable
Definition: P005_03_V2_0_AI_2V.h:224
virtual VOID Send_Information(TProtocol_Base *object_Protocol)
Send detailed information about functional block.
Definition: P005_03_V2_0_AI_2V.cpp:482
TBlock_Input_Connector object_f32_Voltage_Magnitude_1
Definition: P005_03_V2_0_AI_2V.h:209
virtual VOID Init()
Analog input board P005.03 V2.0 object initialization.
Definition: P005_03_V2_0_AI_2V.cpp:355
TBlock_Input_Connector object_f32_Magnitude_Software_Level
Voltage sag enable.
Definition: P005_03_V2_0_AI_2V.h:226
TBlock_Input_Connector object_f32_Voltage_Sag_Magnitude_1
Definition: P005_03_V2_0_AI_2V.h:212
TBlock_Output_Connector object_bool_Magnitude_Software_Level_Error
Definition: P005_03_V2_0_AI_2V.h:245
TBlock_Input_Connector object_f32_Voltage_Sag_Magnitude_2
Definition: P005_03_V2_0_AI_2V.h:213
TBlock_Output_Connector object_f32_BN
Analog input channel 2 block output.
Definition: P005_03_V2_0_AI_2V.h:239
TBlock_Output_Connector object_bool_Symmenty_Error
Signal symmery error flag.
Definition: P005_03_V2_0_AI_2V.h:243
TBlock_Input_Connector object_f32_Sample_Time
Definition: P005_03_V2_0_AI_2V.h:207
TBlock_Output_Connector object_f32_Analog_Input_Data_1
Analog input channel 1 block output.
Definition: P005_03_V2_0_AI_2V.h:234
F32 f32_Theta_Step
Definition: P005_03_V2_0_AI_2V.h:259
TBlock_Input_Connector object_f32_Analog_Input_Full_Scale_1
Analog input channel 1 fill scale value. Also used for channel total gain adjustment.
Definition: P005_03_V2_0_AI_2V.h:216
I16 i16_Analog_Input_Data_2
Analog input channel 2 block output as I16.
Definition: P005_03_V2_0_AI_2V.h:232
TP005_03_V2_0_AI_2V_E1()
Constructor method.
Definition: P005_03_V2_0_AI_2V.cpp:266
TBlock_Output_Connector object_bool_Magnitude_Hardware_Level_Error
Hardware limit reached error flag.
Definition: P005_03_V2_0_AI_2V.h:244
TBlock_Input_Connector object_f32_Analog_Input_Full_Scale_2
Analog input channel 1 fill scale value. Also used for channel total gain gain adjustment.
Definition: P005_03_V2_0_AI_2V.h:217
TBlock_Input_Connector object_f32_Analog_Input_Offset_1
Analog input channel 1 offset.
Definition: P005_03_V2_0_AI_2V.h:219
TBlock_Input_Connector object_f32_Voltage_Magnitude_3
Definition: P005_03_V2_0_AI_2V.h:211
TBlock_Output_Connector object_bool_Hardware_Error
Critical hardware error flag.
Definition: P005_03_V2_0_AI_2V.h:242
VOID Map()
Analog input board P005.03 V2.0 memory map.
Definition: P005_03_V2_0_AI_2V.cpp:345
virtual VOID Execute()
Analog input board P005.03 V2.0 execute method.
Definition: P005_03_V2_0_AI_2V.cpp:379
TBlock_Output_Connector object_f32_CN
Analog input channel 3 block output.
Definition: P005_03_V2_0_AI_2V.h:240
TBlock_Input_Connector object_f32_Analog_Input_Offset_2
Analog input channel 2 offset.
Definition: P005_03_V2_0_AI_2V.h:220
U16 u16_Analog_Input_Status
Analog input status.
Definition: P005_03_V2_0_AI_2V.h:230
TBlock_Input_Connector object_f32_Voltage_Sag_Magnitude_3
Definition: P005_03_V2_0_AI_2V.h:214
F32 f32_Theta
Definition: P005_03_V2_0_AI_2V.h:260
virtual ~TP005_03_V2_0_AI_2V_E1()
Destructor method.
Definition: P005_03_V2_0_AI_2V.cpp:334
I16 i16_Analog_Input_Data_1
Analog input channel 1 block output as I16.
Definition: P005_03_V2_0_AI_2V.h:231
TBlock_Input_Connector object_f32_Voltage_Magnitude_2
Definition: P005_03_V2_0_AI_2V.h:210
Analog input P005.03 V2.0 board TP005_03_V2_0_AI_2V class.
Definition: P005_03_V2_0_AI_2V.h:66
volatile TP005_03_V2_0_AI_V_Registers * struct_Registers
Hardware mapped registers.
Definition: P005_03_V2_0_AI_2V.h:170
I16 i16_Analog_Input_Data_1
Analog input channel 1 block output as I16.
Definition: P005_03_V2_0_AI_2V.h:118
TBlock_Output_Connector object_bool_Symmenty_Error
Signal symmery error flag.
Definition: P005_03_V2_0_AI_2V.h:130
TBlock_Output_Connector object_f32_AN
Analog input channel 1 block output.
Definition: P005_03_V2_0_AI_2V.h:125
virtual ~TP005_03_V2_0_AI_2V()
Destructor method.
Definition: P005_03_V2_0_AI_2V.cpp:127
F32 f32_Offset_2
Effective offset of the channel 2.
Definition: P005_03_V2_0_AI_2V.h:176
TBlock_Input_Connector object_f32_Magnitude_Software_Level
Definition: P005_03_V2_0_AI_2V.h:113
virtual VOID Execute()
Analog input board P005.03 V2.0 execute method.
Definition: P005_03_V2_0_AI_2V.cpp:171
TBlock_Output_Connector object_bool_Magnitude_Hardware_Level_Error
Hardware limit reached error flag.
Definition: P005_03_V2_0_AI_2V.h:131
TBlock_Output_Connector object_f32_Analog_Input_Data_3
Analog input channel 3 block output.
Definition: P005_03_V2_0_AI_2V.h:123
U16 u16_Analog_Input_Status
Analog input status.
Definition: P005_03_V2_0_AI_2V.h:117
TBlock_Input_Connector object_f32_Analog_Input_Full_Scale_2
Analog input channel 1 fill scale value. Also used for channel total gain gain adjustment.
Definition: P005_03_V2_0_AI_2V.h:106
F32 f32_Offset_1
Effective offset of the channel 1.
Definition: P005_03_V2_0_AI_2V.h:175
virtual VOID Send_Information(TProtocol_Base *object_Protocol)
Send detailed information about functional block.
Definition: P005_03_V2_0_AI_2V.cpp:213
TBlock_Output_Connector object_f32_CN
Analog input channel 3 block output.
Definition: P005_03_V2_0_AI_2V.h:127
TBlock_Output_Connector object_bool_Magnitude_Software_Level_Error
Definition: P005_03_V2_0_AI_2V.h:132
TBlock_Output_Connector object_bool_Hardware_Error
Critical hardware error flag.
Definition: P005_03_V2_0_AI_2V.h:129
VOID Map(TP005_03_V2_0_AI_V_Registers *struct_Registers_Base_Address)
Analog input board P005.03 V2.0 memory map.
Definition: P005_03_V2_0_AI_2V.cpp:138
TBlock_Input_Connector object_f32_Analog_Input_Offset_1
Analog input channel 1 offset.
Definition: P005_03_V2_0_AI_2V.h:108
F32 f32_Gain_2
Effective gain of the channel 2.
Definition: P005_03_V2_0_AI_2V.h:173
F32 f32_Gain_1
Effective gain of the channel 1.
Definition: P005_03_V2_0_AI_2V.h:172
TP005_03_V2_0_AI_2V()
Constructor method.
Definition: P005_03_V2_0_AI_2V.cpp:72
TBlock_Input_Connector object_f32_Analog_Input_Full_Scale_1
Analog input channel 1 fill scale value. Also used for channel total gain adjustment.
Definition: P005_03_V2_0_AI_2V.h:105
TBlock_Output_Connector object_f32_BN
Analog input channel 2 block output.
Definition: P005_03_V2_0_AI_2V.h:126
virtual VOID Init()
Analog input board P005.03 V2.0 object initialization.
Definition: P005_03_V2_0_AI_2V.cpp:152
TBlock_Input_Connector object_f32_Analog_Input_Offset_2
Analog input channel 2 offset.
Definition: P005_03_V2_0_AI_2V.h:109
TBlock_Output_Connector object_f32_Analog_Input_Data_1
Analog input channel 1 block output.
Definition: P005_03_V2_0_AI_2V.h:121
TBlock_Output_Connector object_f32_Analog_Input_Data_2
Analog input channel 2 block output.
Definition: P005_03_V2_0_AI_2V.h:122
I16 i16_Analog_Input_Data_2
Analog input channel 2 block output as I16.
Definition: P005_03_V2_0_AI_2V.h:119
Definition: Protocol_Base.h:57
Definition: P005_03_V2_0_AI_2V.h:76
U16 u16_Reserve_0x04
0x04 : Reserved
Definition: P005_03_V2_0_AI_2V.h:83
I16 i16_Analog_Input_Filtered_Data_2
0x06 : Analog input channel 2 filtered data register as I16 value
Definition: P005_03_V2_0_AI_2V.h:85
U16 u16_Analog_Input_Status
0x00 : Status register
Definition: P005_03_V2_0_AI_2V.h:79
I16 i16_Analog_Input_Filtered_Data_1
0x05 : Analog input channel 1 filtered data register as I16 value
Definition: P005_03_V2_0_AI_2V.h:84
I16 i16_Analog_Input_Data_1
0x01 : Analog input channel 1 data register as I16 value
Definition: P005_03_V2_0_AI_2V.h:80
I16 i16_Analog_Input_Filtered_Data_3
0x07 : Analog input channel 3 filtered data register as I16 value
Definition: P005_03_V2_0_AI_2V.h:86
I16 i16_Analog_Input_Data_3
0x03 : Analog input channel 3 data register as I16 value
Definition: P005_03_V2_0_AI_2V.h:82
I16 i16_Analog_Input_Data_2
0x02 : Analog input channel 2 data register as I16 value
Definition: P005_03_V2_0_AI_2V.h:81
U16 u16_CMP_P_3_Status
Definition: P005_03_V2_0_AI_2V.h:162
U16 u16_CMP_P_2_Status
Definition: P005_03_V2_0_AI_2V.h:160
U16 u16_CMP_N_2_Status
Definition: P005_03_V2_0_AI_2V.h:161
U16 u16_Status
Definition: P005_03_V2_0_AI_2V.h:148
U16 u16_CMP_N_3_Status
Definition: P005_03_V2_0_AI_2V.h:163
U16 u16_ADC_Hardware_Fault_1
Definition: P005_03_V2_0_AI_2V.h:151
U16 u16_ADC_Hardware_Fault_3
Definition: P005_03_V2_0_AI_2V.h:153
U16 u16_CMP_P_1_Status
Definition: P005_03_V2_0_AI_2V.h:158
U16 u16_CMP_N_1_Status
Definition: P005_03_V2_0_AI_2V.h:159
U16 u16_ADC_Hardware_Fault_2
Definition: P005_03_V2_0_AI_2V.h:152