Manual On Program Development - Ifm

Transcription

Manual onprogram developmentI

Manual for program development with ecolog 100plusas per October 2002GuaranteeThis manual was written with the utmost care. However, we cannot assume any guarantee for thecontents.Since errors cannot be avoided despite all efforts we appreciate any comment.We reserve the right to make technical alterations to the product which might result in a change ofcontents of the manual.

1.What you need to know.1-11.1Required basic knowledge. 1-11.2Set-up of the manual . 1-1How to get along. 1-11.3.This is what to expect. 1-3Overview. 1-3The contents of this manual. 1-32.The first steps with ecolog 100PLUS .2-12.1.ecolog 100PLUS - fundamentals and concepts . 2-13.What is what in ecolog 100PLUS?.3-13.1.The IEC 61131-3 norm. 3-13.2.Which components does a project have? . 3-13.3.Which languages are available in ecolog 100PLUS?. 3-4Function block diagram (FBD) . 3-4Ladder diagram (LD). 3-7Instruction list (IL) . 3-9Structured text (ST) . 3-12Sequential function chart (SFC). 3-133.4.Online functionality . 3-154.The ecolog 100PLUS software.4-14.1.Components of ecolog 100PLUS in detail . 4-2The main screen . 4-2Options . 4-6Maintaining projects. 4-17PLC Configuration . 4-28Handling objects . 4-30General editing functions . 4-37General online functions . 4-43I

Arrange windows . 4-49Help. 4-504.2.A short ecolog 100 PLUS as a start . 4-544.3.Overview of keyboard shortcuts . 4-815.The little programming manual. 5-15.1.The editors in ecolog 100 Plus . 5-1The declaration editor . 5-2The text editors . 5-8The graphic editors .5-115.2.Visualisation with ecolog 100 PLUS . 5-35Working with visualisation elements. 5-37Configuring visualisation elements. 5-38More functions for visualisation elements . 5-475.3.The resources . 5-52Overview of the resources . 5-52Global Variables . 5-52PLC Configuration. 5-53Sampling Trace . 5-53Watch and Receipt Manager. 5-605.3.Additional information on the languages . 5-63Instruction list (IL). 5-63Structured text (ST). 5-66Sequential function chart (SFC) . 5-755.5.The operators in ecolog 100 PLUS . 5-80Arithmetic operators . 5-80Bitstring operators. 5-83Bit-Shift operators . 5-86Selection operators . 5-88Comparative operators. 5-91Address operator ADR . 5-94Call operator CAL . 5-95IIHandbuch ecolog 100 plus

Copy operator MOVE . 5-95Numeric operators . 5-965.4.The elements of the library Standard.lib. 5-103Type conversion functions and types. 5-103Bistable function blocks . 5-105Edge detection:. 5-106Counter . 5-107Timers. 5-107String functions .5-1105.5.The elements of the library Util ifm.Lib.5-117BCD conversion.5-117Bit / byte functions .5-118Mathematical auxiliary functions .5-119Loop controllers . 5-121Signal generators. 5-123Function manipulators. 5-124Analog value processing. 5-1265.8.Functions, programs and function blocks . 5-127Functions . 5-127Programs . 5-129Function blocks. 5-1315.6.Arrays and structures. 5-134Arrays . 5-134List of Structures. 5-1365.7.Compilation errors. 5-1376.Annex.6-16.1.Glossary . 6-16.2.Index . 6-6III

The contents of this manualIVHandbuch ecolog 100 plus

1.What you need to knowIf you use this manual in the way it is recommended you will reach your target –the efficient application of thePLC systems and the ecolog 100 PLUSprogramming system – much faster.This chapter will give you an overview of the following points:1.1 Which previous knowledge do you need to work with this manual? How is this manual set up? How do you find your way in this manual? Which information will you find in the manual?Required basic knowledgeThis manual is aimed at persons with a knowledge of control technology, abasic knowledge of PLC technology and plc programming knowledge in at leastone of the following programming languages.1.2 ladder diagram instruction list function block diagram sequential function chart or structured textSet-up of the manualThis manual is a combination of different types of instructions. On the one hand,it serves as a teaching guide for a beginner with the ecolog 100 PLUS system; atthe same time it is a reference guide for the experienced programmer.How to get alongTo simplify the use of this manual we have integrated some aids.Please use the contents list of the manual to find a certain topic.The list of keywords will also take you quickly to the term you are looking for.At the start of each chapter we give you a short overview of the contents of thischapter.HeadlinesEach head line on the right-hand side shows you the title of the current chapter.On the left you find the current sub-headline.1-1

