Case 2: Setpoint curve is generated internally

In this case, a new function block is defined that extends the MC_SEW_UserBasic class.

The SUPER^() method, in which certain functions are pre-implemented, is called in the body of the function block. If the properties of the parent class are also automatically attached when this new function block is inserted, they must all be deleted again. Simply add a CallHighPrio() method in which the calculation of the desired setpoint curve is to be implemented.

The following example shows how the implementation of the same setpoint curve as in Case 1: Setpoint curve is fed in from outside (sine wave of the amplitude _lrAmplitude with the period _lrPeriod) could look. For this purpose, additional local variables must be declared in the new MyUserMaster function block. An additional StartSetpointGeneration input is also required, which can be used to start the setpoint generation.

The corresponding calculations must then be programmed in the allHighPrio() method. The assignment must be made to the variables _lrMasterPosition, _lrMasterVelocity and _lrMasterAcceleration:

An instance of the new function block must be declared. The characteristic parameters of the setpoint curve can be initialized during the declaration.

The instance of the function block must be called up in the setpoint generation task (TaskHighPrio). Ideally, the call is made before the corresponding MC_GearIn is called, to which the instance is connected as the "Master". The setpoint generation is started when the relevant function block MC_GearIn has switched the InGear message:

Ultimately, the same setpoint curve is obtained as in case 1. However, the calculation of the setpoint generation is now encapsulated in the block and not programmed externally.