SPRUHJ1I January 2013 – October 2021 TMS320F2802-Q1 , TMS320F28026-Q1 , TMS320F28026F , TMS320F28027-Q1 , TMS320F28027F , TMS320F28027F-Q1 , TMS320F28052-Q1 , TMS320F28052F , TMS320F28052F-Q1 , TMS320F28052M , TMS320F28052M-Q1 , TMS320F28054-Q1 , TMS320F28054F , TMS320F28054F-Q1 , TMS320F28054M , TMS320F28054M-Q1 , TMS320F2806-Q1 , TMS320F28062-Q1 , TMS320F28062F , TMS320F28062F-Q1 , TMS320F28068F , TMS320F28068M , TMS320F28069-Q1 , TMS320F28069F , TMS320F28069F-Q1 , TMS320F28069M , TMS320F28069M-Q1
This should be done in the main function of the project ahead of the forever loop. This will load all of the default values into the SpinTAC Velocity Control. This step can be completed by running the functions ST_init and ST_setupVelCtl that are declared in the spintac_velocity.h header file. If you do not wish to use these two functions, the code example below can be used to configure SpinTAC Velocity Control component. This configuration of SpinTAC Velocity Control represents the typical configuration that should work for most motors.
// Initialize the SpinTAC Speed Controller Component
stVelCtlHandle = STVELCTL_init(&stVelCtl, sizeof(stVelCtl));
// Setup the maximum current in PU
_iq maxCurrent_PU = _IQ(USER_MOTOR_MAX_CURRENT / USER_IQ_FULL_SCALE_CURRENT_A);
// Instance of the velocity controller
STVELCTL_setAxis(stVelCtlHandle, ST_AXIS0);
// Sample time [s], (0, 1)
STVELCTL_setSampleTime_sec(stVelCtlHandle, _IQ(ST_SPEED_SAMPLE_TIME));
// System inertia upper (0, 127.9999] and lower (0, SgiMax] limits [PU/(pu/s^2)]
STVELCTL_setInertiaMaximums(stVelCtlHandle, _IQ(10.0), _IQ(0.001));
// System control signal high (0, OutMax] & low [OutMin, 0) limits [PU]
STVELCTL_setOutputMaximums(stVelCtlHandle, maxCurrent_PU, -maxCurrent_PU);
// System maximum (0, 1.0] and minimum [-1.0, 0) velocity [pu/s]
STVELCTL_setVelocityMaximums(stVelCtlHandle, _IQ(1.0), _IQ(-1.0));
// System upper (0, 0.2/(T*20)] and lower [0, BwScaleMax] limits for bandwidth scale
STVELCTL_setBandwidthScaleMaximums(stVelCtlHandle,
_IQ24((0.2) / (ST_SPEED_SAMPLE_TIME * 20.0)), _IQ24(0.01));
// System inertia [PU/(pu/s^2)], [SgiMin, SgiMax]
STVELCTL_setInertia(stVelCtlHandle, _IQ(USER_SYSTEM_INERTIA));
// Controller bandwidth scale [BwMin, BwMax]
STVELCTL_setBandwidthScale(stVelCtlHandle, _IQ24(USER_SYSTEM_BANDWIDTH_SCALE));
// Initially ST_VelCtl is not enabled
STVELCTL_setEnable(stVelCtlHandle, false);
// Initially ST_VelCtl is not in reset
STVELCTL_setReset(stVelCtlHandle, false);