ConOpSys V2970  P004.07
ANVILEX control operating system
P021_12_KG3_Electrical_Model_Emulator.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file P021_12_KG3_Electrical_Model_Emulator.h
3 //! @author ANVILEX GmbH
4 //! @version V1.0
5 //! @date 19.05.2021
6 //! @brief Electrical model emulator class header file.
7 //! @attention
8 //!
9 //! COPYRIGHT(C) 2021 ANVILEX GmbH
10 //!
11 //! Redistribution and use in source and binary forms, with or without
12 //! modification, are permitted provided that the following conditions are met:
13 //!
14 //! 1. Redistributions of source code must retain the above copyright notice,
15 //! this list of conditions and the following disclaimer.
16 //!
17 //! 2. Redistributions in binary form must reproduce the above copyright notice,
18 //! this list of conditions and the following disclaimer in the documentation
19 //! and/or other materials provided with the distribution.
20 //!
21 //! 3. Neither the name of ANVILEX nor the names of its contributors may be
22 //! used to endorse or promote products derived from this software without
23 //! specific prior written permission.
24 //!
25 //! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 //! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 //! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 //! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
29 //! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30 //! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31 //! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32 //! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33 //! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 //! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35 //! POSSIBILITY OF SUCH DAMAGE.
36 //------------------------------------------------------------------------------
37 
38 //------------------------------------------------------------------------------
39 // Protecting header files from mutual, recursive inclusion.
40 //------------------------------------------------------------------------------
41 
42 #pragma once
43 
44 //------------------------------------------------------------------------------
45 // Include standard libraries header files
46 //------------------------------------------------------------------------------
47 
48 //------------------------------------------------------------------------------
49 // Include thrid party header files
50 //------------------------------------------------------------------------------
51 
52 //------------------------------------------------------------------------------
53 // Include ConOpSys header files
54 //------------------------------------------------------------------------------
55 
56 #include "Function_Block_Base.h"
57 
58 //------------------------------------------------------------------------------
59 // Include ConOpSys application header files
60 //------------------------------------------------------------------------------
61 
62 //------------------------------------------------------------------------------
63 // Macros
64 //------------------------------------------------------------------------------
65 
66 //------------------------------------------------------------------------------
67 //! @brief Function block class declaration
68 //------------------------------------------------------------------------------
69 
71 {
72 
73  //----------------------------------------------------------------------------
74  // Public variables and methods
75  //----------------------------------------------------------------------------
76 
77  public:
78 
79  //! @brief Register structure for generic access
80  typedef struct
81  {
82 
83  //! @brief 0x00 : Module identification register
85 
86  //! @brief 0x01 : Module identification register
88 
89  //! @brief 0x02 : Control register
91 
92  //! @brief 0x03 : Status register
94 
95  //! @brief 0x04 : Grid A phase voltage raw data register address
97 
98  //! @brief 0x05 : Grid B phase voltage raw data register address
100 
101  //! @brief 0x06 : Grid C phase voltage raw data register address
103 
104  //! @brief 0x07 : Grid side inverter A phase voltage raw data register address
106 
107  //! @brief 0x08 : Grid side inverter B phase voltage raw data register address
109 
110  //! @brief 0x09 : Grid side inverter C phase voltage raw data register address
112 
113  //! @brief 0x0A : Stator A phase voltage raw data register address
115 
116  //! @brief 0x0B : Stator B phase voltage raw data register address
118 
119  //! @brief 0x0C : Stator C phase voltage raw data register address
121 
122  //! @brief 0x0D : Grid A phase current raw data register address
124 
125  //! @brief 0x0E : Grid B phase current raw data register address
127 
128  //! @brief 0x0F : Grid C phase current raw data register address
130 
131  //! @brief 0x10 : Grid side inverter A phase current raw data register address
133 
134  //! @brief 0x11 : Grid side inverter B phase current raw data register address
136 
137  //! @brief 0x12 : Grid side inverter C phase current raw data register address
139 
140  //! @brief 0x13 : Rotor side inverter A phase current raw data register address
142 
143  //! @brief 0x14 : Rotor side inverter B phase current raw data register address
145 
146  //! @brief 0x15 : Rotor side inverter C phase current raw data register address
148 
149  //! @brief 0x16 : Smoothing capacitor voltage raw data register address
151 
152  //! @brief 0x17
154 
156 
157  //--------------------------------------------------------------------------
158  // Constructor and destructor methods
159  //--------------------------------------------------------------------------
160 
161  //!-------------------------------------------------------------------------
162  //! @brief Function block class constructor method.
163  //! @note None
164  //! \par Override
165  //! Not allowed
166  //! @attention Don't call this method directly.
167  //--------------------------------------------------------------------------
168 
170 
171  //!-------------------------------------------------------------------------
172  //! @brief Function block class desstructor method.
173  //! @note None
174  //! \par Override
175  //! Not allowed
176  //! @attention Don't call this method directly.
177  //--------------------------------------------------------------------------
178 
180 
181  //!-------------------------------------------------------------------------
182  //! @brief Hardware mapping method.
183  //! @note None
184  //! @param [in] *struct_Registers_Base_Address - Base adress to register structure mapping
185  //! \par Override
186  //! Not allowed
187  //! @attention None
188  //--------------------------------------------------------------------------
189 
190  VOID Map( TP021_12_KG3_Electrical_Model_Emulator_registers *struct_Registers_Base_Address );
191 
192  //--------------------------------------------------------------------------
193  // Function block data processing methods
194  //--------------------------------------------------------------------------
195 
196  //!-------------------------------------------------------------------------
197  //! @brief Function block initialisation method.
198  //! @note None
199  //! \par Override
200  //! Not allowed
201  //! @attention None
202  //--------------------------------------------------------------------------
203 
204  virtual VOID Init();
205 
206  //!-------------------------------------------------------------------------
207  //! @brief Function block execution method.
208  //! @note None
209  //! \par Override
210  //! Not allowed
211  //! @attention None
212  //--------------------------------------------------------------------------
213 
214  virtual VOID Execute();
215 
216  //--------------------------------------------------------------------------
217  // Function block parameters
218  //--------------------------------------------------------------------------
219 
220  //--------------------------------------------------------------------------
221  // Function block inputs
222  //--------------------------------------------------------------------------
223 
224  //--------------------------------------------------------------------------
225  // Function block outputs
226  //--------------------------------------------------------------------------
227 
228  //--------------------------------------------------------------------------
229  // PWM grid side transistors statuses
230  //--------------------------------------------------------------------------
231 
232  //! @brief First transistor PWM status
233  //TBlock_Output_Connector object_bool_PWM_GSI_1_Status;
234 
235  //! @brief Second transistor PWM status
236  //TBlock_Output_Connector object_bool_PWM_GSI_2_Status;
237 
238  //! @brief Third transistor PWM status
239  //TBlock_Output_Connector object_bool_PWM_GSI_3_Status;
240 
241  //! @brief Fourth transistor PWM status
242  //TBlock_Output_Connector object_bool_PWM_GSI_4_Status;
243 
244  //! @brief Fifth transistor PWM status
245  //TBlock_Output_Connector object_bool_PWM_GSI_5_Status;
246 
247  //! @brief Sixth transistor PWM status
248  //TBlock_Output_Connector object_bool_PWM_GSI_6_Status;
249 
250  //--------------------------------------------------------------------------
251  // PWM rotor side transistors statuses
252  //--------------------------------------------------------------------------
253 
254  //! @brief First transistor PWM status
255  //TBlock_Output_Connector object_bool_PWM_RSI_1_Status;
256 
257  //! @brief Second transistor PWM status
258  //TBlock_Output_Connector object_bool_PWM_RSI_2_Status;
259 
260  //! @brief Third transistor PWM status
261  //TBlock_Output_Connector object_bool_PWM_RSI_3_Status;
262 
263  //! @brief Fourth transistor PWM status
264  //TBlock_Output_Connector object_bool_PWM_RSI_4_Status;
265 
266  //! @brief Fifth transistor PWM status
267  //TBlock_Output_Connector object_bool_PWM_RSI_5_Status;
268 
269  //! @brief Sixth transistor PWM status
270  //TBlock_Output_Connector object_bool_PWM_RSI_6_Status;
271 
272  //--------------------------------------------------------------------------
273  // Grid circuit breaker status
274  //--------------------------------------------------------------------------
275 
276  //! @brief Grid circuit breaker status
277  //TBlock_Output_Connector object_bool_Grid_CB_Status;
278 
279  //--------------------------------------------------------------------------
280  // Grid side inventer circuit breaker status
281  //--------------------------------------------------------------------------
282 
283  //! @brief Grid side inventer circuit breaker status
284  //TBlock_Output_Connector object_bool_GSI_CB_Status;
285 
286  //----------------------------------------------------------------------------
287  // Protected variables and methods
288  //----------------------------------------------------------------------------
289 
290  protected:
291 
292  //----------------------------------------------------------------------------
293  // Private variables and methods
294  //----------------------------------------------------------------------------
295 
296  private:
297 
298  //! @brief Structure control register for bit parsing
299  typedef union
300  {
301 
302  //! @brief Raw data
304 
305  //! @brief Structure of the bits
306  struct
307  {
308 
309  //! @brief Bit 0, First GSI transistor PWM control
311 
312  //! @brief Bit 1, Second GSI transistor PWM control
314 
315  //! @brief Bit 2, Third GSI transistor PWM control
317 
318  //! @brief Bit 3, Fourth GSI transistor PWM control
320 
321  //! @brief Bit 4, Fifth GSI transistor PWM control
323 
324  //! @brief Bit 5, Sixth GSI transistor PWM control
326 
327  //! @brief Bit 6, First RSI transistor PWM control
329 
330  //! @brief Bit 7, Second RSI transistor PWM control
332 
333  //! @brief Bit 8, Third RSI transistor PWM control
335 
336  //! @brief Bit 9, Fourth RSI transistor PWM control
338 
339  //! @brief Bit 10, Fifth RSI transistor PWM control
341 
342  //! @brief Bit 11, Sixth RSI transistor PWM control
344 
345  //! @brief Bit 12, Grid circuit breaker control
347 
348  //! @brief Bit 13, Grid side inverter circuit breaker control
350 
351  // @brief Bit 14, First ballast resistor control
353 
354  // @brief Bit 15, Second ballast resistor control
356 
357  };
358 
359  }TControl_Register;
360 
361 
362  //! @brief Structure status register for bit parsing
363  typedef union
364  {
365 
366  //! @brief Raw data
368 
369  //! @brief Structure of the bits
370  struct
371  {
372 
373  //! @brief Bit 0, First GSI transistor PWM status
375 
376  //! @brief Bit 1, Second GSI transistor PWM status
378 
379  //! @brief Bit 2, Third GSI transistor PWM status
381 
382  //! @brief Bit 3, Fourth GSI transistor PWM status
384 
385  //! @brief Bit 4, Fifth GSI transistor PWM status
387 
388  //! @brief Bit 5, Sixth GSI transistor PWM status
390 
391  //! @brief Bit 6, First RSI transistor PWM status
393 
394  //! @brief Bit 7, Second RSI transistor PWM status
396 
397  //! @brief Bit 8, Third RSI transistor PWM status
399 
400  //! @brief Bit 9, Fourth RSI transistor PWM status
402 
403  //! @brief Bit 10, Fifth RSI transistor PWM status
405 
406  //! @brief Bit 11, Sixth RSI transistor PWM status
408 
409  //! @brief Bit 12, Grid circuit breaker status
411 
412  //! @brief Bit 13, Grid side inverter circuit breaker status
414 
415  // @brief Bit 14, First ballast resistor status
417 
418  // @brief Bit 14, Second ballast resistor status
420 
421  };
422 
423  }TStatus_Register;
424 
425  //! @brief Pointer to the memory area in FPGA address space
427 
428 };
429 
430 //------------------------------------------------------------------------------
431 // End of file
432 //------------------------------------------------------------------------------
void VOID
Datatypesess datatype definition.
Definition: Defines.h:105
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 base class for device.
Definition: Function_Block_Base.h:96
Function block class declaration.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:71
volatile TP021_12_KG3_Electrical_Model_Emulator_registers * struct_Registers
Pointer to the memory area in FPGA address space.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:426
~TP021_12_KG3_Electrical_Model_Emulator()
Function block class desstructor method.
Definition: P021_12_KG3_Electrical_Model_Emulator.cpp:101
virtual VOID Execute()
Function block execution method.
Definition: P021_12_KG3_Electrical_Model_Emulator.cpp:138
virtual VOID Init()
Function block initialisation method.
Definition: P021_12_KG3_Electrical_Model_Emulator.cpp:125
VOID Map(TP021_12_KG3_Electrical_Model_Emulator_registers *struct_Registers_Base_Address)
Hardware mapping method.
Definition: P021_12_KG3_Electrical_Model_Emulator.cpp:109
TP021_12_KG3_Electrical_Model_Emulator()
Function block class constructor method.
Definition: P021_12_KG3_Electrical_Model_Emulator.cpp:66
Register structure for generic access.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:81
I16 i16_Phase_A_Grid_Side_Inverter_Current_Raw_Data_Register
0x10 : Grid side inverter A phase current raw data register address
Definition: P021_12_KG3_Electrical_Model_Emulator.h:132
I16 i16_Phase_B_Rotor_Side_Inverter_Current_Raw_Data_Register
0x14 : Rotor side inverter B phase current raw data register address
Definition: P021_12_KG3_Electrical_Model_Emulator.h:144
I16 i16_Phase_C_Stator_Voltage_Raw_Data_Register
0x0C : Stator C phase voltage raw data register address
Definition: P021_12_KG3_Electrical_Model_Emulator.h:120
I16 i16_Phase_A_Grid_Current_Raw_Data_Register
0x0D : Grid A phase current raw data register address
Definition: P021_12_KG3_Electrical_Model_Emulator.h:123
U16 u16_Control_Register
0x02 : Control register
Definition: P021_12_KG3_Electrical_Model_Emulator.h:90
I16 i16_Phase_A_Stator_Voltage_Raw_Data_Register
0x0A : Stator A phase voltage raw data register address
Definition: P021_12_KG3_Electrical_Model_Emulator.h:114
I16 i16_Phase_B_Grid_Voltage_Raw_Data_Register
0x05 : Grid B phase voltage raw data register address
Definition: P021_12_KG3_Electrical_Model_Emulator.h:99
I16 i16_Phase_C_Grid_Side_Inverter_Voltage_Raw_Data_Register
0x09 : Grid side inverter C phase voltage raw data register address
Definition: P021_12_KG3_Electrical_Model_Emulator.h:111
U16 u16_Unit_ID_L
0x00 : Module identification register
Definition: P021_12_KG3_Electrical_Model_Emulator.h:84
I16 i16_Phase_A_Rotor_Side_Inverter_Current_Raw_Data_Register
0x13 : Rotor side inverter A phase current raw data register address
Definition: P021_12_KG3_Electrical_Model_Emulator.h:141
I16 i16_Smoothing_Capacitor_Voltage_Raw_Data_Register
0x16 : Smoothing capacitor voltage raw data register address
Definition: P021_12_KG3_Electrical_Model_Emulator.h:150
U16 u16_Status_Register
0x03 : Status register
Definition: P021_12_KG3_Electrical_Model_Emulator.h:93
U16 u16_Encoder_Raw_Data_Register
0x17
Definition: P021_12_KG3_Electrical_Model_Emulator.h:153
I16 i16_Phase_A_Grid_Voltage_Raw_Data_Register
0x04 : Grid A phase voltage raw data register address
Definition: P021_12_KG3_Electrical_Model_Emulator.h:96
I16 i16_Phase_C_Grid_Voltage_Raw_Data_Register
0x06 : Grid C phase voltage raw data register address
Definition: P021_12_KG3_Electrical_Model_Emulator.h:102
I16 i16_Phase_B_Grid_Side_Inverter_Current_Raw_Data_Register
0x11 : Grid side inverter B phase current raw data register address
Definition: P021_12_KG3_Electrical_Model_Emulator.h:135
U16 u16_Unit_ID_H
0x01 : Module identification register
Definition: P021_12_KG3_Electrical_Model_Emulator.h:87
I16 i16_Phase_A_Grid_Side_Inverter_Voltage_Raw_Data_Register
0x07 : Grid side inverter A phase voltage raw data register address
Definition: P021_12_KG3_Electrical_Model_Emulator.h:105
I16 i16_Phase_B_Stator_Voltage_Raw_Data_Register
0x0B : Stator B phase voltage raw data register address
Definition: P021_12_KG3_Electrical_Model_Emulator.h:117
I16 i16_Phase_C_Grid_Current_Raw_Data_Register
0x0F : Grid C phase current raw data register address
Definition: P021_12_KG3_Electrical_Model_Emulator.h:129
I16 i16_Phase_B_Grid_Current_Raw_Data_Register
0x0E : Grid B phase current raw data register address
Definition: P021_12_KG3_Electrical_Model_Emulator.h:126
I16 i16_Phase_C_Grid_Side_Inverter_Current_Raw_Data_Register
0x12 : Grid side inverter C phase current raw data register address
Definition: P021_12_KG3_Electrical_Model_Emulator.h:138
I16 i16_Phase_B_Grid_Side_Inverter_Voltage_Raw_Data_Register
0x08 : Grid side inverter B phase voltage raw data register address
Definition: P021_12_KG3_Electrical_Model_Emulator.h:108
I16 i16_Phase_C_Rotor_Side_Inverter_Current_Raw_Data_Register
0x15 : Rotor side inverter C phase current raw data register address
Definition: P021_12_KG3_Electrical_Model_Emulator.h:147
U16 bool_PWM_GSI_1_Control
Bit 0, First GSI transistor PWM control.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:310
U16 u16_Raw_Data
Raw data.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:303
U16 bool_PWM_RSI_6_Control
Bit 11, Sixth RSI transistor PWM control.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:343
U16 bool_PWM_RSI_3_Control
Bit 8, Third RSI transistor PWM control.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:334
U16 bool_GSI_CB_Control
Bit 13, Grid side inverter circuit breaker control.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:349
U16 bool_PWM_RSI_2_Control
Bit 7, Second RSI transistor PWM control.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:331
U16 bool_PWM_GSI_6_Control
Bit 5, Sixth GSI transistor PWM control.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:325
U16 bool_PWM_GSI_5_Control
Bit 4, Fifth GSI transistor PWM control.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:322
U16 bool_PWM_RSI_4_Control
Bit 9, Fourth RSI transistor PWM control.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:337
U16 bool_PWM_RSI_5_Control
Bit 10, Fifth RSI transistor PWM control.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:340
U16 bool_Second_Ballast_Control
Definition: P021_12_KG3_Electrical_Model_Emulator.h:355
U16 bool_PWM_GSI_4_Control
Bit 3, Fourth GSI transistor PWM control.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:319
U16 bool_Grid_CB_Control
Bit 12, Grid circuit breaker control.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:346
U16 bool_PWM_RSI_1_Control
Bit 6, First RSI transistor PWM control.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:328
U16 bool_PWM_GSI_2_Control
Bit 1, Second GSI transistor PWM control.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:313
U16 bool_PWM_GSI_3_Control
Bit 2, Third GSI transistor PWM control.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:316
U16 bool_First_Ballast_Control
Definition: P021_12_KG3_Electrical_Model_Emulator.h:352
U16 bool_Grid_CB_Status
Bit 12, Grid circuit breaker status.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:410
U16 bool_PWM_GSI_2_Status
Bit 1, Second GSI transistor PWM status.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:377
U16 bool_PWM_RSI_4_Status
Bit 9, Fourth RSI transistor PWM status.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:401
U16 bool_PWM_GSI_1_Status
Bit 0, First GSI transistor PWM status.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:374
U16 bool_GSI_CB_Status
Bit 13, Grid side inverter circuit breaker status.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:413
U16 bool_PWM_RSI_3_Status
Bit 8, Third RSI transistor PWM status.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:398
U16 bool_PWM_GSI_3_Status
Bit 2, Third GSI transistor PWM status.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:380
U16 bool_PWM_GSI_5_Status
Bit 4, Fifth GSI transistor PWM status.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:386
U16 bool_PWM_GSI_4_Status
Bit 3, Fourth GSI transistor PWM status.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:383
U16 u16_Raw_Data
Raw data.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:367
U16 bool_First_Ballast_Status
Definition: P021_12_KG3_Electrical_Model_Emulator.h:416
U16 bool_PWM_RSI_5_Status
Bit 10, Fifth RSI transistor PWM status.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:404
U16 bool_Second_Ballast_Status
Definition: P021_12_KG3_Electrical_Model_Emulator.h:419
U16 bool_PWM_GSI_6_Status
Bit 5, Sixth GSI transistor PWM status.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:389
U16 bool_PWM_RSI_1_Status
Bit 6, First RSI transistor PWM status.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:392
U16 bool_PWM_RSI_6_Status
Bit 11, Sixth RSI transistor PWM status.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:407
U16 bool_PWM_RSI_2_Status
Bit 7, Second RSI transistor PWM status.
Definition: P021_12_KG3_Electrical_Model_Emulator.h:395