MPIControlConfigDynamicMemAlloc

Definition

typedef struct MPIControlConfigDynamicMemAlloc {
	int32_t	motorCount;
	int32_t	filterCount;
	int32_t	mechaWareCount;
	int32_t	axisCount;
	int32_t	motionSupervisorReservedCount;
	int32_t	motionSupervisorCount;
	int32_t	mathBlockCount;
	int32_t	programSequencerCount;
	int32_t	compensatorCount;
	int32_t	captureCount;
	int32_t	dataRecorderCount;
	int32_t	mechaWareBlockBufferWordCount;
	int32_t	userLimitCount;
	int32_t	compensatorPointCount[MPIControlMAX_OBJECTS];
	int32_t	frameCount[MPIControlMAX_OBJECTS];
	int32_t	preFilterDelayCount[MPIControlMAX_OBJECTS];
	int32_t	recordCount[MPIControlMAX_OBJECTS];
} MPIControlConfigDynamicMemAlloc;

 

Required Header: control.h
Change History: Added in 04.00.

Description

The MPIControlConfigDynamicMemAlloc structure contains the quantity of each allocated object in the controller’s memory.  The controller’s memory allocation is dynamic, allowing it to scale to fit the motion system.  While dynamic memory allocation provides exact fit flexibility, it also requires initial planning for applications that need to support multiple network topologies or need to scale the controller’s object counts during operation.

During SynqNet network initialization, the controller’s memory is dynamically allocated and initialized with MPIControlConfigDynamicMemAlloc and MPIControlConfigEnabled object counts (MS, Axis, Filter, Motor, etc.) matching the discovered network topology.  For example, if 2x nodes are discovered with 2x motors each, then the controller is automatically configured to allocate and enable 4 MS, Axis, Filter, and Motor objects.

If your application uses the discovered object count, then no control object count configuration is necessary. To decrease the number of controller objects, reduce the enabled count to reduce the controller’s processing load.  To increase the number of controller objects, you must re-configure the controller’s MPIControlConfigDynamicMemAlloc and MPIControlConfigEnabled object counts.

WARNING!!  Configuring the control MPIControlConfigDynamicMemAlloc object counts will clear the controller’s dynamic memory and any configurations previously written to the controller’s dynamic memory is lost.  Be sure to configure the control MPIControlConfigDynamicMemAlloc object counts first, BEFORE configuring other objects.

motorCount Number of motor objects allocated 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.
filtercount Number of filter objects allocated 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.
mechaWareCount Number of mechaWare objects allocated for a controller. The mechaWare object handles the user specified closed-loop control model calculations to control the motor.
axisCount Number of axis objects allocated 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.
motionSupervisorReservedCount  
motionSupervisorCount Number of motion supervisor objects allocated 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 motionSupervisorCount equal to the axisCount.
mathBlockCount Number of math blocks allocated for the controller.
programSequencerCount Number of program sequencer objects allocated for the controller. The controller's program sequencer object executes and manages a sequence of pre-compiled controller commands.
compensatorCount This value defines the number of allocated compensator objects.
captureCount Number of capture objects allocated for the controller. The controller's capture object manages the hardware resources to latch a motor's position feedback, triggered by an input.
dataRecorderCount Number of data recorder objects allocated for a controller. The controller's recorder object handles collecting and buffering any data in controller memory. The data recorders can collect up to a total of 32 addresses each sample.
mechaWareBlockBufferWordCount Size of the mechaWare block buffer in words.
userLimitCount Number of user limit objects allocated for the controller. T he controller's user limit object processes logic from input conditions to trigger an output, event, and/or action.
compensatorPointCount[MPIControlMax_OBJECTS] 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. For more information, see Determining Required Compensator Table Size. An array of the number of points in the compensation table for each compensator.
frameCount[MPIControlMAX_OBJECTS] An array containing the number of frames for each axis frame buffer. A larger frame buffer may be required for int32_t 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.
preFilterDelayCount[MPIControlMAX_OBJECTS] An array containing the size of pre-filter delay buffer.
recordCount[MPIControlMAX_OBJECTS] An array of the number of records for each data recorder buffer. Each data record is 64 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 by using client/server, or when a large number of data fields are being recorded. The valid range is 0 to the available memory.

Sample Code

Use mpiControlMemAvail(…) to determine how much controller memory is available or remaining when configuring the controller’s dynamic memory allocation.

/* Configure capture objects */
returnValue =
    mpiControlConfigGet(control, &controlConfig);

/* Allocate 16 capture objects */
controlConfig.dynamicMemAlloc.captureCount = 16;
/* Use 12 for now.  Later, all 16 can be used by increasing the enabled count */
controlConfig.enabled.captureCount = 12;

if (returnValue == MPIMessageOK) {
    returnValue =
        mpiControlConfigSet(control, &controlConfig);
}

See Also

MPIControlConfigEnabled | mpiControlConfigGet | mpiControlConfigSet | MPIControlMAX_OBJECTS | mpiControlMemAvail