ConOpSys V2970  P004.07
ANVILEX control operating system
P015_09_V1_0_DC_Bus.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file P015_09_V1_0_DC_Bus.h
3 //! @brief Control board P015.09 CB d.c. bus 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/P015_09_V1_0/P015_09_V1_0_DC_Bus.h $
7 //! $Revision: 2881 $
8 //! $Date: 2021-11-04 17:20:08 +0500 (Do, 04 Nov 2021) $
9 //! $Author: ggavrituhin $
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 //------------------------------------------------------------------------------
41 // Protecting header files from mutual, recursive inclusion.
42 //------------------------------------------------------------------------------
43 
44 #pragma once
45 
46 //------------------------------------------------------------------------------
47 // Include standard libraries header files
48 //------------------------------------------------------------------------------
49 
50 //------------------------------------------------------------------------------
51 // Include thrid party header files
52 //------------------------------------------------------------------------------
53 
54 //------------------------------------------------------------------------------
55 // Include ConOpSys header files
56 //------------------------------------------------------------------------------
57 
58 #include "Function_Block_Base.h"
59 
60 //------------------------------------------------------------------------------
61 // Include ConOpSys application header files
62 //------------------------------------------------------------------------------
63 
64 //------------------------------------------------------------------------------
65 // Macros
66 //------------------------------------------------------------------------------
67 
68 //------------------------------------------------------------------------------
69 // Class definitions
70 //------------------------------------------------------------------------------
71 
72 //! @brief DC bus board P015.05 V1.0 class
74 {
75 
76  //----------------------------------------------------------------------------
77  // Public defines, methods and variables
78  //----------------------------------------------------------------------------
79 
80  public:
81 
82  // Register structure for generic access
83  typedef struct
84  {
85 
86  union
87  {
88  U16 u16_Status; //!< Status register
89  U16 u16_Control; //!< Control register
90  };
91 
92  I16 i16_Analog_Input_Data; //!< Analog input channel 1 data register
99 
101 
102  //--------------------------------------------------------------------------
103  // Public methods
104  //--------------------------------------------------------------------------
105 
106  // Constructor and destructor
107  TP015_09_V1_0_DC_Bus(); //!< Constructor method
108  virtual ~TP015_09_V1_0_DC_Bus(); //!< Destructor method
109 
110  VOID Map( TP015_09_V1_0_DC_Bus_Registers *struct_Registers_Base_Address ); //!< Hardware mapping method
111  virtual VOID Init(); //!< Initialisation method
112  virtual VOID Execute_Inputs(); //!< Execute inputs
113  virtual VOID Execute(); //!< Execution method
114  virtual VOID Execute_Outputs(); //!< Execute outputs
115  virtual VOID Send_Information( TProtocol_Base *object_Protocol ); //!< Send information about functional block
116 
117  // Block parameters
118 
119  TBlock_Input_Connector object_f32_Analog_Input_Full_Scale; //!< Analog input channel fill scale value. Also used for channel total gain adjustment.
120  TBlock_Input_Connector object_f32_Analog_Input_Offset; //!< Analog input channel offset
121 
122  // Block inputs
123 
125 // TBlock_Input_Connector object_bool_Crowbar_Control; //!< Crowbar status
126 
127  // Block outputs
128 
129  U16 u16_Analog_Input_Status; //!< Analog input status
130  I16 i16_Analog_Input_Data; //!< Analog input data block output as I16
131 
132  TBlock_Output_Connector object_f32_Analog_Input_Data; //!< Analog input data block output connector
133 
134  TBlock_Output_Connector object_bool_Hardware_Error; //!< Critical hardware error flag
135  TBlock_Output_Connector object_bool_Hardware_Limit_Error; //!< Hardware limit reached error flag
136  TBlock_Output_Connector object_bool_Software_Limit_Error; // !< Software limit reached error flag
137 
139 // TBlock_Output_Connector object_bool_Crowbar_Error; //!< Crowbar status signal
140 
141  //----------------------------------------------------------------------------
142  // Protected defines, methods and variables
143  //----------------------------------------------------------------------------
144 
145  protected:
146 
147  //----------------------------------------------------------------------------
148  // Private defines, methods and variables
149  //----------------------------------------------------------------------------
150 
151  private:
152 
153  //--------------------------------------------------------------------------
154  // Private defines
155  //--------------------------------------------------------------------------
156 
157  typedef union
158  {
160  struct
161  {
162  U16 u16_ADC_Hardware_Fault_1:1; // Bit 0 - ADC hardware fault - Experemintal function
163  U16 :1; // Bit 1 - Not used
164  U16 :1; // Bit 2 - Not used
165  U16 :1; // Bit 3 - Not used
166  U16 :1; // Bit 4 - Not used
167  U16 :1; // Bit 5 - Not used
168  U16 u16_Ballast_Control_Feedback:1; // Bit 6 - Ballast control feedback
169  U16 u16_Ballast_Status:1; // Bit 7 - Ballast status
170  U16 u16_CMP_P_1_Status:1; // Bit 8 - Analog comparator P1 status
171  U16 u16_CMP_P_2_Status:1; // Bit 9 - Analog comparator P2 status
172  U16 :1; // Bit 10 - Not used
173  U16 :1; // Bit 11 - Not used
174  U16 :1; // Bit 12 - Not used
175  U16 :1; // Bit 13 - Not used
176  U16 :1; // Bit 14 - Not used
177  U16 :1; // Bit 15 - Not used
178  };
179  } TStatus;
180 
181  //--------------------------------------------------------------------------
182  // Private variables
183  //--------------------------------------------------------------------------
184 
185  volatile TP015_09_V1_0_DC_Bus_Registers *struct_Registers; //!< Pointer to register in FPGA
188 
189  F32 f32_Gain; //!< Effective gain of the voltage measurement channel
190  F32 f32_Offset; //!< Effective offset of the voltage measurement channel
191 
192 };
193 
194 
195 //------------------------------------------------------------------------------
196 // Class definitions
197 //------------------------------------------------------------------------------
198 
199 //! @brief DC bus board P015.05 T2 V1.0 class
201 {
202 
203  //----------------------------------------------------------------------------
204  // Public defines, methods and variables
205  //----------------------------------------------------------------------------
206 
207  public:
208 
209  // Register structure for generic access
210  typedef struct
211  {
212 
213  //! @brief 0x00 : Unit identification L read register
215 
216  //! @brief 0x01 : Unit identification H read register
218 
219  //! @brief 0x02 : Control and status register
220  union
221  {
222 
223  //! @brief 0x02 : Status register
225 
226  //! @brief 0x02 : Control register
228 
229  };
230 
231  //! @brief 0x03 : Analog input channel 1 data register
233 
234  //! @brief 0x04 : Reserved
235 // U16 u16_Reserve_0x04;
236 
237  //! @brief 0x05 : Reserved
238 // U16 u16_Reserve_0x05;
239 
240  //! @brief 0x06 : Analog input filtred channel 1 data register
241 // I16 i16_Analog_Input_Filtered_Data;
242 
244 
245  //--------------------------------------------------------------------------
246  // Public methods
247  //--------------------------------------------------------------------------
248 
249  // Constructor and destructor
250  TP015_09_V1_0_DC_Bus_T2(); //!< Constructor method
251  virtual ~TP015_09_V1_0_DC_Bus_T2(); //!< Destructor method
252 
253  VOID Map( TP015_09_V1_0_DC_Bus_Registers *struct_Registers_Base_Address ); //!< Hardware mapping method
254  virtual VOID Init(); //!< Initialisation method
255  virtual VOID Execute(); //!< Execution method
256  virtual VOID Send_Information( TProtocol_Base *object_Protocol ); //!< Send information about functional block
257 
258  //--------------------------------------------------------------------------
259  // Function block parameters
260  //--------------------------------------------------------------------------
261 
262  //--------------------------------------------------------------------------
263  // Function block inputs
264  //--------------------------------------------------------------------------
265 
267 
268  //--------------------------------------------------------------------------
269  // Function block outputs
270  //--------------------------------------------------------------------------
271 
272  //! @brief Analog input data block output connector
274 
275  //! @brief Comparator P1 status signal
277 
278  //! @brief Comparator P2 status signal
280 
281  //! @brief Ballast status signal
283 
284  //----------------------------------------------------------------------------
285  // Protected defines, methods and variables
286  //----------------------------------------------------------------------------
287 
288  protected:
289 
290  //----------------------------------------------------------------------------
291  // Private defines, methods and variables
292  //----------------------------------------------------------------------------
293 
294  private:
295 
296  //--------------------------------------------------------------------------
297  // Private defines
298  //--------------------------------------------------------------------------
299 
300  typedef union
301  {
303  struct
304  {
305  U16 bit1_ADC_Hardware_Fault_1:1; // Bit 0 - ADC hardware fault - Experemintal function
306  U16 :1; // Bit 1 - Not used
307  U16 :1; // Bit 2 - Not used
308  U16 :1; // Bit 3 - Not used
309  U16 :1; // Bit 4 - Not used
310  U16 :1; // Bit 5 - Not used
311  U16 :1; // Bit 6 - Not used
312  U16 bit1_Ballast_Status:1; // Bit 7 - Ballast status
313  U16 bit1_CMP_P_1_Status:1; // Bit 8 - Analog comparator P1 status
314  U16 bit1_CMP_P_2_Status:1; // Bit 9 - Analog comparator P2 status
315  U16 :1; // Bit 10 - Not used
316  U16 :1; // Bit 11 - Not used
317  U16 :1; // Bit 12 - Not used
318  U16 :1; // Bit 13 - Not used
319  U16 :1; // Bit 14 - Not used
320  U16 :1; // Bit 15 - Not used
321  };
322  } TStatus_Register;
323 
324  typedef union
325  {
327  struct
328  {
329  U16 :1; // Bit 0 - Not used
330  U16 :1; // Bit 1 - Not used
331  U16 :1; // Bit 2 - Not used
332  U16 :1; // Bit 3 - Not used
333  U16 :1; // Bit 4 - Not used
334  U16 :1; // Bit 5 - Not used
335  U16 bit1_Ballast_Control:1; // Bit 6 - Ballast control
336  U16 :1; // Bit 7 - Not used
337  U16 :1; // Bit 8 - Not used
338  U16 :1; // Bit 9 - Not used
339  U16 :1; // Bit 10 - Not used
340  U16 :1; // Bit 11 - Not used
341  U16 :1; // Bit 12 - Not used
342  U16 :1; // Bit 13 - Not used
343  U16 :1; // Bit 14 - Not used
344  U16 :1; // Bit 15 - Not used
345  };
346  } TControl_Register;
347 
348  //--------------------------------------------------------------------------
349  // Private variables
350  //--------------------------------------------------------------------------
351 
352  //! @brief Pointer to register in FPGA
354 
355  F32 f32_Gain; //!< Effective gain of the channels
356 
357  F32 f32_Value_Limit = (U32)115.002f;
358 
359  F32 f32_Code_Limit = (F32)32768.0f;
360 
361 };
362 
363 //------------------------------------------------------------------------------
364 // End of file
365 //------------------------------------------------------------------------------
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
unsigned long U32
Binary 32-Bit unsigned integer datatype defenition.
Definition: Defines.h:203
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
DC bus board P015.05 T2 V1.0 class.
Definition: P015_09_V1_0_DC_Bus.h:201
VOID Map(TP015_09_V1_0_DC_Bus_Registers *struct_Registers_Base_Address)
Hardware mapping method.
Definition: P015_09_V1_0_DC_Bus.cpp:307
TBlock_Output_Connector object_bool_Comparator_P2_Status
Comparator P2 status signal.
Definition: P015_09_V1_0_DC_Bus.h:279
TBlock_Input_Connector object_bool_Ballast_Control
Ballast status.
Definition: P015_09_V1_0_DC_Bus.h:266
F32 f32_Value_Limit
Definition: P015_09_V1_0_DC_Bus.h:357
virtual VOID Execute()
Execution method.
Definition: P015_09_V1_0_DC_Bus.cpp:332
virtual ~TP015_09_V1_0_DC_Bus_T2()
Destructor method.
Definition: P015_09_V1_0_DC_Bus.cpp:299
virtual VOID Send_Information(TProtocol_Base *object_Protocol)
Send information about functional block.
Definition: P015_09_V1_0_DC_Bus.cpp:377
volatile TP015_09_V1_0_DC_Bus_Registers * struct_Registers
Pointer to register in FPGA.
Definition: P015_09_V1_0_DC_Bus.h:353
virtual VOID Init()
Initialisation method.
Definition: P015_09_V1_0_DC_Bus.cpp:319
F32 f32_Gain
Effective gain of the channels.
Definition: P015_09_V1_0_DC_Bus.h:355
TBlock_Output_Connector object_bool_Ballast_Status
Ballast status signal.
Definition: P015_09_V1_0_DC_Bus.h:282
TP015_09_V1_0_DC_Bus_T2()
Constructor method.
Definition: P015_09_V1_0_DC_Bus.cpp:267
TBlock_Output_Connector object_bool_Comparator_P1_Status
Comparator P1 status signal.
Definition: P015_09_V1_0_DC_Bus.h:276
F32 f32_Code_Limit
Definition: P015_09_V1_0_DC_Bus.h:359
TBlock_Output_Connector object_f32_Analog_Input_Data
Analog input data block output connector.
Definition: P015_09_V1_0_DC_Bus.h:273
DC bus board P015.05 V1.0 class.
Definition: P015_09_V1_0_DC_Bus.h:74
virtual VOID Init()
Initialisation method.
Definition: P015_09_V1_0_DC_Bus.cpp:132
TBlock_Output_Connector object_bool_Hardware_Limit_Error
Hardware limit reached error flag.
Definition: P015_09_V1_0_DC_Bus.h:135
F32 f32_Gain
Effective gain of the voltage measurement channel.
Definition: P015_09_V1_0_DC_Bus.h:189
U16 u16_Analog_Input_Status
Analog input status.
Definition: P015_09_V1_0_DC_Bus.h:129
U16 u16_Control
Definition: P015_09_V1_0_DC_Bus.h:187
virtual VOID Send_Information(TProtocol_Base *object_Protocol)
Send information about functional block.
Definition: P015_09_V1_0_DC_Bus.cpp:225
TBlock_Input_Connector object_f32_Analog_Input_Full_Scale
Analog input channel fill scale value. Also used for channel total gain adjustment.
Definition: P015_09_V1_0_DC_Bus.h:119
I16 i16_Analog_Input_Data
Analog input data block output as I16.
Definition: P015_09_V1_0_DC_Bus.h:130
virtual VOID Execute_Outputs()
Execute outputs.
Definition: P015_09_V1_0_DC_Bus.cpp:192
virtual ~TP015_09_V1_0_DC_Bus()
Destructor method.
Definition: P015_09_V1_0_DC_Bus.cpp:112
volatile TP015_09_V1_0_DC_Bus_Registers * struct_Registers
Pointer to register in FPGA.
Definition: P015_09_V1_0_DC_Bus.h:185
virtual VOID Execute_Inputs()
Execute inputs.
Definition: P015_09_V1_0_DC_Bus.cpp:149
F32 f32_Offset
Effective offset of the voltage measurement channel.
Definition: P015_09_V1_0_DC_Bus.h:190
VOID Map(TP015_09_V1_0_DC_Bus_Registers *struct_Registers_Base_Address)
Hardware mapping method.
Definition: P015_09_V1_0_DC_Bus.cpp:120
TBlock_Output_Connector object_bool_Hardware_Error
Critical hardware error flag.
Definition: P015_09_V1_0_DC_Bus.h:134
TBlock_Input_Connector object_f32_Analog_Input_Offset
Analog input channel offset.
Definition: P015_09_V1_0_DC_Bus.h:120
TBlock_Output_Connector object_bool_Ballast_Error
Ballast status signal.
Definition: P015_09_V1_0_DC_Bus.h:138
TP015_09_V1_0_DC_Bus()
Constructor method.
Definition: P015_09_V1_0_DC_Bus.cpp:66
TBlock_Output_Connector object_bool_Software_Limit_Error
Definition: P015_09_V1_0_DC_Bus.h:136
virtual VOID Execute()
Execution method.
Definition: P015_09_V1_0_DC_Bus.cpp:184
U16 u16_Status
Definition: P015_09_V1_0_DC_Bus.h:186
TBlock_Output_Connector object_f32_Analog_Input_Data
Analog input data block output connector.
Definition: P015_09_V1_0_DC_Bus.h:132
TBlock_Input_Connector object_bool_Ballast_Control
Ballast status.
Definition: P015_09_V1_0_DC_Bus.h:124
Definition: Protocol_Base.h:57
Definition: P015_09_V1_0_DC_Bus.h:84
U16 u16_Reserve_0x03
Definition: P015_09_V1_0_DC_Bus.h:94
I16 i16_Analog_Input_Filtered_Data
Definition: P015_09_V1_0_DC_Bus.h:95
I16 i16_Analog_Input_Data
Analog input channel 1 data register.
Definition: P015_09_V1_0_DC_Bus.h:92
U16 u16_Reserve_0x02
Definition: P015_09_V1_0_DC_Bus.h:93
U16 u16_Reserve_0x07
Definition: P015_09_V1_0_DC_Bus.h:98
U16 u16_Reserve_0x05
Definition: P015_09_V1_0_DC_Bus.h:96
U16 u16_Status
Status register.
Definition: P015_09_V1_0_DC_Bus.h:88
U16 u16_Reserve_0x06
Definition: P015_09_V1_0_DC_Bus.h:97
U16 u16_Control
Control register.
Definition: P015_09_V1_0_DC_Bus.h:89
Definition: P015_09_V1_0_DC_Bus.h:211
U16 u16_Status
0x02 : Status register
Definition: P015_09_V1_0_DC_Bus.h:224
U16 u16_Control
0x02 : Control register
Definition: P015_09_V1_0_DC_Bus.h:227
I16 i16_Analog_Input_Data
0x03 : Analog input channel 1 data register
Definition: P015_09_V1_0_DC_Bus.h:232
U16 u16_Unit_ID_L
0x00 : Unit identification L read register
Definition: P015_09_V1_0_DC_Bus.h:214
U16 u16_Unit_ID_H
0x01 : Unit identification H read register
Definition: P015_09_V1_0_DC_Bus.h:217
U16 u16_Status
Definition: P015_09_V1_0_DC_Bus.h:159
U16 u16_ADC_Hardware_Fault_1
Definition: P015_09_V1_0_DC_Bus.h:162
U16 u16_Ballast_Control_Feedback
Definition: P015_09_V1_0_DC_Bus.h:168
U16 u16_Ballast_Status
Definition: P015_09_V1_0_DC_Bus.h:169
U16 u16_CMP_P_1_Status
Definition: P015_09_V1_0_DC_Bus.h:170
U16 u16_CMP_P_2_Status
Definition: P015_09_V1_0_DC_Bus.h:171
U16 bit1_Ballast_Control
Definition: P015_09_V1_0_DC_Bus.h:335
U16 u16_Raw_Data
Definition: P015_09_V1_0_DC_Bus.h:326
U16 bit1_CMP_P_2_Status
Definition: P015_09_V1_0_DC_Bus.h:314
U16 bit1_CMP_P_1_Status
Definition: P015_09_V1_0_DC_Bus.h:313
U16 bit1_Ballast_Status
Definition: P015_09_V1_0_DC_Bus.h:312
U16 u16_Raw_Data
Definition: P015_09_V1_0_DC_Bus.h:302
U16 bit1_ADC_Hardware_Fault_1
Definition: P015_09_V1_0_DC_Bus.h:305