diff --git a/BaseComponents.tsproj b/BaseComponents.tsproj index 00cc7e5..4b3d69d 100644 --- a/BaseComponents.tsproj +++ b/BaseComponents.tsproj @@ -131,12 +131,12 @@ - + - + BasicComponents Instance {08500001-0000-0000-F000-000000000064} diff --git a/BasicComponents.library b/BasicComponents.library index be757a8..dd1cca1 100644 Binary files a/BasicComponents.library and b/BasicComponents.library differ diff --git a/BasicComponents/BasicComponents.plcproj b/BasicComponents/BasicComponents.plcproj index cb355ea..2bf2adc 100644 --- a/BasicComponents/BasicComponents.plcproj +++ b/BasicComponents/BasicComponents.plcproj @@ -21,7 +21,7 @@ false Heisig GmbH BaseComponents - 1.1 + 1.2 BC M.Heisig Basic components fb's (Valves, AI, AO, Motors, etc.) @@ -73,6 +73,12 @@ Code + + Code + + + Code + Code @@ -224,6 +230,7 @@ true + @@ -283,7 +290,7 @@ - + Content @@ -292,11 +299,6 @@ Content - - - Content - - diff --git a/BasicComponents/POUs/Components/AxisPTP/FB_AxisPTP.TcPOU b/BasicComponents/POUs/Components/AxisPTP/FB_AxisPTP.TcPOU index 7f08312..238d5dd 100644 --- a/BasicComponents/POUs/Components/AxisPTP/FB_AxisPTP.TcPOU +++ b/BasicComponents/POUs/Components/AxisPTP/FB_AxisPTP.TcPOU @@ -393,29 +393,18 @@ xError := _xError;]]> - _lrHomingPos := lrHomingPosition; _eHomingMode := eHomingMode; _xExecuteHoming := TRUE; - eResultCode := E_SequenceResultCode.EXECUTING; - eFailureCode := E_SequenceFailureCode.NONE; + M_Homing := TRUE; ELSE - eResultCode := E_SequenceResultCode.FAILED; - eFailureCode := E_SequenceFailureCode.OTHER; + M_Homing := FALSE; END_IF]]> - - - diff --git a/BasicComponents/POUs/Components/Controller/FB_Limit.TcPOU b/BasicComponents/POUs/Components/Controller/FB_Limit.TcPOU new file mode 100644 index 0000000..fdd2216 --- /dev/null +++ b/BasicComponents/POUs/Components/Controller/FB_Limit.TcPOU @@ -0,0 +1,32 @@ + + + + + + rMax THEN + rOut := rMax; + xClampedUpper := TRUE; +ELSIF rIn < rMin THEN + rOut := rMin; + xClampedLower := TRUE; +ELSE + rOut := rIn; + xClampedUpper := FALSE; + xClampedLower := FALSE; +END_IF]]> + + + \ No newline at end of file diff --git a/BasicComponents/POUs/Components/Controller/FB_PI.TcPOU b/BasicComponents/POUs/Components/Controller/FB_PI.TcPOU new file mode 100644 index 0000000..6261e4d --- /dev/null +++ b/BasicComponents/POUs/Components/Controller/FB_PI.TcPOU @@ -0,0 +1,82 @@ + + + + + + 0 THEN + _rDeltaIntegral := (rKp * _rT / rTn) * _rError; +ELSE + _rDeltaIntegral := 0; +END_IF + +// Only add new integral part if we are going away from the upper or lower bound +IF (xSaturatedUpper AND (_rDeltaIntegral > 0.0)) THEN + _rDeltaIntegral := 0.0; +END_IF + +IF (xSaturatedLower AND (_rDeltaIntegral < 0.0)) THEN + _rDeltaIntegral := 0.0; +END_IF + +// Calculate integral part +_rIntegral := _rIntegral + _rDeltaIntegral; + +// Reset integral with deactivated integral time +IF (rTn = 0.0) AND (_rIntegral <> 0) THEN + _rIntegral := 0.0; +END_IF]]> + + + \ No newline at end of file