instaspin_foc
Data Structures | Macros | Typedefs | Functions
main.h File Reference

Defines the structures, global initialization, and functions used in MAIN. More...

#include "sw/modules/math/src/32b/math.h"
#include "sw/modules/memCopy/src/memCopy.h"
#include "sw/modules/est/src/32b/est.h"
#include "sw/modules/svgen/src/32b/svgen_current.h"
#include "sw/modules/fw/src/32b/fw.h"
#include "sw/modules/fem/src/32b/fem.h"
#include "sw/modules/cpu_usage/src/32b/cpu_usage.h"
#include "sw/modules/ctrl/src/32b/ctrl.h"
#include "hal.h"
#include "user.h"

Go to the source code of this file.

Data Structures

struct  _MOTOR_Vars_t_
 

Macros

#define NUM_MAIN_TICKS_FOR_GLOBAL_VARIABLE_UPDATE   1
 Defines the number of main iterations before global variables are updated. More...
 
#define MAX_ACCEL_KRPMPS_SF   _IQ(USER_MOTOR_NUM_POLE_PAIRS*1000.0/USER_TRAJ_FREQ_Hz/USER_IQ_FULL_SCALE_FREQ_Hz/60.0)
 Defines the speed acceleration scale factor. More...
 
#define MOTOR_Vars_INIT
 Initialization values of global variables. More...
 

Typedefs

typedef struct _MOTOR_Vars_t_ MOTOR_Vars_t
 

Functions

interrupt void mainISR (void)
 The main interrupt service (ISR) routine. More...
 
void runCurrentIgnore (void)
 
void runCurrentReconstruction (void)
 
void runFieldWeakening (void)
 
void runOffsetsCalculation (void)
 
void runSetTrigger (void)
 
void updateGlobalVariables_motor (CTRL_Handle handle)
 Updates the global motor variables. More...
 
void updateGlobalVariables (EST_Handle handle)
 Updates the global variables. More...
 
void softwareUpdate1p6 (EST_Handle handle)
 Updates version 1p6 of library. More...
 
void CTRL_resetLs_qFmt (CTRL_Handle handle, const uint_least8_t qFmt)
 Reset Ls Q format to a higher value when Ls identification starts. More...
 
void recalcKpKiPmsm (CTRL_Handle handle)
 Recalculate Kp and Ki gains to fix the R/L limitation of 2000.0 and Kp limitation of 0.11. More...
 
void recalcKpKi (CTRL_Handle handle)
 Recalculate Kp and Ki gains to fix the R/L limitation of 2000.0 and Kp limitation of 0.11. More...
 
void CTRL_calcMax_Ls_qFmt (CTRL_Handle handle, uint_least8_t *p_qFmt)
 Calculates the maximum qFmt value for Ls identification, to get a more accurate Ls per unit. More...
 
void updateIqRef (CTRL_Handle handle)
 Updates Iq reference and also sets the right sign to the speed reference for correct force angle. More...
 
void updateKpKiGains (CTRL_Handle handle)
 Updates Kp and Ki gains in the controller object. More...
 
void runRsOnLine (CTRL_Handle handle)
 Runs Rs online. More...
 
void updateCPUusage (void)
 Updates CPU usage. More...
 
void setFeLimitZero (CTRL_Handle handle)
 Set electrical frequency limit to zero while identifying an induction motor. More...
 
void acim_Dir_qFmtCalc (CTRL_Handle handle)
 Calculates Dir_qFmt for ACIM. More...
 
void setupClarke_I (CLARKE_Handle, const uint_least8_t)
 Sets up the Clarke transform for current. More...
 
void setupClarke_V (CLARKE_Handle, const uint_least8_t)
 Sets up the Clarke transform for voltage. More...
 
_iq angleDelayComp (const _iq fm_pu, const _iq angleUncomp_pu)
 The angleDelayComp function compensates for the delay introduced. More...
 
CTRL_Handle CTRL_init (void *pMemory, const size_t numBytes)
 
void EST_getIdq_pu (EST_Handle handle, MATH_vec2 *pIdq_pu)
 
void EST_setEstParams (EST_Handle handle, USER_Params *pUserParams)
 
