|
83 | 83 | "${C:",
|
84 | 84 | " tempEnable := enable; // Work with temporary value / create process image",
|
85 | 85 | " ",
|
86 |
| - " IF (tempEnable = TRUE) AND (s_tatus = STATUS_NO_CALL) THEN // Enable FB", |
| 86 | + " IF (tempEnable = TRUE) AND (_status = STATUS_NO_CALL) THEN // Enable FB", |
87 | 87 | " // First call; initialize FB",
|
88 |
| - " s_alid := TRUE;", |
89 |
| - " s_usy := TRUE;", |
90 |
| - " s_ommandAborted := FALSE;", |
91 |
| - " s_rror := FALSE;", |
92 |
| - " s_rrorUserCleared := FALSE;", |
93 |
| - " s_rrorAutoCleared := FALSE;", |
94 |
| - " s_tatus := STATUS_FIRST_CALL;", |
95 |
| - " s_ubfunctionStatus := SUB_STATUS_NO_ERROR;", |
96 |
| - " s_berrorState := 0;", |
97 |
| - " diagnostics := s_mptyDiagnostics;", |
98 |
| - " s_isablingCompleted := FALSE;", |
| 88 | + " _valid := TRUE;", |
| 89 | + " _busy := TRUE;", |
| 90 | + " _commandAborted := FALSE;", |
| 91 | + " _error := FALSE;", |
| 92 | + " _errorUserCleared := FALSE;", |
| 93 | + " _errorAutoCleared := FALSE;", |
| 94 | + " _status := STATUS_FIRST_CALL;", |
| 95 | + " _subfunctionStatus := SUB_STATUS_NO_ERROR;", |
| 96 | + " _fberrorState := 0;", |
| 97 | + " diagnostics := _emptyDiagnostics;", |
| 98 | + " _disablingCompleted := FALSE;", |
99 | 99 | " // State machine - start functionality",
|
100 |
| - " s_bstate := FbStates#ENABLING;", |
| 100 | + " _fbstate := FbStates#ENABLING;", |
101 | 101 | " ",
|
102 | 102 | " // TODO: Initialize functionality: reset of variables, diagnostics, etc.",
|
103 | 103 | " ",
|
104 | 104 | " // TODO: Initialize functionality: call subordinated FBs with FALSE",
|
105 | 105 | " // instFB(execute := FALSE);",
|
106 | 106 | " ",
|
107 |
| - " ELSIF (tempEnable = FALSE) AND (s_nableOld = TRUE) THEN // Disable FB ", |
108 |
| - " s_bstate := FbStates#DISABLING;", |
| 107 | + " ELSIF (tempEnable = FALSE) AND (_enableOld = TRUE) THEN // Disable FB ", |
| 108 | + " _fbstate := FbStates#DISABLING;", |
109 | 109 | " ",
|
110 |
| - " ELSIF (s_tatus = STATUS_FIRST_CALL) THEN // Set status identifier of subsequent call", |
111 |
| - " s_tatus := STATUS_SUBSEQUENT_CALL;", |
| 110 | + " ELSIF (_status = STATUS_FIRST_CALL) THEN // Set status identifier of subsequent call", |
| 111 | + " _status := STATUS_SUBSEQUENT_CALL;", |
112 | 112 | " END_IF;",
|
113 | 113 | " ",
|
114 | 114 | " // Edge detection 'enable' input",
|
115 |
| - " s_nableOld := tempEnable;", |
| 115 | + " _enableOld := tempEnable;", |
116 | 116 | " ",
|
117 |
| - " IF (s_tatus = STATUS_NO_CALL) THEN // Nothing to do -> End here to reduce system load", |
| 117 | + " IF (_status = STATUS_NO_CALL) THEN // Nothing to do -> End here to reduce system load", |
118 | 118 | " RETURN;",
|
119 | 119 | " END_IF;",
|
120 | 120 | " ",
|
121 |
| - " CASE s_bstate OF // State machine of FB", |
| 121 | + " CASE _fbstate OF // State machine of FB", |
122 | 122 | " FbStates#NO_PROCESSING:",
|
123 | 123 | " // No processing active (Note: this state must always be present and left empty)",
|
124 | 124 | " ;",
|
|
128 | 128 | " // Call subordinated FB or functionality",
|
129 | 129 | " // instFB(execute := TRUE);",
|
130 | 130 | " // IF (instFB.done = TRUE) THEN // Subsidiary FB finished successfully",
|
131 |
| - " // // Continue processing with next state e.g. s_bstate := FbStates#PROCESSING;", |
| 131 | + " // // Continue processing with next state e.g. _fbstate := FbStates#PROCESSING;", |
132 | 132 | " //",
|
133 | 133 | " // ELSIF (instFB.error = TRUE) THEN // Error occurred in subordinated FB",
|
134 | 134 | " // // If the error occurred needs separate handling (e.g. close connection)",
|
135 | 135 | " // // please set the error output only when this error handling completed successfully",
|
136 |
| - " // s_tatus := ERR_XYZ; // Set correct status that identifies error clearly", |
137 |
| - " // s_ubfunctionStatus := instFB.status // Status or return value of called FBs, FCs and system blocks", |
138 |
| - " // s_berrorState := s_bstate; // Set error state number for diagnostic ", |
139 |
| - " // s_rrorAutoCleared OR s_rrorUserCleared // Set error type", |
| 136 | + " // _status := ERR_XYZ; // Set correct status that identifies error clearly", |
| 137 | + " // _subfunctionStatus := instFB.status // Status or return value of called FBs, FCs and system blocks", |
| 138 | + " // _fberrorState := _fbstate; // Set error state number for diagnostic ", |
| 139 | + " // _errorAutoCleared OR _errorUserCleared // Set error type", |
140 | 140 | " // // TODO: Error handling",
|
141 | 141 | " // ELSIF (instFB.commandAborted = TRUE) THEN // Commanded functionality has been aborted by another command",
|
142 | 142 | " // // Set block status",
|
143 |
| - " // s_tatus := STATUS_COMMAND_ABORTED;", |
| 143 | + " // _status := STATUS_COMMAND_ABORTED;", |
144 | 144 | " // // if that must be reported external",
|
145 |
| - " // // s_ubfunctionStatus := instFB.status // Status or return value of called FBs, FCs and system blocks", |
146 |
| - " // // s_berrorState := s_bstate; // Set error state number for diagnostic ", |
| 145 | + " // // _subfunctionStatus := instFB.status // Status or return value of called FBs, FCs and system blocks", |
| 146 | + " // // _fberrorState := _fbstate; // Set error state number for diagnostic ", |
147 | 147 | " // // TODO: Error handling",
|
148 | 148 | " // END_IF;",
|
149 | 149 | " //",
|
150 |
| - " // // TODO: Set s_rrorAutoCleared := FALSE if autocleared is acknowledged", |
| 150 | + " // // TODO: Set _errorAutoCleared := FALSE if autocleared is acknowledged", |
151 | 151 | " ;",
|
152 | 152 | " ",
|
153 | 153 | " FbStates#PROCESSING: // Processing active",
|
|
157 | 157 | " ",
|
158 | 158 | " FbStates#DISABLING: // Disabling active",
|
159 | 159 | " // TODO: Disabling, e.g. closing connections, etc.",
|
160 |
| - " // When disabling is complete the bit s_isablingCompleted must be set", |
161 |
| - " s_isablingCompleted := TRUE;", |
| 160 | + " // When disabling is complete the bit _disablingCompleted must be set", |
| 161 | + " _disablingCompleted := TRUE;", |
162 | 162 | " ",
|
163 | 163 | " ELSE // Undefined state in state machine reached",
|
164 |
| - " s_tatus := ERR_UNDEFINED_STATE;", |
165 |
| - " s_rrorUserCleared := TRUE;", |
| 164 | + " _status := ERR_UNDEFINED_STATE;", |
| 165 | + " _errorUserCleared := TRUE;", |
166 | 166 | " END_CASE;",
|
167 | 167 | " ",
|
168 | 168 | " // Write outputs",
|
169 |
| - " IF (s_isablingCompleted = TRUE) THEN", |
| 169 | + " IF (_disablingCompleted = TRUE) THEN", |
170 | 170 | " // Reset outputs if disabling completed",
|
171 |
| - " s_alid := FALSE;", |
172 |
| - " s_usy := FALSE;", |
173 |
| - " s_ommandAborted := FALSE;", |
174 |
| - " s_rror := FALSE;", |
175 |
| - " s_rrorUserCleared := FALSE;", |
176 |
| - " s_rrorAutoCleared := FALSE;", |
177 |
| - " s_tatus := STATUS_NO_CALL;", |
| 171 | + " _valid := FALSE;", |
| 172 | + " _ubsy := FALSE;", |
| 173 | + " _commandAborted := FALSE;", |
| 174 | + " _error := FALSE;", |
| 175 | + " _errorUserCleared := FALSE;", |
| 176 | + " _errorAutoCleared := FALSE;", |
| 177 | + " _status := STATUS_NO_CALL;", |
178 | 178 | " // TODO: Reset application specific outputs",
|
179 | 179 | " // ",
|
180 | 180 | " ",
|
181 |
| - " ELSIF (s_rrorUserCleared = TRUE) AND (s_rror = FALSE) THEN", |
| 181 | + " ELSIF (_errorUserCleared = TRUE) AND (_error = FALSE) THEN", |
182 | 182 | " // Error can only be cleared by user; rising edge at enable input is needed to continue ",
|
183 |
| - " s_alid := FALSE;", |
184 |
| - " s_usy := FALSE;", |
185 |
| - " s_ommandAborted := FALSE;", |
186 |
| - " s_rror := TRUE;", |
| 183 | + " _valid := FALSE;", |
| 184 | + " _busy := FALSE;", |
| 185 | + " _commandAborted := FALSE;", |
| 186 | + " _error := TRUE;", |
187 | 187 | " // Write diagnostics",
|
188 |
| - " //diagnostics := s_iagnostic;", |
189 |
| - " diagnostics.Status := s_tatus;", |
190 |
| - " diagnostics.SubfunctionStatus := s_ubfunctionStatus;", |
191 |
| - " diagnostics.StateNumber := s_berrorState;", |
| 188 | + " //diagnostics := _diagnostic;", |
| 189 | + " diagnostics.Status := _status;", |
| 190 | + " diagnostics.SubfunctionStatus := _subfunctionStatus;", |
| 191 | + " diagnostics.StateNumber := _fberrorState;", |
192 | 192 | " // execution aborted --> set state no processing",
|
193 |
| - " s_bstate := FbStates#NO_PROCESSING;", |
| 193 | + " _fbstate := FbStates#NO_PROCESSING;", |
194 | 194 | " ",
|
195 |
| - " ELSIF (s_rrorAutoCleared = TRUE) AND (s_rror = FALSE) THEN", |
| 195 | + " ELSIF (_errorAutoCleared = TRUE) AND (_error = FALSE) THEN", |
196 | 196 | " // Error can be reset by FB automatically",
|
197 |
| - " s_alid := FALSE;", |
198 |
| - " s_usy := TRUE;", |
199 |
| - " s_ommandAborted := FALSE;", |
200 |
| - " s_rror := TRUE;", |
| 197 | + " _valid := FALSE;", |
| 198 | + " _busy := TRUE;", |
| 199 | + " _commandAborted := FALSE;", |
| 200 | + " _error := TRUE;", |
201 | 201 | " // Write diagnostics",
|
202 |
| - " diagnostics.Status := s_tatus;", |
203 |
| - " diagnostics.SubfunctionStatus := s_ubfunctionStatus;", |
204 |
| - " diagnostics.StateNumber := s_berrorState;", |
| 202 | + " diagnostics.Status := _status;", |
| 203 | + " diagnostics.SubfunctionStatus := _subfunctionStatus;", |
| 204 | + " diagnostics.StateNumber := _fberrorState;", |
205 | 205 | " // TODO: Handling of autocleared error",
|
206 | 206 | " // ",
|
207 | 207 | " ",
|
208 |
| - " ELSIF (s_tatus = STATUS_COMMAND_ABORTED) AND (s_ommandAborted = FALSE) THEN", |
| 208 | + " ELSIF (_status = STATUS_COMMAND_ABORTED) AND (_commandAborted = FALSE) THEN", |
209 | 209 | " // Commanded functionality has been aborted by another command",
|
210 |
| - " s_alid := FALSE;", |
211 |
| - " s_usy := FALSE;", |
212 |
| - " s_ommandAborted := TRUE;", |
213 |
| - " s_rror := FALSE;", |
| 210 | + " _valid := FALSE;", |
| 211 | + " _busy := FALSE;", |
| 212 | + " _commandAborted := TRUE;", |
| 213 | + " _error := FALSE;", |
214 | 214 | " // Write diagnostics",
|
215 |
| - " diagnostics.Status := s_tatus;", |
216 |
| - " diagnostics.SubfunctionStatus := s_ubfunctionStatus;", |
217 |
| - " diagnostics.StateNumber := s_berrorState;", |
| 215 | + " diagnostics.Status := _status;", |
| 216 | + " diagnostics.SubfunctionStatus := _subfunctionStatus;", |
| 217 | + " diagnostics.StateNumber := _fberrorState;", |
218 | 218 | " // execution aborted --> set state no processing",
|
219 |
| - " s_bstate := FbStates#NO_PROCESSING;", |
| 219 | + " _fbstate := FbStates#NO_PROCESSING;", |
220 | 220 | " ",
|
221 |
| - " ELSIF (s_rrorAutoCleared = FALSE) AND (s_rrorUserCleared = FALSE) AND (s_ommandAborted = FALSE) AND (s_rror = TRUE) THEN", |
| 221 | + " ELSIF (_errorAutoCleared = FALSE) AND (_errorUserCleared = FALSE) AND (_commandAborted = FALSE) AND (_error = TRUE) THEN", |
222 | 222 | " // If autocleared error is acknowledged",
|
223 |
| - " s_alid := TRUE;", |
224 |
| - " s_usy := TRUE;", |
225 |
| - " s_ommandAborted := FALSE;", |
226 |
| - " s_rror := FALSE;", |
| 223 | + " _valid := TRUE;", |
| 224 | + " _busy := TRUE;", |
| 225 | + " _commandAborted := FALSE;", |
| 226 | + " _error := FALSE;", |
227 | 227 | " // TODO: remove this line if more detailed status information is used instead of 'STATUS_SUBSEQUENT_CALL'",
|
228 |
| - " s_tatus := STATUS_SUBSEQUENT_CALL;", |
| 228 | + " _status := STATUS_SUBSEQUENT_CALL;", |
229 | 229 | " END_IF;",
|
230 | 230 | " ",
|
231 |
| - " valid := s_alid;", |
232 |
| - " busy := s_usy;", |
233 |
| - " commandAborted := s_ommandAborted;", |
234 |
| - " error := s_rror;", |
235 |
| - " status := s_tatus;", |
| 231 | + " valid := _valid;", |
| 232 | + " busy := _busy;", |
| 233 | + " commandAborted := _commandAborted;", |
| 234 | + " error := _error;", |
| 235 | + " status := _status;", |
236 | 236 | " // TODO: Write application specific static values to outputs",
|
237 | 237 | "}",
|
238 | 238 |
|
|
0 commit comments