CoDeSys - infoPLC

Transkript

CoDeSys - infoPLC
Programování v
CoDeSys
(IEC 61131-3)
Version: V1.0 /6.7.05
CoDeSys
Terminologie a definice
Co je IEC 61131-3 ?
Nezávislý standard
pro
programování PLC
CoDeSys?
CoDeSys
(Controller Development System)
CoDeSys
Terminologie a definice
CoDeSys from Smart Software Solutions (3S)
• široce akceptovaný, nezávislý vývojový standard IEC61131
• PLCOpen Base-Level certifikát
• Textové jazyky : - Instrukční List (IL)
- Strukturovaný text (ST)
• Graphical languages
: - reléová schémata (LD)
- Funkční bloky (FBD)
- Sekvenční funkční diagram (SFC)
- Kontinuální funkční diagram (CFC)
• záměna různých jazyků v projektu je možná
CoDeSys
Terminologie a definice
IEC61131-3 jazyky :
Strukturovaný text (ST)
Příklad:

Jazyk vyšší úrovně podobný Pascalu

Vyšší úroveň abstrakce

Žádný přímý přístup na zásobník

Snadný programovaní větví programu a smyček cyklů
CoDeSys
Terminologie a definice
IEC61131-3 jazyky :
Kontinuální funkční diagram (CFC)
 grafický programovací jazyk
 žádné síťové prostředky jako v FBD nebo LD
 Snadno naučitelné
 => „spojování funkčních bloků“
 není vhodné pro rozsáhlé projekty (není zřejmá struktura)
Příklad:
 není vhodné pro programování větvení uvnitř programu
CoDeSys
Cílový balíček
CoDeSys a verse Compax3 software
„CoDeSys pro C3 T30“
Compax3 T30 verse softwaru  V2.0
 „CoDeSys pro C3 T40“
Compax3 T40 verse softwaru  V2.0


„CoDeSys pro C3 powerPlmC“
Compax3 C1x s PowerPlmC

„CoDeSys pro Compax3“
Compax3 T30 verse softwaru <V2.0
CoDeSys
VlastnostiT30/T40
• volně programovatelné
• Proměnné:
500 x 16Bit proměnných (BOOL, INT, WORD);
150 x 32Bit proměnných (DINT, DWORD, REAL, TIME)
3 x 16Bit / 3 x 32Bit Retain Variables
• Velikost programu : Max. 5000 Compax3 bytových operací; S.V.  V2.03
• Nastavitelný čas cyklu; min. time: 1ms (v závislosti na délce programu)
• Přístup z knihovny objektů Compax3
• Standardní Funkční Bloky podle IEC61131-3; Příklad: „TON“
• Compax3- speciální funkční bloky : Příklad: „C3_INPUT“
• Funkční bloky PLCopen pro řízení pohybu ; Příklad: „MC_Home“
CoDeSys
Vlastnosti T30/T40
Následující typy dat jsou kompatibilní s IEC 61131-3
CoDeSys
Vlastnosti T30/T40
Všechny C3 objekty jsou zahrnuty v POUs (Program Organization Unit)
• Compax3 objekty rozdělujeme na 6 skupin:
C3.
C3Array.
C3Pop.
C3Plus.
Compax3 Objekty
Tabulky, pole
Objekty pro POP
Další objekty, které nejsou
standardně požadovány
C3Scope. Objekty pro programování
funkcí osciloskopu.
C3Cam. Objekty pro T40 CAM
C3.
CoDeSys
Vlastnosti T30/T40
Volná tabulka (pole) s 9 sloupci a 32 řádky
• pro ukládání pozic, rychlostí a dalších veličin
• přímí přístup ke každé jednotlivé buňce
• nepřímí přístup přes pointer (ArrayPointer_Row)
CoDeSys
Vlastnosti T30/T40
Podporované operátory:
IL
Numerické funkce:
ABS, SQRT, SIN, COS
Typy konversí dat:
-Každý datový typ je možné
konvertovat na jiný
pomocí
klávesy
F2
CoDeSys
Edge trigger:
„R_TRIG“ náběžná hrana
„F_TRIG“ sestupná hrana
Standardní
funkční bloky
CoDeSys
Timer /časovač/:
„TON“ sepnutí se zpožděním
„TOF“ odepnutí se zpožděním
„TP“ pulzní časovač
max. 8 časovačů s rozlišením 500µs
Standardní
funkční bloky
Zadat
T#1.5s
CoDeSys
Bistabilní /dvoustavové/ funkční bloky:
„RS“ dominantní reset
„SR“ dominantní set
Standardní
funkční bloky
CoDeSys
Softwarové čítače:
„CTU“ vzestupný
„CTD“ sestupný
„CTUD“ kombinace CTU a CTD
Frekvence závislá od délky cyklu !
Standardní
funkční bloky
CoDeSys
PLCopen řízení pohybu
Standard
pro
řízení pohybu
v souladu s IEC61131-3
=> Všechny PLCopen
Function Blocks with a
standardized interface,
functionality and behavior!
PLCopen
Funkční bloky
CoDeSys
PLCopen
crossing
State-Diagram
PLCopen
Funktionsbausteine
CoDeSys
Energising the power stage:
„MC_Power“
Activates the module; as long
as Enable =TRUE, the power
stage will be energised.
Reset Compax error:
„MC_Reset“
After the error is successfully
acknowledged, the power must be
supplied to the power stage again
by a rising flank on the enable input
of the MC_Power module.
PLCopen
Function Bocks
CoDeSys
PLCopen
Function Bocks
Machine reference (Homing):
„MC_Home“
Predefined search for the
machine reference point.
Position-Offset
Example: -180° degree
-
+
-180° degree = Status actual position after MC_Home „Done“
For homing motion the
software limits are not controlled.
CoDeSys
PLCopen
Function Bocks
Positioning modules:
„MC_MoveAbsolute“
„MC_MoveRelative“
„MC_MoveAdditive“
position-target
Adds a relative distance to the
target position of a positioning
process in progress
CoDeSys
PLCopen
Function Bocks
Timing sequence:
• Rising Edge starts execution
• To command a new motion a new level-change from FALSE to
TRUE has to be generated
• Falling Edge resets Function Block outputs
• Outputs are set only for a single PLC cycle if Execute input goes to
FALSE before Function Block execution is finished
Motion starts
Execute
Position reached
Case 1
Time of motion
Done
Motion starts
Execute
Case 2
Done
Time of motion
Position reached
tzyklus
CoDeSys
PLCopen
Function Bocks
Dynamic Positioning:
A second positioning process can be activated in the "Discrete
Motion" state, the 1st positioning process will be interrupted. The transition
to the new destination occurs dynamically, i.e. without any intervening stop.
Note:
• The new position/distance and the speed are taken over by the second
positioning process.
• The values for acceleration, deceleration and jerks are not taken over.
The values of the original positioning process apply.
CoDeSys
PLCopen
Function Bocks
Continuous positioning:
„MC_MoveVelocity“
Speed control with adjustable
speed.
Via library constants
Note:
- To stop the drive, the function module must be interrupted by
another positioning function module or positioning must be stopped
by calling the MC_Stop function module.
- Stop to the end of limits (Software-/hardware-limits)
CoDeSys
Stop:
„MC_Stop“
As long as the "Execute" input is
set, the axis remains in the
"Stopping" status (as long the axis
is energized) and is unable to
execute any additional movement
commands!
PLCopen
Function Bocks
CoDeSys
Reading the device
status:
„MC_ReadStatus“
Specifies the current
status according to the
PLCopen status
machine
Activates the module;
continuous outputs of
output parameters as long
as Enable=TRUE
PLCopen
Function Bocks
CoDeSys
PLCopen
Function Bocks
Electronic gearbox:
„MC_GearIn“
 Release 2004R3-1
Controlled speed and
position synchronicity
with adjustable
transmission ratio.
Note:
- The transmission ratio can be changed at any time with a positive edge
on Execute.
- Acceleration / deceleration to the set transmission ratio takes place
without a jerk limit.
- only with MC_Stop or error you will get out of the status synchronized
motion
CoDeSys
IEC example: Master = external encoder:
PLCopen
Function Bocks
CoDeSys
Timing diagram / IEC example:
Input 2
Input 3
0
PLCopen
Function Bocks
CoDeSys
PLCopen
Function Bocks
Reading the current position:
„MC_ReadActualPosition“
Activates the module, continuous
reading of the axis position as
long as Enable=TRUE
Better: C3 Object: „C3.StatusPosition_Actual“ (less Code)
Reading axis errors:
„MC_ReadAxisError“
CoDeSys
Compax3
Specifice Function Blocks
Digital Inputs/Outputs:
„C3_Input“ Reading digital inputs
„C3_Output“ Write digital outputs
Note:
Start the program with reading C3_Input
and use C3_Output at the end of
processing cycle.
C3_INPUT
I0: BOOL
I1: BOOL
C3_OUTPUT
I2: BOOL
I3: BOOL
O0: BOOL
I4: BOOL
O1: BOOL
I5: BOOL
O2 : BOOL
I6: BOOL
O3 : BOOL
I7: BOOL
CoDeSys
Compax3
Specifice Function Blocks
Process image of the optional digital inputs/outputs
with Option (M10/M12):
„C3_IOADDITION_0“
„C3_IOADDITION_1“
„C3_IOADDITION_2“
assigned as 4 inputs or 4 outputs
CoDeSys
Compax3
Specifice Function Blocks
Link of Parker I/Os (PIOs):
„PIO_Init“ => „for Initialisation“
„PIO_Inputx...y“
„PIO_Outputx...y“
4 groups: 0-15; 16-31; 32-47; 48-64
Note:
Compax with CANopen-bus „I21“
CANopen-Master of PIOs
Device: PIO Address
 Release 2004R3-1
CoDeSys
Compax3
Specifice Function Blocks
Read access of the array 9 Column á 32 Rows:
„C3_READArray“
Rows will be read cyclically as
long as Enable = TRUE
CoDeSys
Compax3
Specifice Function Blocks
Switching off error messages:
„C3_ERRORMASK“
.
Opening the motor brake:
„C3_OpenBrake“
Opening the motor holding brake –
works only with no current (standstill not powered).
CoDeSys
Compax3
Specifice Function Blocks
Manual operation:
„C3_Jog“
 Release 2004R3-1
.
Note:
- The axis must be in the "standstill" state in order to start manual
operation
- Start: When starting manual operation, the output ”Busy” is set to TRUE
- Stop: The axis is brought to a standstill if the respective input
(JogForward or JogBackward) is set to FALSE again
CoDeSys
Compax3
Specifice Function Blocks
Memorizing the signals with the trigger event:
„C3_TouchProbe“
Temporal precision of
signal recording: < 1 µs
Select trigger input via constant:
"TouchProbeInput0“ ... 7 “.
Selects the signal to be scanned.
Use ADR()-operator and the signal must
be in the REAL or the INT format.
Note: Only one of the module can be active
CoDeSys
Compax3
Specifice Function Blocks
Example: „C3_TouchProbe“
Read the actual current, triggered via input I0
Recorded current value
CoDeSys
Compax3
Specifice Function Blocks
Current setting operation:
„C3_Current“
Current control. Speed and
position controllers are switched off.
Current to be set in mA
Mode:
0= The current read during Execute on the Current input is set.
3=After Execute, the Current input is read again in each cycle and the corresponding
current is set
Note: The status ”current control” must be aborted with MC_Stop
before new positionings are possible.
CoDeSys
C3 PLCopen Library constants:
PLCopen
Function Blocks
CoDeSys
C3 PLCopen Library constants:
PLCopen
Function Blocks
CoDeSys
Thank
You !

Podobné dokumenty

Multi-function control MotionPLC GEL 8230/8231 GEL 8235/8236

Multi-function control MotionPLC GEL 8230/8231 GEL 8235/8236 (without feedback). Additional inputs and outputs permit several CAN REMOTE I/Os with up to 64 inputs or outputs per node and up to 64 node addresses. The standard CoDeSys programming environment r...

Více