|
1 <?xml version='1.0' encoding='utf-8'?> |
|
2 <project xmlns="http://www.plcopen.org/xml/tc6_0201" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xhtml="http://www.w3.org/1999/xhtml" xsi:schemaLocation="http://www.plcopen.org/xml/tc6_0201"> |
|
3 <fileHeader companyName="Unknown" productName="Generic PLC" productVersion="1" creationDateTime="2013-01-29T14:01:00" contentDescription="This example shows logging functionality in Beremiz. Here are shown two ways of logging: - from IEC PLC program; - from python extension. "/> |
|
4 <contentHeader name="Logging example" modificationDateTime="2024-06-03T22:15:34"> |
|
5 <coordinateInfo> |
|
6 <fbd> |
|
7 <scaling x="0" y="0"/> |
|
8 </fbd> |
|
9 <ld> |
|
10 <scaling x="0" y="0"/> |
|
11 </ld> |
|
12 <sfc> |
|
13 <scaling x="0" y="0"/> |
|
14 </sfc> |
|
15 </coordinateInfo> |
|
16 </contentHeader> |
|
17 <types> |
|
18 <dataTypes/> |
|
19 <pous> |
|
20 <pou name="C_Pragma" pouType="functionBlock"> |
|
21 <interface> |
|
22 <inputVars> |
|
23 <variable name="TRIG"> |
|
24 <type> |
|
25 <BOOL/> |
|
26 </type> |
|
27 </variable> |
|
28 <variable name="IN"> |
|
29 <type> |
|
30 <INT/> |
|
31 </type> |
|
32 </variable> |
|
33 </inputVars> |
|
34 <localVars> |
|
35 <variable name="rtrig"> |
|
36 <type> |
|
37 <derived name="R_TRIG"/> |
|
38 </type> |
|
39 </variable> |
|
40 </localVars> |
|
41 </interface> |
|
42 <body> |
|
43 <ST> |
|
44 <xhtml:p><![CDATA[rtrig(CLK := TRIG); |
|
45 IF rtrig.Q THEN |
|
46 {{ |
|
47 short inval = GetFbVar(IN); |
|
48 printf("C runtime OK #%d\n", inval); |
|
49 fflush(stdout); |
|
50 }} |
|
51 END_IF; |
|
52 ]]></xhtml:p> |
|
53 </ST> |
|
54 </body> |
|
55 </pou> |
|
56 <pou name="program0" pouType="program"> |
|
57 <interface> |
|
58 <localVars> |
|
59 <variable name="beat"> |
|
60 <type> |
|
61 <BOOL/> |
|
62 </type> |
|
63 </variable> |
|
64 <variable name="count"> |
|
65 <type> |
|
66 <INT/> |
|
67 </type> |
|
68 </variable> |
|
69 <variable name="LOGGER0"> |
|
70 <type> |
|
71 <derived name="LOGGER"/> |
|
72 </type> |
|
73 </variable> |
|
74 <variable name="lvl"> |
|
75 <type> |
|
76 <derived name="LOGLEVEL"/> |
|
77 </type> |
|
78 <initialValue> |
|
79 <simpleValue value="INFO"/> |
|
80 </initialValue> |
|
81 </variable> |
|
82 <variable name="Timer"> |
|
83 <type> |
|
84 <derived name="TOF"/> |
|
85 </type> |
|
86 </variable> |
|
87 <variable name="C_Pragma0"> |
|
88 <type> |
|
89 <derived name="C_Pragma"/> |
|
90 </type> |
|
91 </variable> |
|
92 </localVars> |
|
93 </interface> |
|
94 <body> |
|
95 <FBD> |
|
96 <inVariable localId="2" height="30" width="218" executionOrderId="0" negated="false"> |
|
97 <position x="859" y="365"/> |
|
98 <connectionPointOut> |
|
99 <relPosition x="218" y="15"/> |
|
100 </connectionPointOut> |
|
101 <expression>'C runtime log OK #'</expression> |
|
102 </inVariable> |
|
103 <block localId="3" width="59" height="40" typeName="NOT" executionOrderId="0"> |
|
104 <position x="241" y="287"/> |
|
105 <inputVariables> |
|
106 <variable formalParameter="IN"> |
|
107 <connectionPointIn> |
|
108 <relPosition x="0" y="30"/> |
|
109 <connection refLocalId="14" formalParameter="Q"> |
|
110 <position x="241" y="317"/> |
|
111 <position x="197" y="317"/> |
|
112 </connection> |
|
113 </connectionPointIn> |
|
114 </variable> |
|
115 </inputVariables> |
|
116 <inOutVariables/> |
|
117 <outputVariables> |
|
118 <variable formalParameter="OUT"> |
|
119 <connectionPointOut> |
|
120 <relPosition x="59" y="30"/> |
|
121 </connectionPointOut> |
|
122 </variable> |
|
123 </outputVariables> |
|
124 </block> |
|
125 <inOutVariable localId="4" height="30" width="60" executionOrderId="0" negatedOut="false" negatedIn="false"> |
|
126 <position x="57" y="302"/> |
|
127 <connectionPointIn> |
|
128 <relPosition x="0" y="15"/> |
|
129 <connection refLocalId="3" formalParameter="OUT"> |
|
130 <position x="57" y="317"/> |
|
131 <position x="37" y="317"/> |
|
132 <position x="37" y="390"/> |
|
133 <position x="314" y="390"/> |
|
134 <position x="314" y="317"/> |
|
135 <position x="300" y="317"/> |
|
136 </connection> |
|
137 </connectionPointIn> |
|
138 <connectionPointOut> |
|
139 <relPosition x="60" y="15"/> |
|
140 </connectionPointOut> |
|
141 <expression>beat</expression> |
|
142 </inOutVariable> |
|
143 <block localId="5" width="68" height="98" typeName="ADD" executionOrderId="0"> |
|
144 <position x="463" y="403"/> |
|
145 <inputVariables> |
|
146 <variable formalParameter="IN1"> |
|
147 <connectionPointIn> |
|
148 <relPosition x="0" y="39"/> |
|
149 <connection refLocalId="10" formalParameter="OUT"> |
|
150 <position x="463" y="442"/> |
|
151 <position x="455" y="442"/> |
|
152 <position x="439" y="442"/> |
|
153 </connection> |
|
154 </connectionPointIn> |
|
155 </variable> |
|
156 <variable formalParameter="IN2"> |
|
157 <connectionPointIn> |
|
158 <relPosition x="0" y="78"/> |
|
159 <connection refLocalId="6"> |
|
160 <position x="463" y="481"/> |
|
161 <position x="438" y="481"/> |
|
162 </connection> |
|
163 </connectionPointIn> |
|
164 </variable> |
|
165 </inputVariables> |
|
166 <inOutVariables/> |
|
167 <outputVariables> |
|
168 <variable formalParameter="OUT"> |
|
169 <connectionPointOut> |
|
170 <relPosition x="68" y="39"/> |
|
171 </connectionPointOut> |
|
172 </variable> |
|
173 </outputVariables> |
|
174 </block> |
|
175 <inOutVariable localId="6" height="30" width="103" executionOrderId="0" negatedOut="false" negatedIn="false"> |
|
176 <position x="335" y="466"/> |
|
177 <connectionPointIn> |
|
178 <relPosition x="0" y="15"/> |
|
179 <connection refLocalId="5" formalParameter="OUT"> |
|
180 <position x="335" y="481"/> |
|
181 <position x="320" y="481"/> |
|
182 <position x="320" y="518"/> |
|
183 <position x="544" y="518"/> |
|
184 <position x="544" y="442"/> |
|
185 <position x="531" y="442"/> |
|
186 </connection> |
|
187 </connectionPointIn> |
|
188 <connectionPointOut> |
|
189 <relPosition x="103" y="15"/> |
|
190 </connectionPointOut> |
|
191 <expression>count</expression> |
|
192 </inOutVariable> |
|
193 <block localId="8" width="67" height="144" typeName="CONCAT" executionOrderId="0"> |
|
194 <position x="1127" y="329"/> |
|
195 <inputVariables> |
|
196 <variable formalParameter="IN1"> |
|
197 <connectionPointIn> |
|
198 <relPosition x="0" y="51"/> |
|
199 <connection refLocalId="2"> |
|
200 <position x="1127" y="380"/> |
|
201 <position x="1077" y="380"/> |
|
202 </connection> |
|
203 </connectionPointIn> |
|
204 </variable> |
|
205 <variable formalParameter="IN2"> |
|
206 <connectionPointIn> |
|
207 <relPosition x="0" y="113"/> |
|
208 <connection refLocalId="9" formalParameter="OUT"> |
|
209 <position x="1127" y="442"/> |
|
210 <position x="1080" y="442"/> |
|
211 </connection> |
|
212 </connectionPointIn> |
|
213 </variable> |
|
214 </inputVariables> |
|
215 <inOutVariables/> |
|
216 <outputVariables> |
|
217 <variable formalParameter="OUT"> |
|
218 <connectionPointOut> |
|
219 <relPosition x="67" y="51"/> |
|
220 </connectionPointOut> |
|
221 </variable> |
|
222 </outputVariables> |
|
223 </block> |
|
224 <block localId="9" width="119" height="40" typeName="INT_TO_STRING" executionOrderId="0"> |
|
225 <position x="961" y="412"/> |
|
226 <inputVariables> |
|
227 <variable formalParameter="IN"> |
|
228 <connectionPointIn> |
|
229 <relPosition x="0" y="30"/> |
|
230 <connection refLocalId="5" formalParameter="OUT"> |
|
231 <position x="961" y="442"/> |
|
232 <position x="531" y="442"/> |
|
233 </connection> |
|
234 </connectionPointIn> |
|
235 </variable> |
|
236 </inputVariables> |
|
237 <inOutVariables/> |
|
238 <outputVariables> |
|
239 <variable formalParameter="OUT"> |
|
240 <connectionPointOut> |
|
241 <relPosition x="119" y="30"/> |
|
242 </connectionPointOut> |
|
243 </variable> |
|
244 </outputVariables> |
|
245 </block> |
|
246 <block localId="10" width="106" height="40" typeName="BOOL_TO_INT" executionOrderId="0"> |
|
247 <position x="333" y="412"/> |
|
248 <inputVariables> |
|
249 <variable formalParameter="IN" edge="rising"> |
|
250 <connectionPointIn> |
|
251 <relPosition x="0" y="30"/> |
|
252 <connection refLocalId="3" formalParameter="OUT"> |
|
253 <position x="333" y="442"/> |
|
254 <position x="314" y="442"/> |
|
255 <position x="314" y="317"/> |
|
256 <position x="300" y="317"/> |
|
257 </connection> |
|
258 </connectionPointIn> |
|
259 </variable> |
|
260 </inputVariables> |
|
261 <inOutVariables/> |
|
262 <outputVariables> |
|
263 <variable formalParameter="OUT"> |
|
264 <connectionPointOut> |
|
265 <relPosition x="106" y="30"/> |
|
266 </connectionPointOut> |
|
267 </variable> |
|
268 </outputVariables> |
|
269 </block> |
|
270 <block localId="11" width="65" height="209" typeName="LOGGER" instanceName="LOGGER0" executionOrderId="0"> |
|
271 <position x="1307" y="266"/> |
|
272 <inputVariables> |
|
273 <variable formalParameter="TRIG"> |
|
274 <connectionPointIn> |
|
275 <relPosition x="0" y="51"/> |
|
276 <connection refLocalId="3" formalParameter="OUT"> |
|
277 <position x="1307" y="317"/> |
|
278 <position x="300" y="317"/> |
|
279 </connection> |
|
280 </connectionPointIn> |
|
281 </variable> |
|
282 <variable formalParameter="MSG"> |
|
283 <connectionPointIn> |
|
284 <relPosition x="0" y="114"/> |
|
285 <connection refLocalId="8" formalParameter="OUT"> |
|
286 <position x="1307" y="380"/> |
|
287 <position x="1194" y="380"/> |
|
288 </connection> |
|
289 </connectionPointIn> |
|
290 </variable> |
|
291 <variable formalParameter="LEVEL"> |
|
292 <connectionPointIn> |
|
293 <relPosition x="0" y="177"/> |
|
294 <connection refLocalId="12"> |
|
295 <position x="1307" y="443"/> |
|
296 <position x="1280" y="443"/> |
|
297 </connection> |
|
298 </connectionPointIn> |
|
299 </variable> |
|
300 </inputVariables> |
|
301 <inOutVariables/> |
|
302 <outputVariables/> |
|
303 </block> |
|
304 <inVariable localId="12" height="30" width="79" executionOrderId="0" negated="false"> |
|
305 <position x="1201" y="428"/> |
|
306 <connectionPointOut> |
|
307 <relPosition x="79" y="15"/> |
|
308 </connectionPointOut> |
|
309 <expression>lvl</expression> |
|
310 </inVariable> |
|
311 <block localId="14" typeName="TOF" instanceName="Timer" executionOrderId="0" height="98" width="47"> |
|
312 <position x="150" y="278"/> |
|
313 <inputVariables> |
|
314 <variable formalParameter="IN"> |
|
315 <connectionPointIn> |
|
316 <relPosition x="0" y="39"/> |
|
317 <connection refLocalId="4"> |
|
318 <position x="150" y="317"/> |
|
319 <position x="117" y="317"/> |
|
320 </connection> |
|
321 </connectionPointIn> |
|
322 </variable> |
|
323 <variable formalParameter="PT"> |
|
324 <connectionPointIn> |
|
325 <relPosition x="0" y="78"/> |
|
326 <connection refLocalId="1"> |
|
327 <position x="150" y="356"/> |
|
328 <position x="117" y="356"/> |
|
329 </connection> |
|
330 </connectionPointIn> |
|
331 </variable> |
|
332 </inputVariables> |
|
333 <inOutVariables/> |
|
334 <outputVariables> |
|
335 <variable formalParameter="Q"> |
|
336 <connectionPointOut> |
|
337 <relPosition x="47" y="39"/> |
|
338 </connectionPointOut> |
|
339 </variable> |
|
340 <variable formalParameter="ET"> |
|
341 <connectionPointOut> |
|
342 <relPosition x="47" y="78"/> |
|
343 </connectionPointOut> |
|
344 </variable> |
|
345 </outputVariables> |
|
346 </block> |
|
347 <inVariable localId="1" executionOrderId="0" height="30" width="61" negated="false"> |
|
348 <position x="56" y="341"/> |
|
349 <connectionPointOut> |
|
350 <relPosition x="61" y="15"/> |
|
351 </connectionPointOut> |
|
352 <expression>T#1s</expression> |
|
353 </inVariable> |
|
354 <block localId="15" typeName="C_Pragma" instanceName="C_Pragma0" executionOrderId="0" width="74" height="60"> |
|
355 <position x="594" y="336"/> |
|
356 <inputVariables> |
|
357 <variable formalParameter="TRIG"> |
|
358 <connectionPointIn> |
|
359 <relPosition x="0" y="30"/> |
|
360 <connection refLocalId="3" formalParameter="OUT"> |
|
361 <position x="594" y="366"/> |
|
362 <position x="447" y="366"/> |
|
363 <position x="447" y="317"/> |
|
364 <position x="300" y="317"/> |
|
365 </connection> |
|
366 </connectionPointIn> |
|
367 </variable> |
|
368 <variable formalParameter="IN"> |
|
369 <connectionPointIn> |
|
370 <relPosition x="0" y="50"/> |
|
371 <connection refLocalId="5" formalParameter="OUT"> |
|
372 <position x="594" y="386"/> |
|
373 <position x="562" y="386"/> |
|
374 <position x="562" y="442"/> |
|
375 <position x="531" y="442"/> |
|
376 </connection> |
|
377 </connectionPointIn> |
|
378 </variable> |
|
379 </inputVariables> |
|
380 <inOutVariables/> |
|
381 <outputVariables/> |
|
382 </block> |
|
383 </FBD> |
|
384 </body> |
|
385 </pou> |
|
386 </pous> |
|
387 </types> |
|
388 <instances> |
|
389 <configurations> |
|
390 <configuration name="config"> |
|
391 <resource name="resource1"> |
|
392 <task name="task0" priority="0" interval="T#100ms"> |
|
393 <pouInstance name="prg" typeName="program0"/> |
|
394 </task> |
|
395 </resource> |
|
396 </configuration> |
|
397 </configurations> |
|
398 </instances> |
|
399 </project> |