Creating a curve description using constructors
For creating a curve description from the IEC program, we advise against writing into the corresponding data structure for the following reasons:
- The data might be inconsistent.
- No checking is performed to verify if the values set at the limits can be implemented at all using the selected mathematical function. For example, a linear function could be configured with two different speeds at the left and the right segment border.
- Double assignments are necessary.
- The values at the left limit of a segment are usually identical with those at the right limit of the previous segment. In the case of direct access, the user would have to ensure that a value is always assigned correctly at both limits.
- Mathematical dependencies must be taken into account by the user.
- By using constructors, an optimized symmetrical acceleration profile with a 5th degree polynomial is obtained if there are certain interrelations between the values at the segment limits. With direct access to the data structure, users have to calculate these interrelations themselves in order to determine the values accordingly.
We recommend using what are known as "constructors" instead of direct access to the data structure for the following reasons:
- Constructors provide an amount of parameters that matches the mathematical function. All the other parameters at the segment limits are calculated consistently.
- The "Append" constructor is available for adding a curve segment to an existing segment. This constructor calculates the values at the right limit of the previous segment automatically.
- Constructors take into account mathematical dependencies, so the user does not have to worry about them.
Each mathematical function provides the matching set of constructors. The following types of constructors are basically distinguished:
- "RestRest"
- Defines a rest-rest profile with (Xa, Ya, Xe, Ye); Va = Ve = Aa = Ae = 0
- "RestVelocity"
- Defines a rest-velocity profile with (Xa, Ya, Xe, Ye, Ve); Va = Aa = Ae = 0
- "VelocityRest"
- Defines a velocity-rest profile with (Xa, Ya, Va, Xe, Ye); Ve = Aa = Ae = 0
- "Common"
- Defines a general profile matching the mathematical function. The number of specified parameters depends on the mathematical function.
Three more types of constructors are distinguished:
- "Add" constructors add a segment to the curve description with the segment limits resulting from the parameters passed to the constructor.
- "Append" constructors add a segment to the curve description with the values at the left limit resulting from the values at the right limit of the previous segment.
- "Assign" constructors assign a segment to the curve description at any position in the curve description. If a segment has already been defined at the corresponding position, it will be overwritten.
- INFORMATION: In this case, the curve description is not checked automatically for being continuous or coherent. Therefore, the user is responsible for checking this. The method described in chapter Checking the curve description for consistency can be used for checking the curve description.
Access is made via the itfConstructors property at a variable of the type "CamDescription". This is where the required mathematical function is selected:
Next, select the required constructor and define the required values using the specified variables:
Alternatively, the method using input assistance ("F2") can be selected when the designation of a constructor (e.g. "Add") is indicated in the text search:
Automatic code generation generates a variable of the type "CamDescriptionScheduler" for each axis that uses MOVIKIT® MultiMotion Camming. It contains two curve descriptions of the type "CamDescription" between which users can switch on the fly. In this case, the curve descriptions of the "CamDescriptionScheduler" are managed, which means one of the two curve descriptions might currently be active and should not be configured.
The purpose of the constructors is to configure a curve description from the application program. The relevant curve description must not be active at the time of configuration. This is ensured if the "Camming" mode is not active or if the configuration concerns the curve description that was requested at the "CamDescriptionScheduler" via the property "itfFreeCamDescription".
Users first have to be granted access to the curve description that is currently not in use and save it to a local variable of the type "ICamDescription2". Only then can users access the required constructor via the locally saved variable. Constructors have a return value of the type "BOOL" indicating whether the configuration has been successful.
INFORMATION
A constructor adds a segment each time the curve description has been called successfully. A successful call is processed within one PLC cycle. This is why it is important that a constructor is not called in several subsequent cycles.
If a new curve description is to be created using constructors by overwriting an existing curve description, the existing curve description must first be deleted by calling up the method DeleteCamDescription().
The following is a sample program code for configuring the curve description for a simple flying saw:
The curve consists of the following three segments:
- Polynomial 5 "Rest-velocity"
- Straight line with constant velocity
- Polynomial 5 "Velocity-rest"
The curve configured with the constructors is represented as follows in the Cam Editor:
The profiles look as follows in the trace recording:
[1] | SEW_GVL_Internal.Axis2._fbProfileGenerationControl._stOUTInterpolation. stSetpointsUserUnits.lrPosition |
[2] | SEW_GVL_Internal.Axis2._fbProfileGenerationControl._stOUTInterpolation. stSetpointsUserUnits.lrVelocity |
[3] | SEW_GVL_Internal.Axis2._fbProfileGenerationControl._stOUTInterpolation. stSetpointsUserUnits.lrAcceleration |