1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168
|
PACKAGE
CUSTOM (CLASS GENERAL; NOT BLD_VISIBLE)
PARAMETER SPPnt : Number
Value(0.0)
PARAMETER ArrayPnt : Number
Value(0.0)
PARAMETER Offset : Number
Value(0.0)
PARAMETER Counter : Number
Value(0.0)
PARAMETER DevVal : Number
Value(0.0)
PARAMETER RUNNING : Logical
Value(OFF)
-- Array of CB Selection ON/OFF
PARAMETER CBFlag: Logical -- Test On/Off
Value (OFF)
-- Array of CB Stop on Error ON/OFF
PARAMETER CBHold: Logical -- Hold On Error On/Off
Value(OFF)
-- Array of CB Reset Test ON/OFF..Set to ON to Start and the system will
-- reset when started
PARAMETER CBReset: Logical -- Reset CB Test ON/OFF
Value(ON)
-- Array for Tolerance per CB controller in %
PARAMETER CBTol: Number -- Tol in % per CB
Value(2) -- %
-- Array for the K factor
PARAMETER CB_K: Number -- K Factor
Value (1.0)
-- Array for the T1 factor
PARAMETER CB_T1: Number -- T1 Factor
Value (0.1)
-- Parameter for Timer in Seconds
PARAMETER Timer : Number
Value(120) -- Seconds
-- Parameters for Start Time
PARAMETER TIME1 : TIME
-- Parameter for Time Stopped
PARAMETER TIME2 : TIME
-- Array of CB Controller Points 1..8
PARAMETER CBREG: CB_PT Array(1..8) -- CB20PV01 etc
-- Array Of CB SP values
PARAMETER SPVAL: NUMBER ARRAY(1..9) -- SP Values
Value(0.0,25.0,50.0,75.0,100.0,75.0,50.0,25.0,0.0)
-- Array of all the PV values Read Back from System 0 - 24 HRS
PARAMETER CB1PV: NUMBER ARRAY(1..72) -- 9 per 3 h * 8
PARAMETER CB2PV: NUMBER ARRAY(1..72) -- 9 per 3 h * 8
PARAMETER CB3PV: NUMBER ARRAY(1..72) -- 9 per 3 h * 8
PARAMETER CB4PV: NUMBER ARRAY(1..72) -- 9 per 3 h * 8
PARAMETER CB5PV: NUMBER ARRAY(1..72) -- 9 per 3 h * 8
PARAMETER CB6PV: NUMBER ARRAY(1..72) -- 9 per 3 h * 8
PARAMETER CB7PV: NUMBER ARRAY(1..72) -- 9 per 3 h * 8
PARAMETER CB8PV: NUMBER ARRAY(1..72) -- 9 per 3 h * 8
-- Array of all error values Read Back from System 0 - 24 HRS
PARAMETER CB1ERR: NUMBER ARRAY(1..72)
PARAMETER CB2ERR: NUMBER ARRAY(1..72)
PARAMETER CB3ERR: NUMBER ARRAY(1..72)
PARAMETER CB4ERR: NUMBER ARRAY(1..72)
PARAMETER CB5ERR: NUMBER ARRAY(1..72)
PARAMETER CB6ERR: NUMBER ARRAY(1..72)
PARAMETER CB7ERR: NUMBER ARRAY(1..72)
PARAMETER CB8ERR: NUMBER ARRAY(1..72)
END CUSTOM
BLOCK CBTEST1 (generic CB_PT ; AT general)
|
-- LOCAL PARAMETERS --
----------------------
Local i : Number
----------------------
--EXTERNAL PARAMETER--
----------------------
EXTERNAL $HIWAY02 -- HIWAY 02 STATUS DETAIL
EXTERNAL $HY02B21 -- HIWAY 02 BOX 21 STATUS DETAIL
----------------------
--- MAIN CODE BODY ---
----------------------
-- This section checks to ensure that entities have been loading,
-- otherwise the program is aborted.
IF EQUAL_NULL_POINT_ID(CBREG(1)) Then -- Data must be available
& (SEND:("No Data Entered");
& EXIT)
If CBFlag = ON Then
& Set RUNNING = ON
If Counter < Timer and CBFlag = ON then
& Call ChkMode
If Counter < Timer and CBFlag = ON then
& Set Counter = Counter + 1 -- Add 10 seconds to timer
If Counter < Timer and CBFlag = ON and CBReset = ON then
& (Call ResetCB;
& Exit)
If CBFlag = OFF then
& (Set RUNNING = OFF;
& Exit)
If Counter = Timer then
& Set Counter = 0
else
& Exit
If sppnt > 0 then Call ReadPV
If SPpnt >= 9 then
& (Set SPPnt = 0.0;
& Set ArrayPnt = ArrayPnt + 9)
If ArrayPnt = 72 then
& (Set CBHold = OFF;
& Set TIME2 = DATE_TIME;
& Set RUNNING = OFF;
& Set CBFlag = OFF; -- End of 24 Hrs..exit
& Exit)
Set SPPnt = SPPnt + 1
Call UpdateOP
END CBtest1
SUBROUTINE ResetCB
Reset3: loop for i in 1..72
call Set_Bad(cb1pv(i))
call Set_Bad(cb1err(i))
call Set_Bad(cb2pv(i))
call Set_Bad(cb2err(i))
call Set_Bad(cb3pv(i))
call Set_Bad(cb3err(i))
call Set_Bad(cb4pv(i))
call Set_Bad(cb4err(i))
call Set_Bad(cb5pv(i))
call Set_Bad(cb5err(i))
call Set_Bad(cb6pv(i))
call Set_Bad(cb6err(i))
call Set_Bad(cb7pv(i))
call Set_Bad(cb7err(i))
call Set_Bad(cb8pv(i))
call Set_Bad(cb8err(i))
Repeat Reset3
Set CBReset = OFF
Set SPPnt = 0
Set ArrayPnt = 0
Set Counter = 0
Set Offset = 0
Set TIME1 = DATE_TIME
Set CBHold = ON
end ResetCB
Subroutine UpdateOP
Set CBReg(1).op = spval(sppnt)
Set CBReg(2).op = spval(sppnt)
Set CBReg(3).op = spval(sppnt)
Set CBReg(4).op = spval(sppnt)
Set CBReg(5).op = spval(sppnt)
Set CBReg(6).op = spval(sppnt)
Set CBReg(7).op = spval(sppnt)
Set CBReg(8).op = spval(sppnt)
end UpdateOP
Subroutine ReadPV
Set Offset = SPPnt + ArrayPnt
Set CB1PV(Offset) = CBReg(1).PV
If CBReg(1).PV < CBReg(1).op - DevVal Then
& set CB1ERR(Offset) = CBReg(1).PV
If CBReg(1).PV > CBReg(1).op + DevVal Then
& set CB1ERR(Offset) = CBReg(1).PV
Set CB2PV(Offset) = CBReg(2).PV
If CBReg(2).PV < CBReg(2).op - DevVal Then
& set CB2ERR(Offset) = CBReg(2).PV
If CBReg(2).PV > CBReg(2).op + DevVal Then
& set CB2ERR(Offset) = CBReg(2).PV
Set CB3PV(Offset) = CBReg(3).PV
If CBReg(3).PV < CBReg(3).op - DevVal Then
& set CB3ERR(Offset) = CBReg(3).PV
If CBReg(3).PV > CBReg(3).op + DevVal Then
& set CB3ERR(Offset) = CBReg(3).PV
Set CB4PV(Offset) = CBReg(4).PV
If CBReg(4).PV < CBReg(4).op - DevVal Then
& set CB4ERR(Offset) = CBReg(4).PV
If CBReg(4).PV > CBReg(4).op + DevVal Then
& set CB4ERR(Offset) = CBReg(4).PV
Set CB5PV(Offset) = CBReg(5).PV
If CBReg(5).PV < CBReg(5).op - DevVal Then
& set CB5ERR(Offset) = CBReg(5).PV
If CBReg(5).PV > CBReg(5).op + DevVal Then
& set CB5ERR(Offset) = CBReg(5).PV
Set CB6PV(Offset) = CBReg(6).PV
If CBReg(6).PV < CBReg(6).op - DevVal Then
& set CB6ERR(Offset) = CBReg(6).PV
If CBReg(6).PV > CBReg(6).op + DevVal Then
& set CB6ERR(Offset) = CBReg(6).PV
Set CB7PV(Offset) = CBReg(7).PV
If CBReg(7).PV < CBReg(7).op - DevVal Then
& set CB7ERR(Offset) = CBReg(7).PV
If CBReg(7).PV > CBReg(7).op + DevVal Then
& set CB7ERR(Offset) = CBReg(7).PV
Set CB8PV(Offset) = CBReg(8).PV
If CBReg(8).PV < CBReg(8).op - DevVal Then
& set CB8ERR(Offset) = CBReg(8).PV
If CBReg(8).PV > CBReg(8).op + DevVal Then
& set CB8ERR(Offset) = CBReg(8).PV
end ReadPV
Subroutine ChkMode
LoopChk: Loop for i in 1..8
-- If cbreg(i).algiddac <> pidcma then
--& set cbreg(i).algiddac = pidcma
If cbreg(i).mode <> Cas then
& (set CBREG(i).mode = Cas;
& set CBREG(i).nmode = Cas)
Repeat LoopChk
End ChkMode
END PACKAGE
|