1.2FooterSet-up of the manualThe footer on each page indicates the page number of the chapter.Selective reading In the margin you will find some notes to facilitate the identification of certainparagraphs.Here, you will also find pictograms and markings which we will explain below.The doctor's capParagraphs marked with this pictogram provide general knowledge on how towork with the ecolog 100PLUS system. In these paragraphs we will, for example,explain the handling of the software surface.The arrowHere we will give you important information on the correct handling of theecolog 100 PLUS system.Control cabinetParagraphs marked with this pictogram are related to the controller.The grey barParagraphs marked with this bar contain program text.1-2

What you need to know1.3.This is what to expectThis manual describes version 2.1 of the programming software ecolog 100PLUSsystem. In the manual we will refer to it as ecolog.OverviewWhat is ecolog?ecolog is the system software for the R360 PLC system of ifm electronic. Thesystem software allows optimum access of these functions.ProgrammingIn this manual you will get to know the different programming languages withregard toUse of thesoftwareHardwarehandling type syntax and scope.Simple examples will show you the handling of the software with Menu structure Project structure Program test Function keys etc.The fundamentals of the R360 controller system and its set-up are describedin a separate manual.The contents of this manualFor your orientation we will give you a quick overview of the contents of themanual.ecologChapter 2 summarises fundamentals and concepts of ecolog. It will give youan overview of the structure the functions and the characteristicsof the ecolog software. If you already know ecolog from earlier versions youcan just “fly over” this chapter. If ecolog is new to you, you should read thischapter more carefully.The componentsof ecologChapter 3 will tell you which components ecolog works with. You will, e.g. findout about the structure of a project. Furthermore you will get more informationon the languages available in ecolog with regard to their structure and syntax.1-3

1.3.This is whatThe softwareIf the term ecolog only means very little to you, this will change after you haveread chapter 4. First, you will learn how to install ecolog. We will then give youan overview of the individual software components. Furthermore, we will explainthe individual menu functions. At the end of this chapter you will write your firstprogram and learn the handling of ecolog.TheprogrammingmanualChapter 5 will explain the functions of ecolog which are helpful for theprogramming, such as editors, operators or how to visualise your controller withecolog.LibrariesChapter 6 introduces the libraries included in ecolog.AnnexThe annex to this manual contains a glossary. It lists and explains all specialterms. The annex also contains an index which you can use to quickly findinformation on a certain term used in the manual.NoteDue to the big scope of this manual errors cannot be excluded. That is why weneed your help. Please let us know if you have discovered any mistakes orhave some ideas for improvement. This will help us to continuously improve ourmanuals in the interest of the user. You can reach us through the PLCspecialists of ifm electronic gmbh or our subsidiaries.Version 2.1As compared to the previous version, version 2.1 contains some additionswhich we have listed below. This manual will give you a detailed description ofthese additions in the appropriate place.Revised program surface New object management via the Object Organizer More flexible work with context menus Status bar Revised selection fields New menu surfaces Multi-level undoing / recovery of work steps Display of tool tipsLanguage properties alias types enumeration types pointer types all type conversions new polymorphous operatorsVisualisation1-4 Insert/selection mode Element dialogue

What you need to know Adjustable fonts Transparent colour for elements Tool bar Lines and graphs as visualisation elements Tool tip for elementsRevised SFC SFC overview mode Entry/exit action for standard steps Monitoring and forcing of transitions nonconform SFC steps The tooltip now shows the name of the step or the transition online andoffline. In addition, comment and time setting are displayed. Init-step is now possible as IEC step when the option 'Use IEC steps' wasselected and a new SFC POU was added. When executing actions, the actions deactivated in the current cycle areexecuted before the active actions. Variables can be used as time limits Monitoring also works in the zoom mode. Comment width adjustable in the options field.Revised trace function Analogue trigger Display of differences (second cursor) Coordinate gridCommunication DLL Functional API OPC1-5

