MotorWare f2806x Module API Documentation
afsel.h
Go to the documentation of this file.
1 /* --COPYRIGHT--,BSD
2  * Copyright (c) 2012, 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 #ifndef _AFSEL_H_
33 #define _AFSEL_H_
34 
40 
41 
42 // **************************************************************************
43 // the includes
44 
50 
51 
56 
57 
58 // Include the algorithm overview defined in modules/<module>/docs/doxygen/doxygen.h
60 
61 #ifdef __cplusplus
62 extern "C" {
63 #endif
64 
65 
66 // **************************************************************************
67 // the defines
68 
69 
70 
71 // **************************************************************************
72 // the typedefs
73 
74 
77 typedef struct _AFSEL_Obj_ *AFSEL_Handle;
78 
79 
80 // **************************************************************************
81 // the function prototypes
82 
83 
86 extern void AFSEL_disable(AFSEL_Handle handle);
87 
88 
91 extern void AFSEL_enable(AFSEL_Handle handle);
92 
93 
97 extern _iq AFSEL_getAngle_pu(AFSEL_Handle handle);
98 
99 
103 extern _iq AFSEL_getFreq_pu(AFSEL_Handle handle);
104 
105 
109 extern _iq AFSEL_getIqMax(AFSEL_Handle handle);
110 
111 
115 extern _iq AFSEL_getIqSlope(AFSEL_Handle handle);
116 
117 
122 extern AFSEL_Handle AFSEL_init(void);
123 
124 
128 extern bool AFSEL_isDisabled(AFSEL_Handle handle);
129 
130 
134 extern bool AFSEL_isEnabled(AFSEL_Handle handle);
135 
136 
139 extern void AFSEL_run(AFSEL_Handle handle);
140 
141 
145 static inline void AFSEL_setCountHysThreshold(AFSEL_Handle handle,const uint16_t value);
146 
147 
151 extern void AFSEL_setFreqHigh_pu(AFSEL_Handle handle,const _iq freq);
152 
153 
157 extern void AFSEL_setFreqLow_pu(AFSEL_Handle handle,const _iq freq);
158 
159 
170 extern void AFSEL_setParams(AFSEL_Handle handle,
171  const _iq IqMaxLfEst,
172  const _iq IqMaxHfEst,
173  const _iq IqSlopeLfEst,
174  const _iq IqSlopeHfEst,
175  const _iq freqLow_pu,
176  const _iq freqHigh_pu,
177  IPD_HFI_Handle hfiHandle,
178  EST_Handle estHandle);
179 
180 
187 extern void AFSEL_setup(AFSEL_Handle handle,
188  const _iq angleLf_pu,
189  const _iq freqLf_pu,
190  const _iq angleHf_pu,
191  const _iq freqHf_pu);
192 
193 
196 extern void AFSEL_updateState(AFSEL_Handle handle);
197 
198 
199 
200 #ifdef __cplusplus
201 }
202 #endif // extern "C"
203 
205 #endif // end of _AFSEL_H_ definition
206 
Contains the public interface to the types definitions.
void AFSEL_setFreqHigh_pu(AFSEL_Handle handle, const _iq freq)
Sets the frequency at which the HF estimator takes over angle and freq.
static void AFSEL_setCountHysThreshold(AFSEL_Handle handle, const uint16_t value)
Sets the threshold counter.
void AFSEL_run(AFSEL_Handle handle)
Run the afsel.
void AFSEL_enable(AFSEL_Handle handle)
Enable the afsel module.
struct _EST_Obj_ * EST_Handle
Defines the estimator (EST) handle.
Definition: 32b/est.h:52
void AFSEL_setParams(AFSEL_Handle handle, const _iq IqMaxLfEst, const _iq IqMaxHfEst, const _iq IqSlopeLfEst, const _iq IqSlopeHfEst, const _iq freqLow_pu, const _iq freqHigh_pu, IPD_HFI_Handle hfiHandle, EST_Handle estHandle)
Sets the parameters.
AFSEL_Handle AFSEL_init(void)
Initializes the afsel module.
_iq AFSEL_getAngle_pu(AFSEL_Handle handle)
Gets the angle that will currently be used for FOC.
Contains the public interface to the estimator (EST) module routines.
long _iq
_iq AFSEL_getIqSlope(AFSEL_Handle handle)
Gets the current Iq trajectory slope.
void AFSEL_updateState(AFSEL_Handle handle)
Updates the state, called outside of the ISR.
bool AFSEL_isDisabled(AFSEL_Handle handle)
Is the afsel module disabled?
void AFSEL_disable(AFSEL_Handle handle)
Disable the afsel module.
Contains the public interface to the math (MATH) module routines.
_iq AFSEL_getFreq_pu(AFSEL_Handle handle)
Gets the speed that will currently be used.
bool AFSEL_isEnabled(AFSEL_Handle handle)
Is the afsel module enabled?
struct IPD_HFI_Obj * IPD_HFI_Handle
Defines the IPD_HFI handle.
Definition: ipd_hfi.h:96
void AFSEL_setup(AFSEL_Handle handle, const _iq angleLf_pu, const _iq freqLf_pu, const _iq angleHf_pu, const _iq freqHf_pu)
Sets the parameters in the ISR before AFSEL_run() is called.
void AFSEL_setFreqLow_pu(AFSEL_Handle handle, const _iq freq)
Sets the frequency at which the LF estimator takes over angle and freq.
_iq AFSEL_getIqMax(AFSEL_Handle handle)
Gets the Iq maximum value currently used.
struct _AFSEL_Obj_ * AFSEL_Handle
Defines the AFSEL Torque handle.
Definition: afsel.h:77