Created
July 18, 2025 07:19
-
-
Save kumajaya/64f2fad8168671c81c4676d3048a0b2c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (*=========================================================*) | |
| (* OEE Shutdown Runtime Management *) | |
| (* *) | |
| (* Author : Ketut Kumajaya *) | |
| (* Date : 18/07/2025 *) | |
| (* Version: 1.0 *) | |
| (*=========================================================*) | |
| (* Eksekusi di text code lain menggunakan rising trigger ASP_RUN dan delay on *) | |
| IF FALSE THEN | |
| (* Inisialisasi saat plant start *) | |
| IF ASP_RUN THEN | |
| SD_TYPE := 0; (* Reset SD_TYPE ke 0 saat plant start *) | |
| SD_FLAG := FALSE; (* Reset penanda trip *) | |
| END_IF; | |
| END_IF; | |
| (* Eksekusi di text code lain menggunakan falling trigger ASP_RUN dan delay on *) | |
| IF FALSE THEN | |
| (* Inisialisasi saat plant trip *) | |
| IF NOT ASP_RUN THEN | |
| SD_TYPE := 1; (* Set SD_TYPE ke 1 saat trip terjadi *) | |
| SD_FLAG := TRUE; (* Set penanda trip *) | |
| timers[35] := RUNS_BS; (* Set timer dari nilai yang terakhir disimpan *) | |
| END_IF; | |
| END_IF; | |
| (* Reset semua timer jika diperlukan *) | |
| IF RUNR_BS THEN (* Buffered Shutdown (BS) *) | |
| timers[35] := 0; | |
| RUNS_BS := 0; | |
| RUNM_BS := 0; | |
| RUNH_BS := 0; | |
| END_IF; | |
| IF RUNR_AG THEN (* Agreed Shutdown (AG) *) | |
| timers[36] := 0; | |
| RUNS_AG := 0; | |
| RUNM_AG := 0; | |
| RUNH_AG := 0; | |
| END_IF; | |
| IF RUNR_RS THEN (* Random Shutdown (RS) *) | |
| timers[38] := 0; | |
| RUNS_RS := 0; | |
| RUNM_RS := 0; | |
| RUNH_RS := 0; | |
| END_IF; | |
| IF RUNR_EGET THEN (* External Shutdown - Electricity Trip (EG - ET) *) | |
| timers[37] := 0; | |
| RUNS_EGET := 0; | |
| RUNM_EGET := 0; | |
| RUNH_EGET := 0; | |
| END_IF; | |
| IF RUNR_EGLO THEN (* External Shutdown - Lack of Order (EG - LO) *) | |
| timers[39] := 0; | |
| RUNS_EGLO := 0; | |
| RUNM_EGLO := 0; | |
| RUNH_EGLO := 0; | |
| END_IF; | |
| IF RUNR_EGWS THEN (* External Shutdown - Water Shortage (EG - WS) *) | |
| timers[40] := 0; | |
| RUNS_EGWS := 0; | |
| RUNM_EGWS := 0; | |
| RUNH_EGWS := 0; | |
| END_IF; | |
| (* External Shutdown Group EG *) | |
| RUNS_EG := RUNS_EGET + RUNS_EGLO + RUNS_EGWS; | |
| RUNM_EG := RUNM_EGET + RUNM_EGLO + RUNM_EGWS; | |
| RUNH_EG := RUNH_EGET + RUNH_EGLO + RUNH_EGWS; | |
| (* Transfer buffered timer ke tipe shutdown yang dipilih *) | |
| (* dengan mengaktifkan sementara penanda trip *) | |
| IF SD_FLAG THEN | |
| CASE SD_TYPE OF | |
| 2: (* Agreed Shutdown (AG) *) | |
| RUNS_AG := RUNS_AG + RUNS_BS; | |
| RUNM_AG := RUNM_AG + RUNM_BS + (RUNS_AG DIV 60); | |
| RUNH_AG := RUNH_AG + RUNH_BS + (RUNM_AG DIV 60); | |
| RUNS_AG := RUNS_AG MOD 60; | |
| RUNM_AG := RUNM_AG MOD 60; | |
| timers[36] := RUNS_AG; | |
| 3: (* Random Shutdown (RS) *) | |
| RUNS_RS := RUNS_RS + RUNS_BS; | |
| RUNM_RS := RUNM_RS + RUNM_BS + (RUNS_RS DIV 60); | |
| RUNH_RS := RUNH_RS + RUNH_BS + (RUNM_RS DIV 60); | |
| RUNS_RS := RUNS_RS MOD 60; | |
| RUNM_RS := RUNM_RS MOD 60; | |
| timers[38] := RUNS_RS; | |
| 4: (* External Shutdown - Electricity Trip (EG - ET) *) | |
| RUNS_EGET := RUNS_EGET + RUNS_BS; | |
| RUNM_EGET := RUNM_EGET + RUNM_BS + (RUNS_EGET DIV 60); | |
| RUNH_EGET := RUNH_EGET + RUNH_BS + (RUNM_EGET DIV 60); | |
| RUNS_EGET := RUNS_EGET MOD 60; | |
| RUNM_EGET := RUNM_EGET MOD 60; | |
| timers[37] := RUNS_EGET; | |
| 5: (* External Shutdown - Lack of Order (EG - LO) *) | |
| RUNS_EGLO := RUNS_EGLO + RUNS_BS; | |
| RUNM_EGLO := RUNM_EGLO + RUNM_BS + (RUNS_EGLO DIV 60); | |
| RUNH_EGLO := RUNH_EGLO + RUNH_BS + (RUNM_EGLO DIV 60); | |
| RUNS_EGLO := RUNS_EGLO MOD 60; | |
| RUNM_EGLO := RUNM_EGLO MOD 60; | |
| timers[39] := RUNS_EGLO; | |
| 6: (* External Shutdown - Water Shortage (EG - WS) *) | |
| RUNS_EGWS := RUNS_EGWS + RUNS_BS; | |
| RUNM_EGWS := RUNM_EGWS + RUNM_BS + (RUNS_EGWS DIV 60); | |
| RUNH_EGWS := RUNH_EGWS + RUNH_BS + (RUNM_EGWS DIV 60); | |
| RUNS_EGWS := RUNS_EGWS MOD 60; | |
| RUNM_EGWS := RUNM_EGWS MOD 60; | |
| timers[40] := RUNS_EGWS; | |
| END_CASE; | |
| (* Reset buffered timer setelah transfer *) | |
| IF SD_TYPE >= 2 AND SD_TYPE <= 6 THEN | |
| SD_FLAG := FALSE; (* Matikan kembali penanda trip *) | |
| IF ASP_RUN = TRUE THEN | |
| SD_TYPE = 0; (* Reset SD_TYPE ke 0 jika plant run *) | |
| END_IF; | |
| timers[35] := 0; | |
| RUNS_BS := 0; | |
| RUNM_BS := 0; | |
| RUNH_BS := 0; | |
| END_IF; | |
| END_IF; | |
| (* Buferred timer hanya berjalan saat plant trip dan penanda trip aktif *) | |
| IF ASP_RUN = FALSE AND SD_FLAG = TRUE THEN | |
| (*Buferred Shutdown runtime*) | |
| IF SD_TYPE=1 THEN | |
| RUNS_BS := timers[35]; | |
| ELSE | |
| timers[35] := RUNS_BS; | |
| END_IF; | |
| IF timers[35]>=60 THEN | |
| timers[35] := 0; | |
| RUNS_BS := 0; | |
| RUNM_BS := RUNM_BS + 1; | |
| END_IF; | |
| IF RUNM_BS>=60 THEN | |
| RUNM_BS := 0; | |
| RUNH_BS := RUNH_BS + 1; | |
| END_IF; | |
| END_IF; | |
| (* Shutdown timer hanya berjalan saat plant trip dan penanda trip tidak aktif *) | |
| IF ASP_RUN = FALSE AND SD_FLAG = FALSE THEN | |
| (* Agreed Shutdown (AG) runtime *) | |
| IF SD_TYPE=2 THEN | |
| RUNS_AG := timers[36]; | |
| ELSE | |
| timers[36] := RUNS_AG; | |
| END_IF; | |
| IF timers[36]>=60 THEN | |
| timers[36] := 0; | |
| RUNS_AG := 0; | |
| RUNM_AG := RUNM_AG + 1; | |
| END_IF; | |
| IF RUNM_AG>=60 THEN | |
| RUNM_AG := 0; | |
| RUNH_AG := RUNH_AG + 1; | |
| END_IF; | |
| (* Random Shutdown (RS) runtime *) | |
| IF SD_TYPE=3 THEN | |
| RUNS_RS := timers[38]; | |
| ELSE | |
| timers[38] := RUNS_RS; | |
| END_IF; | |
| IF timers[38]>=60 THEN | |
| timers[38] := 0; | |
| RUNS_RS := 0; | |
| RUNM_RS := RUNM_RS + 1; | |
| END_IF; | |
| IF RUNM_RS>=60 THEN | |
| RUNM_RS := 0; | |
| RUNH_RS := RUNH_RS+1; | |
| END_IF; | |
| (* External Shutdown - Electricity Trip (EG - ET) runtime *) | |
| IF SD_TYPE=4 THEN | |
| RUNS_EGET := timers[37]; | |
| ELSE | |
| timers[37] := RUNS_EGET; | |
| END_IF; | |
| IF timers[37]>=60 THEN | |
| timers[37] := 0; | |
| RUNS_EGET := 0; | |
| RUNM_EGET := RUNM_EGET + 1; | |
| END_IF; | |
| IF RUNM_EGET>=60 THEN | |
| RUNM_EGET := 0; | |
| RUNH_EGET := RUNH_EGET + 1; | |
| END_IF; | |
| (*External Shutdown - Lack of Order (EG - LO) runtime*) | |
| IF SD_TYPE=5 THEN | |
| RUNS_EGLO := timers[39]; | |
| ELSE | |
| timers[39] := RUNS_EGLO; | |
| END_IF; | |
| IF timers[39]>=60 THEN | |
| timers[39] := 0; | |
| RUNS_EGLO := 0; | |
| RUNM_EGLO := RUNM_EGLO + 1; | |
| END_IF; | |
| IF RUNM_EGLO>=60 THEN | |
| RUNM_EGLO := 0; | |
| RUNH_EGLO := RUNH_EGLO + 1; | |
| END_IF; | |
| (* External Shutdown - Water Shortage (EG - WS) runtime *) | |
| IF SD_TYPE=6 THEN | |
| RUNS_EGWS := timers[40]; | |
| ELSE | |
| timers[40] := RUNS_EGWS; | |
| END_IF; | |
| IF timers[40]>=60 THEN | |
| timers[40] := 0; | |
| RUNS_EGWS := 0; | |
| RUNM_EGWS := RUNM_EGWS + 1; | |
| END_IF; | |
| IF RUNM_EGWS>=60 THEN | |
| RUNM_EGWS := 0; | |
| RUNH_EGWS := RUNH_EGWS + 1; | |
| END_IF; | |
| END_IF; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment