1 <?xml version="1.0" encoding="UTF-8"?> |
|
2 <project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
|
3 xmlns="http://www.plcopen.org/xml/tc6.xsd" |
|
4 xmlns:xhtml="http://www.w3.org/1999/xhtml" |
|
5 xsi:schemaLocation="http://www.plcopen.org/xml/tc6.xsd"> |
|
6 <fileHeader companyName="Lolitech" |
|
7 productName="GenTraj" |
|
8 productVersion="1.0" |
|
9 creationDateTime="2009-01-13T12:15:00"/> |
|
10 <contentHeader name="GenTraj" |
|
11 modificationDateTime="2009-01-14T20:10:13"> |
|
12 <coordinateInfo> |
|
13 <fbd> |
|
14 <scaling x="0" y="0"/> |
|
15 </fbd> |
|
16 <ld> |
|
17 <scaling x="0" y="0"/> |
|
18 </ld> |
|
19 <sfc> |
|
20 <scaling x="0" y="0"/> |
|
21 </sfc> |
|
22 </coordinateInfo> |
|
23 </contentHeader> |
|
24 <types> |
|
25 <dataTypes/> |
|
26 <pous> |
|
27 <pou name="GenTraj" pouType="functionBlock"> |
|
28 <interface> |
|
29 <inputVars> |
|
30 <variable name="Period"> |
|
31 <type> |
|
32 <REAL/> |
|
33 </type> |
|
34 </variable> |
|
35 <variable name="Gmvt"> |
|
36 <type> |
|
37 <REAL/> |
|
38 </type> |
|
39 </variable> |
|
40 <variable name="Vmvt"> |
|
41 <type> |
|
42 <REAL/> |
|
43 </type> |
|
44 </variable> |
|
45 <variable name="P0"> |
|
46 <type> |
|
47 <REAL/> |
|
48 </type> |
|
49 </variable> |
|
50 <variable name="V0"> |
|
51 <type> |
|
52 <REAL/> |
|
53 </type> |
|
54 </variable> |
|
55 <variable name="Pf"> |
|
56 <type> |
|
57 <REAL/> |
|
58 </type> |
|
59 </variable> |
|
60 <variable name="Vf"> |
|
61 <type> |
|
62 <REAL/> |
|
63 </type> |
|
64 </variable> |
|
65 </inputVars> |
|
66 <outputVars> |
|
67 <variable name="Pn"> |
|
68 <type> |
|
69 <REAL/> |
|
70 </type> |
|
71 </variable> |
|
72 <variable name="Vn"> |
|
73 <type> |
|
74 <REAL/> |
|
75 </type> |
|
76 </variable> |
|
77 <variable name="Gn"> |
|
78 <type> |
|
79 <REAL/> |
|
80 </type> |
|
81 </variable> |
|
82 </outputVars> |
|
83 <localVars> |
|
84 <variable name="P"> |
|
85 <type> |
|
86 <REAL/> |
|
87 </type> |
|
88 </variable> |
|
89 <variable name="F"> |
|
90 <type> |
|
91 <REAL/> |
|
92 </type> |
|
93 </variable> |
|
94 <variable name="Ps2"> |
|
95 <type> |
|
96 <REAL/> |
|
97 </type> |
|
98 </variable> |
|
99 <variable name="Fs3"> |
|
100 <type> |
|
101 <REAL/> |
|
102 </type> |
|
103 </variable> |
|
104 <variable name="delta"> |
|
105 <type> |
|
106 <REAL/> |
|
107 </type> |
|
108 </variable> |
|
109 <variable name="Va"> |
|
110 <type> |
|
111 <REAL/> |
|
112 </type> |
|
113 </variable> |
|
114 <variable name="Vb"> |
|
115 <type> |
|
116 <REAL/> |
|
117 </type> |
|
118 </variable> |
|
119 <variable name="Vaut"> |
|
120 <type> |
|
121 <REAL/> |
|
122 </type> |
|
123 </variable> |
|
124 </localVars> |
|
125 </interface> |
|
126 <body> |
|
127 <ST> |
|
128 <![CDATA[IF Period <> P THEN |
|
129 P := Period; |
|
130 F := 1.0 / P; |
|
131 Ps2 := P / 2.0; |
|
132 Fs3 := F / 3.0; |
|
133 END_IF; |
|
134 |
|
135 IF Pf <> Pn THEN |
|
136 delta := Pf - P0 - V0 * P; |
|
137 |
|
138 Va := SQRT(ABS(2.0 * Gmvt * delta) + Vf * Vf); |
|
139 Vb := Vf + delta * Fs3; |
|
140 |
|
141 IF Va > ABS(Vb) THEN |
|
142 Vaut := MIN(ABS(Vb), Vmvt); |
|
143 IF Vb < 0.0 THEN |
|
144 Vaut := -Vaut; |
|
145 END_IF; |
|
146 ELSE |
|
147 Vaut := MIN(Va, Vmvt); |
|
148 IF Pf < P0 THEN |
|
149 Vaut := -Vaut; |
|
150 END_IF; |
|
151 END_IF; |
|
152 |
|
153 Gn := MIN(ABS((Vaut - V0) * F), Gmvt); |
|
154 IF Vaut < V0 THEN |
|
155 Gn := -Gn; |
|
156 END_IF; |
|
157 |
|
158 END_IF; |
|
159 |
|
160 Vn := V0 + Gn * P; |
|
161 |
|
162 Pn := P0 + (Vn + V0) * Ps2; |
|
163 |
|
164 IF (P0 >= Pf) <> (Pn >= Pf) AND Vf <> 0.0 THEN |
|
165 Pn := Pf; |
|
166 END_IF; |
|
167 |
|
168 ]]> |
|
169 </ST> |
|
170 </body> |
|
171 </pou> |
|
172 <pou name="TestMotion" pouType="program"> |
|
173 <interface> |
|
174 <localVars> |
|
175 <variable name="GO"> |
|
176 <type> |
|
177 <BOOL/> |
|
178 </type> |
|
179 <initialValue> |
|
180 <simpleValue value="TRUE"/> |
|
181 </initialValue> |
|
182 </variable> |
|
183 <variable name="TRIG"> |
|
184 <type> |
|
185 <BOOL/> |
|
186 </type> |
|
187 </variable> |
|
188 <variable name="GenTraj1"> |
|
189 <type> |
|
190 <derived name="GenTraj"/> |
|
191 </type> |
|
192 </variable> |
|
193 <variable name="py_eval"> |
|
194 <type> |
|
195 <derived name="python_eval"/> |
|
196 </type> |
|
197 </variable> |
|
198 <variable name="RS1"> |
|
199 <type> |
|
200 <derived name="RS"/> |
|
201 </type> |
|
202 </variable> |
|
203 </localVars> |
|
204 </interface> |
|
205 <body> |
|
206 <FBD> |
|
207 <inVariable localId="2" height="25" width="63"> |
|
208 <position x="203" y="208"/> |
|
209 <connectionPointOut> |
|
210 <relPosition x="63" y="12"/> |
|
211 </connectionPointOut> |
|
212 <expression>GO</expression> |
|
213 </inVariable> |
|
214 <inVariable localId="4" height="25" width="100"> |
|
215 <position x="295" y="312"/> |
|
216 <connectionPointOut> |
|
217 <relPosition x="100" y="12"/> |
|
218 </connectionPointOut> |
|
219 <expression>REAL#0.1</expression> |
|
220 </inVariable> |
|
221 <inVariable localId="6" height="25" width="100"> |
|
222 <position x="294" y="345"/> |
|
223 <connectionPointOut> |
|
224 <relPosition x="100" y="12"/> |
|
225 </connectionPointOut> |
|
226 <expression>REAL#1.0</expression> |
|
227 </inVariable> |
|
228 <inVariable localId="7" height="25" width="99"> |
|
229 <position x="294" y="378"/> |
|
230 <connectionPointOut> |
|
231 <relPosition x="99" y="12"/> |
|
232 </connectionPointOut> |
|
233 <expression>REAL#1.0</expression> |
|
234 </inVariable> |
|
235 <inVariable localId="8" height="25" width="100"> |
|
236 <position x="292" y="477"/> |
|
237 <connectionPointOut> |
|
238 <relPosition x="100" y="12"/> |
|
239 </connectionPointOut> |
|
240 <expression>REAL#10.0</expression> |
|
241 </inVariable> |
|
242 <block localId="9" width="178" height="290" typeName="GenTraj" instanceName="GenTraj1"> |
|
243 <position x="488" y="255"/> |
|
244 <inputVariables> |
|
245 <variable formalParameter="EN"> |
|
246 <connectionPointIn> |
|
247 <relPosition x="0" y="36"/> |
|
248 <connection refLocalId="13" formalParameter="Q1"> |
|
249 <position x="488" y="291"/> |
|
250 <position x="442" y="291"/> |
|
251 <position x="442" y="259"/> |
|
252 <position x="396" y="259"/> |
|
253 </connection> |
|
254 </connectionPointIn> |
|
255 </variable> |
|
256 <variable formalParameter="Period"> |
|
257 <connectionPointIn> |
|
258 <relPosition x="0" y="69"/> |
|
259 <connection refLocalId="4"> |
|
260 <position x="488" y="324"/> |
|
261 <position x="395" y="324"/> |
|
262 </connection> |
|
263 </connectionPointIn> |
|
264 </variable> |
|
265 <variable formalParameter="Gmvt"> |
|
266 <connectionPointIn> |
|
267 <relPosition x="0" y="102"/> |
|
268 <connection refLocalId="6"> |
|
269 <position x="488" y="357"/> |
|
270 <position x="394" y="357"/> |
|
271 </connection> |
|
272 </connectionPointIn> |
|
273 </variable> |
|
274 <variable formalParameter="Vmvt"> |
|
275 <connectionPointIn> |
|
276 <relPosition x="0" y="135"/> |
|
277 <connection refLocalId="7"> |
|
278 <position x="488" y="390"/> |
|
279 <position x="393" y="390"/> |
|
280 </connection> |
|
281 </connectionPointIn> |
|
282 </variable> |
|
283 <variable formalParameter="P0"> |
|
284 <connectionPointIn> |
|
285 <relPosition x="0" y="168"/> |
|
286 <connection refLocalId="9" formalParameter="Pn"> |
|
287 <position x="488" y="423"/> |
|
288 <position x="430" y="423"/> |
|
289 <position x="430" y="607"/> |
|
290 <position x="724" y="607"/> |
|
291 <position x="724" y="324"/> |
|
292 <position x="666" y="324"/> |
|
293 </connection> |
|
294 </connectionPointIn> |
|
295 </variable> |
|
296 <variable formalParameter="V0"> |
|
297 <connectionPointIn> |
|
298 <relPosition x="0" y="201"/> |
|
299 <connection refLocalId="9" formalParameter="Vn"> |
|
300 <position x="488" y="456"/> |
|
301 <position x="453" y="456"/> |
|
302 <position x="453" y="577"/> |
|
303 <position x="696" y="577"/> |
|
304 <position x="696" y="357"/> |
|
305 <position x="666" y="357"/> |
|
306 </connection> |
|
307 </connectionPointIn> |
|
308 </variable> |
|
309 <variable formalParameter="Pf"> |
|
310 <connectionPointIn> |
|
311 <relPosition x="0" y="234"/> |
|
312 <connection refLocalId="8"> |
|
313 <position x="488" y="489"/> |
|
314 <position x="392" y="489"/> |
|
315 </connection> |
|
316 </connectionPointIn> |
|
317 </variable> |
|
318 <variable formalParameter="Vf"> |
|
319 <connectionPointIn> |
|
320 <relPosition x="0" y="267"/> |
|
321 <connection refLocalId="10"> |
|
322 <position x="488" y="522"/> |
|
323 <position x="392" y="522"/> |
|
324 </connection> |
|
325 </connectionPointIn> |
|
326 </variable> |
|
327 </inputVariables> |
|
328 <inOutVariables/> |
|
329 <outputVariables> |
|
330 <variable formalParameter="ENO"> |
|
331 <connectionPointOut> |
|
332 <relPosition x="178" y="36"/> |
|
333 </connectionPointOut> |
|
334 </variable> |
|
335 <variable formalParameter="Pn"> |
|
336 <connectionPointOut> |
|
337 <relPosition x="178" y="69"/> |
|
338 </connectionPointOut> |
|
339 </variable> |
|
340 <variable formalParameter="Vn"> |
|
341 <connectionPointOut> |
|
342 <relPosition x="178" y="102"/> |
|
343 </connectionPointOut> |
|
344 </variable> |
|
345 <variable formalParameter="Gn"> |
|
346 <connectionPointOut> |
|
347 <relPosition x="178" y="135"/> |
|
348 </connectionPointOut> |
|
349 </variable> |
|
350 </outputVariables> |
|
351 </block> |
|
352 <inVariable localId="10" height="25" width="99"> |
|
353 <position x="293" y="510"/> |
|
354 <connectionPointOut> |
|
355 <relPosition x="99" y="12"/> |
|
356 </connectionPointOut> |
|
357 <expression>REAL#0.0</expression> |
|
358 </inVariable> |
|
359 <block localId="11" width="75" height="70" typeName="EQ"> |
|
360 <position x="197" y="247"/> |
|
361 <inputVariables> |
|
362 <variable formalParameter="IN1"> |
|
363 <connectionPointIn> |
|
364 <relPosition x="0" y="32"/> |
|
365 <connection refLocalId="9" formalParameter="Pn"> |
|
366 <position x="197" y="279"/> |
|
367 <position x="145" y="279"/> |
|
368 <position x="145" y="629"/> |
|
369 <position x="724" y="629"/> |
|
370 <position x="724" y="324"/> |
|
371 <position x="666" y="324"/> |
|
372 </connection> |
|
373 </connectionPointIn> |
|
374 </variable> |
|
375 <variable formalParameter="IN2"> |
|
376 <connectionPointIn> |
|
377 <relPosition x="0" y="57"/> |
|
378 <connection refLocalId="8"> |
|
379 <position x="197" y="304"/> |
|
380 <position x="176" y="304"/> |
|
381 <position x="176" y="433"/> |
|
382 <position x="409" y="433"/> |
|
383 <position x="409" y="489"/> |
|
384 <position x="392" y="489"/> |
|
385 </connection> |
|
386 </connectionPointIn> |
|
387 </variable> |
|
388 </inputVariables> |
|
389 <inOutVariables/> |
|
390 <outputVariables> |
|
391 <variable formalParameter="OUT"> |
|
392 <connectionPointOut> |
|
393 <relPosition x="75" y="32"/> |
|
394 </connectionPointOut> |
|
395 </variable> |
|
396 </outputVariables> |
|
397 </block> |
|
398 <block localId="12" width="120" height="87" typeName="python_eval" instanceName="py_eval"> |
|
399 <position x="318" y="73"/> |
|
400 <inputVariables> |
|
401 <variable formalParameter="TRIG"> |
|
402 <connectionPointIn> |
|
403 <relPosition x="0" y="36"/> |
|
404 <connection refLocalId="15" formalParameter="OUT"> |
|
405 <position x="318" y="109"/> |
|
406 <position x="225" y="109"/> |
|
407 </connection> |
|
408 </connectionPointIn> |
|
409 </variable> |
|
410 <variable formalParameter="CODE"> |
|
411 <connectionPointIn> |
|
412 <relPosition x="0" y="69"/> |
|
413 <connection refLocalId="14"> |
|
414 <position x="318" y="142"/> |
|
415 <position x="280" y="142"/> |
|
416 </connection> |
|
417 </connectionPointIn> |
|
418 </variable> |
|
419 </inputVariables> |
|
420 <inOutVariables/> |
|
421 <outputVariables> |
|
422 <variable formalParameter="ACK"> |
|
423 <connectionPointOut> |
|
424 <relPosition x="120" y="36"/> |
|
425 </connectionPointOut> |
|
426 </variable> |
|
427 <variable formalParameter="RESULT"> |
|
428 <connectionPointOut> |
|
429 <relPosition x="120" y="69"/> |
|
430 </connectionPointOut> |
|
431 </variable> |
|
432 </outputVariables> |
|
433 </block> |
|
434 <block localId="13" width="55" height="60" typeName="RS" instanceName="RS1"> |
|
435 <position x="341" y="229"/> |
|
436 <inputVariables> |
|
437 <variable formalParameter="S"> |
|
438 <connectionPointIn> |
|
439 <relPosition x="0" y="30"/> |
|
440 <connection refLocalId="2"> |
|
441 <position x="341" y="259"/> |
|
442 <position x="303" y="259"/> |
|
443 <position x="303" y="220"/> |
|
444 <position x="266" y="220"/> |
|
445 </connection> |
|
446 </connectionPointIn> |
|
447 </variable> |
|
448 <variable formalParameter="R1"> |
|
449 <connectionPointIn> |
|
450 <relPosition x="0" y="50"/> |
|
451 <connection refLocalId="11" formalParameter="OUT"> |
|
452 <position x="341" y="279"/> |
|
453 <position x="272" y="279"/> |
|
454 </connection> |
|
455 </connectionPointIn> |
|
456 </variable> |
|
457 </inputVariables> |
|
458 <inOutVariables/> |
|
459 <outputVariables> |
|
460 <variable formalParameter="Q1"> |
|
461 <connectionPointOut> |
|
462 <relPosition x="55" y="30"/> |
|
463 </connectionPointOut> |
|
464 </variable> |
|
465 </outputVariables> |
|
466 </block> |
|
467 <inVariable localId="14" height="25" width="50"> |
|
468 <position x="230" y="130"/> |
|
469 <connectionPointOut> |
|
470 <relPosition x="50" y="12"/> |
|
471 </connectionPointOut> |
|
472 <expression>'GO'</expression> |
|
473 </inVariable> |
|
474 <block localId="15" width="65" height="40" typeName="NOT"> |
|
475 <position x="160" y="79"/> |
|
476 <inputVariables> |
|
477 <variable formalParameter="IN"> |
|
478 <connectionPointIn> |
|
479 <relPosition x="0" y="30"/> |
|
480 <connection refLocalId="16"> |
|
481 <position x="160" y="109"/> |
|
482 <position x="118" y="109"/> |
|
483 </connection> |
|
484 </connectionPointIn> |
|
485 </variable> |
|
486 </inputVariables> |
|
487 <inOutVariables/> |
|
488 <outputVariables> |
|
489 <variable formalParameter="OUT"> |
|
490 <connectionPointOut> |
|
491 <relPosition x="65" y="30"/> |
|
492 </connectionPointOut> |
|
493 </variable> |
|
494 </outputVariables> |
|
495 </block> |
|
496 <inOutVariable localId="16" height="25" width="50"> |
|
497 <position x="68" y="97"/> |
|
498 <connectionPointIn> |
|
499 <relPosition x="0" y="12"/> |
|
500 <connection refLocalId="15" formalParameter="OUT"> |
|
501 <position x="68" y="109"/> |
|
502 <position x="42" y="109"/> |
|
503 <position x="42" y="50"/> |
|
504 <position x="262" y="50"/> |
|
505 <position x="262" y="109"/> |
|
506 <position x="225" y="109"/> |
|
507 </connection> |
|
508 </connectionPointIn> |
|
509 <connectionPointOut> |
|
510 <relPosition x="50" y="12"/> |
|
511 </connectionPointOut> |
|
512 <expression>TRIG</expression> |
|
513 </inOutVariable> |
|
514 <block localId="17" width="140" height="40" typeName="STRING_TO_INT"> |
|
515 <position x="486" y="112"/> |
|
516 <inputVariables> |
|
517 <variable formalParameter="IN"> |
|
518 <connectionPointIn> |
|
519 <relPosition x="0" y="30"/> |
|
520 <connection refLocalId="12" formalParameter="RESULT"> |
|
521 <position x="486" y="142"/> |
|
522 <position x="438" y="142"/> |
|
523 </connection> |
|
524 </connectionPointIn> |
|
525 </variable> |
|
526 </inputVariables> |
|
527 <inOutVariables/> |
|
528 <outputVariables> |
|
529 <variable formalParameter="OUT"> |
|
530 <connectionPointOut> |
|
531 <relPosition x="140" y="30"/> |
|
532 </connectionPointOut> |
|
533 </variable> |
|
534 </outputVariables> |
|
535 </block> |
|
536 <block localId="18" width="120" height="40" typeName="INT_TO_BOOL"> |
|
537 <position x="671" y="112"/> |
|
538 <inputVariables> |
|
539 <variable formalParameter="IN"> |
|
540 <connectionPointIn> |
|
541 <relPosition x="0" y="30"/> |
|
542 <connection refLocalId="17" formalParameter="OUT"> |
|
543 <position x="671" y="142"/> |
|
544 <position x="626" y="142"/> |
|
545 </connection> |
|
546 </connectionPointIn> |
|
547 </variable> |
|
548 </inputVariables> |
|
549 <inOutVariables/> |
|
550 <outputVariables> |
|
551 <variable formalParameter="OUT"> |
|
552 <connectionPointOut> |
|
553 <relPosition x="120" y="30"/> |
|
554 </connectionPointOut> |
|
555 </variable> |
|
556 </outputVariables> |
|
557 </block> |
|
558 <outVariable localId="19" height="25" width="63"> |
|
559 <position x="826" y="130"/> |
|
560 <connectionPointIn> |
|
561 <relPosition x="0" y="12"/> |
|
562 <connection refLocalId="18" formalParameter="OUT"> |
|
563 <position x="826" y="142"/> |
|
564 <position x="791" y="142"/> |
|
565 </connection> |
|
566 </connectionPointIn> |
|
567 <expression>GO</expression> |
|
568 </outVariable> |
|
569 </FBD> |
|
570 </body> |
|
571 </pou> |
|
572 </pous> |
|
573 </types> |
|
574 <instances> |
|
575 <configurations> |
|
576 <configuration name="config"> |
|
577 <resource name="ress"> |
|
578 <task name="MAIN_TASK" interval="00:00:00.100000" priority="0"> |
|
579 <pouInstance name="MAIN_INSTANCE" type="TestMotion"/> |
|
580 </task> |
|
581 </resource> |
|
582 </configuration> |
|
583 </configurations> |
|
584 </instances> |
|
585 </project> |
|