1.3.This is whatRevised FBD/LD Syntax colouring in FBD, LD and SFC Autoformatting in FBD, LD and SFC Presentation of bitmaps in function blocks Automatic adaptation of the network when editing textImport of variable lists When a new global variable list is created, a text file or DCF file containingthe variables can be indicated. DCF files are converted into IEC syntax. The files are read in again each time they are opened and compiled.Other Automatic declaration on request Options for OPC/Comm-DLL Status line field for replace mode Number of windows unlimited Conversion to LD Password protection of individual objectsAll known errors have, of course, been eliminated. We have also improvedsome details.So have much fun and much success with ecolog 100PLUS.1-6

2.The first steps with ecolog 100PLUSThis chapter will give you an overview of: the structure the functions and the characteristicsof the ecolog software.2.1.ecolog 100PLUS - fundamentals and conceptsWhat is ecolog?ecolog is a complete development environment for the R360 PLC system.ecolog is a tool, which makes it easy to learn how to write programs to IEC61131-3 standard.What isIEC1131-3?IEC1131-3 is an international standard for PLC programming languages. It isimportant to know that only the programming language has been standardised(windows, presentation of values in online mode, data storage etc.) Thelanguages used in ecolog comply with those of the IEC standard.What is aproject?A project in this context is a composition of components. These componentssolve a given control task, e.g. sequential control of a unit signal preprocessing for a part of a plantWhat are theprimarycomponents ofan ecologproject?The primary components of an ecolog project are as follows:Whatprogramminglanguages areavailable?ecolog supports the following programming languages: POUs (program organisation units, executable code) data (bits, words etc.) visualisations LD (ladder diagram) IL (instruction list) FBD (function block diagram) SFC (sequential function chart) ST (structured text)2-1

ecolog 100PLUS - fundamentals and conceptsHow is a projectcreated?A project is created using the following procedures: The R360 configuration– I/O definitionComponent creation–POUs–Data–VisualisationsHow can I testmy project?Of course the true test of a project is the start-up of the actual plant. However,the simulation mode in ecolog has proved a valuable possibility to test aproject.What is thesimulationoption?The term simulation (simulation mode) refers to imitating the controller andplant reaction on a PC. With such a test system which does not require the PLCsystem or the plant, errors can already be detected and corrected in the office.This saves time and nerves. The effect can be further increased if the simulatedsystem is shown with visualisation images.Using the simulation mode along with the many debugging features available inecolog allows you to complete your precommissioning test easily andefficiently.Hardware specific functions cannot be tested in the simulation mode.What debuggingfeatures doesecolog have?The following debugging features are standard with ecolog: forcing of I/O’s and variables creation of watch windows for current project data setting of breakpoints in simulation mode (stopping program execution) stepping What aboutdocumentation?2-2–from cycle to cycle–breakpoint to breakpoint in simulation modesampling trace (graph of variable values as a function of time)The whole project can be completely or partly documented at any time or canbe exported in a text file.

3.What is what in ecolog 100PLUS?In this chapter you will find out about:3.1. the IEC 61131-3 standard the different components of a project in ecolog the available programming languages the available online functions in ecologThe IEC 61131-3 normThe IEC 61131-3 norm is an international standard for programming languagesfor programmable logic controllers.The programming languages in ecolog meet the requirements of the norm.The processing of an ecolog project starts with the special POU PLC PRG.The POU PLC PRG can call other POUs.3.2.Which components does a project have?ProjectA project contains all objects of a control program. It is saved in a file with thename of the project. A project in ecolog is structured as follows.ecolog projectPOUsData types PLC PRG operatorsvariables (BOOL, WORD,INT, TIME) programs arrays functions structures function blocksVisualisationsPOUPLC PRG, operators, programs, functions and function blocks are POUs.PLC PRG has a special status.PLC PRGPLC PRG is a special predefined POU. Each project has to contain this specialprogram. This POU is called exactly once per control cycle.When 'Project''Add Object' is executed for the first time after a new projecthas been created, the POU dialogue has a default POU with the namePLC PRG, type program. You should not change this default!3-1

Which components does a project have?Do not delete POU PLC PRG and do not rename it.Each POU consists of a declaration part and a body. The body is written in oneof the IEC programming languages IL, ST, SFC, FBD or LD.ecolog supports almost all IEC standard POUs. If you want to use these POUsin your project, you have to link library Standard.lib to your project. POUs cancall other POUs. Recursions, however, are not allowed.OperatorAn operator is a POU that links other POUs in a defined way. The programmingsystem knows these operators and they do not need to be linked to the projectlike e.g. functions.ProgramA program is a module which is used for structuring the set task. An example ofthis could be a machine control. At the switching panel you can select betweenmanual, jog or automatic operation. The program is called once per cycledepending on the operating mode.Programs are globally known in the whole project. All values are retained fromone program execution to the next.Program exampleFunctionA function is a POU which, when executed, supplies exactly one data element(which can also be multi-element such as arrays or structures). For clarification,let's look at the function sin 90 . The result of this function is the value 1.When declaring the function please note that the function has to keep its type.This means that the function name must be followed by a colon, followed by atype.A correct function declaration might look like this:FUNCTION Fct:INTAlso, a result has to be assigned to the function. This means that the functionname is used like an output variable.3-2

What is what in ecolog 100PLUS?A function declaration starts with the key word FUNCTION and ends withEND FUNCTION.Function blockA function block is a POU that does not only supply a feedback value as is thecase for a function. On execution it supplies one or several values. One functionblock can combine several functions.A function block declaration starts with the key word FUNCTION BLOCK andends with END FUNCTION BLOCK.An example in IL for a function block with two input variables and two outputvariables. One output is the product of both inputs, the other one is acomparison regarding equality.Example of a function blockInstances offunction blocksCopies of function blocks are called instances. These instances can be usedseveral times in one project.Each instance has a name (the instance name) and a data structure whichcontains its inputs, outputs and internal variables. Instances, like variables, aredeclared locally or globally by indicating the name of the function block.Example of an instance called PUMPE 11 of the function block pump control.PUMPE11: pump control;Function blocks are always called via the above instances.You can only access the input and output parameters from outside the instanceof a function block, i.e. the internal variables of the function block remaininvisible for the user of the function block.3-3

Which languages are available in ecolog 100PLUS?Data typesIn a project the data types are in charge of the data organisation. Apart fromstandard data types the user can define his own data types. Structures,enumeration types and references can be defined.VariablesBOOL, WORD, INT, DWORD, DINT and TIME can be used as variables.ArraysArrays are complex variables which are addressed via an index (see fields)StructuresStructures are complex variables comparable to records.Visualisationecolog provides you with the possibility of visualisation to illustrate your projectvariables. By means of visualisation you can draw geometrical elements offline.These elements can then change their shape or colour online depending oncertain variable values.Other contents of a project which can be, but do not have to be, used are:ResourcesYou need the resources for configuring and organising your project and fortracking variable values: Global variables which can be used in the complete project PLC configuration for configuring your hardware Task configuration for controlling your program via tasks Sampling trace for the graphic recording of variable values Watch and receipt manager for displaying and pre-assigning variablevalues.LibrariesYou can link a variety of libraries in your project whose POUs, data types andglobal variables you can use as well as self-defined ones. The Standard.lib isavailable as a standard (e.g. for the controller).3.3.Which languages are available in ecolog 100PLUS?Function block diagram (FBD)Function plan is a graphical programming language. It uses a list of networks;each network contains a structure representing a logic or arithmeticalexpression, a function block call, a jump or return instruction. Operators,functions and function blocks are shown as boxes. The name of an operator, afunction or a function block is displayed in the box.Advantages Intuitive operation, therefore well suited for beginners Clear structure due to graphical depiction Integrated word processing Bit and word processing can be combinedDisadvantages3-4

What is what in ecolog 100PLUS? Confusing for complex processes Only limited and confusing use of program loopsThe ecolog 100PLUS CD contains an example of a dryer control programmed inFBD. It is also available as visualisation.3-5

Which languages are available in ecolog 100PLUS?Visualisation of a dryer controlDetail of the program text3-6

What is what in ecolog 100PLUS?Ladder diagram (LD)Ladder diagram is also a graphical programming language resembling theprinciple of an electric circuit.On the one hand ladder diagram is ideal for designing logic switch mechanisms,on the other hand it is also suited for creating networks as in FBD. Therefore LDcan well be used for controlling calls of other POUs. More about this later.Advantages Clear and easy to understand due to graphical depiction with mainly bitprocessing. Internationally usedDisadvantagesConfusing in complex processes due to different depiction of bit and wordprocessing.The ecolog 100PLUS CD contains an example of a motor control programmed inLD. It is also available as visualisation.Visualisation of a motor control3-7

Which languages are available in ecolog 100PLUS?Detail of the program textThe ladder diagram consists of a sequence of networks. On the right and lefthand side a network is limited by a current lead. In between, you find a circuitdiagram consisting of contacts, coils and links.On the left side each network consists of a series of contacts displaying, fromleft to right, the states "ON" or "OFF"; these states correspond to the Booleanvalues TRUE and FALSE. Each contact is linked to a Boolean variable. Whenthis variable is TRUE, the state is passed on from left to right over the link;otherwise the right connection is given the value OFF.ContactEach network in LD consists of a contact network on the left side (contacts areshown by means of two parallel lines: ), passing on the states "ON" or "OFF"from left to right.These states correspond to the Boolean values TRUE and FALSE. Eachcontact is linked to a Boolean variable. When this variable is TRUE, the state ispassed on from left to right over the link; otherwise the right connection is giventhe value OFF.Contacts can be switched in parallel; one of the parallel branches then has tosubmit the value "On" so that the parallel branch submits the value "On". Or thecontacts are switched in series; in this case all contacts have to submit the state"On" so that the last contact submits the state "On". This corresponds to electricparallel or series connections.A contact can also be negated which is symbolised by the slash in the contactsymbol: / . The value of the line is submitted when the variable is FALSE.Coil3-8On the right side of a network in LD you find any number of so-called coilsdepicted by brackets:( ). They can only be connected in parallel. A coil submitsthe value of the links from left to right and copies it into a related Booleanvariable. The input line can have the value ON (corresponds to the Booleanvariable TRUE) or the value OFF (corresponds to FALSE).

What is what in ecolog 100PLUS?Contacts and coils can also be negated (in our example the contact SCHALT1and the coil %QX3.0 are negated). Wenn a coil is negated (symbolised by theslash in the coil symbol: (/) it copies the negated value into the related Booleanvariable. When a contact is negated it only switches when the Boolean variableis FALSE.Function blocksin ladderdiagramApart from contacts and coils you can also enter function blocks and programs.In the network they have to have an input and an output with Boolean valuesand they can be used in the same places as contacts, i.e. on the left side of theLD network.Set/Reset coilsCoils can also be defined as set or reset coils. A set coil (identified by the 'S' inthe coil symbol: (S)) never overwrites the value TRUE in the related Booleanvariable. That means that once the variable has been set to TRUE it remainslike this.A reset coil (identified by the 'R' in the coil symbol: (R)), never overwrites thevalue FALSE in the related Boolean variable. That means that once the variablehas been set to FALSE it remains like this.LD as FBDWhen working with LD it might happen that you want to use the result of thecontact circuit to control other POUs. For this purpose you can save the resultby means of coils in a

What is ecolog? ecolog is a complete development environment for the R360 PLC system. ecolog is a tool, which makes it easy to learn how to write programs to IEC-61131-3 standard. What is IEC1131-3? IEC1131-3 is an international standard for PLC programming languages. It is important to know that only the programming language has been standardised