Folie 1 - Electromate Industrial Sales

Download Report

Transcript Folie 1 - Electromate Industrial Sales

EPOS Programming
 Terms
 Programming Tool: Projects
 Basics of the PLC Programming
 Programming Language IEC 61131-3 Standard
 Sample Programs
EPOS P Training
Description of some terms
 PLC
Programmable Logic Control
 PLCopen
An Industrial Control organisation
 IEC 61131-3 Programming Standard created by
 OpenPCS
Programming tool for EPOS P
(from Infoteam)
2, © by maxon motor ag, Jan 05
PLCopen (in the past IEC 1131)
What is a PLC?
inputs
sensors
PLC
outputs
actuators
motors, valves
 roots in the wiring logic
– originally hardware based: Relays
 increasingly software based
– more flexible, easier to modify
– more efficient, lower costs
– industrial PC = PLC + programming device
– programming device will be removed after programming
 special requirements: rough environment
– no moving parts such as harddisks
3, © by maxon motor ag, Jan 05
 needs a programming device
A PLC program works in a cyclic manner
 Cyclic calculation of the output
pattern according to the input
pattern
inputs
inputs
program
– it starts again when it’s finished
– no inputs during the cycle
cycle time
 cycle time depends on the
outputs
 smart living technology: < min;
 drives: several ms
 particular programming
languages
4, © by maxon motor ag, Jan 05
application
What is PLCopen?
 User organisation for the promotion of
IEC 61131-3 standards
 develops and publishes the standards (e.g.
for Motion Control, Safety, …)
 certification authority
– motion functionality based on PLCopen Motion
Control
– The use of the PLCopen Logo is expensive;
therefore we do not advertise with it!
5, © by maxon motor ag, Jan 05
 PLCopen and maxon EPOS P
What is IEC 61131-3 ?
 describes concepts and directives for building a PLC
project, respectively PLC program
– use of defined terms (key words)
– contains 5 equal programming languages
– drive/motion function library
 advantages
– widely spread in the PLC world and motion control industry
– independent of used hardware
– “a certain” re-usability of PLC programs
– widely accepted
6, © by maxon motor ag, Jan 05
– well known “look and feel”, no need to learn new language
OpenPCS
 the programming tool for the EPOS P
– from company: Infoteam
 follows the standard IEC 61131-3
 not described in the IEC 61131-3 standard:
– How does a program editor have to look?
– management of projects and libraries
– online functions, e.g. software modification, debugging
– file and data base structures
and this is where the programming tools differ!
7, © by maxon motor ag, Jan 05
– documentation
Configuration
8, © by maxon motor ag, Jan 05
 PLC configuration in general
 Project in the EPOS-Studio
 Project in the OpenPCS
Project in the EPOS Studio
 Project in the EPOS Studio
– describes involved components
and its communication
– EPOS P: for 1 EPOS P
– EPOS: for 1 EPOS
– MCD EPOS: for 1 MCD EPOS
– MCD EPOS P: for 1 MCDEPOS P
– Info will be handed over to
OpenPCS
 tools and wizards depend on involved components
 communication, network connections
9, © by maxon motor ag, Jan 05
– For Network: Create New Project
e.g. EPOS Project
10, © by maxon motor ag, Jan 05
 for a EPOS
 navigation is adjusted
OpenPCS Project
 project contains
– resources, runtime programs
– allocation of variables to physical PLC
addresses
– references to other programs: global
variables, data types
– corresponds to PLC configuration
– e.g.: EPOS P “master function", CPU’s, special processors
– on one resource several runtime programs can run
 program sequence controlled by "Task"
– importance = priority
– execution type: periodic, cyclic, interrupt
11, © by maxon motor ag, Jan 05
 resource = processing unit of the PLC
Programming
 POU
Program Organisation Unit
Programs, Function Blocks, Functions
12, © by maxon motor ag, Jan 05
 Variables declaration, types
 Programming languages
Program Organisation Unit (POU)
 For structuring IEC 61131-3 application
PROG
programs
 3 types of POU
FB
FUN
– Functions (FUN)
– Function Blocks (FB)
FB
FUN
FUN
FUN
FUN
 POU’ s have a strict hierarchy
– recursion is not allowed
– memory demand is known from the beginning
– memory allocation can be made
13, © by maxon motor ag, Jan 05
– Programs (PROG)
Program Organisation Unit (POU)
– begin and end with KEY WORD
(taken care of by OpenPCS)
1. declaration section

interface variables, local variables
2. instruction section in one of the 5
programming languages
FUNCTION_BLOCK
PROGRAM
Interface
variables
local Variables
Instruction
POU body
END_PROGRAMM
END_FUNCTION_BLOCK
END_FUNCTION
14, © by maxon motor ag, Jan 05
 structure of a POU
FUNCTION
Characteristics of POU‘s
 closed unit
– can be compiled independently
– can be called within the whole project
– can be used in the whole project
– unique name within a project
 new POU
– File -> New -> POU
– reusability and modularisation
– e.g.: standard library, MC library, CAN library
15, © by maxon motor ag, Jan 05
 libraries can be built of FUN’s and FB’s
POU – variable declaration
 VAR
local data
 VAR_INPUT
input parameter
 VAR_OUTPUT output parameter
 VAR_INOUT input and output
 VAR_GLOBAL global data
 VAR_EXTERNAL reference to
 END_VAR
key word
for the end
16, © by maxon motor ag, Jan 05
global data
POU – type declaration
 for each variable a type has to be defined
 optionally an initial value can be
specified
– else standard value
– or value of previous call
programmer
– File -> New -> Declarations ->Types
– global valid
– TYPE … END_TYPE
17, © by maxon motor ag, Jan 05
 types can also be defined by the
Variable declaration in OpenPCS
 VAR_GLOBAL
– global data of the resource
 File -> New -> Declarations ->
Global
– global data of the program
 upper panel of the program
– upper panel of the POU
18, © by maxon motor ag, Jan 05
 all other VAR
Functions (FUN)
 return exactly one output value
– call with input variable (VAR_INPUT)
– for the same input, there is always the same output value
 without memory
– only local variables allowed (VAR), which will be
initialised at every call
 FUN can only call other functions
 standard functions are predefined
– arithmetic functions and comparisons
– e.g. sin (x)
FUNCTION Hallo: BOOL
VAR
…
END_VAR
…
…
Hallo := TRUE
END_FUNCTION
19, © by maxon motor ag, Jan 05
– no global or external variables allowed
Function Blocks (FB)
 work with an own data record
– with memory for internal state
– instantiation
 output depends on the inputs and state information
– input parameter and output parameter
– e.g. for timer and counter
 predefined Motion Control FB’s
– e.g. for relative movements
20, © by maxon motor ag, Jan 05
 can call FUN’s and other FB’s
 predefined standard FB’s
Program (PROG)
 main program
– “brain" of an PLC application program
– There is only one instance
 defines the access to the PLC periphery
– allocation to the physical address (e.g. input and output of the PLC)
 declaration of the variables of the whole program
 has no input and output parameter
21, © by maxon motor ag, Jan 05
(VAR_GLOBAL)
Programming languages in IEC 61131-3
– IL:
Instruction List
similar to assembler
– ST:
Structured Text
similar to high level
programming language
– LD:
Ladder Diagram
graphical
– FBD: Functional Block Diagram
graphical
– SFC: Sequential Function Chart
graphical
 It doesn’t matter with which language the user writes his
program. It is even possible to write different parts
(POU’s) of the program in different languages.
22, © by maxon motor ag, Jan 05
 5 equivalent programming languages
FBD Function Block Diagram
 graphical, strong accentuation of the function blocks
and the functions
– Similar to LabView
 relatively big overhead for parameters and FB
 no conditional code programmable
(all FB will always be loaded and called)
– (@ 30 IL/ms)
23, © by maxon motor ag, Jan 05
 realistic cycle times >= 10 ms
Sample FBD: SimpleMotionSequence
FUNCTION_BLOCK
with instantiation
FUNCTION
variables,
constants,
virtual
connections
24, © by maxon motor ag, Jan 05
without name
Libraries
 standard library
– for timer functions, arithmetical functions, …
– see OpenPCS help
 motion control (MC) library
– for axis control
– according to PLCopen standard
– see Programming Reference 6.1
– for reading and writing of SDO objects
– according to CANopen Standard
– see Programming Reference 6.2
25, © by maxon motor ag, Jan 05
 CANopen library
LD / LDD Ladder Diagram
 graphical
– in the style of
current logic, relay
technique
– Boolean logic
 widely used in USA
– Rockwell LD-Editor
as reference
26, © by maxon motor ag, Jan 05
and Asia
SFC Sequential Function Chart
 graphical
 for process control engineering
steps: will be executed if
activated
conditions (transitions)
– deactivates previous
step and activates
next step
27, © by maxon motor ag, Jan 05
– will be executed after
the previous step is
finished
 widely used in Europe
 textual programming
similar to assembler
– PLC assembler
 line oriented
– 1 line = 1 instruction
 CR = current result
– the virtual accumulator for
all data types
 realistic cycle times:
– optimised down to 1 ms
VAR
First, Second, Result: INT:=10;
StringOp: String[30]:='123456789';
StringRes: String[25]
END_VAR
…
B1: LD
First
(* 10(INT) *)
ADD Second
(* 20(INT) *)
ST
Result
(* 20(INT) *)
GT
0
(* True(BOOL) *)
JMPC B2
(* because
CR=True *)
JMC FarAway
(* CR undefined,
reaction depends
on implement.*)
B2: LD
StringOp (* 123456789
(String) *)
ST
StringRes (* 123456789 *)
28, © by maxon motor ag, Jan 05
IL Instruction List
ST Structured Text
 widely used in Europe
 textual, similar to high level
language (e.g. Pascal or C+)
 some features
– instructions separated with “ ; ”
– loops: FOR, WHILE, REPEAT
– complex expressions
 realistic cycle times:
– optimised down to 1 ms
29, © by maxon motor ag, Jan 05
– conditions: CASE,
IF…THEN…ELSIF...ELSE
30, © by maxon motor ag, Jan 05
Exercise 1:
 Download SimpleMotionSequence Program to the
31, © by maxon motor ag, Jan 05
controller and execute it.
Exercise 1a:
 Create a program that will enable the drive and move the
motor to an absolute position.
– Position = 20000
– Velocity = 1000
– Acceleration = 10000
32, © by maxon motor ag, Jan 05
– Deceleration = 10000
Exercise 1b:
 Create a program that will oscillate the motor between two
positions using FBD.
– Position 1 = 0
– Position 2 = 20000
– Velocity = 1500
– Acceleration = 15000
33, © by maxon motor ag, Jan 05
– Deceleration = 15000
Exercise 1 continued…
34, © by maxon motor ag, Jan 05
Step 2: Click on Open
Step 4: Select maxon
Programming
Tool
Step
8:
Click
on
motor
ag
Step 1: Double
Click
on
Step
9: Select
FBD

New
StepFile
3:
Click
on
File
“IEC 61131
Select
Step5:
10:
VerifyEPOS
POUProject
 New Step
Programming”
PType
Project
is Program
Step 13: Click Yes
Step
6:
Enter
Project
Step
11:
POU
to add
toEnter
Active
Name
Name
Resource
Step
Click
OK
Step7:
12:
Click
OK