📄 cml_ampstruct.h
字号:
/// Regen resister resistance (100 milliohm units)
uint16 resistance;
/// Continuous power limit for regen resister (Watts). This is
/// the amount of power that the resister is able to disapate
/// continuously
uint16 contPower;
/// Peak power limit for resister (Watts). This is the maximum
/// amount of power that the resister is able to dissapate for
/// a limited amount of time.
uint16 peakPower;
/// Peak time limit (milliseconds). This is the amount of time
/// that the regen resister is able to dissapate peak power before
/// it needs to be folded back to the continuous power limit.
uint16 peakTime;
/// Regen resister turn on voltage (100 millivolt units). When the bus voltage
/// rises above this value the regen resister will be enabled.
uint16 vOn;
/// Regen resister turn off voltage (100 millivolt units). When the bus voltage
/// drops below this value, the regen resiter will be disabled.
uint16 vOff;
/// Default constructor.
/// Initializes all structure elements to zero.
RegenConfig( void )
{
model[0] = 0;
resistance = 0;
contPower = 0;
peakPower = 0;
peakTime = 0;
vOn = 0;
vOff = 0;
}
};
/***************************************************************************/
/**
Configuration parameters for amplifier's internal function generator.
*/
/***************************************************************************/
struct FuncGenConfig
{
/// Configuration
int16 cfg;
/// Duty cycle in 0.1% (i.e. 0 to 1000)
int16 duty;
/// Frequency (Hz)
int16 freq;
/// Amplitude. Units depend on what the function generator is driving
/// 0.01 Amps for current.
/// 0.1 encoder counts/sec for veloctiy.
/// Encoder counts for position.
int32 amp;
/// Default constructor, sets all members to zero
FuncGenConfig( void )
{
cfg = duty = freq = 0;
amp = 0;
}
};
/***************************************************************************/
/**
Analog input configuration. These parameters are used when the amplifier
is being driven from it's analog reference input pin. Note that not all
amplifier have an analog input reference, and that this is not a standard
CANopen mode of operation.
*/
/***************************************************************************/
struct AnalogRefConfig
{
/// Calibration offset. This offset is set at the factory and
/// should normally not be modified. Units are millivolts
int16 calibration;
/// Offset in millivolts.
int16 offset;
/// Deadband in millivolts. The analog input will be treated as
/// zero when it's absolute value is less then this.
int16 deadband;
/// Scaling factor. Units are dependent on the mode of operation:
/// 0.01 Amp when driving current.
/// 0.1 Encoder counts/second when driving velocity
int32 scale;
/// Default constructor. Simply sets all members to zero.
AnalogRefConfig( void )
{
calibration = 0;
offset = 0;
deadband = 0;
scale = 0;
}
};
/***************************************************************************/
/**
PWM or Pulse/Direction input configuration. These parameters are used when
the amplifier is being controlled through it's PWM inputs (current or veloctiy
mode), or pulse/direction input pins (position mode). These parameters have
no effect when running in standard CANopen modes of operation.
*/
/***************************************************************************/
struct PwmInConfig
{
/// PWM input pin configuration. See amplifier documentation for
/// detailed information.
int16 cfg;
/// Scaling factor. Units are dependent on the mode of operation:
/// 0.01 Amp when driving current.
/// 0.1 Encoder counts/second when driving velocity
/// Encoder counts (upper 16 bits) / pulses (lower 16 bits)
/// ratio for position mode.
int32 scale;
/// PWM input frequency. This parameter is only used when running in
/// UV current mode. For other PWM or step/dir input modes the PWM
/// frequency is automatically calculated by the amplifier and this
/// parameter is ignored.
/// The frequency is set 10 Hz units. For example, setting this parameter
/// to 100 indicates that the PWM input frequency is 1kHz.
int16 freq;
/// Default constructor. Simply sets all members to zero.
PwmInConfig( void )
{
cfg = 0;
scale = 0;
freq = 1000;
}
};
/***************************************************************************/
/**
CANopen network bit rate enumeration.
*/
/***************************************************************************/
enum CAN_BIT_RATE
{
CAN_RATE_1MEG = 0x0000, ///< 1,000,000 bits / second
CAN_RATE_800K = 0x1000, ///< 800,000 bits / second
CAN_RATE_500K = 0x2000, ///< 500,000 bits / second
CAN_RATE_250K = 0x3000, ///< 250,000 bits / second
CAN_RATE_125K = 0x4000, ///< 125,000 bits / second
CAN_RATE_50K = 0x5000, ///< 50,000 bits / second
CAN_RATE_20K = 0x6000 ///< 20,000 bits / second
};
/***************************************************************************/
/**
CANopen Node ID and bit rate configuration. The amplifier's CANopen node ID
and network bit rate can be configured using the members of this structure.
Note that the ID and bit rate are only set on power-up or reset, so after
programming a new configuration the amplifier must be reset for the
configuration to become active.
The CANopen node ID is a 7 bit number in the range 1 to 128. The value 0 is
reserved and is not considered a valid node ID. Selecting a node ID of 0
will cause the amplifier to stop communicating over the CANopen network.
The node ID is calculated using a combination of any of the following:
- The CAN address switch on amplifiers which support this feature
- 0 to 7 general purpose input pins.
- A programmable offset in the range 0 to 128.
On startup, the input pins are read first. The inputs that will be used for
CAN address selection are the highest numbered pins available. For example,
on an amplifier with 12 input pins (0 to 11), if 3 inputs are used for CANopen
node ID selection, then the pins used will be 9, 10 and 11. These three pins
will result in a base node address between 0 and 7.
If the CAN address switch is being used, then the value read from the input
pins will be shifted up four bits (multiplied by 16) and the value of the
input switch will be added to it.
Finally, the programmed offset will be added to the value read from the input
pins and address switch. The lowest 7 bits of this sum will be used as the
CANopen node ID. If this value results in an ID of zero, the CANopen interface
will be disabled.
For example, to program an amplifier to ignore input pins and the address
switch, and just set a fixed ID of 7, set the number of input pins to zero,
turn off the address switch, and set the offset to 7.
*/
/***************************************************************************/
struct CanNetworkConfig
{
/// Number of general purpose input pins to read on startup for
/// node ID selection. This parameter may be set from 0 to 7.
uint8 numInPins;
/// If true, use the CAN address switch as part of the node ID
/// calculation. Note that on amplifiers which do not support this
/// switch this parameter is ignored.
bool useSwitch;
/// Offset added to the value read from the input pins & address
/// switch.
uint8 offset;
/// CANopen network bit rate to use.
CAN_BIT_RATE bitRate;
/// Default constructor. Simply sets all members to zero.
CanNetworkConfig()
{
numInPins = 0;
useSwitch = false;
offset = 0;
bitRate = CAN_RATE_1MEG;
}
void FromAmpFormat( uint16 a );
uint16 ToAmpFormat( void );
};
/***************************************************************************/
/**
Amplifier configuration structure. This structure contains all user
configurable parameters used by an amplifier which may be stored in non-volatile
memory.
*/
/***************************************************************************/
struct AmpConfig
{
/// Amplifier axis name
char name[ COPLEY_MAX_STRING ];
/// Amplifier default mode of operation.
AMP_MODE controlMode;
/// Amplifier phasing mode. This parameter controls the type of
/// commutation used by the amplifer.
AMP_PHASE_MODE phaseMode;
/// PWM output mode. This parameter can be used to configure the
/// pwm output section of the amplifier.
AMP_PWM_MODE pwmMode;
/// String used by CME to save state information
/// This string is reserved and should not be modified.
char CME_Config[ COPLEY_MAX_STRING ];
/// Amplifier fault mask register
AMP_FAULT faultMask;
/// Programmed veloctiy value. This parameter is only used
/// in Amp mode AMPMODE_PROG_VEL.
uunit progVel;
/// Programmed current value (0.01 amp units). This parameter
/// is only used in Amp mode AMPMODE_PROG_CRNT.
int16 progCrnt;
/// Amplifier options. This parameter is reserved for
/// future use.
uint32 options;
/// Diagnostic microstepping rate. This parameter gives the
/// microstep rate (degrees / second) for use in a special
/// diagnostic microstepping mode. The parameter is not
/// used in normal CANopen modes, and is only include here
/// for completness.
int16 stepRate;
/// Index capture configuration. This parameter is not normally
/// used in CANopen mode and is included here for completness only.
uint16 capCtrl;
/// One bit of a standard CANopen status word is user
/// programmable using this setting. This feature is not
/// used by CML and is only included here for completness.
EVENT_STATUS limitBitMask;
/// Some amplifier models provide a secondary encoder connected
/// which can be configured as either an input or output. This
/// parameter is used to configure this hardware.
uint16 encoderOutCfg;
/// CANopen network configuration
CanNetworkConfig can;
/// Position loop configuration
PosLoopConfig pLoop;
/// Velocity loop configuration
VelLoopConfig vLoop;
/// Current loop configuration
CrntLoopConfig cLoop;
/// Motor information
MtrInfo motor;
/// Tracking window settings
TrackingWindows window;
/// Software position limits
SoftPosLimit limit;
/// General purpose I/O pin configuration
AmpIoCfg io;
/// Homing mode configuration
HomeConfig home;
/// Trajectory profile settings
ProfileConfig profile;
/// Analog reference input settings
AnalogRefConfig ref;
/// PWM input configuration
PwmInConfig pwmIn;
/// Internal function generator settings
FuncGenConfig fgen;
/// Regeneration resister configuration
RegenConfig regen;
/// Velocity loop output filter settings
Filter vloopOutFltr;
/// Velocity loop command filter settings
Filter vloopCmdFltr;
/// Default constructor. Simply sets all members to zero.
AmpConfig()
{
name[0] = 0;
controlMode = AMPMODE_DISABLED;
phaseMode = PHASE_MODE_ENCODER;
pwmMode = PWM_MODE_STANDARD;
CME_Config[0] = 0;
faultMask = (AMP_FAULT)0;
progVel = 0;
progCrnt = 0;
options = 0;
stepRate = 0;
capCtrl = 0;
limitBitMask = (EVENT_STATUS)0;
encoderOutCfg = 0;
}
};
CML_NAMESPACE_END()
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -