ConOpSys V2970  P004.07
ANVILEX control operating system
Function_Block_SRF_PLL.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 //! @file Function_Block_SRF_PLL.h
3 //! @author ANVILEX GmbH
4 //! @version V1.0
5 //! @date 16.05.2015
6 //! @brief SRF PLL class header file.
7 //! @attention
8 //!
9 //! COPYRIGHT(C) 2015 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 // TFunction_Block_SRF_PLL
39 //
40 //------------------------------------------------------------------------------
41 
42 //------------------------------------------------------------------------------
43 // Protecting header files from mutual, recursive inclusion.
44 //------------------------------------------------------------------------------
45 
46 #pragma once
47 
48 //------------------------------------------------------------------------------
49 // Include standard libraries header files
50 //------------------------------------------------------------------------------
51 
52 //------------------------------------------------------------------------------
53 // Include thrid party header files
54 //------------------------------------------------------------------------------
55 
56 //------------------------------------------------------------------------------
57 // Include ConOpSys header files
58 //------------------------------------------------------------------------------
59 
60 #include "Function_Block_Base.h"
61 
62 //------------------------------------------------------------------------------
63 // Include ConOpSys application header files
64 //------------------------------------------------------------------------------
65 
66 //------------------------------------------------------------------------------
67 // Macros
68 //------------------------------------------------------------------------------
69 
70 //------------------------------------------------------------------------------
71 //! @brief Class declaration description
72 //------------------------------------------------------------------------------
73 
75 {
76 
77  //----------------------------------------------------------------------------
78  // Public defines, methods and variables
79  //----------------------------------------------------------------------------
80 
81  public:
82 
83  //--------------------------------------------------------------------------
84  // Public methods
85  //--------------------------------------------------------------------------
86 
87  //!-------------------------------------------------------------------------
88  //! @brief Class constructor method.
89  //! @note None
90  //! \par Override
91  //! Not allowed
92  //! @attention Don't call this method directly.
93  //--------------------------------------------------------------------------
94 
96 
97  //!-------------------------------------------------------------------------
98  //! @brief Class destructor method.
99  //! @note None
100  //! \par Override
101  //! Not allowed
102  //! @attention Don't call this method directly.
103  //--------------------------------------------------------------------------
104 
105  virtual ~TFunction_Block_SRF_PLL();
106 
107  //!-------------------------------------------------------------------------
108  //! @brief Function block initialisation method.
109  //! @note None
110  //! \par Override
111  //! Not allowed
112  //! @attention Don't call this method directly.
113  //--------------------------------------------------------------------------
114 
115  virtual VOID Init();
116 
117  //!-------------------------------------------------------------------------
118  //! @brief Function block execution method.
119  //! @note None
120  //! \par Override
121  //! Not allowed
122  //! @attention None
123  //--------------------------------------------------------------------------
124 
125  virtual VOID Execute();
126 
127  //!-------------------------------------------------------------------------
128  //! @brief Send information about Function block over communication link protocol
129  //! @note This method sends information about Function block over specified communication link protocol.
130  //! @param [in] TProtocol_Base *object_Protocol - Pointer to the communication link protocol
131  //! @return None
132  //! \par Override
133  //! Not allowed
134  //! @attention None
135  //--------------------------------------------------------------------------
136 
137  virtual VOID Send_Information( TProtocol_Base *object_Protocol );
138 
139  //--------------------------------------------------------------------------
140  // Public variables
141  //--------------------------------------------------------------------------
142 
143  //--------------------------------------------------------------------------
144  // Function block parameter connectors
145  //--------------------------------------------------------------------------
146 
147  TBlock_Input_Connector object_f32_Base_Magnitude; //!< Base magnitude of the input signal
148  TBlock_Input_Connector object_f32_Base_Frequency; //!< Base frequency of the input signal in herz
149  TBlock_Input_Connector object_f32_Maximal_Frequency_Limit; //!< Minimal tracked frequency in herz
150  TBlock_Input_Connector object_f32_Minimal_Frequency_Limit; //!< Maximal tracked frequency in herz
151  TBlock_Input_Connector object_f32_Zetta; //!< Damping factor : 0.7
152  TBlock_Input_Connector object_f32_Delta; //!< Tolerance band in part per hundret : 0.05 (5%) oder 0.02 (2%)
153  TBlock_Input_Connector object_f32_Ts; //!< Settling time in seconds : 0.03s
154  TBlock_Input_Connector object_f32_Theta_Offset; //!< Output angle phase offset in radian
155  TBlock_Input_Connector object_f32_Sample_Time; //!< Sample time given in seconds
156 
157  //--------------------------------------------------------------------------
158  // Function block input connectors
159  //--------------------------------------------------------------------------
160 
161  TBlock_Input_Connector object_bool_Enable; //!< Enable PLL operation input signal
162  TBlock_Input_Connector object_f32_A; //!< Input signal phase A
163  TBlock_Input_Connector object_f32_B; //!< Input signal phase B
164  TBlock_Input_Connector object_f32_C; //!< Input signal phase C
165 
166  //--------------------------------------------------------------------------
167  // Function block output connectors
168  //--------------------------------------------------------------------------
169 
170  TBlock_Output_Connector object_f32_Frequency; //!< Frequency of the input signal in herz
171  TBlock_Output_Connector object_f32_Omega; //!< Angular frequency of the input signal in radian per seconds
172  TBlock_Output_Connector object_f32_Theta; //!< Actual phase of the input signal in radian
173 
175 
176  //----------------------------------------------------------------------------
177  // Protected methods and variables
178  //----------------------------------------------------------------------------
179 
180  protected:
181 
182  //----------------------------------------------------------------------------
183  // Private methods and variables
184  //----------------------------------------------------------------------------
185 
186  private:
187 
188  //--------------------------------------------------------------------------
189  // Private variables
190  //--------------------------------------------------------------------------
191 
192  //! @brief Base frequency in rad/s
194 
195  //! @brief Minimal tracked frequency
197 
198  //! @brief Maximal tracked frequency
200 
201 // //! @brief Alpha component of input signal
202 // F32 f32_Alpha;
203 
204 // //! @brief Beta component of input signal
205 // F32 f32_Beta;
206 
207  //! @brief D component of input signal
209 
210  //! @brief Q component of input signal
212 
213  //--------------------------------------------------------------------------
214  // LPF related variables
215  //--------------------------------------------------------------------------
216 
217  //! @brief LPF natural frequency in radian per second
219 
220  //! @brief LPF time constant
222 
223  //! @brief LPF proportional gain
225 
226  //! @brief LPF integral gain
228 
229 // //! @brief LPF temporary output
230 // F32 f32_LPF_Temporary_Output;
231 
232  //! @brief Internal variable
234 
235  //! @brief Internal variable
237 
238  //! @brief LPF output
240 
241  //--------------------------------------------------------------------------
242  // PI regulator related variables
243  //--------------------------------------------------------------------------
244 
245  //! @brief Proportianal gain of PI regulator
247 
248  //! @brief Integral gain of PI regulator
250 
251  //! @brief PI regulator intergral storage
253 
254  //--------------------------------------------------------------------------
255  // Angle integrator related variables
256  //--------------------------------------------------------------------------
257 
258  //! @brief Phase angle
260 
261  //! @brief Sinus value
263 
264  //! @brief Cosuinus value
266 
267  //--------------------------------------------------------------------------
268  // Status related variables
269  //--------------------------------------------------------------------------
270 
271  //! @brief PLL locked delay time
273 
274  //! @brief Delay time counter
276 
277  //--------------------------------------------------------------------------
278  // DEBUG
279  //--------------------------------------------------------------------------
280 /*
281  F32 f32_A_Sample;
282  F32 f32_B_Sample;
283  F32 f32_C_Sample;
284 */
285 };
286 
287 //------------------------------------------------------------------------------
288 // End of file
289 //------------------------------------------------------------------------------
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
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
Class declaration description.
Definition: Function_Block_SRF_PLL.h:75
F32 f32_KP
Proportianal gain of PI regulator.
Definition: Function_Block_SRF_PLL.h:246
TBlock_Input_Connector object_f32_Zetta
Damping factor : 0.7.
Definition: Function_Block_SRF_PLL.h:151
F32 f32_Sinus
Sinus value.
Definition: Function_Block_SRF_PLL.h:262
TBlock_Input_Connector object_f32_Minimal_Frequency_Limit
Maximal tracked frequency in herz.
Definition: Function_Block_SRF_PLL.h:150
TBlock_Input_Connector object_f32_Theta_Offset
Output angle phase offset in radian.
Definition: Function_Block_SRF_PLL.h:154
F32 f32_LPF_Ki
LPF integral gain.
Definition: Function_Block_SRF_PLL.h:227
TBlock_Output_Connector object_bool_Locked
PLL locked flag.
Definition: Function_Block_SRF_PLL.h:174
TBlock_Input_Connector object_f32_Base_Frequency
Base frequency of the input signal in herz.
Definition: Function_Block_SRF_PLL.h:148
TBlock_Input_Connector object_f32_C
Input signal phase C.
Definition: Function_Block_SRF_PLL.h:164
U32 u32_Delay_Counter
Delay time counter.
Definition: Function_Block_SRF_PLL.h:275
TBlock_Input_Connector object_f32_Maximal_Frequency_Limit
Minimal tracked frequency in herz.
Definition: Function_Block_SRF_PLL.h:149
F32 f32_LPF_Ti
LPF time constant.
Definition: Function_Block_SRF_PLL.h:221
F32 f32_PI_Integral
PI regulator intergral storage.
Definition: Function_Block_SRF_PLL.h:252
virtual VOID Send_Information(TProtocol_Base *object_Protocol)
Send information about Function block over communication link protocol.
Definition: Function_Block_SRF_PLL.cpp:474
virtual VOID Execute()
Function block execution method.
Definition: Function_Block_SRF_PLL.cpp:221
TBlock_Output_Connector object_f32_Frequency
Frequency of the input signal in herz.
Definition: Function_Block_SRF_PLL.h:170
F32 f32_LPF_Kp
LPF proportional gain.
Definition: Function_Block_SRF_PLL.h:224
TBlock_Input_Connector object_f32_Ts
Settling time in seconds : 0.03s.
Definition: Function_Block_SRF_PLL.h:153
F32 f32_Q
Q component of input signal.
Definition: Function_Block_SRF_PLL.h:211
U32 u32_Locked_Delay
PLL locked delay time.
Definition: Function_Block_SRF_PLL.h:272
F32 f32_LPF_Output_Maximum_Limit
Internal variable.
Definition: Function_Block_SRF_PLL.h:236
F32 f32_LPF_Wn
LPF natural frequency in radian per second.
Definition: Function_Block_SRF_PLL.h:218
F32 f32_KI
Integral gain of PI regulator.
Definition: Function_Block_SRF_PLL.h:249
F32 f32_Omega_Base
Base frequency in rad/s.
Definition: Function_Block_SRF_PLL.h:193
F32 f32_LPF_Output
LPF output.
Definition: Function_Block_SRF_PLL.h:239
virtual VOID Init()
Function block initialisation method.
Definition: Function_Block_SRF_PLL.cpp:184
TBlock_Input_Connector object_f32_Base_Magnitude
Base magnitude of the input signal.
Definition: Function_Block_SRF_PLL.h:147
virtual ~TFunction_Block_SRF_PLL()
Class destructor method.
Definition: Function_Block_SRF_PLL.cpp:176
TBlock_Input_Connector object_bool_Enable
Enable PLL operation input signal.
Definition: Function_Block_SRF_PLL.h:161
TBlock_Input_Connector object_f32_A
Input signal phase A.
Definition: Function_Block_SRF_PLL.h:162
F32 f32_LPF_Output_Minimum_Limit
Internal variable.
Definition: Function_Block_SRF_PLL.h:233
TBlock_Input_Connector object_f32_Delta
Tolerance band in part per hundret : 0.05 (5%) oder 0.02 (2%)
Definition: Function_Block_SRF_PLL.h:152
TBlock_Input_Connector object_f32_Sample_Time
Sample time given in seconds.
Definition: Function_Block_SRF_PLL.h:155
TBlock_Output_Connector object_f32_Omega
Angular frequency of the input signal in radian per seconds.
Definition: Function_Block_SRF_PLL.h:171
TBlock_Input_Connector object_f32_B
Input signal phase B.
Definition: Function_Block_SRF_PLL.h:163
F32 f32_Omega_Maximum_Limit
Minimal tracked frequency.
Definition: Function_Block_SRF_PLL.h:196
F32 f32_Omega_Minimum_Limit
Maximal tracked frequency.
Definition: Function_Block_SRF_PLL.h:199
TBlock_Output_Connector object_f32_Theta
Actual phase of the input signal in radian.
Definition: Function_Block_SRF_PLL.h:172
F32 f32_Cosinus
Cosuinus value.
Definition: Function_Block_SRF_PLL.h:265
TFunction_Block_SRF_PLL()
Class constructor method.
Definition: Function_Block_SRF_PLL.cpp:68
F32 f32_D
D component of input signal.
Definition: Function_Block_SRF_PLL.h:208
F32 f32_Theta
Phase angle.
Definition: Function_Block_SRF_PLL.h:259
Definition: Protocol_Base.h:57