📄 cml_ampstruct.h
字号:
/************************************************************/
/* */
/* Copley Motion Libraries */
/* */
/* Author: Stephen Glow */
/* */
/* Copyright (c) 2002-2005 Copley Controls Corp. */
/* http://www.copleycontrols.com */
/* */
/************************************************************/
/** \file
This file contains a number of structures used to pass configuration
parameters to an Amp object.
*/
#ifndef _DEF_INC_CML_AMPSTRUCT
#define _DEF_INC_CML_AMPSTRUCT
#include "CML_Error.h"
#include "CML_Filter.h"
#include "CML_Settings.h"
#include "CML_Utils.h"
CML_NAMESPACE_START()
/***************************************************************************/
/**
This class represents error conditions that can occur when loading amplifer
data from a data file.
*/
/***************************************************************************/
class AmpFileError: public Error
{
public:
static const AmpFileError format; ///< Amplifier file format error
static const AmpFileError tooOld; ///< Amplifier file format is too old, use CME version 3.1 or later
static const AmpFileError noFileAccess; ///< File access was not enabled at compile time. See CML_Settings.h
static const AmpFileError fileOpen; ///< Error opening amplifier file
static const AmpFileError range; ///< A parameter in the amplifier file is out of range
static const AmpFileError axis; ///< Amplifier file is for multi axis, not supported
protected:
/// Standard protected constructor
AmpFileError( uint16 id, const char *desc ): Error( id, desc ){}
};
/***************************************************************************/
/**
Amplifier characteristics data structure.
This structure is used to hold information about the amplifier such as it's
model number, serial number, peak current rating, etc.
The amplifier characteristics defined in this structure can not be changed.
They are defined by Copley Controls when the amplifier is designed and/or
manufactured.
Use the Amp::GetAmpInfo method to retrieve this information from the amplifier.
*/
/***************************************************************************/
struct AmpInfo
{
#define COPLEY_MAX_STRING 41
char model[ COPLEY_MAX_STRING ]; ///< Model number string
char mfgName[ COPLEY_MAX_STRING ]; ///< Name of the amplifier manufacturer
char mfgWeb[ COPLEY_MAX_STRING ]; ///< Web address of the manufacturer
char mfgInfo[ COPLEY_MAX_STRING ]; ///< Amplifier's manufacturing information string
char swVer[ COPLEY_MAX_STRING ]; ///< Software version number
uint16 swVerNum; ///< Version number represented as an integer
uint32 serial; ///< Serial number
uint32 modes; ///< Supported modes of operation (see DSP402 spec)
uint16 crntPeak; ///< Peak current rating (10 milliamp units)
uint16 crntCont; ///< Continuous current rating (10 milliamp units)
uint16 crntTime; ///< Time at peak current (milliseconds)
uint16 voltMax; ///< Max bus voltage (100 millivolt units)
uint16 voltMin; ///< Min bus voltage (100 millivolt units)
uint16 voltHyst; ///< Bus voltage hysteresis for over voltage shutdown (100 millivolt units)
uint16 tempMax; ///< Max temperature (deg C)
uint16 tempHyst; ///< Temperature hysteresis for over temp shutdown (deg C)
uint16 pwmPeriod; ///< PWM period (10 nanosecond units)
uint16 servoPeriod; ///< Servo period (multiples of PWM period)
// The following values or primarily for internal use by Copley
int16 crntScale; ///< Current scaling factor
int16 voltScale; ///< Voltage scaling factor
int16 refScale; ///< Reference scaling factor
int16 aencScale; ///< Analog encoder scaling factor
int16 type; ///< Amp type
int16 pwm_off; ///< PWM off time
int16 pwm_dbzero; ///< PWM deadband @ zero current
int16 pwm_dbcont; ///< PWM deadband @ continuous current
int16 regenPeak; ///< Internal regen resister peak limit
int16 regenCont; ///< Internal regen resister continuous limit
int16 regenTime; ///< Internal regen resister peak time
};
/***************************************************************************/
/**
This structure holds the position loop configuration parameters specific to
the Copley amplifier.
The position loop is one of three servo control loops used by the amplifier
to control a motor. The configuration parameters used by this control loop
allow the servo performance to be 'tuned' for various motors and loads.
The amplifier member functions Amp::GetPosLoopConfig and Amp::SetPosLoopConfig
are used to read and write this data to the amplifier.
*/
/***************************************************************************/
struct PosLoopConfig
{
/// Proportional gain
int16 kp;
/// Velocity feed forward
int16 kvff;
/// Acceleration feed forward
int16 kaff;
/// Scaling factor. This is a multiplier that is applied to the
/// output of the position loop. It's scaled up by 100, so setting
/// the scaling factor to 1234 would multiply the output of the
/// loop by 12.34.
/// This parameter was added in firmware version 3.30. For any
/// earlier version it will default to 100 (scale by 1.0).
int16 scale;
/// Default constructor.
/// Simply initializes all servo parameters to zero.
PosLoopConfig( void )
{
kp = 0;
kvff = 0;
kaff = 0;
scale = 100;
}
};
/***************************************************************************/
/**
This structure holds the velocity loop configuration parameters
specific to the Copley amplifier.
The velocity loop is one of three servo control loops used by the amplifier
to control a motor. The configuration parameters used by this control loop
allow the servo performance to be 'tuned' for various motors and loads.
The amplifier member functions Amp::GetVelLoopConfig and Amp::SetVelLoopConfig
are used to read and write this data to the amplifier.
*/
/***************************************************************************/
struct VelLoopConfig
{
/// Proportional gain
int16 kp;
/// Integral gain
int16 ki;
/// Acceleration feed forward
int16 kaff;
/// Output shift value. The output of the loop is downshifted
/// this many bits to get the current loop command
int16 shift;
/// Maximum allowed velocity.
/// This value is used to limit the velocity command before the
/// velocity loop uses it to calculate output current.
/// When running in a position mode (normal for CAN operation)
/// The velocity command is the output from the position loop.
/// This command is clipped by this value before it is passed
/// to the velocity loop.
///
/// This parameter is specified in "user units". See
/// Amp::SetCountsPerUnit for details.
uunit maxVel;
/// Maximum allowed acceleration
///
/// This value limits the rate of change of the velocity command
/// input to the velocity loop. It is used when the magnitude of
/// the command is increasing.
///
/// Note that the acceleration & deceleration limits are NOT used
/// when the position loop is driving the velocity loop.
///
/// This parameter is specified in "user units". See
/// Amp::SetCountsPerUnit for details.
uunit maxAcc;
/// Maximum allowed deceleration
/// This value limits the rate of change of the velocity command
/// input to the velocity loop. It is used when the magnitude of
/// the command is decreasing.
///
/// Note that the acceleration & deceleration limits are not used
/// when the position loop is driving the velocity loop.
///
/// This parameter is specified in "user units". See
/// Amp::SetCountsPerUnit for details.
uunit maxDec;
/// Deceleration used for emergency stop
/// When the position loop is driving the velocity loop this value
/// is only used for tracking error conditions. If a tracking error
/// occurs, the velocity loop takes over control and drives to zero
/// velocity using this deceleration value.
///
/// Setting this value to zero indicates that the deceleration is
/// unlimited.
///
/// This parameter is specified in "user units". See
/// Amp::SetCountsPerUnit for details.
uunit estopDec;
/// Default constructor.
/// Simply initializes all members to zero.
VelLoopConfig( void )
{
kp = 0;
ki = 0;
kaff = 0;
shift = 0;
maxVel = 0;
maxAcc = 0;
maxDec = 0;
estopDec = 0;
}
};
/***************************************************************************/
/**
This structure holds the current loop configuration parameters.
The current loop is one of three servo control loops used by the amplifier
to control a motor. The configuration parameters used by this control loop
allow the servo performance to be 'tuned' for various motors and loads.
This structure also holds the parameters used to control current limiting.
The current limiting acts on the commanded current before it is sent to the
current loop.
The amplifier member functions Amp::GetCrntLoopConfig and Amp::SetCrntLoopConfig
are used to read and write this data to the amplifier.
*/
/***************************************************************************/
struct CrntLoopConfig
{
/// Proportional gain
int16 kp;
/// Integral gain
int16 ki;
/// Current offset
int16 offset;
/// Peak current limit (0.01 amp units)
/// This is the maximum current that can be applied to the
/// motor at any time
/// Also used as Boost current in stepper mode
int16 peakLim;
/// Continuous current limit (0.01 amp units)
/// This is the maximum current that can continuously be
/// applied to the load.
/// Also used as Run current in stepper mode.
int16 contLim;
/// Time at peak current limit (milliseconds)
/// If peak current is requested, it will fall back to the
/// continuous limit within this amount of time.
/// Also used as Boost current time in stepper mode.
int16 peakTime;
/// Stepper hold current (0.01 amps).
/// Current used to hold the motor at rest.
/// Used in stepper mode only.
uint16 stepHoldCurrent;
/// Run to hold time(milliseconds)
/// The period of time, beginning when a move is complete,
/// to when output current switched to hold current.
/// Used in stepper mode only.
uint16 stepRun2HoldTime;
/// Voltage control mode time delay (milliseconds)
/// Time delay to enter into a special voltage control mode.
/// If set to zero this feature is disabled.
/// Used for stepper mode only.
uint16 stepVolControlDelayTime;
/// Rate of change of current command (milliamps/sec).
/// This parameter is only used when running in the low level
/// programmed current mode (AMPMODE_PROG_CRNT), or in the
/// CANopen profile torque mode (AMPMODE_CAN_TORQUE). In
/// other modes this parameter is ignored and no limit is placed
/// on the slope of the current command.
///
/// If this parameter is set to zero (default) it is not used
/// in any mode of operation.
///
/// Note that this parameter is internally the same as the torque
/// slope parameter which can be set using the function
/// Amp::SetTorqueSlope. The units are different however as this
/// parameter controls slope in units of current and the torque slope
/// function adjusts in units of torque.
int32 slope;
/// Default constructor.
/// Simply initializes all members to zero.
CrntLoopConfig( void )
{
kp = 0;
ki = 0;
offset = 0;
slope = 0;
peakLim = 0;
contLim = 0;
peakTime = 0;
stepHoldCurrent = 0;
stepRun2HoldTime = 0;
stepVolControlDelayTime = 0;
}
};
/***************************************************************************/
/**
Homing parameter structure. This structure allows all homing parameters
to be grouped together and passed to the amplifier for convenience.
*/
/***************************************************************************/
struct HomeConfig
{
/// Homing method to use
COPLEY_HOME_METHOD method;
/// Extended home method. If the main home method is set to
/// any value other then 'CHM_EXTENDED' then this parameter
/// is ignored. If the home method is set to this value, then
/// this value will be used to define the low level homing
/// routine used by the amplifier.
///
/// For the most part this parameter can be ignored. It's
/// intended to allow access to some low level features of
/// the amplifier's homing state machine which are otherwise
/// not available through the more generic home methods.
///
/// Encodings for this parameter can be found in the CANopen
/// programmers guide for CANopen object 0x2352, or in the
/// serial port programmers guide for variable 0xC2.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -