From 1079229ffb7948f452ddd2b3b5515f9300a066db Mon Sep 17 00:00:00 2001 From: Simon-Cooper <39404307+Simon-Cooper@users.noreply.github.com> Date: Fri, 7 Feb 2020 10:17:46 +0000 Subject: [PATCH] ALLOW LOCAL SIMULATIONS TO BYBASS UPS CHECK Add CHECK_UPS action to house monitoring of the UPS global status Modify RESTORE_POSITIONS state machine to remove numerical enumeration usage Add device identity functionblock to check whether local simulation or CX Add POSITION RECOVERY action to check device type and determine whether to run position restore and ups checking Add solution/_Config/ folder to gitignore to remove NC and IO --- .gitignore | 1 + solution/solution.tsproj | 129 ++++++++---------------- solution/tc_project_app/POUs/MAIN.TcPOU | 73 +++++++++----- 3 files changed, 91 insertions(+), 112 deletions(-) diff --git a/.gitignore b/.gitignore index 8f8c117..cab1dc8 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ logs.0* solution/TrialLicense.tclrs tools/linux/ADS/ tools/linux/getADSState/getADSState.bin +_Config/ diff --git a/solution/solution.tsproj b/solution/solution.tsproj index f74cba4..5dd70ed 100644 --- a/solution/solution.tsproj +++ b/solution/solution.tsproj @@ -1,8 +1,8 @@ - + - NCTOPLC_AXIS_REF_STATE + NCTOPLC_AXIS_REF_STATE 32 Operational @@ -112,6 +112,12 @@ 1 17 + + IsDriveLimitActive + BIT + 1 + 18 + ContinuousMotion BIT @@ -199,6 +205,11 @@ 16#%08X + + + {4C3FC5AC-D5AA-44C6-AC5A-159774BA0F6D} + + NCTOPLC_AXIS_REF_OPMODE @@ -394,11 +405,11 @@ - NCTOPLC_AXIS_REF + NCTOPLC_AXIS_REF 2048 StateDWord - NCTOPLC_AXIS_REF_STATE + NCTOPLC_AXIS_REF_STATE 32 0 @@ -646,6 +657,18 @@ External Setpoint Generation: 64 1600 + + AbsPhasingPos + LREAL + 64 + 1664 + + + TorqueOffset + LREAL + 64 + 1728 + ActPosWithoutPosCorrection LREAL @@ -692,6 +715,9 @@ External Setpoint Generation: + + + @@ -873,7 +899,7 @@ External Setpoint Generation: - + @@ -889,6 +915,9 @@ External Setpoint Generation: + + + @@ -927,46 +956,7 @@ External Setpoint Generation: GVL.axes[1].Axis.NcToPlc - NCTOPLC_AXIS_REF - - AxisState - - - - HomingState - - - - CoupleState - - + NCTOPLC_AXIS_REF GVL.axes[2].inputs.bLimitFwd @@ -990,46 +980,7 @@ External Setpoint Generation: GVL.axes[2].Axis.NcToPlc - NCTOPLC_AXIS_REF - - AxisState - - - - HomingState - - - - CoupleState - - + NCTOPLC_AXIS_REF @@ -1055,4 +1006,12 @@ External Setpoint Generation: + + + + + + + + diff --git a/solution/tc_project_app/POUs/MAIN.TcPOU b/solution/tc_project_app/POUs/MAIN.TcPOU index f81cabd..5eebc02 100644 --- a/solution/tc_project_app/POUs/MAIN.TcPOU +++ b/solution/tc_project_app/POUs/MAIN.TcPOU @@ -1,5 +1,5 @@  - + - + + + + + + + + + + eSUPS_PowerFailure THEN +ELSIF eGlobalSUpsState <> eSUPS_PowerOK THEN (* next cycles of powerfailure *) (* skip regular code execution for the remaining cycles of the powerfailure/writing of persistent data/quick shutdown ... *) RETURN; -END_IF - -RESTORE_POSITIONS(); -PROG(); -AXES(); -ERROR();]]> - - - - +END_IF]]> @@ -121,6 +126,15 @@ fbEL1808( ]]> + + + '0') THEN + CHECK_UPS(); + RESTORE_POSITIONS(); +END_IF]]> + + - + if busy then continue with PLC cycle and check again next time. @@ -199,14 +213,14 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN // .valid=FALSE and .busy=FALSE which indicateds the FB probably hasn't started and thus needs to see a rising edge. // Set execute to low, Exit MAIN.STARTUP and go back a step in the CASE statement. bExecuteReadEncRefSys:=FALSE; - eStartUp:=eStartUp-1; + eStartUp:=ReadAxisFeedbackType; iRetry:=iRetry+1; // counter used for troubleshooting to see how many cycles it takes before fbReadEncRefSys function blocks are read correctly RETURN; END_IF END_IF END_FOR // If the code gets here all axes either have .valid=TRUE for all axes - eStartUp:=eStartUp+1; + eStartUp:= ExecuteRestore; ExecuteRestore: // Execute position restore by setting fbRestorePosition.execute = TRUE @@ -217,7 +231,7 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN END_IF END_IF END_FOR - eStartUp:=eStartUp+1; + eStartUp:= CheckRestore; CheckRestore: // Check the set position fbs are finished @@ -232,7 +246,7 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN END_IF END_IF END_FOR - eStartUp:=eStartUp+1; + eStartUp:= FinishRestore; FinishRestore: // Remove execute = TRUE for fbRestorePosition @@ -245,7 +259,7 @@ IF bRestoreExecute AND NOT bPositionRestoreDone THEN END_IF]]> - + - - - - + @@ -271,6 +282,10 @@ END_FOR]]> + + + + @@ -287,6 +302,10 @@ END_FOR]]> + + + +