|
/* glentek_omega.h */
/*
* Drive Config Structure
*/
typedef enum GLENTEKOmegaOptionMask {
GLENTEKOmegaOptionMaskRS232_ECHO = 0x0001, /* 1: Echo On, 0: Echo Off */
GLENTEKOmegaOptionMaskTRAP_MODE = 0x0002, /* 1: Trap Commutation 0:
Sine Commutation */
GLENTEKOmegaOptionMaskVELOCITY_METHOD = 0x0004, /* 1: Traditional, 0: 1/T */
GLENTEKOmegaOptionMaskVELOCITY_REVERSE = 0x0008, /* 1: Negate, 0: Do not negate */
GLENTEKOmegaOptionMaskENCODER_REVERSE = 0x0010, /* 1: Negate, 0: Do not negate */
} GLENTEKOmegaOptionMask;
typedef enum GLENTEKOmegaIoInvertMask {
GLENTEKOmegaIoInvertMaskNODE_ALARM = 0x0008, /* read-only */
GLENTEKOmegaIoInvertMaskNEG_LIMIT = 0x0020,
GLENTEKOmegaIoInvertMaskPOS_LIMIT = 0x0040,
GLENTEKOmegaIoInvertMaskHOME = 0x0080,
GLENTEKOmegaIoInvertMaskAMP_FAULT_OUT = 0x0100, /* read-only */
GLENTEKOmegaIoInvertMaskAMP_TEMP_FAULT = 0x0200, /* read-only */
GLENTEKOmegaIoInvertMaskMOTOR_TEMP = 0x0800,
GLENTEKOmegaIoInvertMaskHALL0 = 0x1000,
GLENTEKOmegaIoInvertMaskHALL1 = 0x2000,
GLENTEKOmegaIoInvertMaskHALL2 = 0x4000,
} GLENTEKOmegaIoInvertMask;
typedef enum GLENTEKOmegaCommInitMethod {
GLENTEKOmegaCommInitMethodTWANG_SEARCH = 1,
GLENTEKOmegaCommInitMethodDITHER_SEARCH = 2,
GLENTEKOmegaCommInitMethodHALL_EDGE = 3,
GLENTEKOmegaCommInitMethodCOMM_TRACK = 3,
} GLENTEKOmegaCommInitMethod;
typedef enum GLENTEKOmegaCommCrctMethod {
GLENTEKOmegaCommCrctMethodHALL_EDGE = 1,
GLENTEKOmegaCommCrctMethodCOMM_TRACK_EDGE = 1,
GLENTEKOmegaCommCrctMethodINDEX_AUTO = 2,
GLENTEKOmegaCommCrctMethodINDEX_MANUAL = 3,
} GLENTEKOmegaCommCrctMethod;
typedef struct GLENTEKOmegaFilterCoeff {
long A2; /* -32768 to 32767 = -1.0 to 1.0*/
long A1; /* -32768 to 32767 = -1.0 to 1.0*/
long B2; /* -32768 to 32767 = -1.0 to 1.0*/
long B1; /* -32768 to 32767 = -1.0 to 1.0*/
long B0; /* -32768 to 32767 = -1.0 to 1.0*/
long scale; /* Bit shift used to scale*/
/* coefficients to within +/-1.0*/
/* range. Coefficients should be*/
/* scaled by 2^-scale before*/
/* storing.*/
} GLENTEKOmegaFilterCoeff;
typedef struct GLENTEKOmegaConfig {
struct {
unsigned long inductance; /* Units of 0.01 mH*/
unsigned long resistance; /* Units of 0.01 Ohm*/
unsigned long encoderType; /* 0: rotary, 1: linear*/
union {
struct {
unsigned long motorPole; /* even numbers only*/
unsigned long lineCount; /* lines per rev*/
} rotary;
struct {
unsigned long polePitch; /* units of 0.01mm*/
unsigned long resolution; /* A to B edge res (0.01um)*/
} linear;
} encoder;
} motor;
unsigned long busVoltage; /* DC Volts*/
unsigned long rs485Address; /* Communication address*/
GLENTEKOmegaOptionMask optionMask; /* Option register*/
GLENTEKOmegaIoInvertMask ioInvertMask; /* Digital input invert mask*/
struct {
float peakLimit; /* Amps - Peak Current Limit*/
float ecbThreshold; /* Amps - Low speed threshold*/
unsigned long ecbTime; /* units in 0.01 Sec*/
float foldbackThreshold; /* Amps*/
unsigned long foldbackTime; /* units TBD*/
} current;
struct {
long accelLimit; /* not supported*/
long decelLimit; /* not supported*/
} trajectory;
struct {
unsigned long edgePerCycleNumer; /* edges/cycle numerator*/
unsigned long edgePerCycleDenom; /* edges/cycle denominator*/
unsigned long encoderScale; /* normalizes edgePerCycleNumer*/
long hallOffsetAngle; /* -180 to + 180*/
long leadAngle; /* -180 to + 180*/
long leadGain; /* proportional to degrees/RPM*/
} commutation;
struct {
GLENTEKOmegaCommInitMethod method;
float phaseSearchCurrentLimit;
unsigned long currentSlewRate; /* proportional to Amps/Sec*/
long rotationRate; /* degrees/sec, phase vector*/
long limitSwDistance; /* Distance to move away from a*/
/* tripped limit switch before*/
/* re-attempting phase search.*/
/* Units of electric degrees.*/
} comm_init;
struct {
GLENTEKOmegaCommCrctMethod correctMethod; /* commutation correction*/
long indexOffset; /* -180 to + 180*/
} commCorrectionOptions;
struct {
union {
unsigned long highZ; /* (PWM Cycles) reduced wire enc*/
unsigned long hallFault; /* (mSec)std encoders*/
} timeout;
unsigned long highZtoLatch; /* PWM Cycles to latch Hall state*/
unsigned long LatchToValid; /* PWM Cycles from latch Hall to encoder read*/
} commutationTiming;
struct {
unsigned long loopGain; /* 0 to 32767 = 0 to 1.0*/
unsigned long proportionalGain; /* 0 to 32767 = 0 to 1.0*/
unsigned long integralGain; /* 0 to 32767 = 0 to 1.0*/
unsigned long masterGain; /* P&I gain multiplier*/
unsigned long smallErrThreshold;
unsigned long smallErrP_Gain; /* 0 to 32767 = 0 to 1.0*/
} currentLoopTuning;
struct {
unsigned long proportionalGain; /* 0 to 32767 = 0 to 1.0*/
unsigned long intergalGain; /* 0 to 32767 = 0 to 1.0*/
unsigned long derivativeGain; /* 0 to 32767 = 0 to 1.0*/
unsigned long masterGain; /* P&I gain multiplier*/
} velocityLoopTuning;
struct {
unsigned long encoderPrescale; /* 0 - 14*/
unsigned long velocityGain; /* 0 to 32767 = 0 to 1.0*/
} velMeasurementGains;
struct {
unsigned long commandLimit; /* If in Velocity mode, the*/
/* velocity command is limited*/
/* to this value.*/
unsigned long warningLimit; /* Threshold for velocity*/
/* warning flag*/
unsigned long warningTime; /* Time above Warning Limit*/
/* before setting warning flag*/
unsigned long faultLimit; /* Threshold for velocity Fault*/
/* flag.*/
unsigned long faultTime; /* Time above Fault Limit before*/
/* setting fault flag*/
unsigned long zeroSpeedWindow; /* Threshold for setting zero*/
/* speed status bit, Also used*/
/* for zero speed detection*/
/* during phase search algrthm.*/
unsigned long zeroSpeedTime; /* Time for zero speed detection*/
} velocityFunctions;
/*
Biquad Filter CoefficientsAll biquad filters implement the following
difference equation:
y(n)=[a2*y(n-2)+a1*y(n-1)+b2*x(n-2)+b1*x(n-1)+b0*x(n)]*2^scale
where y(n), y(n-1), y(n-2) is the present and past filter outputs
x(n), x(n-1), x(n-2) is the present and past filter inputs.
The following values can be used to set the filters to No
filtering:B0=32677, A2=A1=B2=B1=Scale=0
*/
GLENTEKOmegaFilterCoeff forwardPathFilter1; /* default: no filtering*/
GLENTEKOmegaFilterCoeff forwardPathFilter2; /* default: no filtering*/
GLENTEKOmegaFilterCoeff forwardPathFilter3; /* default: velocity 320Hz,*/
/* first order, low pass*/
GLENTEKOmegaFilterCoeff velocityFeedbackFilter1; /* default: velocity 160Hz,*/
/* first order, high pass*/
struct{
unsigned long parameterSelect; /* table TBD*/
long dacOffset;
long dacGain;
long testVoltage;
} analogOutput;
} GLENTEKOmegaConfig;
|