File view
| 1 | //$Id: plc_types.lib,v 1.5 2008-09-09 23:13:38 charlie Exp $ |
| 2 | /* |
| 3 | $Log: plc_types.lib,v $ |
| 4 | |
| 5 | |
| 6 | */ |
| 7 | |
| 8 | /*** BeginHeader */ |
| 9 | |
| 10 | #ifndef __ISM_TYPES_ |
| 11 | #define __ISM_TYPES_ |
| 12 | |
| 13 | /*** EndHeader */ |
| 14 | |
| 15 | /*** BeginHeader */ |
| 16 | |
| 17 | typedef unsigned uint; |
| 18 | typedef char uint8_t; |
| 19 | typedef unsigned uint16_t; |
| 20 | typedef int int16_t; |
| 21 | typedef long int32; |
| 22 | typedef long int32_t; |
| 23 | typedef unsigned long uint32_t; |
| 24 | typedef unsigned long Ms; |
| 25 | typedef const char Msg[DISPLAY_LENGTH_DEF]; |
| 26 | typedef char boolean; |
| 27 | typedef char bool; |
| 28 | typedef struct tm TmStr; |
| 29 | |
| 30 | #define DEFAULT_ALARM_WAIT_TIME 20000l |
| 31 | #define DEFAULT_RUNNING_TURBINES_REQUIRED 2 |
| 32 | #define DEFAULT_RUN_TIMEOUT (15l * 60L * 1000L) |
| 33 | |
| 34 | typedef struct timeStatSt { |
| 35 | float AvgMs; |
| 36 | Ms LastPass; |
| 37 | Ms LastCycle; |
| 38 | Ms MaxMs; |
| 39 | } TimeStatSt; |
| 40 | typedef TimeStatSt * TimeStatStPtr; |
| 41 | |
| 42 | typedef struct sumpSt { |
| 43 | int ShutDnFlag; |
| 44 | int AlarmPos; |
| 45 | int PerProdFlag; |
| 46 | int NoSumpFlag; |
| 47 | int Status[N_INPUTS]; |
| 48 | } sumpStruct; |
| 49 | |
| 50 | typedef struct ldnSt { |
| 51 | float Pressure; |
| 52 | uint8_t Idx; |
| 53 | uint8_t Active; |
| 54 | uint8_t ErrorCnt; |
| 55 | uint8_t DataReady; |
| 56 | uint8_t MbAddr; |
| 57 | int *RmbReg; |
| 58 | int *WmbReg; |
| 59 | } ldnStruct; |
| 60 | typedef ldnStruct * ldnStPtr; |
| 61 | |
| 62 | typedef struct mbSt { |
| 63 | Ms ActivityTimer; |
| 64 | int Address; |
| 65 | int Baudidx; |
| 66 | int Offsetidx; |
| 67 | } modBusStruct; |
| 68 | |
| 69 | typedef struct eventStr { |
| 70 | TmStr TOD; |
| 71 | Ms Time; |
| 72 | float Rate; |
| 73 | int LogType; |
| 74 | int Code; |
| 75 | int Product; |
| 76 | int Channel; |
| 77 | int Status; |
| 78 | int Notes; |
| 79 | } EventSt; |
| 80 | typedef EventSt * EventStPtr; |
| 81 | |
| 82 | typedef struct dispSt { |
| 83 | Ms Timer; |
| 84 | Ms HoldTimer; |
| 85 | Ms NextUpdate; |
| 86 | int Chan; |
| 87 | uint8_t UpdateFlag; |
| 88 | uint8_t Hold; |
| 89 | } displayStruct; |
| 90 | typedef displayStruct * dispStPtr; |
| 91 | |
| 92 | typedef struct configSt { |
| 93 | sumpStruct Sump; |
| 94 | modBusStruct ModBus; |
| 95 | |
| 96 | int SiteConfigFlag; |
| 97 | int MenuFlag; |
| 98 | int AlarmSilenceFlag; |
| 99 | int TestCnl; |
| 100 | int ViewCnl; |
| 101 | int DspInputStatus; |
| 102 | int DspNetworkStatus; |
| 103 | int N_Products; |
| 104 | int N_Turbines; |
| 105 | int N_CVs; |
| 106 | int N_PS; |
| 107 | int UpdateFlag; |
| 108 | int PresRetries; |
| 109 | int RePresRetries; |
| 110 | int ShutDownMode; |
| 111 | int TestMode; |
| 112 | int FlowDelay; |
| 113 | int PresCheckDelay; |
| 114 | } configStruct; |
| 115 | typedef configStruct * configStPtr; |
| 116 | |
| 117 | typedef struct cvSt{ |
| 118 | Ms OnDly; |
| 119 | Ms OffDly; |
| 120 | Ms scvOnDly; |
| 121 | Ms scvOffDly; |
| 122 | Ms pcvOnDly; |
| 123 | Ms pcvOffDly; |
| 124 | Ms dcvOnDly; |
| 125 | Ms dcvOffDly; |
| 126 | Ms authStart; |
| 127 | |
| 128 | int SCV; |
| 129 | int scvIOChannel; |
| 130 | int PCV; |
| 131 | int pcvIOChannel; |
| 132 | int DCV; |
| 133 | int dcvIOChannel; |
| 134 | int firstAuthFlag; |
| 135 | int CVLock; |
| 136 | } cvStruct; |
| 137 | |
| 138 | typedef struct productSt { |
| 139 | cvStruct CV; |
| 140 | |
| 141 | Ms CheckTime; |
| 142 | int LeadTurbine; |
| 143 | int Authorize; |
| 144 | int N_Turbines; |
| 145 | int N_LeadTurbines; |
| 146 | int N_RunTurbines; |
| 147 | int N_PistonSwitches; |
| 148 | int FirstTurbine; |
| 149 | int RotateFlag; |
| 150 | int AutoAuthFlag; |
| 151 | int FilterFlag; |
| 152 | int ProdName; |
| 153 | int ResilVal; |
| 154 | int DisStartTimeHours; |
| 155 | int DisStartTimeMin; |
| 156 | int DisEndTimeHours; |
| 157 | int DisEndTimeMin; |
| 158 | int RunPressure; |
| 159 | int HighPressure; |
| 160 | int LowPressure; |
| 161 | int RePresCount; |
| 162 | int CheckPres; |
| 163 | int ReturnFuel; |
| 164 | int Idx; |
| 165 | } productStruct; |
| 166 | typedef productStruct * prodStPtr; |
| 167 | |
| 168 | typedef struct elecTestingSt{ |
| 169 | float Rate[PT_CYCLES+1]; |
| 170 | Ms TestTime; |
| 171 | Ms StartTime; |
| 172 | Ms DurationTime; |
| 173 | uint16_t Resil; |
| 174 | uint8_t Type; |
| 175 | uint8_t ID; |
| 176 | uint8_t HighPressure; |
| 177 | uint8_t LowPressure; |
| 178 | uint8_t MaxCycles; |
| 179 | uint8_t Status; |
| 180 | uint8_t Result; |
| 181 | uint8_t Note; |
| 182 | uint8_t State; |
| 183 | uint8_t PreviousState; |
| 184 | uint8_t CurCycle; |
| 185 | uint8_t Turbine; |
| 186 | uint8_t ShuntValve; |
| 187 | uint8_t RdyFlag; |
| 188 | uint8_t PresFlag; |
| 189 | } ElecTestingStr; |
| 190 | typedef ElecTestingStr * elecTestStPtr; |
| 191 | |
| 192 | typedef struct channelSt { |
| 193 | ElecTestingStr GPH3Test; // Make these a pointer to |
| 194 | ElecTestingStr PrecTest; // Globel Testing Array idx |
| 195 | EventSt Event; // For passing test info |
| 196 | EventSt EventAl; |
| 197 | Ms StartTime; |
| 198 | Ms DurationTime; |
| 199 | Ms DelayTime; |
| 200 | Ms OnDly; |
| 201 | Ms OffDly; |
| 202 | Ms FlowTime; |
| 203 | int Turbine; |
| 204 | int RdyFlag; |
| 205 | int ShuntValve; |
| 206 | int State; |
| 207 | int PreviousState; |
| 208 | int Authorize; |
| 209 | int PresFlag; |
| 210 | int PresOkFlag; |
| 211 | int PresAlmFlag; |
| 212 | int SumpAlmFlag; |
| 213 | int ResetPbFlag; |
| 214 | int DisableFlag; |
| 215 | int FlowFlag; |
| 216 | int SensorOutFlag; |
| 217 | int NeverLeadFlag; |
| 218 | int ByPass; |
| 219 | int OverRideFlag; |
| 220 | int IOChannel; |
| 221 | int IOPS; |
| 222 | int ID; |
| 223 | int Idx; |
| 224 | int ProductID; |
| 225 | int LeadFlag; |
| 226 | int NextStage; |
| 227 | int AuthOff; |
| 228 | int Retries; |
| 229 | int ResilVal; |
| 230 | int NoReadIS; |
| 231 | |
| 232 | int AlarmFlag; |
| 233 | int lastState; // check if need |
| 234 | int lastPres; // check if need |
| 235 | int RunPressure; |
| 236 | int HighPressure; |
| 237 | int LowPressure; |
| 238 | int WarnFlag; |
| 239 | |
| 240 | prodStPtr Prod; |
| 241 | ldnStPtr LDN; |
| 242 | |
| 243 | } channelStruct; |
| 244 | typedef channelStruct * chanStPtr; |
| 245 | |
| 246 | /*** EndHeader */ |
| 247 | |
| 248 | |
| 249 | /*** BeginHeader */ |
| 250 | #endif |
| 251 | /*** EndHeader */ |
| 252 |