void EST_setupEstIdleState (EST_Handle handle)
 
EST_Handle EST_init (void *pMemory, const size_t numBytes)
 
_iq EST_runPowerWarp (EST_Handle handle, const _iq Id_int_pu, const _iq Iq_pu)
 Runs PowerWarp. More...
 
_iq getAbsElecAngle (const _iq angle_pu)
 Calculates the absolute electrical angle. More...
 
_iq getAbsMechAngle (_iq *pAngle_mech_poles, _iq *pAngle_z1_pu, const _iq angle_pu)
 Calculates mechanical angle from electrical angle. More...
 

Detailed Description

Defines the structures, global initialization, and functions used in MAIN.

(C) Copyright 2011, Texas Instruments, Inc.

Definition in file main.h.


Data Structure Documentation

struct _MOTOR_Vars_t_

Definition at line 134 of file main.h.

Data Fields
CTRL_State_e CtrlState
CTRL_Version CtrlVersion
EST_State_e EstState
bool Flag_enableFieldWeakening
bool Flag_enableForceAngle
bool Flag_enableOffsetcalc
bool Flag_enablePowerWarp
bool Flag_enableRsRecalc
bool Flag_enableSpeedCtrl
bool Flag_enableSys
bool Flag_enableUserParams
bool Flag_MotorIdentified
bool Flag_Run_Identify
float_t Flux_VpHz
_iq Flux_Wb
MATH_vec3 I_bias
_iq Id_A
_iq IdRef_A
float_t ipd_excFreq_Hz
_iq ipd_excMag_coarse_pu
_iq ipd_excMag_fine_pu
_iq ipd_Kspd
float ipd_waitTime_coarse_sec
float ipd_waitTime_fine_sec
_iq Iq_A
_iq IqRef_A
_iq Is_A
_iq Ki_Idq
_iq Ki_spd
_iq Kp_Idq
_iq Kp_spd
float_t Lsd_H
float_t Lsq_H
float_t MagnCurr_A
_iq MaxAccel_krpmps
_iq OverModulation
float_t Rr_Ohm
float_t Rs_Ohm
float_t RsOnLine_Ohm
_iq RsOnLineCurrent_A
_iq Speed_krpm
_iq SpeedRef_krpm
_iq SpeedRef_pu
_iq SpeedTraj_krpm
_iq SvgenMaxModulation_ticks
_iq Torque_Nm
USER_ErrorCode_e UserErrorCode
MATH_vec3 V_bias
_iq Vd
_iq VdcBus_kV
_iq Vq
_iq Vs
_iq VsRef

Macro Definition Documentation

#define MAX_ACCEL_KRPMPS_SF   _IQ(USER_MOTOR_NUM_POLE_PAIRS*1000.0/USER_TRAJ_FREQ_Hz/USER_IQ_FULL_SCALE_FREQ_Hz/60.0)

Defines the speed acceleration scale factor.

Definition at line 72 of file main.h.

#define MOTOR_Vars_INIT

Initialization values of global variables.

Definition at line 76 of file main.h.

#define NUM_MAIN_TICKS_FOR_GLOBAL_VARIABLE_UPDATE   1

Defines the number of main iterations before global variables are updated.

Definition at line 68 of file main.h.

Typedef Documentation

typedef struct _MOTOR_Vars_t_ MOTOR_Vars_t

Function Documentation

void EST_getIdq_pu ( EST_Handle  handle,
MATH_vec2 pIdq_pu 
)

Referenced by mainISR().

EST_Handle EST_init ( void *  pMemory,
const size_t  numBytes 
)

Referenced by main().

_iq EST_runPowerWarp ( EST_Handle  handle,
const _iq  Id_int_pu,
const _iq  Iq_pu 
)

Runs PowerWarp.

Parameters
[in]handleThe estimator (EST) handle
[in]Id_int_puThe intermediate value along the Id trajectory in pu
[in]Iq_puThe measured Iq value in pu
Returns
The target value for the Id trajectory in pu
void EST_setEstParams ( EST_Handle  handle,
USER_Params pUserParams 
)

Referenced by main().

void EST_setupEstIdleState ( EST_Handle  handle)

Referenced by main().