From 6bde1ed06b0a326a573eb1fba1f85118f2cbb555 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szil=C3=A1rd=20H=C3=B6kk=C3=B6n?= Date: Mon, 18 May 2026 10:08:40 +0200 Subject: [PATCH 1/9] MBP-389: Create INIT action in MAIN Moves fbGetCurTaskIndex inside INIT, to be available for initialisation. --- solution/tc_project_app/POUs/MAIN.TcPOU | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/solution/tc_project_app/POUs/MAIN.TcPOU b/solution/tc_project_app/POUs/MAIN.TcPOU index ffc8e43..b9bab87 100644 --- a/solution/tc_project_app/POUs/MAIN.TcPOU +++ b/solution/tc_project_app/POUs/MAIN.TcPOU @@ -46,7 +46,8 @@ END_VAR ]]> - eSUPS_PowerOK THEN //Next cycles of powerfailure //Skip regular code execution for the remaining cycles of the powerfailure/writing of persistent data/quick shutdown... END_IF +]]> + + + + + @@ -147,10 +155,7 @@ END_IF - Date: Mon, 18 May 2026 10:12:41 +0200 Subject: [PATCH 2/9] MBP-389: Add pragma linked AMSNETID Converts AMSNETID (ARRAY[0..5] OF BYTE) to T_AmsNetId (STRING(23)) in INIT. --- solution/tc_project_app/POUs/MAIN.TcPOU | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/solution/tc_project_app/POUs/MAIN.TcPOU b/solution/tc_project_app/POUs/MAIN.TcPOU index b9bab87..5a1334c 100644 --- a/solution/tc_project_app/POUs/MAIN.TcPOU +++ b/solution/tc_project_app/POUs/MAIN.TcPOU @@ -31,7 +31,11 @@ VAR fbWritePositionBias: MC_WriteParameter; fbGetDeviceIdentification: FB_GetDeviceIdentificationEx; - dtAtStartup: DT; + dtAtStartup: DT; + {attribute 'TcLinkTo' := 'TIID^Device 2 (EtherCAT)^InfoData^AmsNetId'} + aEtherCATMasterNetId AT%I*: AMSNETID; + sEtherCATMasterNetId: T_AmsNetId; + nTestNum: UINT := 0; //Variable used in ESS's FAT_SAT_tools scripts to keep track of the test number //Read position at a specific time interval @@ -125,6 +129,15 @@ END_IF From e202b4e3462c932a8a9ba5c79ea891fb0c838292 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szil=C3=A1rd=20H=C3=B6kk=C3=B6n?= Date: Mon, 18 May 2026 10:17:30 +0200 Subject: [PATCH 3/9] MBP-389: Rename iAxis to iCnt New name better reflects the usage of the variable. --- solution/_Config/PLC/tc_project_app.xti | 26 +++++++++++++++++- solution/tc_project_app/POUs/MAIN.TcPOU | 36 ++++++++++++------------- 2 files changed, 43 insertions(+), 19 deletions(-) diff --git a/solution/_Config/PLC/tc_project_app.xti b/solution/_Config/PLC/tc_project_app.xti index 5ee5506..7e82da1 100644 --- a/solution/_Config/PLC/tc_project_app.xti +++ b/solution/_Config/PLC/tc_project_app.xti @@ -1,11 +1,35 @@ + + + AMSNETID + 48 + BYTE + + 0 + 6 + + + %d.%d.%d.%d.%d.%d + [0] + [1] + [2] + [3] + [4] + [5] + + + - + tc_project_app Instance {08500001-0000-0000-F000-000000000064} PlcTask Inputs + + MAIN.aEtherCATMasterNetId + AMSNETID + Safety_Shutter.bPSSPermit1 diff --git a/solution/tc_project_app/POUs/MAIN.TcPOU b/solution/tc_project_app/POUs/MAIN.TcPOU index 5a1334c..cdb3f08 100644 --- a/solution/tc_project_app/POUs/MAIN.TcPOU +++ b/solution/tc_project_app/POUs/MAIN.TcPOU @@ -21,7 +21,7 @@ VAR bRestoreExecute: BOOL := FALSE; nReadEncRefSysRetry: UINT := 0; //Counts number of retries to read encoder reference system nCheckRestoreRetry: UINT := 0; //Counts number of retries to restore axis position or position bias - iAxes: UINT; //Index for, for-loops in position recovery actions + iCnt: UINT; //Index for various for-loops iCurrentAxis: UINT := 1; //Index for position recovery actions (not in for loops) afbReadPositionBias: ARRAY [1..GVL_APP.nAXIS_NUM] OF MC_ReadParameter; @@ -103,9 +103,9 @@ END_FOR fbC6017UPS(eUPSMode := eSelUpsMode); END_CASE -FOR iAxes := 1 TO GVL_APP.nAXIS_NUM DO - IF astAxes[iAxes].stStatus.bAxisInitialized THEN - afbReadPositionBias[iAxes](Axis := GVL.astAxes[iAxes].Axis, +FOR iCnt := 1 TO GVL_APP.nAXIS_NUM DO + IF astAxes[iCnt].stStatus.bAxisInitialized THEN + afbReadPositionBias[iCnt](Axis := GVL.astAxes[iCnt].Axis, Enable := TRUE, ReadMode:= READMODE_CYCLIC, ParameterNumber := E_AxisParameters.AxisEncoderOffset); @@ -132,11 +132,11 @@ GVL.fbGetCurTaskIndex(); IF _TaskInfo[fbGetCurTaskIndex.index].FirstCycle THEN sEtherCATMasterNetId := CONCAT(TO_STRING(aEtherCATMasterNetId[0]), '.'); - FOR iAxis := 1 TO 4 DO - sEtherCATMasterNetId := CONCAT(sEtherCATMasterNetId, TO_STRING(aEtherCATMasterNetId[iAxis])); + FOR iCnt := 1 TO 4 DO + sEtherCATMasterNetId := CONCAT(sEtherCATMasterNetId, TO_STRING(aEtherCATMasterNetId[iCnt])); sEtherCATMasterNetId := CONCAT(sEtherCATMasterNetId, '.'); END_FOR - sEtherCATMasterNetId := CONCAT(sEtherCATMasterNetId, TO_STRING(aEtherCATMasterNetId[iAxis])); + sEtherCATMasterNetId := CONCAT(sEtherCATMasterNetId, TO_STRING(aEtherCATMasterNetId[iCnt])); END_IF ]]> @@ -146,8 +146,8 @@ END_IF - Date: Mon, 18 May 2026 10:23:34 +0200 Subject: [PATCH 4/9] MBP-389: Add AmsNetID as an input of monitoring --- .../Applications/Cabinet_Monitoring.TcPOU | 5 ++++- solution/tc_project_app/POUs/MAIN.TcPOU | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/solution/tc_project_app/POUs/Application_Specific/Applications/Cabinet_Monitoring.TcPOU b/solution/tc_project_app/POUs/Application_Specific/Applications/Cabinet_Monitoring.TcPOU index 1af68a5..d91673b 100644 --- a/solution/tc_project_app/POUs/Application_Specific/Applications/Cabinet_Monitoring.TcPOU +++ b/solution/tc_project_app/POUs/Application_Specific/Applications/Cabinet_Monitoring.TcPOU @@ -2,6 +2,9 @@ , aErrorMsg=> , nEcMasterFramesLost=> , diff --git a/solution/tc_project_app/POUs/MAIN.TcPOU b/solution/tc_project_app/POUs/MAIN.TcPOU index cdb3f08..ba44ef1 100644 --- a/solution/tc_project_app/POUs/MAIN.TcPOU +++ b/solution/tc_project_app/POUs/MAIN.TcPOU @@ -180,7 +180,7 @@ Safety_Shutter(); //Pneumatics_Template(); //Application program calls -Cabinet_Monitoring(); +Cabinet_Monitoring(sEtherCATMasterNetId:= sEtherCATMasterNetId); Pneumatic_Box(); //Shutter_Operator_Panel(); //Slit_Template(); From c108aa766196cdf7fa9faa026dc584f9924bf8bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szil=C3=A1rd=20H=C3=B6kk=C3=B6n?= Date: Mon, 18 May 2026 10:49:42 +0200 Subject: [PATCH 5/9] MBP-389: Add error message for invalid AmsNetID --- solution/_Config/PLC/tc_project_app.xti | 26 ++++++++++++++++++++++++- solution/tc_project_app/POUs/MAIN.TcPOU | 15 +++++++++----- 2 files changed, 35 insertions(+), 6 deletions(-) diff --git a/solution/_Config/PLC/tc_project_app.xti b/solution/_Config/PLC/tc_project_app.xti index 7e82da1..30b5ff4 100644 --- a/solution/_Config/PLC/tc_project_app.xti +++ b/solution/_Config/PLC/tc_project_app.xti @@ -1,5 +1,25 @@ + + + AMSNETID + 48 + BYTE + + 0 + 6 + + + %d.%d.%d.%d.%d.%d + [0] + [1] + [2] + [3] + [4] + [5] + + + AMSNETID @@ -21,7 +41,7 @@ - + tc_project_app Instance {08500001-0000-0000-F000-000000000064} @@ -30,6 +50,10 @@ MAIN.aEtherCATMasterNetId AMSNETID + + MAIN.aEtherCATMasterNetId + AMSNETID + Safety_Shutter.bPSSPermit1 diff --git a/solution/tc_project_app/POUs/MAIN.TcPOU b/solution/tc_project_app/POUs/MAIN.TcPOU index ba44ef1..72b23ae 100644 --- a/solution/tc_project_app/POUs/MAIN.TcPOU +++ b/solution/tc_project_app/POUs/MAIN.TcPOU @@ -131,12 +131,17 @@ END_IF GVL.fbGetCurTaskIndex(); IF _TaskInfo[fbGetCurTaskIndex.index].FirstCycle THEN - sEtherCATMasterNetId := CONCAT(TO_STRING(aEtherCATMasterNetId[0]), '.'); - FOR iCnt := 1 TO 4 DO - sEtherCATMasterNetId := CONCAT(sEtherCATMasterNetId, TO_STRING(aEtherCATMasterNetId[iCnt])); - sEtherCATMasterNetId := CONCAT(sEtherCATMasterNetId, '.'); + FOR iCnt := 0 TO (SIZEOF(AMSNETID) - 1) DO + IF aEtherCATMasterNetId[iCnt] = 0 THEN + ADSLOGSTR(ADSLOG_MSGTYPE_ERROR,'Invalid Device 2 AmsNetID',''); + EXIT; + END_IF + + sEtherCATMasterNetId := CONCAT(sEtherCATMasterNetId, TO_STRING(aEtherCATMasterNetId[iCnt])); + IF iCnt < (SIZEOF(AMSNETID) - 1) THEN + sEtherCATMasterNetId := CONCAT(sEtherCATMasterNetId, '.'); + END_IF END_FOR - sEtherCATMasterNetId := CONCAT(sEtherCATMasterNetId, TO_STRING(aEtherCATMasterNetId[iCnt])); END_IF ]]> From f017d8293a1f1bcbbeeb679738326e24389b4771 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szil=C3=A1rd=20H=C3=B6kk=C3=B6n?= Date: Mon, 18 May 2026 10:51:03 +0200 Subject: [PATCH 6/9] MBP-389: Fix white space --- .../Applications/Cabinet_Monitoring.TcPOU | 16 +++++----- solution/tc_project_app/POUs/MAIN.TcPOU | 30 +++++++++---------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/solution/tc_project_app/POUs/Application_Specific/Applications/Cabinet_Monitoring.TcPOU b/solution/tc_project_app/POUs/Application_Specific/Applications/Cabinet_Monitoring.TcPOU index d91673b..f8efc1f 100644 --- a/solution/tc_project_app/POUs/Application_Specific/Applications/Cabinet_Monitoring.TcPOU +++ b/solution/tc_project_app/POUs/Application_Specific/Applications/Cabinet_Monitoring.TcPOU @@ -3,7 +3,7 @@ , - aErrorMsg=> , - nEcMasterFramesLost=> , - nCPULoad=> , - fCycleExecTime_ms=> , - nAlarmGrpBitNumber=> ); + nEcMasterNetId := sEtherCATMasterNetId, //AMS NetId of Device (EtherCAT) from I/Os + aErrorID => , + aErrorMsg => , + nEcMasterFramesLost => , + nCPULoad => , + fCycleExecTime_ms => , + nAlarmGrpBitNumber => ); *) ]]> diff --git a/solution/tc_project_app/POUs/MAIN.TcPOU b/solution/tc_project_app/POUs/MAIN.TcPOU index 72b23ae..7affb16 100644 --- a/solution/tc_project_app/POUs/MAIN.TcPOU +++ b/solution/tc_project_app/POUs/MAIN.TcPOU @@ -31,10 +31,10 @@ VAR fbWritePositionBias: MC_WriteParameter; fbGetDeviceIdentification: FB_GetDeviceIdentificationEx; - dtAtStartup: DT; - {attribute 'TcLinkTo' := 'TIID^Device 2 (EtherCAT)^InfoData^AmsNetId'} - aEtherCATMasterNetId AT%I*: AMSNETID; - sEtherCATMasterNetId: T_AmsNetId; + dtAtStartup: DT; + {attribute 'TcLinkTo' := 'TIID^Device 2 (EtherCAT)^InfoData^AmsNetId'} + aEtherCATMasterNetId AT%I*: AMSNETID; + sEtherCATMasterNetId: T_AmsNetId; nTestNum: UINT := 0; //Variable used in ESS's FAT_SAT_tools scripts to keep track of the test number @@ -131,17 +131,17 @@ END_IF GVL.fbGetCurTaskIndex(); IF _TaskInfo[fbGetCurTaskIndex.index].FirstCycle THEN - FOR iCnt := 0 TO (SIZEOF(AMSNETID) - 1) DO - IF aEtherCATMasterNetId[iCnt] = 0 THEN - ADSLOGSTR(ADSLOG_MSGTYPE_ERROR,'Invalid Device 2 AmsNetID',''); - EXIT; - END_IF - - sEtherCATMasterNetId := CONCAT(sEtherCATMasterNetId, TO_STRING(aEtherCATMasterNetId[iCnt])); - IF iCnt < (SIZEOF(AMSNETID) - 1) THEN - sEtherCATMasterNetId := CONCAT(sEtherCATMasterNetId, '.'); - END_IF - END_FOR + FOR iCnt := 0 TO (SIZEOF(AMSNETID) - 1) DO + IF aEtherCATMasterNetId[iCnt] = 0 THEN + ADSLOGSTR(ADSLOG_MSGTYPE_ERROR,'Invalid Device 2 AmsNetID',''); + EXIT; + END_IF + + sEtherCATMasterNetId := CONCAT(sEtherCATMasterNetId, TO_STRING(aEtherCATMasterNetId[iCnt])); + IF iCnt < (SIZEOF(AMSNETID) - 1) THEN + sEtherCATMasterNetId := CONCAT(sEtherCATMasterNetId, '.'); + END_IF + END_FOR END_IF ]]> From 510555355494e9d837fccbd971cf63dcf559cf6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szil=C3=A1rd=20H=C3=B6kk=C3=B6n?= Date: Fri, 17 Jul 2026 08:23:31 +0200 Subject: [PATCH 7/9] MBP-389: Rename EtherCAT Device --- solution/tc_project_app/POUs/MAIN.TcPOU | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solution/tc_project_app/POUs/MAIN.TcPOU b/solution/tc_project_app/POUs/MAIN.TcPOU index 7affb16..d17b997 100644 --- a/solution/tc_project_app/POUs/MAIN.TcPOU +++ b/solution/tc_project_app/POUs/MAIN.TcPOU @@ -32,7 +32,7 @@ VAR fbGetDeviceIdentification: FB_GetDeviceIdentificationEx; dtAtStartup: DT; - {attribute 'TcLinkTo' := 'TIID^Device 2 (EtherCAT)^InfoData^AmsNetId'} + {attribute 'TcLinkTo' := 'TIID^KF200-EC1 (EtherCAT)^InfoData^AmsNetId'} aEtherCATMasterNetId AT%I*: AMSNETID; sEtherCATMasterNetId: T_AmsNetId; From b1f3b6735c2998792f4d3102bb16fcdf60c40eb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szil=C3=A1rd=20H=C3=B6kk=C3=B6n?= Date: Thu, 23 Jul 2026 13:32:59 +0200 Subject: [PATCH 8/9] MBP-389: Add Device to the hardware name --- solution/tc_project_app/POUs/MAIN.TcPOU | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/solution/tc_project_app/POUs/MAIN.TcPOU b/solution/tc_project_app/POUs/MAIN.TcPOU index d17b997..f1b9536 100644 --- a/solution/tc_project_app/POUs/MAIN.TcPOU +++ b/solution/tc_project_app/POUs/MAIN.TcPOU @@ -32,7 +32,8 @@ VAR fbGetDeviceIdentification: FB_GetDeviceIdentificationEx; dtAtStartup: DT; - {attribute 'TcLinkTo' := 'TIID^KF200-EC1 (EtherCAT)^InfoData^AmsNetId'} + + {attribute 'TcLinkTo' := 'TIID^KF200-EC1 (EtherCAT Device)^InfoData^AmsNetId'} aEtherCATMasterNetId AT%I*: AMSNETID; sEtherCATMasterNetId: T_AmsNetId; From f9b95824df8f439d4ae858fab6c8acc315fb4257 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szil=C3=A1rd=20H=C3=B6kk=C3=B6n?= Date: Thu, 23 Jul 2026 13:50:19 +0200 Subject: [PATCH 9/9] MBP-389: Fix white space --- solution/tc_project_app/POUs/MAIN.TcPOU | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solution/tc_project_app/POUs/MAIN.TcPOU b/solution/tc_project_app/POUs/MAIN.TcPOU index f1b9536..6286bc2 100644 --- a/solution/tc_project_app/POUs/MAIN.TcPOU +++ b/solution/tc_project_app/POUs/MAIN.TcPOU @@ -32,7 +32,7 @@ VAR fbGetDeviceIdentification: FB_GetDeviceIdentificationEx; dtAtStartup: DT; - + {attribute 'TcLinkTo' := 'TIID^KF200-EC1 (EtherCAT Device)^InfoData^AmsNetId'} aEtherCATMasterNetId AT%I*: AMSNETID; sEtherCATMasterNetId: T_AmsNetId;