ConOpSys V2970  P004.07
ANVILEX control operating system
KG3_DCBIO_V2.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file KG3_DCBIO_V2.h
3 //! @brief DC 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/KG3_DCBIO_V2.h $
7 //! $Revision: 2545 $
8 //! $Date: 2021-03-25 13:28:47 +0500 (Чт, 25 мар 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 //------------------------------------------------------------------------------
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  //--------------------------------------------------------------------------
83  // Public defines
84  //--------------------------------------------------------------------------
85 
86  //! @brief Register structure for generic access
87  typedef struct
88  {
89 
90  //! @brief 0x00 : Module identification register
92 
93  //! @brief 0x01 : Module identification register
95 
96  //! @brief 0x02 : Status register
98 
99  //! @brief 0x03 : Control register
101 
102  //! @brief 0x04 : Reserved
104 
105  //! @brief 0x05 : Reserved
107 
108  //! @brief 0x06 : Reserved
110 
111  //! @brief 0x07 : Positive rail voltage sensor ID register
113 
114  //! @brief 0x08 : Positive rail voltage register
116 
117  //! @brief 0x09 : Positive rail voltage latch register address
119 
120  //! @brief 0x0A : Positive rail voltage general error counter register
122 
123  //! @brief 0x0B : Positive rail voltage timeout error counter register
125 
126  //! @brief 0x0C : Positive rail voltage sync error counter register
128 
129  //! @brief 0x0D : Positive rail voltage parity error counter register
131 
132  //! @brief 0x0E : Negative rail voltage status register
134 
135  //! @brief 0x0F : Negative rail voltage control register
137 
138  //! @brief 0x10 : Reserved
140 
141  //! @brief 0x11 : Reserved
143 
144  //! @brief 0x12 : Reserved
146 
147  //! @brief 0x13 : Negative rail voltage sensor id register
149 
150  //! @brief 0x14 : Negative rail voltage register
152 
153  //! @brief 0x15 : Negative rail voltage latch register address
155 
156  //! @brief 0x16 : Negative rail voltage general error counter register
158 
159  //! @brief 0x17 : Negative rail voltage timeout error counter register
161 
162  //! @brief 0x18 : Negative rail voltage sync error counter register
164 
165  //! @brief 0x19 : Negative rail voltage parity error counter register
167 
168  //! @brief 0x1A : Digital input register
170 
171  //! @brief 0x1B : Digital Output register
173 
175 
176  //--------------------------------------------------------------------------
177  // Public methods
178  //--------------------------------------------------------------------------
179 
180  //!-------------------------------------------------------------------------
181  //! @brief Function block class constructor method.
182  //! @note None
183  //! \par Override
184  //! Not allowed
185  //! @attention Don't call this method directly.
186  //--------------------------------------------------------------------------
187 
188  TKG3_DCBIO_V2();
189 
190  //!-------------------------------------------------------------------------
191  //! @brief Function block class desstructor method.
192  //! @note None
193  //! \par Override
194  //! Not allowed
195  //! @attention Don't call this method directly.
196  //--------------------------------------------------------------------------
197 
198  ~TKG3_DCBIO_V2();
199 
200  //!-------------------------------------------------------------------------
201  //! @brief Hardware mapping method.
202  //! @note None
203  //! @param [in] *struct_Registers_Base_Address - Base adress to register structure mapping
204  //! \par Override
205  //! Not allowed
206  //! @attention None
207  //--------------------------------------------------------------------------
208 
209  VOID Map( TKG3_DCBIO_V2_Registers *struct_Registers_Base_Address );
210 
211  //!-------------------------------------------------------------------------
212  //! @brief Function block initialisation method.
213  //! @note None
214  //! \par Override
215  //! Not allowed
216  //! @attention None
217  //--------------------------------------------------------------------------
218 
219  virtual VOID Init();
220 
221  //!-------------------------------------------------------------------------
222  //! @brief Function block execution method.
223  //! @note None
224  //! \par Override
225  //! Not allowed
226  //! @attention None
227  //--------------------------------------------------------------------------
228 
229  virtual VOID Execute();
230 
231  //!-------------------------------------------------------------------------
232  //! @brief Function block outputs execution method.
233  //! @note None
234  //! \par Override
235  //! Not allowed
236  //! @attention None
237  //--------------------------------------------------------------------------
238 
239  virtual VOID Execute_Outputs();
240 
241  //!-------------------------------------------------------------------------
242  //! @brief Function block inputs execution method.
243  //! @note None
244  //! \par Override
245  //! Not allowed
246  //! @attention None
247  //--------------------------------------------------------------------------
248 
249  virtual VOID Execute_Inputs();
250 
251  //!-------------------------------------------------------------------------
252  //! @brief Send information about driver over communication link protocol
253  //! @note This method sends information driver over specified communication link protocol.
254  //! @param [in] *object_Protocol - Pointer to the communication link protocol
255  //! @return None
256  //! \par Override
257  //! Not allowed
258  //! @attention None
259  //--------------------------------------------------------------------------
260 
261  virtual VOID Send_Information( TProtocol_Base *object_Protocol );
262 
263  //--------------------------------------------------------------------------
264  // Block parameters
265  //--------------------------------------------------------------------------
266 
267  //! @brief Analog input channel fill scale value. Also used for channel total gain adjustment.
269 
270  //! @brief Analog input channel offset
272 
273  //--------------------------------------------------------------------------
274  // Block inputs
275  //--------------------------------------------------------------------------
276 
277  //! @brief Ballast status
279 
280  //! @brief DC BUS offset
282 
283  //! @brief DC BUS gain
285 
286  //! @brief Ballast setpoint 1
288 
289  //! @brief Ballast setpoint 2
291 
292  //! @brief Precharge enable
294 
295  //! @brief Precharge enable
297 
298  //--------------------------------------------------------------------------
299  // Blocks outputs
300  //--------------------------------------------------------------------------
301 
302  //! @brief Analog input data block output connector
304 
305  //! @brief Critical hardware error flag
307 
308  //! @brief Hardware limit reached error flag
310 
311  //! @brief Software limit reached error flag
313 
314  //! @brief Ballast status signal
316 
317  //! @brief DC BUS voltage
319 
320  //! @brief Precharge fault
322 
323  //! @brief Ballast fault 1
325 
326  //! @brief Ballast fault 2
328 
329  //--------------------------------------------------------------------------
330  // Public variables
331  //--------------------------------------------------------------------------
332 
333  //! @brief Analog input status
335 
336  //! @brief Analog input data block output as I16
338 
339  //----------------------------------------------------------------------------
340  // Protected defines, methods and variables
341  //----------------------------------------------------------------------------
342 
343  protected:
344 
345  //----------------------------------------------------------------------------
346  // Private defines, methods and variables
347  //----------------------------------------------------------------------------
348 
349  private:
350 
351  //--------------------------------------------------------------------------
352  // Private defines
353  //--------------------------------------------------------------------------
354 
355  typedef union
356  {
357 
359 
360  struct
361  {
362 
363  U16 :1; // Bit 0 - Not used
364  U16 :1; // Bit 1 - Not used
365  U16 :1; // Bit 2 - Not used
366  U16 :1; // Bit 3 - Not used
367  U16 :1; // Bit 4 - Not used
368  U16 :1; // Bit 5 - Not used
369  U16 :1; // Bit 6 - Not used
370  U16 :1; // Bit 7 - Not used
371  U16 :1; // Bit 8 - Not used
372  U16 :1; // Bit 9 - Not used
373  U16 :1; // Bit 10 - Not used
374  U16 :1; // Bit 11 - Not used
375  U16 :1; // Bit 12 - Not used
376  U16 :1; // Bit 13 - Not used
377  U16 :1; // Bit 14 - Not used
378  U16 :1; // Bit 15 - Not used
379  };
380 
381  } TStatus;
382 
383  //! @brief Structure for bit parsing
384  typedef union
385  {
386 
387  //! @brief Raw data
389 
390  //! @brief Structure of the bits
391  struct
392  {
393 
394  //! @brief Bit 0, Channel 1
396 
397  //! @brief Bit 1, Channel 2
399 
400  //! @brief Bit 2, Channel 3
402 
403  //! @brief Bit 3, Channel 4
405 
406  //! @brief Bit 4, Channel 5
408 
409  //! @brief Bit 5, Channel 6
411 
412  //! @brief Bit 6, Channel 7
414 
415  //! @brief Bit 7, Channel 8
417 
418  //! @brief Bits 8..15, unused bits
419  U16 :8;
420 
421  };
422 
423  } TChannels;
424 
425  //--------------------------------------------------------------------------
426  // Private variables
427  //--------------------------------------------------------------------------
428 
429  //! @brief Pointer to register in FPGA
431 
432  //! @brief Status register
434 
435  //! @brief Control register
437 
438  //! @brief Effective gain of the voltage measurement channel
440 
441  //! @brief Effective offset of the voltage measurement channel
443 
444 };
445 
446 //------------------------------------------------------------------------------
447 // End of file
448 //------------------------------------------------------------------------------
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
DC bus board P015.05 V1.0 class.
Definition: KG3_DCBIO_V2.h:74
F32 f32_Offset
Effective offset of the voltage measurement channel.
Definition: KG3_DCBIO_V2.h:442
U16 u16_Status
Status register.
Definition: KG3_DCBIO_V2.h:433
TBlock_Input_Connector object_f32_Analog_Input_Offset
Analog input channel offset.
Definition: KG3_DCBIO_V2.h:271
TBlock_Output_Connector object_bool_Precharge_Fault
Precharge fault.
Definition: KG3_DCBIO_V2.h:321
virtual VOID Execute_Outputs()
Function block outputs execution method.
Definition: KG3_DCBIO_V2.cpp:193
TBlock_Input_Connector object_f32_Ballast_Setpoint_2
Ballast setpoint 2.
Definition: KG3_DCBIO_V2.h:290
U16 u16_Control
Control register.
Definition: KG3_DCBIO_V2.h:436
virtual VOID Execute_Inputs()
Function block inputs execution method.
Definition: KG3_DCBIO_V2.cpp:148
TBlock_Input_Connector object_bool_Emergency_Stop
Precharge enable.
Definition: KG3_DCBIO_V2.h:296
U16 u16_Analog_Input_Status
Analog input status.
Definition: KG3_DCBIO_V2.h:334
TBlock_Input_Connector object_f32_DC_BUS_Offset
DC BUS offset.
Definition: KG3_DCBIO_V2.h:281
virtual VOID Init()
Function block initialisation method.
Definition: KG3_DCBIO_V2.cpp:132
F32 f32_Gain
Effective gain of the voltage measurement channel.
Definition: KG3_DCBIO_V2.h:439
TBlock_Input_Connector object_f32_Ballast_Setpoint_1
Ballast setpoint 1.
Definition: KG3_DCBIO_V2.h:287
TBlock_Output_Connector object_bool_Hardware_Error
Critical hardware error flag.
Definition: KG3_DCBIO_V2.h:306
TBlock_Output_Connector object_bool_Hardware_Limit_Error
Hardware limit reached error flag.
Definition: KG3_DCBIO_V2.h:309
TBlock_Output_Connector object_bool_Ballast_Fault_1
Ballast fault 1.
Definition: KG3_DCBIO_V2.h:324
volatile TKG3_DCBIO_V2_Registers * struct_Registers
Pointer to register in FPGA.
Definition: KG3_DCBIO_V2.h:430
TBlock_Output_Connector object_f32_Analog_Input_Data
Analog input data block output connector.
Definition: KG3_DCBIO_V2.h:303
TBlock_Output_Connector object_bool_Ballast_Error
Ballast status signal.
Definition: KG3_DCBIO_V2.h:315
TBlock_Output_Connector object_bool_Software_Limit_Error
Software limit reached error flag.
Definition: KG3_DCBIO_V2.h:312
TBlock_Output_Connector object_bool_Ballast_Fault_2
Ballast fault 2.
Definition: KG3_DCBIO_V2.h:327
virtual VOID Send_Information(TProtocol_Base *object_Protocol)
Send information about driver over communication link protocol.
Definition: KG3_DCBIO_V2.cpp:226
TBlock_Output_Connector object_f32_DC_BUS_Voltage
DC BUS voltage.
Definition: KG3_DCBIO_V2.h:318
TKG3_DCBIO_V2()
Function block class constructor method.
Definition: KG3_DCBIO_V2.cpp:66
TBlock_Input_Connector object_f32_DC_BUS_GAIN
DC BUS gain.
Definition: KG3_DCBIO_V2.h:284
TBlock_Input_Connector object_f32_Analog_Input_Full_Scale
Analog input channel fill scale value. Also used for channel total gain adjustment.
Definition: KG3_DCBIO_V2.h:268
~TKG3_DCBIO_V2()
Function block class desstructor method.
Definition: KG3_DCBIO_V2.cpp:112
TBlock_Input_Connector object_bool_Ballast_Control
Ballast status.
Definition: KG3_DCBIO_V2.h:278
TBlock_Input_Connector object_bool_Precharge_Enable
Precharge enable.
Definition: KG3_DCBIO_V2.h:293
VOID Map(TKG3_DCBIO_V2_Registers *struct_Registers_Base_Address)
Hardware mapping method.
Definition: KG3_DCBIO_V2.cpp:120
virtual VOID Execute()
Function block execution method.
Definition: KG3_DCBIO_V2.cpp:185
I16 i16_Analog_Input_Data
Analog input data block output as I16.
Definition: KG3_DCBIO_V2.h:337
Definition: Protocol_Base.h:57
Register structure for generic access.
Definition: KG3_DCBIO_V2.h:88
U16 u16_Positive_Rail_Voltage_Latch_Register
0x09 : Positive rail voltage latch register address
Definition: KG3_DCBIO_V2.h:118
U16 u16_Negative_Rail_Voltage_Status_Register
0x0E : Negative rail voltage status register
Definition: KG3_DCBIO_V2.h:133
U16 u16_Positive_Rail_Voltage_Parity_Error_Counter_Register
0x0D : Positive rail voltage parity error counter register
Definition: KG3_DCBIO_V2.h:130
U16 u16_Reserve_05
0x05 : Reserved
Definition: KG3_DCBIO_V2.h:106
U16 u16_Reserve_12
0x12 : Reserved
Definition: KG3_DCBIO_V2.h:145
U16 u16_Unit_ID_H
0x01 : Module identification register
Definition: KG3_DCBIO_V2.h:94
U16 u16_Negative_Rail_Voltage_Register
0x14 : Negative rail voltage register
Definition: KG3_DCBIO_V2.h:151
U16 u16_Reserve_04
0x04 : Reserved
Definition: KG3_DCBIO_V2.h:103
U16 u16_Positive_Rail_Voltage_Sync_Error_Counter_Register
0x0C : Positive rail voltage sync error counter register
Definition: KG3_DCBIO_V2.h:127
U16 u16_Digital_Input_Register
0x1A : Digital input register
Definition: KG3_DCBIO_V2.h:169
U16 u16_Negative_Rail_Voltage_Sensor_ID_Register
0x13 : Negative rail voltage sensor id register
Definition: KG3_DCBIO_V2.h:148
U16 u16_Negative_Rail_Voltage_Timeout_Error_Counter_Register
0x17 : Negative rail voltage timeout error counter register
Definition: KG3_DCBIO_V2.h:160
U16 u16_Negative_Rail_Voltage_General_Error_Counter_Register
0x16 : Negative rail voltage general error counter register
Definition: KG3_DCBIO_V2.h:157
U16 u16_Positive_Rail_Voltage_Timeout_Error_Counter_Register
0x0B : Positive rail voltage timeout error counter register
Definition: KG3_DCBIO_V2.h:124
U16 u16_Negative_Rail_Voltage_Control_Register
0x0F : Negative rail voltage control register
Definition: KG3_DCBIO_V2.h:136
U16 u16_Reserve_11
0x11 : Reserved
Definition: KG3_DCBIO_V2.h:142
U16 u16_Positive_Rail_Voltage_General_Error_Counter_Register
0x0A : Positive rail voltage general error counter register
Definition: KG3_DCBIO_V2.h:121
U16 u16_Reserve_06
0x06 : Reserved
Definition: KG3_DCBIO_V2.h:109
U16 u16_Control_Register
0x03 : Control register
Definition: KG3_DCBIO_V2.h:100
U16 u16_Unit_ID_L
0x00 : Module identification register
Definition: KG3_DCBIO_V2.h:91
U16 u16_Negative_Rail_Voltage_Sync_Error_Counter_Register
0x18 : Negative rail voltage sync error counter register
Definition: KG3_DCBIO_V2.h:163
U16 u16_Status_Register
0x02 : Status register
Definition: KG3_DCBIO_V2.h:97
U16 u16_Negative_Rail_Voltage_Parity_Error_Counter_Register
0x19 : Negative rail voltage parity error counter register
Definition: KG3_DCBIO_V2.h:166
U16 u16_Reserve_10
0x10 : Reserved
Definition: KG3_DCBIO_V2.h:139
U16 u16_Negative_Rail_Voltage_Latch_Register
0x15 : Negative rail voltage latch register address
Definition: KG3_DCBIO_V2.h:154
U16 u16_Digital_Output_Register
0x1B : Digital Output register
Definition: KG3_DCBIO_V2.h:172
U16 u16_Positive_Rail_Voltage_Sensor_ID_Register
0x07 : Positive rail voltage sensor ID register
Definition: KG3_DCBIO_V2.h:112
U16 u16_Positive_Rail_Voltage_Register
0x08 : Positive rail voltage register
Definition: KG3_DCBIO_V2.h:115
U16 bool_Channel_7
Bit 6, Channel 7.
Definition: KG3_DCBIO_V2.h:413
U16 bool_Channel_5
Bit 4, Channel 5.
Definition: KG3_DCBIO_V2.h:407
U16 bool_Channel_2
Bit 1, Channel 2.
Definition: KG3_DCBIO_V2.h:398
U16 bool_Channel_1
Bit 0, Channel 1.
Definition: KG3_DCBIO_V2.h:395
U16 u16_Channels
Raw data.
Definition: KG3_DCBIO_V2.h:388
U16 bool_Channel_4
Bit 3, Channel 4.
Definition: KG3_DCBIO_V2.h:404
U16 bool_Channel_8
Bit 7, Channel 8.
Definition: KG3_DCBIO_V2.h:416
U16 bool_Channel_6
Bit 5, Channel 6.
Definition: KG3_DCBIO_V2.h:410
U16 bool_Channel_3
Bit 2, Channel 3.
Definition: KG3_DCBIO_V2.h:401
U16 u16_Status
Definition: KG3_DCBIO_V2.h:358