MotorWare f2806x Module API Documentation
ipd_hfi.h
Go to the documentation of this file.
1 /* --COPYRIGHT--,BSD
2  * Copyright (c) 2013, Texas Instruments Incorporated
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * * Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * * Neither the name of Texas Instruments Incorporated nor the names of
17  * its contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
27  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
28  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30  * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  * --/COPYRIGHT--*/
32 
33 #ifndef _IPD_HFI_H_
34 #define _IPD_HFI_H_
35 
41 
42 
43 // **************************************************************************
44 // the includes
45 
46 // modules
49 
54 
55 
60 
61 
62 // Include the algorithm overview defined in modules/<module>/docs/doxygen/doxygen.h
64 
65 
66 // **************************************************************************
67 // the typedefs
68 
69 
72 typedef enum
73 {
81 
82 
85 typedef enum
86 {
92 
93 
96 typedef struct IPD_HFI_Obj *IPD_HFI_Handle;
97 
98 
99 // **************************************************************************
100 // the globals
101 
102 
103 // **************************************************************************
104 // the functions
105 
106 
110 static inline void IPD_HFI_computePhasor(const _iq angle_pu,MATH_vec2 *pPhasor)
111 {
112 
113  pPhasor->value[0] = _IQcosPU(angle_pu);
114  pPhasor->value[1] = _IQsinPU(angle_pu);
115 
116  return;
117 } // end of IPD_HFI_computePhasor() function
118 
119 
122 extern void IPD_HFI_disable(IPD_HFI_Handle handle);
123 
124 
127 extern void IPD_HFI_enable(IPD_HFI_Handle handle);
128 
129 
133 extern _iq IPD_HFI_getAngle_pu(IPD_HFI_Handle handle);
134 
135 
139 extern _iq IPD_HFI_getKspd_pu(IPD_HFI_Handle handle);
140 
141 
145 extern _iq IPD_HFI_getSpeed_pu(IPD_HFI_Handle handle);
146 
147 
152 
153 
154 
159 
160 
164 extern _iq IPD_HFI_getVdValue(IPD_HFI_Handle handle);
165 
166 
171 extern IPD_HFI_Handle IPD_HFI_init(void);
172 
173 
177 extern bool IPD_HFI_isEnabled(IPD_HFI_Handle handle);
178 
179 
182 extern bool IPD_HFI_isOnLine(IPD_HFI_Handle handle);
183 
184 
188 extern void IPD_HFI_run(IPD_HFI_Handle handle,const MATH_vec2 *pIab_pu);
189 
190 
194 extern void IPD_HFI_setAngle_pu(IPD_HFI_Handle handle,const _iq angle_pu);
195 
196 
200 void IPD_HFI_setFlag_motorSpinning(IPD_HFI_Handle handle,const bool value);
201 
202 
213 extern void IPD_HFI_setHpf_Idq_Params(IPD_HFI_Handle handle,
214  const _iq b0,const _iq b1,const _iq a1,
215  const _iq x1,const _iq y1);
216 
217 
221 extern void IPD_HFI_setId_sum(IPD_HFI_Handle handle,const _iq Id_sum_pu);
222 
223 
227 extern void IPD_HFI_setKspd_pu(IPD_HFI_Handle handle,const _iq Kspd_pu);
228 
229 
240 extern void IPD_HFI_setLpf_spd_Params(IPD_HFI_Handle handle,
241  const _iq b0,const _iq b1,const _iq a1,
242  const _iq x1,const _iq y1);
243 
244 
257 extern void IPD_HFI_setParams(IPD_HFI_Handle handle,
258  float_t estFreq_Hz,
259  float_t excFreq_Hz,
260  float_t lpFilterCutOffFreq_Hz,
261  float_t hpFilterCutOffFreq_Hz,
262  float_t iqFullScaleFreq_Hz,
263  float_t Kspd,
264  float_t excMag_coarse_pu,
265  float_t excMag_fine_pu,
266  float_t waitTime_coarse_sec,
267  float_t waitTime_fine_sec);
268 
269 
273 extern void IPD_HFI_setSpeed_pu(IPD_HFI_Handle handle,const _iq speed_pu);
274 
275 
279 extern void IPD_HFI_setSpeed_lp_pu(IPD_HFI_Handle handle,const _iq speed_lp_pu);
280 
281 
286 extern void IPD_HFI_setTrajMags(IPD_HFI_Handle handle,const _iq *pMags);
287 
288 
294 extern void IPD_HFI_setTrajParams(IPD_HFI_Handle handle,
295  const uint_least32_t period,const uint_least32_t targetPeriod,
296  const _iq *pTrajMags,const uint_least32_t *pTrajPeriods);
297 
298 
302 extern void IPD_HFI_setTrajPeriods(IPD_HFI_Handle handle,const uint_least32_t *pPeriods);
303 
304 
308 extern void IPD_HFI_setWaitTimes(IPD_HFI_Handle handle,const uint_least32_t *pWaitTimes);
309 
310 
313 extern void IPD_HFI_updateState(IPD_HFI_Handle handle);
314 
315 
316 // end of file
317 
318 #ifdef __cplusplus
319 }
320 #endif // extern "C"
321 
323 
324 #endif // end of _IPD_HFI_H_ definition
the coarse angle detection state
Definition: ipd_hfi.h:76
#define _IQsinPU(A)
IPD_HFI_State_e IPD_HFI_getState(IPD_HFI_Handle handle)
Gets the estimator state.
Contains the public interface to the types definitions.
the idle trajectory state
Definition: ipd_hfi.h:87
void IPD_HFI_setSpeed_lp_pu(IPD_HFI_Handle handle, const _iq speed_lp_pu)
Sets the low pass filtered speed value in the estimator.
void IPD_HFI_setFlag_motorSpinning(IPD_HFI_Handle handle, const bool value)
Sets the value of the motor spinning flag.
the coarse trajectory state
Definition: ipd_hfi.h:88
Defines a two element vector.
Definition: 32b/math.h:248
Contains the public interface to the Proportional-Integral-Derivative (PID) controller module routine...
void IPD_HFI_setTrajParams(IPD_HFI_Handle handle, const uint_least32_t period, const uint_least32_t targetPeriod, const _iq *pTrajMags, const uint_least32_t *pTrajPeriods)
Sets the trajectory parameters in the estimator.
the total number of states
Definition: ipd_hfi.h:79
#define _IQcosPU(A)
the online state
Definition: ipd_hfi.h:78
bool IPD_HFI_isOnLine(IPD_HFI_Handle handle)
Denotes whether the module is online (true) or not (false)
the error state
Definition: ipd_hfi.h:74
IPD_HFI_State_e
Defines the initial position detection, high frequency injection (IPD_HFI) states.
Definition: ipd_hfi.h:72
void IPD_HFI_disable(IPD_HFI_Handle handle)
Disables the initial position detection, high frequency injection (IPD_HFI) module.
void IPD_HFI_setTrajPeriods(IPD_HFI_Handle handle, const uint_least32_t *pPeriods)
Sets the periods for each trajectory state.
long _iq
the idle state
Definition: ipd_hfi.h:75
static void IPD_HFI_computePhasor(const _iq angle_pu, MATH_vec2 *pPhasor)
Computes a phasor for a given angle.
Definition: ipd_hfi.h:110
void IPD_HFI_setAngle_pu(IPD_HFI_Handle handle, const _iq angle_pu)
Sets the angle value in the module.
_iq IPD_HFI_getSpeed_lp_pu(IPD_HFI_Handle handle)
Gets the low pass filtered speed value from the estimator.
_iq IPD_HFI_getVdValue(IPD_HFI_Handle handle)
Gets the current trajectory magnitude value.
void IPD_HFI_setHpf_Idq_Params(IPD_HFI_Handle handle, const _iq b0, const _iq b1, const _iq a1, const _iq x1, const _iq y1)
Sets the Idq high pass filter parameters.
void IPD_HFI_setLpf_spd_Params(IPD_HFI_Handle handle, const _iq b0, const _iq b1, const _iq a1, const _iq x1, const _iq y1)
Sets the speed low pass filter parameters.
the total number of states
Definition: ipd_hfi.h:90
IPD_HFI_TRAJ_State_e
Defines the trajectory states.
Definition: ipd_hfi.h:85
void IPD_HFI_run(IPD_HFI_Handle handle, const MATH_vec2 *pIab_pu)
Runs the initial position detection, high frequency injection (IPD_HFI) algorithm.
void IPD_HFI_setWaitTimes(IPD_HFI_Handle handle, const uint_least32_t *pWaitTimes)
Sets the wait times for each estimator state.
_iq value[2]
Definition: 32b/math.h:251
void IPD_HFI_setSpeed_pu(IPD_HFI_Handle handle, const _iq speed_pu)
Sets the speed value in the estimator.
void IPD_HFI_setParams(IPD_HFI_Handle handle, float_t estFreq_Hz, float_t excFreq_Hz, float_t lpFilterCutOffFreq_Hz, float_t hpFilterCutOffFreq_Hz, float_t iqFullScaleFreq_Hz, float_t Kspd, float_t excMag_coarse_pu, float_t excMag_fine_pu, float_t waitTime_coarse_sec, float_t waitTime_fine_sec)
Sets the initial position detection, high frequency injection (IPD_HFI) parameters.
Contains the public interface to the math (MATH) module routines.
_iq IPD_HFI_getKspd_pu(IPD_HFI_Handle handle)
Gets the speed gain value.
IPD_HFI_Handle IPD_HFI_init(void)
Initializes the initial position detection, high frequency injection (IPD_HFI) module.
_iq IPD_HFI_getAngle_pu(IPD_HFI_Handle handle)
Gets the angle value from the estimator.
struct IPD_HFI_Obj * IPD_HFI_Handle
Defines the IPD_HFI handle.
Definition: ipd_hfi.h:96
bool IPD_HFI_isEnabled(IPD_HFI_Handle handle)
Returns a boolean value denoting if the module is enabled (true) or not (false)
Contains the public interface to the Park transform module routines.
void IPD_HFI_setKspd_pu(IPD_HFI_Handle handle, const _iq Kspd_pu)
Sets the speed gain value.
_iq IPD_HFI_getSpeed_pu(IPD_HFI_Handle handle)
Gets the speed value from the estimator.
void IPD_HFI_updateState(IPD_HFI_Handle handle)
Updates the state.
the fine trajectory state
Definition: ipd_hfi.h:89
the fine angle detection state
Definition: ipd_hfi.h:77
void IPD_HFI_setId_sum(IPD_HFI_Handle handle, const _iq Id_sum_pu)
Sets the integral value for the direct current in the estimator.
void IPD_HFI_setTrajMags(IPD_HFI_Handle handle, const _iq *pMags)
Sets the trajectory magnitudes in the estimator.
void IPD_HFI_enable(IPD_HFI_Handle handle)
Enables the initial position detection, high frequency injection (IPD_HFI) module.
Contains the public interface to the first-order filter (FILTER_FO) module routines.
float float_t
Defines the portable data type for 32 bit, signed floating-point data.
Definition: types.h:121