📄 incurmod.c
字号:
/**********************************************************************
* *
* Software License Agreement *
* *
* The software supplied herewith by Microchip Technology *
* Incorporated (the "Company") for its dsPIC controller *
* is intended and supplied to you, the Company's customer, *
* for use solely and exclusively on Microchip dsPIC *
* products. The software is owned by the Company and/or its *
* supplier, and is protected under applicable copyright laws. All *
* rights are reserved. Any use in violation of the foregoing *
* restrictions may subject the user to criminal sanctions under *
* applicable laws, as well as to civil liability for the breach of *
* the terms and conditions of this license. *
* *
* THIS SOFTWARE IS PROVIDED IN AN "AS IS" CONDITION. NO *
* WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, *
* BUT NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND *
* FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. THE *
* COMPANY SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, *
* INCIDENTAL OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. *
* *
**********************************************************************/
// Scaling for current model routine
#include "general.h"
#include "Parms.h"
#include "CurModel.h"
/**********************************************************
InitCurModelScaling
Initialize scaling constants for current model routine.
Physical constants:
fRotorTmConst Rotor time constant in sec
Physical form of equations:
Magnetizing current (amps):
Imag = Imag + (fLoopPeriod/fRotorTmConst)*(Id - Imag)
Slip speed in RPS:
VelSlipRPS = (1/fRotorTmConst) * Iq/Imag / (2*pi)
Rotor flux speed in RPS:
VelFluxRPS = iPoles * VelMechRPS + VelSlipRPS
Rotor flux angle (radians):
AngFlux = AngFlux + fLoopPeriod * 2 * pi * VelFluxRPS
Scaled Variables:
qImag Magnetizing current scaled by maximum current
qVelSlip Mechnical Slip velocity in RPS scaled by fScaleMechRPS
qAngFlux Flux angle scaled by pi
Scaled Equations:
qImag = qImag + qKcur * (qId - qImag)
qVelSlip = Kslip * qIq/qImag
qAngFlux = qAngFlux + Kdelta * (qVelMech + qVelSlip)
Scaling factors:
qKcur = (2^15) * (fLoopPeriod/fRotorTmConst)
qKdelta = (2^15) * 2 * iPoles * fLoopPeriod * fScaleMechRPS
qKslip = (2^15)/(2 * pi * fRotorTmConst * iPoles * fScaleMechRPS)
**********************************************************/
bool InitCurModelScaling( void )
{
CurModelParm.qKcur = 32768.0 * MotorParm.fLoopPeriod / MotorParm.fRotorTmConst;
CurModelParm.qKdelta = 32768.0 * 2 * MotorParm.iPoles * MotorParm.fLoopPeriod * MotorParm.fScaleMechRPS;
CurModelParm.qKslip = 32768.0/(6.2832 * MotorParm.iPoles * MotorParm.fScaleMechRPS*MotorParm.fRotorTmConst);
// Maximum allowed slip speed
CurModelParm.qMaxSlipVel = 32768.0/8;
// Initialize private variables used by CurrModel
InitCurModel();
return False;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -