.

MPIControlConfig / MEIControlConfig

Definition: MPIControlConfig

 
typedef struct MPIControlConfig {
    long   axisCount;
long axisFrameCount[MPIControlMAX_AXES]; long captureCount; long compareCount; long compensatorCount; long compensatorPointCount[MPIControlMAX_COMPENSATORS]; long filterCount; long motionCount; long motorCount; long recorderCount; long recordCount[MPIControlMAX_RECORDERS]; long sequenceCount; long userVersion; long sampleRate; } MPIControlConfig;
  Change History: Modified in the 03.04.00.

Description

MPIControlConfig is a structure that specifies the controller configurations. It allocates the number of resources and configurations for the controller's operation. The controller's performance is inversely related to the DSP's load. The controller configuration structure allows the user to disable/enable objects for optimum performance.

WARNING!
mpiControlConfigSet(...) should ONLY be called during application initialization and NOT during motion. If the sampleRate or TxTime is changed, the SynqNet network will be shutdown and re-initialized with the new sampleRate and/or TxTime. If the axisCount, axisFrameCount[], compensatorCount, compensatorPointCount[], recorderCount, or recordCount[] is changed, then the controller's dynamic memory will be cleared and re-allocated with the new configuration. During the re-allocation, compensators, recorders, and axes are not available for application use.

 
axisCount Number of axis objects enabled for the controller. The controller's axis object handles the trajectory calculations for command position. For simple systems, set the axisCount equal to the motorCount.
axisFrameCount

An array containing the number of frames for each axis frame buffer. Each frame is the size of MEIXmpFrame{}. The controller's frame buffers are dynamically allocated by changing the axisFrameCount[]. A larger frame buffer may be required for long multi-point or cam motion profiles. Frame buffer counts must be a power of 2 in size (i.e. 128, 256, ...). Axes mapped to the same motion object MUST have the same frame buffer size. The default axis frame buffer size is 128. The valid range is from 128 to the available memory. Use meiControlExtMemAvail(...) to determine the controller's available memory. Be sure to leave some free memory for potential future features.

captureCount Number of capture objects enabled for the controller. The controller supports up to 32 captures. The controller's capture object manages the hardware resources to latch a motor's position feedback, triggered by a motor's input.
compareCount Number of compare objects enabled for the controller. The controller's compare object manages the hardware resources to trigger a motor's output, triggered by a comparison between the motor's feedback and a pre-loaded position value.
compensatorCount

This value defines the number of enabled compensators.

compensatorPointCount

The number of points in the compensation table for each compensator. Compensator tables get allocated on a per-compensator basis. Each compensator can have a different compensation table size as specified by the compensatorPointCount[n] value. See Determining Required Compensator Table Size for more information.

An array of the number of points in the compensation table for each compensator. Each point is 32bits. The controller's compensation tables are dynamically allocated by changing the compensatorPointCount. When using compensator objects, see Determining Required Compensator Table Size for more information on a proper value for the point count.

filterCount Number of filter objects enabled for a controller. The filter object handles the closed-loop servo calculations to control the motor. For simple systems, set the filterCount equal to the motorCount.
motionCount Number of motion supervisor obejcts enabled for a controller. The controller's motion supervisor handles coordination of motion and events for an axis or group of axes. For simple systems, set the motionCount equal to the axisCount.
motorCount Number of motor objects enabled for a controller. The controller's motor object handles the interface to the servo or stepper drive, dedicated I/O and general purpose motor related I/O. For simple systems, the motorCount should equal the number of physical motors connected to the controller (either directly or via SynqNet).
recorderCount

Number of data recorder objects enabled for a controller. The controller's recorder object handles collecting and buffering any data in controller memory. The enabled data recorders can collect up to a total of 32 addresses each sample. The valid range for the recordCount is 0 to 32.

recordCount

An array of the number of records for each data recorder buffer. Each data record is 32 bits. The controller's data recorder buffers can be dynamically allocated by changing the recordCount. A larger data recorder buffer may be required for higher sample rates, slow host computers, when running via client/server, or when a large number of data fields are being recorded. The valid range is 0 to the available memory. Use meiControlExtMemAvail(...) to determine the controller's available external memory. meiControlExtMemAvail() measures the available memory in 8 bit bytes, so divide the size by 4 to get the number of 32 bit words that the record buffer can be increased by.

sequenceCount Number of sequence objects enabled for the controller. The controller's sequence object executes and manages a sequence of pre-compiled controller commands.
userVersion A 32 bit user defined field. The userVersion can be used to mark a firmware image with an identifier. This is useful if multiple controller firmware images are saved to a file.
sampleRate

Number of controller foreground update cycles per second. For SynqNet controllers, this is also the cyclic update rate for the SynqNet network. During the controller's foreground cycle, the axis trajectories are calculated, the filters (closed-loop servo control) are calculated, motion is coordinated, the SynqNet data buffers are updated, and other time critical operations are performed.The default sample rate is 2000 (period = 500 microseconds). The minimum sampleRate for SynqNet systems is 1000 (period = 1 millisecond). The maximum is dependent on the controller hardware and processing load.

There are several factors that must be considered to find an appropriate sampleRate for a system. The servo performance, the motion profile accuracy, the SynqNet network cyclic rate, the SynqNet drive update rates, controller background cycle update rate, and controller/application performance.

For SynqNet systems, select a sampleRate that is a common multiple of the SynqNet drives connected to the network. For example, if the drive update rate is 8kHz, then appropriate controller sample rates are: 16000, 8000, 5333, 4000, 3200, 2667, 2286, 2000, 1778, 1600, 1455, 1333, 1231, 1067, and 1000

See Also:
Sample Rate
SynqNet Controller Performance

 

Definition: MEIControlConfig

 
typedef struct MEIControlConfig {
    char               userLabel[MEIObjectLabelCharMAX+1];
                          /* +1 for NULL terminator */
    long               preFilterCount;
    long               TxTime;
    long               syncInterruptPeriod; 
    MEIPreFilter       preFilter[MEIXmpMAX_PreFilters];
    MEIXmpUserBuffer   UserBuffer;
} MEIControlConfig;

  Change History: Modified in the 03.04.00. Modified in the 03.03.00. Modified in the 03.02.00.

Description

 
userLabel This value consists of 16 characters and is used to label the control object for user identification purposes. The userLabel field is NOT used by the controller.
preFilterCount This value defines the number of enabled pre-filters.
TxTime

This value determines the controller's transmit time for the SynqNet data. The units are a percentage of the sample period. The default is 75%. Smaller TxTime values will reduce the latency between when the controller receives the data, calculates the outputs, and transmits the data. If the TxTime is too small, the data will be sent before the controller updates the buffer, which will cause a TX_FAILURE event.

See Also:
Sample Rate
SynqNet Controller Performance

syncInterruptPeriod

samples/interrupt. Configures the controller to send a hardware interrupt to host computer every n controller samples.

0 = disabled, 1 = every sample, 2 = every other sample, etc...
preFilter This array defines the configuration for each pre-filter.
UserBuffer This structure defines the controller's user buffer. This is used for custom features that require a controller data buffer.

Sample Code


/*
  Write a value to element index of the user buffer.
  Make sure to save topology to flash before doing this.
*/
void write2UserBuffer(MPIControl control, long value, long index)
{
    MPIControlConfig   config;
    MEIControlConfig   external;
    long               returnValue;
	
    if((index < MEIXmpUserDataSize) && (index >= 0))
    {
      /* Make sure to save topology to flash before doing this */
      returnValue = mpiControlConfigGet(control,
           &config,
           &external);
      msgCHECK(returnValue);

      external.UserBuffer.Data[index] = value;

      returnValue = mpiControlConfigSet(control,
                                        &config,
                                        &external);	
      msgCHECK(returnValue);
     }
}

See Also

mpiControlConfigGet | mpiControlConfigSet | meiControlExtMemAvail | MEIPreFilter

Dynamic Allocation of External Memory Buffers

 

       Legal Notice  |  Tech Email  |  Feedback
      
Copyright ©
2001-2021 Motion Engineering