Trapezoidal control
This instruction automatically performs trapezoidal control according to the parameters in the function block and in the specified DUT. Pulses are output from the specified channel when the control flag for this channel is FALSE and the execution condition is TRUE.
Input
FP-SIGMA, FP-X, FP0, F168_PulseOutput_Trapezoidal: Only with edge trigger
F171_PulseOutput_Trapezoidal: Execution condition can be:with edge triggerpermanent, if change of speed is required.
Absolute value control = TRUE, Relative value control = FALSE
Initial and final speed: Set this value according to the frequency range selected in PulseOutput_Channel_Configuration_DUT:
FPS, FP-X: 1–9800 (1.5Hz–9.8kHz)
48–100000 (48Hz–100kHz)
191–100000 (191–100kHz)
F171_PulseOutput_Trapezoidal: 1–50000 (1Hz–50kHz)
FP0, F168_PulseOutput_Trapezoidal: 40–5000 (40Hz–5kHz)
Target speed: Set this value according to the frequency range selected in PulseOutput_Channel_Configuration_DUT:
FPS, FP-X: 1–9800 (1.5Hz–9.8kHz)
48–100000 (48Hz–100kHz)
191–100000 (191–100kHz)
F171_PulseOutput_Trapezoidal: 1–50000 (1Hz–50kHz)
FP0, F168_PulseOutput_Trapezoidal: 40–5000 (40Hz–5kHz)
Acceleration/deceleration time (FPS, FP-X):
With 30 steps: 30ms–32760ms (specify in steps of 30)
With 60 steps: 60ms–32760ms (specify in steps of 60)
Acceleration/deceleration time (FP0, F168_PulseOutput_Trapezoidal): 30ms–32760ms
Acceleration time (F171_PulseOutput_Trapezoidal): 1ms–32760ms
Deceleration time (F171_PulseOutput_Trapezoidal): 1ms–32760ms
Target value[pulses]: -2147483648–2147483647
Output
TRUE if an applied input value is invalid. Execution of the function block stops.
This non-inline instruction is part of the tool instructions for pulse output. For a detailed description of the instruction(s) used internally, please refer to:
FPS, FP-X: F171_PulseOutput_Trapezoidal
FP0: F168_PulseOutput_Trapezoidal
Use PulseInfo_IsActive to check if the control flag for the selected channel is FALSE.
With a Data Unit Type (DUT) you can define a data unit type that is composed of other data types. A DUT is first defined in the DUT pool and then processed like the standard data types (BOOL, INT, etc.) in the list of global variables or the POU header.
All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.
VAR
PulseOutput_Trapezoidal: PulseOutput_Trapezoidal_FB;
bExecute: BOOL:=FALSE;
bAbsolute: BOOL:=FALSE;
ChannelConfiguration_DUT: PulseOutput_Channel_Configuration_DUT;
bError: BOOL:=FALSE;
bConfigureDUT: BOOL:=FALSE;
END_VAR
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 28 ;
NETWORK_BODY
B(B_CONTACT,,bConfigureDUT,5,1,7,3,);
B(B_F,E_MOVE!,,14,0,20,4,,?DEN?D?AENO?C);
B(B_VARIN,,1,12,2,14,4,);
B(B_F,E_MOVE!,,14,8,20,12,,?DEN?D?AENO?C);
B(B_VARIN,,FALSE,12,10,14,12,);
B(B_VAROUT,,ChannelConfiguration_DUT.bOutput_Pulse_SignReverse,20,10,22,12,);
B(B_F,E_MOVE!,,14,12,20,16,,?DEN?D?AENO?C);
B(B_F,E_MOVE!,,14,4,20,8,,?DEN?D?AENO?C);
B(B_VARIN,,TRUE,12,6,14,8,);
B(B_VAROUT,,ChannelConfiguration_DUT.bOutput_Pulse_SignForward,20,6,22,8,);
B(B_VARIN,,TRUE,12,14,14,16,);
B(B_VAROUT,,ChannelConfiguration_DUT.iChannel,20,2,22,4,);
B(B_F,E_MOVE!,,14,16,20,20,,?DEN?D?AENO?C);
B(B_VARIN,,FALSE,12,18,14,20,);
B(B_VAROUT,,ChannelConfiguration_DUT.bDutyRatio25,20,18,22,20,);
B(B_VAROUT,,ChannelConfiguration_DUT.bAccelerationSteps60,20,14,22,16,);
B(B_VAROUT,,ChannelConfiguration_DUT.bFrequencyRange_191Hz_100kHz,20,22,22,24,);
B(B_VARIN,,TRUE,12,22,14,24,);
B(B_F,E_MOVE!,,14,20,20,24,,?DEN?D?AENO?C);
B(B_F,E_MOVE!,,14,24,20,28,,?DEN?D?AENO?C);
B(B_VARIN,,TRUE,12,26,14,28,);
B(B_VAROUT,,ChannelConfiguration_DUT.Trapezoidal_bTargetSpeedUpToTheMaximum,20,26,22,28,);
L(9,18,14,18);
L(9,14,14,14);
L(9,10,14,10);
L(9,6,14,6);
L(9,2,9,18);
L(9,18,9,22);
L(9,22,14,22);
L(9,22,9,26);
L(9,26,14,26);
L(9,2,14,2);
L(7,2,9,2);
L(1,2,5,2);
L(1,0,1,28);
END_NETWORK_BODY
END_NET_WORK
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 11 ;
NETWORK_BODY
B(B_FB,PulseOutput_Trapezoidal_FB!,PulseOutput_Trapezoidal,14,1,28,11,,?BbExecute?BbAbsolute?BdiInitialAndFinalSpeed?BdiTargetSpeed?BdiAccelerationTime?BdiDecelerationTime?BdiTargetValue?BdutChannelConfiguration?AbError);
B(B_VARIN,,bExecute,12,2,14,4,);
B(B_VARIN,,bAbsolute,12,3,14,5,);
B(B_VARIN,,600,12,4,14,6,);
B(B_VARIN,,12000,12,5,14,7,);
B(B_VARIN,,300,12,6,14,8,);
B(B_VARIN,,600,12,7,14,9,);
B(B_VARIN,,50000,12,8,14,10,);
B(B_VARIN,,ChannelConfiguration_DUT,12,9,14,11,);
B(B_VAROUT,,bError,28,2,30,4,);
L(1,0,1,11);
END_NETWORK_BODY
END_NET_WORK
END_BODY
(* Used DUT parameters *)
ChannelConfiguration_DUT.iChannel := 1;
ChannelConfiguration_DUT.bOutput_Pulse_ForwardTrue := TRUE;
ChannelConfiguration_DUT.bOutput_Pulse_ForwardFalse := FALSE;
ChannelConfiguration_DUT.bAccelerationSteps60 := FALSE;
ChannelConfiguration_DUT.bDutyRatio25 := TRUE;
ChannelConfiguration_DUT.bFrequencyRange_191Hz_100kHz := TRUE;
ChannelConfiguration_DUT.Trapezoidal_bTargetSpeedUpToTheMaximum := TRUE;
ChannelConfiguration_DUT.bExecuteInInterrupt := FALSE;
(* FB *)
PulseOutput_Trapezoidal(bExecute := bExecute,
bAbsolute := bAbsolute,
diInitialAndFinalSpeed := 600,
diTargetSpeed := 12000,
diAccelerationTime := 300,
diDecelerationTime := 600,
diTargetValue := 50000,
dutChannelConfiguration := ChannelConfiguration_DUT,
bError => bError);