You are on page 1of 122

Manual Draft 2

SoMachine
Training Manual
SoMachine Version 3.0

Schneider-Electric Pty Ltd


245 route des Lucioles BP147
Sophia Antipolis Cedex 06903
FRANCE

DISCLAIMER
The information provided in this documentation contains general descriptions and/or technical characteristics of the performance of the
products contained herein. This documentation is not intended as a substitute for and is not to be used for determining suitability or reliability
of these products for specific user applications. It is the duty of any such user or integrator to perform the appropriate and complete risk
analysis, evaluation and testing of the products with respect to the relevant specific application or use thereof. Neither Schneider Electric nor
any of its affiliates or subsidiaries shall be responsible or liable for misuse of the information contained herein. If you have any suggestions
for improvements or amendments or have found errors in this publication, please notify us.
No part of this document may be reproduced in any form or by any means, electronic or mechanical, including photocopying, without
express written permission of Schneider Electric.
All pertinent state, regional, and local safety regulations must be observed when installing and using this product. For reasons of safety and
to help ensure compliance with documented system data, only the manufacturer should perform repairs to components.
When devices are used for applications with technical safety requirements, the relevant instructions must be followed.
Failure to use Schneider Electric software or approved software with our hardware products may result in injury, harm, or improper
operating results.
Failure to observe this information can result in injury or equipment damage.
2010 Schneider Electric. All rights reserved.
TRADEMARKS
Schneider Electric SAS has made every effort to supply trademark information about company names, products and services mentioned in
this manual. Trademarks shown below were derived from various sources.
Windows, Windows NT, Windows 2000, Windows XP, MSSQL Server and Excel are trademarks of Microsoft Corporation.
General Notice:
Some product names used in this manual are used for identification purposes only and may be trademarks of their respective companies.
About Us
Members of Schneiders team of Instructional Designers have tertiary qualifications in Education, Educational Course Development and are
also experienced trainers in their own right; some are also published authors. Currently, the team is supporting a range of over 70 courses in
multiple languages and multiple software environments.
Authors
Alynda Brown, Bruce Howlett, Eric Pauchet
Contributors
David Chapman, Michel Beridot

February 2011 Edition for SoMachine Version 3.0


Manual Draft 2
Written, Printed and bound in France

ii

SoMachine Version 3.0

February 2011

Contents
CHAPTER 1:

INTRODUCTION TO SOMACHINE........................................................... 1-1

Overview .................................................................................................................... 1-1


Safety Information...................................................................................................... 1-2
Before the Course Begins........................................................................................... 1-4
Course Overview...................................................................................................... 1-10
Conventions Used in this Manual ............................................................................ 1-12
CHAPTER 2:

SOMACHINE AT A GLANCE ................................................................... 2-1

Overview .................................................................................................................... 2-1


Introduction to SoMachine......................................................................................... 2-2
System Requirements................................................................................................. 2-3
Features of SoMachine............................................................................................... 2-4
The SoMachine Interface ........................................................................................... 2-6
Home Screen .............................................................................................................. 2-7
General Functions Menu ............................................................................................ 2-9
Project Work Flow ................................................................................................... 2-11
Show Existing Machine ........................................................................................... 2-13
Properties Screen...................................................................................................... 2-17
CHAPTER 3:

PROJECT MANAGEMENT ....................................................................... 3-1

Overview .................................................................................................................... 3-1


New Projects .............................................................................................................. 3-2
Create New Machine.................................................................................................. 3-3
Start with Empty Project ............................................................................................ 3-4
Start with Standard Project......................................................................................... 3-8
Archive Projects ....................................................................................................... 3-12
CHAPTER 4:

NEW PROJECT CREATION ..................................................................... 4-1

Overview .................................................................................................................... 4-1


The Configuration Screen .......................................................................................... 4-2
Display Manager ........................................................................................................ 4-4
Add a Device to a Project........................................................................................... 4-5
Add an Expansion Module to a Device...................................................................... 4-8

SoMachine

Manual Draft 2

iii

CHAPTER 5:

CONTROLLER PROGRAMMING ............................................................. 5-1

Overview .................................................................................................................... 5-1


Program Screen .......................................................................................................... 5-2
Tasks .......................................................................................................................... 5-8
PLC Program Execution............................................................................................. 5-9
POU Program Creation ............................................................................................ 5-10
Gateway Configuration ............................................................................................ 5-16
Task Configuration................................................................................................... 5-17
PLC Simulator.......................................................................................................... 5-21
CoDeSys Program Languages.................................................................................. 5-26
Watchdog Mechanisms ............................................................................................ 5-36
Structuring an Application ....................................................................................... 5-37
The POU Function ................................................................................................... 5-38
Sample Project.......................................................................................................... 5-44
Global Variables....................................................................................................... 5-47

iv

SoMachine Version 3.0

February 2011

Chapter 1:

Introduction to SoMachine

Overview
All-in-One Software

SoMachine is OEM machine programming software that provides an all-in-one


software environment designed specifically for OEM machine builders.
SoMachine combines all the necessary elements to:

design

commission

service

OEM machines in a single environment.

This Chapter Covers These Topics:


Safety Information................................................................. 1-2
Before the Course Begins...................................................... 1-4
Course Overview ................................................................. 1-10
Conventions Used in this Manual........................................ 1-12

Safety Information
Important
Information

NOTICE

Read these instructions carefully, and look at the equipment to become familiar
with the device before trying to install, operate, or maintain it. The following
special messages may appear throughout this documentation or on the equipment
to warn of potential hazards or to call attention to information that clarifies or
simplifies a procedure.
The addition of this symbol to a Danger or Warning safety label
indicates that an electrical hazard exists, which will result in
personal injury if the instructions are not followed.

This is the safety alert symbol. It is used to alert you to potential


personal injury hazards. Obey all safety alert messages that
follow this symbol to avoid possible injury or death.

DANGER
DANGER indicates an imminently hazardous situation which, if not avoided, will
result in death or serious injury.

WARNING
WARNING indicates a potentially hazardous situation which, if not avoided, can
result in death or serious injury.

CAUTION
CAUTION indicates a potentially hazardous situation which, if not avoided, can
result in minor or moderate injury.

CAUTION
CAUTION, used without the safety alert symbol, indicates a potentially
hazardous situation which, if not avoided, can result in equipment damage.

1-2

SoMachine Version 3.0

February 2011

Safety Information (cont.)


Important
Information
(cont.)

PLEASE NOTE

Electrical equipment should be installed, operated, serviced, and maintained only


by qualified personnel. No responsibility is assumed by Schneider Electric for any
consequences arising out of the use of this material.
A qualified person is one who has skills and knowledge related to the construction
and operation of electrical equipment and the installation, and has received safety
training to recognize and avoid the hazards involved.

SoMachine

Manual Draft 2

1-3

Before the Course Begins


Scope of this
Training Manual

This training manual is a supplement to the authorised training. In order to make


proper use of the software students should also refer to the Online Help and
SoMachine Knowledge Base.
The graphics displaying screen shots have been taken using the Windows XP
operating system using Classic mode display properties. If students are running a
different version of Windows then screens may differ slightly from the ones shown
in the training manual.
Some screen shots may have been taken from beta versions of the software and
may vary slightly from release screen shots.

Validity Note

This document has been updated with the release of SoMachine V3.0.
The technical characteristics of the device(s) described in this training manual may
also appear online. To access this information online:

Step

Action

Go the Schneider Electric home page www.schneider-electric.com

In the Search box type the model number of a product or the name of a product
range.

Do not type any blank spaces in the model number.


To get information on a grouping of similar modules, use asterisks (*).
3

If you entered a model number, go to the Product datasheets search results


and click on the model number the interests you.
If you entered the name of a product range, to the Product Ranges search results
and click on the product range that interests you.

If more than one model number appears in the Products search results, click on
the model number that interests you.

Depending on the size of your screen, you may need to scroll down to see the data
sheet.

To save or print a data sheet as a .pdf file, click Download XXX product

datasheet.

The characteristics presented in this manual should be the same as those that
appear online. In line with our policy of constant improvement we may revise
content over time to improve clarity and accuracy. In the event that you see a
difference between the manual and online information, use the online information
as your reference.

1-4

SoMachine Version 3.0

February 2011

Before the Course Begins (cont.)


Product Related
Information

WARNING
UNINTENDED EQUIPMENT OPERATION

Only use software approved by Schneider Electric for use with this
equipment.

Update your application program every time you change the physical
hardware configuration.

Failure to follow these instructions can result in death, serious injury, or


equipment damage.

WARNING
LOSS OF CONTROL

The designer of any control scheme must consider the potential failure
modes of control paths and, for certain critical control functions, provide
a means to achieve a safe state during and after a path failure.
Examples of critical control functions are emergency stop and overtravel
stop, power outage and restart.

Separate or redundant control paths must be provided for critical control


functions.

System control paths may include communication links. Consideration


must be given to the implications of unanticipated transmission delays
or failures of the link.

Observe all accident prevention regulations and local safety guidelines1.

Each implementation of this equipment must be individually and


thoroughly tested for a proper operation before being placed into
service.

Failure to follow these instructions can result in death, serious injury, or


equipment damage.
1

For additional information, refer to NEMA ICS 1.1 (latest edition), "Safety
Guidelines for the Application, Installation, and Maintenance of Solid State
Control" and to NEMA ICS 7.1 (latest edition), "Safety Standards for Construction
and Guide for Selection, Installation and Operation of Adjustable-Speed Drive
Systems" or their equivalent governing your particular location.

SoMachine

Manual Draft 2

1-5

Before the Course Begins (cont.)


User
Responsibilities

The products specified in this document have been tested under actual service
conditions. Of course, your specific application requirements may be different
from those assumed for this and any related examples described herein. In that
case, you will have to adapt the information provided in this and other related
documents to your particular needs. To do so, you will need to consult the specific
product documentation of the hardware and/or software components that you may
add or substitute for any examples specified in this training documentation. Pay
particular attention and conform to any safety information, different electrical
requirements and normative standards that would apply to your adaptation.

WARNING
REGULATORY INCOMPATIBILITY
Be sure that all equipment applied and systems designed comply with all
applicable local, regional and national regulations and standards.
Failure to follow these instructions can result in death, serious injury, or
equipment damage.

The use and application of the information contained herein require expertise in the
design and programming of automated control systems. Only the user or integrator
can be aware of all the conditions and factors present during installation and setup,
operation, and maintenance of the machine or process, and can therefore determine
the automation and associated equipment and the related safeties and interlocks
which can be effectively and properly used. When selecting automation and
control equipment, and any other related equipment or software, for a particular
application, the user or integrator must also consider any applicable local, regional
or national standards and/or regulations.

1-6

SoMachine Version 3.0

February 2011

Before You Begin (cont.)


User
Responsibilities
(cont.)

Some of the major software functions and/ or hardware components used in the
examples described in this training document cannot be substituted without
significantly compromising the performance of your application. Further, any such
substitutions or alterations may completely invalidate any proposed architectures,
descriptions, examples, instructions, wiring diagrams and/or compatibilities
between the various hardware components and software functions specified herein
and in related documentation. You must be aware of the consequences of any
modifications, additions or substitutions. A residual risk, as defined by EN/ISO
12100-1, Article 5, will remain if:
it is necessary to modify the recommended logic and if the added or modified
components are not properly integrated in the control circuit.
you do not follow the required standards applicable to the operation of the
machine, or if the adjustments to and the maintenance of the machine are not
properly made (it is essential to strictly follow the prescribed machine
maintenance schedule).
the devices connected to any safety outputs do not have mechanically-linked
contacts.

CAUTION
EQUIPMENT INCOMPATIBILITY
Read and thoroughly understand all device and software documentation before
attempting any component substitutions or other changes related to the
application examples provided in this document.
Failure to follow these instructions can result in injury or equipment
damage.

SoMachine

Manual Draft 2

1-7

Before the Course Begins (cont.)


Start-up and Test

When applying this training and before using electrical control and automation
equipment after design and installation, the application and associated functional
safety system must be subjected to a start-up test by qualified personnel to verify
correct operation of the equipment. It is important that arrangements for such
testing be made and that enough time is allowed to perform complete and
satisfactory testing.

CAUTION
EQUIPMENT OPERATION HAZARD

Verify that all installation and set up procedures have been completed.

Before operational tests are performed, remove all blocks or other


temporary holding means used for shipment from all component
devices.

Remove tools, meters and debris from equipment.

Failure to follow these instructions can result in injury or equipment


damage.

Verify that the completed system, including the functional safety system, is free
from all short circuits and grounds, except those grounds installed according to
local regulations. If high-potential voltage testing is necessary, follow the
recommendations in equipment documentation to help prevent injury or equipment
damage.

1-8

SoMachine Version 3.0

February 2011

Before the Course Begins (cont.)


Operation and
Adjustments

Regardless of the care exercised in the design and manufacture of equipment or in


the selection and ratings of components, there are hazards that can be encountered
if such equipment is improperly installed and operated.
In some applications, such as packaging machinery, additional operator protection
such as point-of-operation guarding must be provided. This is necessary if the
hands and other parts of the body are free to enter the pinch points or other
hazardous areas where serious injury can occur. Software products alone cannot
protect an operator from injury. For this reason, the software cannot be substituted
for or take the place of point-of-operation protection.

WARNING
UNGUARDED MACHINERY CAN CAUSE SERIOUS INJURY

Do not use this software and related automation equipment on


equipment which does not have point-of-operation protection.

Do not reach into machinery during operation.

Failure to follow these instructions can result in death, serious injury, or


equipment damage.

Ensure that appropriate safeties and mechanical/electrical interlocks related to


point-of-operation protection have been installed and are operational before placing
the equipment into service. All interlocks and safeties related to point-of-operation
protection must be coordinated with the related automation equipment and software
programming.

Note:

Coordination of safeties and mechanical/electrical interlocks for point-of-operation


protection is outside the scope of the examples and implementations suggested in
this training documentation.
It is sometimes possible to adjust the equipment incorrectly and may produce
unsatisfactory or unsafe operation. Always use the manufacturer instructions as a
guide to functional adjustments. Personnel who have access to these adjustments
must be familiar with the equipment manufacturer instructions and the machinery
used with the electrical equipment.

SoMachine

Manual Draft 2

1-9

Course Overview
Course
Objectives

By the completion of this training course you will:


Be able to create a new SoMachine project
Be able to connect to a Controller
Be able to create a simple Programmable Organisation Unit

Target Audience

The SoMachine training course is an integral part of the complete Schneider


Electric curriculum. This course is designed for:
Users who are new to SoMachine

1-10

SoMachine Version 3.0

February 2011

Course Overview (cont.)


Course Program

The training course will take one day to complete. The following program outlines
the topics that will be covered on each day:

Day
1

Topics
Introduction to SoMachine
SoMachine at a Glance
Project Management
Controller I/O Configuration
Controller Programming

SoMachine

Manual Draft 2

1-11

Conventions Used in this Manual


Objectives

These are the skills you will achieve by the end of each chapter. An overview
providing a brief synopsis of the topic begins each section. Often, examples are
given to illustrate the conceptual overview.

Example The SoMachine configuration environment consists of several toolbars, browser


windows and programming editors. This chapter introduces the user to the
configuration environment using an example project with pre-defined elements.

Exercises

After a concept is explained you will be given exercises that practise the skills you
just learned. These exercises begin by explaining the general concept of each
exercise and then step-by-step procedures are listed to guide you through each
procedure.

Example Paste a genie from a library in the Include project onto a test page called Utility.
1

Run the Milk_Upgrade project then trigger and view some alarms.
i.

User Input

Use the following template settings:

Whenever information is to be typed into a field or dialog box it will be written in


this font:

Example KETTLE_TEMP/25
Note that some exercises will show a fragment of information already typed into a
SoMachine screen and then ask students to add extra lines of configuration. In this
instance, the previously entered material will be given to the student as pale grey
italic text:
KETTLE_TEMP/25
OVEN_TEMP/5

1-12

SoMachine Version 3.0

February 2011

Conventions Used in this Manual (cont.)


Hints & Tips

This heading will provide you with useful or helpful information

Example Hints & Tips


To go to the next field, use the mouse cursor or press the TAB key.

A note will refer to a feature which may not be obvious at first glance but
something that always should be kept in mind.

Note

Example Note:

Any events named GLOBAL are enabled automatically when events are enabled.
Menus and Menu
Options

Text separated by the double arrow symbol indicates that you are to select a
menu

Example File New

Open a menu File then select the menu option New


Horizontal and
Vertical Tabs

Text written this way indicates the Horizontal then the (Vertical) tab you are to
select.

Example Appearance (General)

SoMachine

Manual Draft 2

1-13

Conventions Used in this Manual (cont.)


Text written in this way indicates further references about the current topic.

See Also

Example See Also:

For further information about Templates, see SoMachine Help - Using Page
Templates.
Further Training

This heading describes topics that are covered in more advanced courses.

Example Further Training:

Trend Table Maths is a topic in the SoMachine Customisation and Design


Course.
This heading describes situations where the user needs to be careful.

Caution

Example -

CAUTION
UNINTENDED EQUIPMENT OPERATION
Verify that all installation and set up procedures have been completed.
Failure to follow these instructions can result in equipment damage.

1-14

SoMachine Version 3.0

February 2011

Chapter 2:

SoMachine at a Glance

Overview
Introduction

SoMachine is a professional, efficient and open OEM software solution that


develops, configures and commissions the entire machine in a single environment
including logic, motor control, HMI and related network automation functions.

This Chapter Covers These Topics:


Introduction to SoMachine .................................................... 2-2
System Requirements ............................................................ 2-3
Features of SoMachine .......................................................... 2-4
The SoMachine Interface ...................................................... 2-6
Home Screen ......................................................................... 2-7
General Functions Menu ....................................................... 2-9
Project Work Flow .............................................................. 2-11
Show Existing Machine....................................................... 2-13
Properties Screen ................................................................. 2-17

Introduction to SoMachine
OEM Solution
Software

One Machine
Environment

SoMachine in
Flexible Machine
Control

2-2

SoMachine Version 3.0

February 2011

System Requirements
Before the
Installation of
SoMachine

Before installing SoMachine the computer that will be used as the Server needs to
be configured. SoMachine has been designed for machines with the following
specifications:

Hardware
Requirements

The computer equipment may need to be upgraded to run SoMachine Version 3.0,
as the minimum hardware requirements have changed:

Description

Minimum Specification

Recommended

Processor

Pentium V, 1.8 GHz, Pentium M,


1.0 GHz or equivalent

Pentium V, 3.0 GHz, Pentium


M, 1.5 GHz or equivalent

Random Access
Memory (RAM)

2 GB

3 GB

Available Disk
Space

3.5 GB including the memory


4 GB
space for the software installation,
temporary space for execution and
space for saving applications

Drive

DVD Reader

DVD Reader

Display

Resolution: 1024 x 786 pixels

Resolution: 1280 x 1024 pixels

Peripherals

Mouse or compatible pointing


device
USB interface

Web Access

Web registration requires internet


access system

Software
Requirements

SoMachine Component

Minimum System Software

Operating System

The SoMachine software supports 1 of the


following operating systems:

Microsoft Windows XP Professional


Service Pack 2 and Service Pack 3
Microsoft Windows Vista Home Basic
Microsoft Windows Vista Service Pack
1

SoMachine

Manual Draft 2

2-3

Features of SoMachine
Standard
Languages

SoMachine includes, as standard, 6 IEC (International Electrotechnical


Commission) languages which are compliant with IEC 61131-3. Depending on
requirements, the application may use any mixture of these different languages.
Function Block Diagram (FBD)
Sequential Functional Chart (SFC)
Structured Text (ST)
Instruction List (IL)
Ladder (LD)
Continous Function Chart (CFC)

Controller
Programming
Services

User Created Function Blocks (FBs)


User Created Functions
Data Unit Type (DUTs)
On-line changes
Watch windows
Graphical monitoring of variables (trace)
Breakpoints, step-by-step execution
Simulation
Visualization for application and machine set-up

HMI Based
Services

Graphics libraries containing more than 4000 2D and 3D objects.


Simple drawing objects (points, line, rectangles, ellipses, etc )
Preconfigured objects (button, switch, bar graph, etc )
Recipes (32 groups of 256 recipes with max. 1024 ingredients)
Action tables
Alarms
Printing
Java scripts
Multimedia file support: wav, png, jpg, emf, bmp
Variable trending

Motion Services

Embeded devices configuration and commissioning


CAM profile editor
Sample application trace
Motion and drive function blocks libraries for inverters, servos and steppers
Visualization screens

2-4

SoMachine Version 3.0

February 2011

Features of SoMachine (cont.)


Global Services

User access and profile


Project documentation printing
Project comparison (control)
Variable sharing based on publish/subscribe mechanism
Library version management

Integrated
Fieldbus
Configurators

Master:
-

CANopen

CANmotion

Modbus Serial Line

AS-interface

Connectivity:

Application
Libraries

Profibus-DP

Ethernet IP

Modbus TCP

General:
-

PLCopen function blocks for Motion control

Segment Solutions:

SoMachine

Packaging function blocks

Conveying function blocks

Hoisting function blocks

Manual Draft 2

2-5

The SoMachine Interface


How to Start
SoMachine

To start SoMachine:
Select the SoMachine item from the Windows start menu:
Start Programs Schneider Electric SoMachine SoMachine

or
Double click the SoMachine icon on the desktop

2-6

SoMachine Version 3.0

February 2011

Home Screen
Visual Graphical
User Interface

Navigation within SoMachine is intuitive and highly visual. The GUI is optimised
in such a way that the appropriate tools become available as you enter different
development stages of your project. The user interface ensures nothing is
overlooked, and suggests the tasks to be performed throughout the project
development cycle. The workspace has been streamlined, so that only that which is
necessary and relevant to the current task is featured, without any superfluous
information.

Main Selection
Screen

After successful startup SoMachine displays the main selection screen with the
open Home screen that provides access to the functions.

SoMachine

General Functions Menu

Hide/View Handle

Task Selection Pane

Work Area

Online Help

Language Selection Menu

Information Pane

Manual Draft 2

2-7

Home Screen (cont.)


Tasks of the
Home Screen

The task selection pane on the left-hand side of the main selection screen groups
the SoMachine functions in folders according to the tasks that can be performed.

Tasks of the Home Screen

Commands Provided

Show existing machine

This folder provides commands for opening an


already existing SoMachine project

Browse for existing project

Locate a project previously created in SoMachine

Create new machine

This folder provides commands for creating a new


SoMachine project either from scratch or by using a
template project

Machine workflow

This folder provides commands that are especially


dedicated to commissioning a machine. Further
commands that are beyond commissioning tasks are
not available from this folder

Learning Center

This folder provides further information on


SoMachine. This information includes:

a quick overview
an eLearning
examples

2-8

SoMachine Version 3.0

February 2011

General Functions Menu


How to Gain
Access to the
Menu

SoMachine

To gain access to the General Functions Menu:


Click the SoMachine icon that is always visible in the upper left corner of the
SoMachine window.

Manual Draft 2

2-9

General Functions Menu (cont.)


Tasks of the
General
Functions Menu

The General Functions Menu provides the following commands:

Command

Description

Home

Execute this command to return to the Home screen, that is the main
selection screen.

Save

Execute this command to save the changes to the current project.

Save As

Execute this command to save the current project to a different location


or under a different name. A standard Windows Save Project dialog
box is displayed that allows users to browse to the new folder and / or
enter the new file name.

Save/Send
archive

Execute this command to create an archive file of the SoMachine project


that is currently open and:

to save the archive file to a connected drive by using the Save button
of the Project Archive dialog box
or

to create a temporary archive file that is attached to an empty e-mail


by using the Send button of the Project Archive dialog box. This
e-mail is automatically created by SoMachine if the Messaging
Application Programming Interface (MAPI) is correctly installed.
Preferences

Execute this command to define:

the Preferred Path where SoMachine projects are saved


the Online Polling Interval (ms) that is the time span that has to
elapse between 2 attempts to poll the connected devices
Advanced Options including Autosave

2-10

Help

Execute this command to open the SoMachine online help.

About

Execute this command to open the About dialog box that provides
information about the currently installed SoMachine.

Exit

Execute this command to close SoMachine.

SoMachine Version 3.0

February 2011

Project Work Flow


Optimised
Project
Development

The SoMachine user interface is optimised to be intuitive and highly visual. With
the help of the navigation tabs a project workflow is ensured and nothing will be
overlooked.

After starting a project the user is asked to fill in the Properties with useful
information for project identification.

After defining the scope of the project the user creates a Configuration with at
least one controller. The graphical configuration screen makes it easy to establish
the hardware with additional modules, e.g. an additional controller, an HMI or
fieldbus communication.

SoMachine

Manual Draft 2

2-11

Project Work Flow (cont.)


Optimised
Project
Development
(cont.)

The Program tab opens the project for programming and application development.
All CoDeSys functionalities are available in this area.

The Commissioning tab provides online access to the controller and the connected
devices for monitoring device status and the user is able to download the
application(s) or update the firmware.

2-12

SoMachine Version 3.0

February 2011

Show Existing Machine


Commands of the
Task

The Show existing machine task allows users to open an existing project.
The Task includes the following commands:
Browse for existing project
Extract archive

How to Open an
Existing Project

The work area provides quick access to the four SoMachine projects that have been
opened most recently.

To open an existing project:


Double click the project's thumbnail in the Work area
or
Select the project in the Work area and click the Open button in the Project
Information pane. The project will open at the Properties screen for assigning
further information.

SoMachine

Manual Draft 2

2-13

Show Existing Machine (cont.)


How to Browse
for an Existing
Project

To Browse for an existing project:


Click the Show existing machine item in the Task pane, then click Browse for
existing project item in the Task pane

Search the directory tree in the left pane for the folder that contains the existing
project then double click the project icon in the Work area
or
Select the project in the Work area and click the Open button in the Project
Information pane

2-14

SoMachine Version 3.0

February 2011

Exercise - Browse for an Existing Project


1

Open an Example Project.


i.

Launch SoMachine.

ii.

When the Home screen appears click the Show existing machine
item in the Task pane, then click Browse for existing project item
in the Task pane

iii.

Search the directory tree in the left pane for the folder that contains
the existing project examples. If the default path has been installed
this will be

C:\Program Files\Schneider Electric\SoMachine\CoDeSys\


NewGUI\Learning Center\Examples\en

SoMachine

iv.

Select the folder 04-Traffic lights.

v.

Double click the Traffic lights.project thumbnail.

Manual Draft 2

2-15

Exercise - Browse for an Existing Project (cont.)


vi.

2-16

When the project is opened SoMachine will display the project in the
General Properties tab.

Return to the Home screen.

SoMachine Version 3.0

February 2011

Properties Screen
Additional
Project
Information

The Properties screen allows users to enter additional project information. The
textual and graphical information entered here is optional. As this information is
always displayed in the information pane for the project selected in the work area,
it helps to identify the individual projects, avoiding the need to open them. This
screen is only displayed after a project has been opened.

The Properties screen provides the following tasks:


General
Description
Custom Information

SoMachine

Manual Draft 2

2-17

Properties Screen (cont.)


Tasks of the
General Screen

The task selection pane on the left-hand side of the properties screen groups the
SoMachine functions in folders according to the tasks that can be performed.

Tasks of the
Properties Screen

Commands Provided

General Task

The General task allows users to save the project file to a


different location or under a different name and provides the
option to add author information. The work area provides the
following sections:

File Information
Author Information
File Information

The section File Information displays the name of the


project file and the folder it is saved in. To save the project to
a different location or under a different name, click the Save
as button, navigate to the preferred folder, and save the
project file.

Author Information

The section Author Information provides entry fields for


optional information the author considers relevant. The
entries are displayed in the section Project Information on
the right side of the screen.
To save the information entered in the Properties screen, click
the SoMachine icon and select Save from the General

Functions Menu
Description Task

2-18

The Description task allows users to add an image to the


project. This optional customer image helps users to identify
the project

SoMachine Version 3.0

February 2011

Properties Screen (cont.)


Description Task

The Description task allows users to add an image to the project. This optional
customer image helps users to identify the project.

The work area provides the Add button to add a preferred Customer Image to the
SoMachine project and displays the Configuration View corresponding to the
settings in the Configuration screen. After an image has been added to the project
Change and Remove buttons are provided.

SoMachine

Manual Draft 2

2-19

Properties Screen (cont.)


Custom
Information Task

The Custom Information task allows users to customise project information that
they may consider relevant. The screen provides entry fields for custom
information as well as a button to add attachments to the project.

Methods of Using
the Interface

Many actions have more than one way of being invoked. For example, a typical
action will be invoked by:
Click a tool on a toolbar
Select a menu item from the main menu
Use a keyboard shortcut
Right click inside a window and select an item from a context sensitive menu
This manual, frequently demonstrates only one method of performing an action.
This is not because this is necessarily best method, but because it is too time
consuming and unnecessary to show all possible methods. Your instructor will
encourage the use of a variety of methods.

2-20

SoMachine Version 3.0

February 2011

Exercise - Examine the User Interface


1

SoMachine

Create a new project based on one of the existing examples.


i.

Use the Windows Explorer to create a new folder named C:\Class.

ii.

Return to the Home screen and click the Learning Center item in
the left pane.

iii.

Click the Examples item from the expanded menu.

iv.

Double click the 04-Traffic lights thumbnail then the Traffic


lights.project thumbnail.

v.

When the Save Project As dialog appears save the project as


MyTraffic then click the Save button.

vi.

Save the project as MyTraffic in the C:\Class directory.

Manual Draft 2

2-21

Exercise - Examine the User Interface (cont.)


2

2-22

Examine the interface using an example project.


i.

The new project opens at the Properties screen.

ii.

Click the Configuration tab then select the device in the Work area
to display the description in the Information pane.

SoMachine Version 3.0

February 2011

Exercise - Examine the User Interface (cont.)


iii.

Navigate the Devices pane.


i.

SoMachine

Select the Program tab.

If the tree branches are closed they may be expanded by clicking the
plus (+) sign next to each object. Double click the Library Manager
item. This opens the Library Manager Editor which displays all the
defined libraries in this PLC.

Manual Draft 2

2-23

Exercise - Examine the User Interface (cont.)


4

2-24

Examine the objects in the Example project.


i.

Double click the Visualization object.

ii.

The toolbars are context sensitive. When the Visualisation is the


focus window a graphic editor toolbar will appear underneath the
main toolbar.

iii.

Click the Library Manager tab and the graphic toolbar will disappear.

SoMachine Version 3.0

February 2011

Exercise - Examine the User Interface (cont.)


5

SoMachine

Run the project.


i.

Select Online Simulation from the menu to place the project into
Simulation mode.

ii.

Select Online Login to log in to the simulator.

iii.

Since there is no program in the simulator, the following message


will appear. Click Yes.

iv.

The operator interface shows that the program is connected.

Manual Draft 2

2-25

Exercise - Examine the User Interface (cont.)

2-26

v.

Select Online Start to start the controller.

vi.

Type the name of one of the countries into the input field and press
ENTER.

vii.

Click the Start/Stop Sequence button.

SoMachine Version 3.0

February 2011

Exercise - Examine the User Interface (cont.)


viii.

Examine all of the objects in the Devices pane.

ix.
6

SoMachine

Double click the Light_Sequences (FB) POU in the Devices tree to


open the POU. Observe the values changing.

Shutdown the runtime.


i.

Select Online Stop.

ii.

Select Online Logout.

iii.

Select Online Simulation to disable Simulation Mode.

Return to the Home screen.

Manual Draft 2

2-27

Chapter 3:

Project Management

Overview
Introduction

SoMachine allows the user to perform fundamental tasks such as creating,


exporting and importing projects. There are also other project management tools
such as archiving which create a highly compressed version of the project.
The implemented project management principle allows users to browse the existing
projects quickly getting the relevant information without the need to open them
before selection.
The user can create a new project, starting from several means: using Tested
Validated and Documented Architectures, using the provided examples, using an
existing project or from scratch. There is quick access to the most recently-used
projects.

This Chapter Covers These Topics:


New Projects.......................................................................... 3-2
Create New Machine ............................................................. 3-3
Start with Empty Project ....................................................... 3-4
Start with Standard Project.................................................... 3-8
Archive Projects .................................................................. 3-12

New Projects
First Step in the
Configuration

The first step when configuring SoMachine is to create a new project. The project
is where all information is stored.
SoMachine facilitates project creation by providing different project templates.
The project templates are categorised in four groups:

Project Template Group

Description

Empty Projects

Empty project, empty library and projects with a


predefined controller

Generic Implementations

Generic project shells, including controller, HMI, field


devices and functions - tested, validated and documented

Conveying
Implementations

Project shells dedicated to conveying, including


controller, HMI, field devices and application functions tested, validated and documented

Packaging Implementations Project shells dedicated to packaging, including


controller, HMI, field devices and applied functions tested, validated and documented

Configure
Projects

SoMachine provides tools that assist users in creating new projects quickly and
easily.
It provides for project startup:
a variety of preferred implementations. A dedicated TVDA Finder tool (Tested
Validated Documented Architectures) assists users in selecting the preferred
implementation that best suits individual projects.
a variety of application projects for conveying, hoisting, and packaging that
provide basic configurations for these applications.
some examples that provide basic projects for making yourself familiar with
SoMachine.
Once the project is created, SoMachine provides extensive possibilities to add
textual and graphical information to each project file. This additional information
enables users to distinguish projects avoiding the need to open them when they
have to select the suitable project out of those that are available on the computer.
For easy configuration of the project, SoMachine provides a graphical
configuration editor that allows users to add and configure the requested devices in
a comfortable way.

3-2

SoMachine Version 3.0

February 2011

Create New Machine


Create New
Machine
Commands

The Create new machine menu allows users to create a new project either from
scratch or by using a project template.

It includes the following commands:


Start with empty project
Start with standard project
Start with TVD architecture
Start with application
Start with existing project
Start with example

SoMachine

Manual Draft 2

3-3

Start with Empty Project


The Empty
Project
Command

How to Create an
Empty Project

The Start with empty project command allows users to create a new project from
scratch without any preconfigured devices or settings. The command opens a Save
Project As dialog box where users can browse to the destination folder and assign
a name to the new project.

To create an empty project:


Click the Start with empty project menu item

When the Save Project As dialog opens browse for a location using the Save in:
field
Create a name for the project in the Filename: field then click Save.

3-4

SoMachine Version 3.0

February 2011

Exercise - Create a New Empty Project


1

SoMachine

Create a new Empty Project.


i.

Click the Create new machine item in the left pane.

ii.

Click the Start with empty project item from the expanded menu.

iii.

When the Save Project As dialog appears use the Save in: field to
navigate to the C:\Class folder. Use the File name: field to name
the project Empty.project then click the Save button.

Manual Draft 2

3-5

Exercise - Create a New Empty Project (cont.)


iv.

3-6

When the project is created SoMachine will display the project in the
General Properties tab.

SoMachine Version 3.0

February 2011

Exercise - Create a New Empty Project (cont.)


2

SoMachine

Examine the project settings.


i.

Click the Configuration tab. There are no devices selected.

ii.

Click the Program tab. The Devices pane is also empty. When a
device is added to the project the devices pane will be populated
with standard references.

Return to the Home screen.

Manual Draft 2

3-7

Start with Standard Project


The Standard
Project
Command
How to Start
with a Standard
Project

The Start with standard project command allows users to create a new project on
the basis of a specified PLC. SoMachine provides a variety of PLCs that can be
used as templates to create individual projects.

To create a standard project:


Click the Start with standard project menu item

Select the device from the Device: drop down list then click the Create Project
button.

3-8

SoMachine Version 3.0

February 2011

Exercise - Create a New Standard Project


1

SoMachine

Create a new project based on a specific PLC.


i.

At the Home screen click the Create new machine item in the left
pane.

ii.

Click the Start with standard project item from the expanded menu.

iii.

Select the device TM238LFDC24DT from the Device: drop down list.
Change the default name of the POU Name: to MyPOU. Click the
Create Project button.

Manual Draft 2

3-9

Exercise - Create a New Standard Project (cont.)


iv.

When the Save Project As dialog appears use the Save in: field to
navigate to the C:\Class folder. Use the File name: field to name
the project Standard.project then click the Save button.

Examine the project settings.


i.

3-10

Open the Configuration tab. Select the controller to display the


description in the Information tab.

SoMachine Version 3.0

February 2011

Exercise - Create a New Standard Project (cont.)


ii.

SoMachine

Open the Program tab. Select each of the objects in the Devices
pane to view the objects that have populated this pane. Compare
this with the Devices pane in the Empty project.

Save the project.

Manual Draft 2

3-11

Archive Projects
Save the
Compiled Project

A project Archive is a very compressed version of the project. The compression


rate can result in a file that is more than one fiftieth the size of the project file.
Archiving is similar to exporting except that it saves the compiled application. The
consequences of this is that the user cannot archive a project until a successful
compile can be completed. Until this is possible it is necessary to export.

Archive
Properties

A project Archive is saved with the extension .ProjectArchive. The


ProjectArchive file contains:
The PLC binary
The Upload information, i.e. Comments and Animation tables
The Operator Screens

How to Create an
Archive

To create an archive:
Select File Project Archive Save/Send Archive from the main menu. Enter
desired path for the archive file when prompted.

Note:

Archiving is possible only if the project was compiled and when the Upload
information has been included, when it contains at least the comments.

3-12

SoMachine Version 3.0

February 2011

Exercise - Archive Projects


1

Archive the project.


i.

Open one of the previous projects. Select File Project Archive


Save/Send Archive from the main menu.

ii.

Select the following information then click the Save... button.

iii.

Save the file as .projectarchive.

iv.

Open Windows Explorer and compare the size of the two files

.project and .projectarchive.

SoMachine

v.

Which file is larger? ______________________________

vi.

Why? _________________________________________

Manual Draft 2

3-13

Chapter 4:

New Project Creation

Overview
Introduction

The Configuration screen is only displayed after a SoMachine project has been
opened.
The screen consists of a graphical configuration editor that provides necessary
functions to perform the entire hardware and network configuration of the machine.
The configuration settings performed here will also be available in the controller
and Vijeo Designer Program screen

This Chapter Covers These Topics:


The Configuration Screen...................................................... 4-2
Display Manager ................................................................... 4-4
Add a Device to a Project...................................................... 4-5
Add an Expansion Module to a Device................................. 4-8

The Configuration Screen


Configuration
Screen Interface

4-2

The graphical Configuration Editor provides necessary functions to perform the


entire hardware and network configuration of your machine in a graphical way.

General Functions Menu

Hide/View Handle

Task Selection Pane

Work Area

Online Help

Display Manager

Information Pane

SoMachine Version 3.0

February 2011

The Configuration Screen (cont.)


Task Selection
Pane

The Task Selection pane of the Configuration tab lists the devices that may be
added to the configuration in the graphical configuration editor grouped by type
into Logic Controller, HMI Controller, and other categories of devices.

When a new project is created from scratch, the work area of the graphical
Configuration Editor will be empty. The work area will display a prompt for the
user to drag a device from the list in the left pane into this empty area.

SoMachine

Manual Draft 2

4-3

Display Manager
Functions of the
Display Manager

To simplify the use of the graphical Configuration Editor a Display Manager is


provided at the bottom of the pane.

The display manager contains the following functions:

Display Manager Item Description

4-4

Zoom

The Zoom slider controls the magnification of the graphical


configuration editor

100%

The 100% button returns the display of the elements in the


graphical configuration editor to their original size

Show All

The Show All button displays the elements available in the


graphical configuration editor

Reroute

The Reroute button redraws the connecting lines between


the items

Reroute On Drop

Activate this function to redraw the connecting lines


between the items with every new device that is dragged into
the graphical configuration editor

Coll All

The Coll All button collapses the subdevices that are


expansion modules

Exp Last

The Exp Last button expands the subdevices


(expansion modules) of the last device that was
selected

Exp All

The Exp All button expands all subdevices that are


expansion modules

SoMachine Version 3.0

February 2011

Add a Device to a Project


How to Add a
Device

To add a device:
Select the device in this list and drag it to the work area. Notice the device
description on the right, designed to help you make the correct selection.

When the device has been added to the work area a graphical representation of the
device is displayed.

SoMachine

Manual Draft 2

4-5

Add a Device to a Project (cont.)


How to Search
for a Device

To assist in finding the suitable device icon, SoMachine provides a Search


function.

To search for a device:


Enter the name of the device in the text box surrounded by asterisks and click the
Search button.

SoMachine will return a list of devices meeting the search phrase that was entered
or will display a message indicating that no devices were found.

4-6

SoMachine Version 3.0

February 2011

Exercise - Add a Device to an Empty Project


1

SoMachine

Use the Configuration Screen to add a device to an empty Project.


i.

Return to the Home Screen and open the Empty.project created in


Exercise - Create a New Empty Project (page 3-5).

ii.

Open the Configuration Screen.

iii.

Use the Search function to locate the controller TM238LFDC24DT.


Enter the name of the device into the Search field then click the
Search button.

iv.

Drag and Drop the controller TM238LFDC24DT into the work area.

v.

When the device has been added to the work area a graphical
representation of the device is displayed.

Save the project and return to the Home Screen.

Manual Draft 2

4-7

Add an Expansion Module to a Device


How to Add a
Digital
Expansion
Module

To add an expansion module to a device:


Click the Add Expansion hot spot on the device.

Select a module from the Add object dialog then click Add and close. Notice the
Information panel displays information on the selected device. This helps the user
to select the correct device

4-8

SoMachine Version 3.0

February 2011

Exercise - Add an Expansion Module


1

SoMachine

Use the Configuration Screen to add an expansion module to a


device.
i.

Return to the project created in Exercise - Add a Device to an


Empty Project (page 4-7).

ii.

Open the Configuration screen where the device created in the


previous exercise will be displayed.

iii.

Click the Add Expansion hot spot on the device.

iv.

When the hot spot is clicked the Add Object dialog will open.

Manual Draft 2

4-9

Exercise - Add an Expansion Module (cont.)

v.

Click the (+) next to the Digital Expansion Modules branch then
the Inputs branch and select the TM2DA18DT module. Notice that
when the module is selected the Information pane give a description
of the module

vi.

Click the Add and close button to add the module to the device

Save the project.


i.

4-10

Open the Devices tab and click the Save Project

SoMachine Version 3.0

button.

February 2011

Chapter 5:

Controller Programming

Overview
Introduction

Over a period of ten to fifteen years PLC Programming languages developed


independently from each other. Control applications developed their own
proprietary languages based on Ladder programming, C, BASIC and many others.
Since all of these languages were different the people who needed to use these
languages had to spend a great deal of time learning each language.
During the early 1990s the International Electrotechnical Commission (IEC)
developed a standard for all PLCs called IEC 61131. IEC 61131-3 (Part 3) was
developed in 1993. This part of the standard is concerned with the PLC
programming languages.
SoMachine is able to use the five IEC standard languages. These are Sequential
Function Chart (SFC) language and four inter-operable programming languages:,
Ladder Diagram (LD), Function Block Diagram (FBD), Structured Text (ST)
and Instruction List (IL). SoMachine is also able to use the programming
language Continuous Function Chart (CFC)
SFC is mainly used to control highly sequential processes, like repetitive machine
operations. This is properly referred to as a state machine. It can also be used as a
supervisory control mechanism.

This Chapter Covers These Topics:


Program Screen ..................................................................... 5-2
Tasks...................................................................................... 5-8
PLC Program Execution........................................................ 5-9
POU Program Creation........................................................ 5-10
Gateway Configuration ....................................................... 5-16
Task Configuration.............................................................. 5-17
PLC Simulator ..................................................................... 5-21
CoDeSys Program Languages............................................. 5-26
Watchdog Mechanisms ....................................................... 5-36
Structuring an Application .................................................. 5-37
The POU Function............................................................... 5-38
Sample Project..................................................................... 5-44
Global Variables.................................................................. 5-47

Program Screen
Devices Window

The Program screen is displayed when a SoMachine project is opened. It provides


access to the CoDeSys programming environment. Any configuration settings that
were already performed in the Configuration screen are displayed in the Devices
view and can be modified, deleted and / or added here. Any changes performed in
this view will also be available in the Configuration screen.

The Devices window consists of four main nodes. Configuration screens are
accessed by double clicking on the node in the device tree. The four main nodes
are:

Area

Description

Controller

PLC type and PLC configuration

Program

All parts of the PLCs program

Embedded Functions

functions built into the M238

I/O (fast & normal I/O),


HSC high speed counter,
PTO and PWM (pulse train output, pulse width
modulation)
Communication

Communication ports to external devices

Advantys
CAN devices
Servo & Stepper drives
etc.

5-2

SoMachine Version 3.0

February 2011

Program Screen (cont.)


Gateway

In order to connect to a M238 controller, a Gateway must be defined and set to be


the active path. The Gateway is defined in the Communications tab in the
Controller section of SoMachine.

Other configuration items in the Controller section include:

Item

Description

Applications

Displays list of applications on the PLC

PLC Settings

Name of application running IO, output behavior when in


STOP mode

Services

Set time in PLC. Firmware rev, Boot version


Real time in the PLC can be set

SoMachine

Status

Status of PLC and expansion bus

Information

Information about connected PLC model

Manual Draft 2

5-3

Program Screen (cont.)


Program Section

The Program Section contains several items:

Application
-

All parts of the PLCs program

GVL (Global Variable List)


-

Declaration of global variables. Variables visible between all programs in


project.

3 GVL lists per project is the maximum allowed

Library Manager
-

Add optional libraries to current project or create your own custom library

Libraries provide the following items that are executed in the runtime
system of the automation device:

Functions and function blocks

Datatype definitions

Global variables

Visualization objects

Programs (PRG) and Functions(FUN)


-

Named POU (Program Organizational Unit). User created program


sections or functions in the current project. May be created in any of the
six IEC supported languages.

Task Configuration
-

5-4

Controls the execution of the programs in the project. MAST created by


system when you start a new project

SoMachine Version 3.0

February 2011

Program Screen (cont.)


Embedded
Functions

IO
-

Configuration of the M238s internal I/O. The M238 has 6 discrete inputs,
8 fast inputs, 6 discrete outputs, 4 fast outputs

HSC
-

SoMachine

Configuration of the built-in high speed counter. The HSC function can
execute fast counts of pulses from sensors, encoders, switches, etc. The
HSC is independent of the M238 scan time.

Manual Draft 2

5-5

Program Screen (cont.)


Embedded
Functions (cont.)

PTO_PWM
-

Configuration of the pulse train output or pulse width modulation outputs.

The PTO function provides a square wave output for a specified number of pulses
and a specified cycle time.
The PTO function can be implemented in two different modes:
-

one train of pulses

a pulse profile (multiple trains of pulses).

Two PTO channels are available on the Modicon M238 controller. Each PTO
channel is associated to 2 fast outputs and 1 standard input:
PWM uses a square wave whose duty cycle is modulated resulting in the variation

of the average value of the waveform.

Two PWM channels are the maximum possible.

5-6

SoMachine Version 3.0

February 2011

Program Screen (cont.)


Communication

Depending on the M238 model, there are either:


-

One serial port, no Can Master or

Two Serial ports, one Can Master

By default, the TM238LFDC24DT device is preconfigured as follows:


-

Serial Line 1: Modbus manager

Serial Line 2: SoMachine - Network manager

Serial1/Serial2 RS232/485, RTU/ASCII


-

Program download, HMI interface, other services are possible

CANbus
-

connect remote CANopen devices

SoMachine

16 remote devices are possible

Manual Draft 2

5-7

Tasks
Task Basics

A Task is a group of sections and subroutines, executed cyclically or periodically


for the MAST task, and periodically for the FAST task (cyclic task with a
periodicity smaller than that of the MAST task).
Task Configuration allows the definition of one or several tasks to control the
execution of an application program. Tasks control the execution of the
application.

The M238 allows the configuration of up to seven tasks with the restrictions listed
below.
There are Five types of tasks:
Cyclic (3 max) - executed on a time scheduleevery 50ms
Event (2 Max) - executed on L -> H transition of trigger on event tag
Freewheeling (1 Max) starts with program and cycles, no specific time
External Event (4 Max) (not in menu) executed when designated system
event is TRUE. Example - embedded input = ON or OFF or Both
See Also:

For further information about Maximum Number of Tasks for each platform, see
SoMachine Help - and search for Maximum Number of Tasks.
Task Triggering

Tasks may be triggered by:

a time (cyclic, freewheeling)


an internal or external event
-

the rising edge of a global project variable

an interrupt event of the controller

the combination of priority and condition determine the order that the tasks
will be executed

5-8

SoMachine Version 3.0

February 2011

PLC Program Execution


PLC Program
Cycle

The diagram above describes a PLC Program cycle.


Local I/O - processed by the tasks which use them (Task MAST, Task Namexxx,).
Expansion Module I/O - processed by the MAST task only, not by other tasks
if they exist

SoMachine

Manual Draft 2

5-9

POU Program Creation


Program
Organization
Units (POU)

The Devices window allows users to add POUs (Program Organization Units) to
the application. A POU is an object in SoMachine where programming code is
written.

The different types of POU are:

5-10

POU Type

Description

Program

Returns one or several values during operation. All values are retained
from the last time the program was run until the next. It can be called
by another POU.

Function Block

Provides one or more values during the processing of a program. As


opposed to a function, the values of the output variables and the
necessary internal variables shall persist from one execution of the
function block to the next. So invocation of a function block with the
same arguments (input parameters) need not always yield the same
output values.

Function

Yields exactly one data element (which can consist of several


elements, such as fields or structures) when it is processed. The call in
textual languages can occur as an operator in expressions.

SoMachine Version 3.0

February 2011

POU Program Creation (cont.)


How to Create a
POU

SoMachine

To create a POU:
Right click Application and select Add Object POU from the menu.

Manual Draft 2

5-11

POU Program Creation (cont.)


How to Create a
POU (cont.)

Enter a Name and an Implementation Language.

All POUs are created in this manner. When finished, they must be scheduled to
run by assigning them to a Task.

5-12

SoMachine Version 3.0

February 2011

Exercise - Create a POU


1

SoMachine

Use the Program screen to create a POU.


i.

Return to the Home Screen and open the Empty.project created in


Exercise - Create a New Empty Project (page 3-5).

ii.

Open the Program Screen.

iii.

Right click the Application node and select Add Object POU from
the menu.

Manual Draft 2

5-13

Exercise - Create a POU (cont.)

5-14

iv.

When the Add POU dialog opens type the name POU_ST in the
Name: field then select Structured Text (ST) in the Implementation
Language: field. Click the Open button when complete.

v.

The Devices pane will display the new POU and the Work area will
be open ready for the user to enter the new program.

vi.

Click the Save Program


project.

button on the main toolbar to save the

SoMachine Version 3.0

February 2011

Exercise - Create a POU (cont.)


2

Create a program to calculate the average of three variables.


i.

Return to the Devices pane and double click the POU_ST item to
open the programming editor.

ii.

Create four INT variables shown between the VAR and END_VAR.
These are local variables and are only usable in this POU. Be careful
with the syntax.

iii.

Add the code shown in the lower window.

Click the Save Project

button on the main toolbar to save the POU.

SoMachine

Save the project.

Manual Draft 2

5-15

Gateway Configuration
How to Add a
USB Gateway

To add a USB Gateway:


If the PC is connected to the controller, you can double click the controller to
access the Communication Settings.

If no gateway is present, you can use the Add gateway... button to add one. You
can also configure multiple gateways but only one can be active at a time. When
the Set active path button is pressed, the path visualisation changes from normal
to bold.

Use the Set active path button to select the active gateway. When the Set active
path button is pressed, the path visualisation changes from normal to bold.

5-16

SoMachine Version 3.0

February 2011

Task Configuration
How to
Configure a Task

To Configure a Task:
A POU_ST is added to MAST Function.
Priority Define the priority of the current task (0 is the highest priority, 31 is the

lowest priority).
Type Define the type of task

Cyclic - execute cyclically according to the period defined.

Event start on rising edge of the variable associated to trigger the event

External Event start on rising edge of the trigger input for the event.

Freewheeling - execute at start program. At the end of a cycle run, the task

is automatically restarted in a continuous loop, after a delay that is 30%proportional to the duration of the last task cycle. There is no cycle time
defined but T#: 1...1000 ms.
Watchdog Enable the watchdog, enter the watchdog time and the sensitivity.
The Sensitivity field defines the number of times a watchdog overrun can occur

before a watchdog event is generated.


POU Add previously created POU program(s) in the task and fix the execution
order of the POU in online mode. Like a segment scheduler in other =S= PLCs.

SoMachine

Manual Draft 2

5-17

Task Configuration (cont.)


How to Add a
POU to a Task

To add a POU to a Task:


Double click the Task in the Devices pane to open the Configuration window in
the Work area.
Click Add POU in the POUs section of the Configuration tab.

Select the POU.

5-18

SoMachine Version 3.0

February 2011

Exercise - Configure a Task


1

Add a POU to the MAST Task.


i.

Double click the MAST item in the Devices pane to open the MAST
Configuration window in the Work area.

ii.

Click Add POU in the POUs section of the Configuration tab. This
will open the Input Assistant.

iii.

Expand the branches of Application and select the POU_ST. Click

OK.

SoMachine

Manual Draft 2

5-19

Exercise - Configure a Task (cont.)

5-20

iv.

The POUs section of the MAST Configuration tab will display the
POU_ST item.

v.

Check the lower left corner of the SoMachine window under the
Messages section to see that the message Precompile OK has
appeared.

vi.

Select Build Build from the menu.

Save the project.

SoMachine Version 3.0

February 2011

PLC Simulator
Offline PLC
Simulator

How to Start the


Simulator

SoMachine provides an Offline PLC Simulator. Applications may be downloaded


to the simulator and run offline for:
-

Program development

Program debugging

To start the simulator:


Select Online Simulate <PLC Name> from the main menu to place SoMachine
into simulation mode.

Select Online Login to log in to the Simulator. Transfer the application.

SoMachine

Manual Draft 2

5-21

PLC Simulator (cont.)


How to Start the
Simulator (cont.)

5-22

The simulation mode is indicated in the software by a red rectangle reading


SIMULATION being displayed in the information line of the dialog box and by the
controller in the Devices window being displayed in italics.

SoMachine Version 3.0

February 2011

Exercise - Start the Simulator


1

SoMachine

Connect the project to the Simulator.


i.

Select Online Simulation from the main menu to place SoMachine


into simulation mode.

ii.

Select Online Login to log in to the Simulator.

iii.

Since there is no program in the simulator, the following message


will appear. Click Yes.

Manual Draft 2

5-23

Exercise - Start the Simulator (cont.)


iv.

5-24

The operator interface shows that the program is connected.


M238 is shown on the left and an M258 is shown on the right

An

Test the running project


i.

Select Online Start to start the Controller.

ii.

Open the POU and observe its operation.


variables currently have a value of zero.

SoMachine Version 3.0

Notice that all the

February 2011

Exercise - Start the Simulator (cont.)


iii.

Enter some values into the Prepared value field for var1, var2, var3
as shown. The Prepared Value field is a queue for the variables. The
values are not currently applied to the variables.

iv.

Press <CTRL> + W on the keyboard or Online Write Values from


the menu to force the values into the variables. Confirm the action.

The values are written into the variables and the average is
calculated.

SoMachine

Log out of the application and save the project

Manual Draft 2

5-25

CoDeSys Program Languages


ST (Structured text) is similar to programming in PASCAL or C.

POU ST

Note:

Multiple variable declarations of same data type is possible


POU FBD

5-26

FBD (Function block diagram) is a network oriented graphical language. The


components are placed in Networks (i.e., Row) so there is no free placement.

SoMachine Version 3.0

February 2011

Exercise - Program a Function Block Diagram


POU
1

SoMachine

Create a program using FBD language to calculate the average of


three variables.
i.

Return to the Devices pane and add a new POU program in the
Function Block Diagram (FBD) language. Name the new POU
POU_FBD.

ii.

Create the same four INT variables that were used in Exercise Create a POU (page 5-13).

iii.

Right click to the left of Network 1 in the lower pane of the Work
area and select Insert Box from the menu.

Manual Draft 2

5-27

Exercise - Program a FBD POU (cont.)


iv.

When the Input Assistant opens select FDB Operators from the
Categories: pane then select ADD from the Items: pane. Click OK.

v.

The ADD operator will be inserted into the editor.


ADD block and select Insert Input from the menu.

Right click the

A third input will be added to the ADD operator.

5-28

SoMachine Version 3.0

February 2011

Exercise - Program a FBD POU (cont.)


vi.

Click to select the first Input then click the Ellipsis

button.

vii.

This will open the Input Assistant. Select var1 then click OK. In
the same manner add variables var2 and var3 to the second and
third inputs respectively.

viii.

Right click the Output pin and select Insert Box to open the Input
Assistant. Select Keywords from the Categories: pane then select
DIV from the Items: pane. Click OK. Add 3 to the lower input pin
(denominator).

SoMachine

Manual Draft 2

5-29

Exercise - Program a FBD POU (cont.)

5-30

ix.

Right click the Output pin of the DIV block and select Insert
Assignment.

x.

Use the Input Assistant to add the avg variable.


program will look like this:

SoMachine Version 3.0

The completed

February 2011

Exercise - Program a FBD POU (cont.)


2

SoMachine

Test the program.


i.

Add the new POU to the MAST task.

ii.

Select Online Login from the main menu. Since the code has
changed SoMachine will prompt for the type of login. Select Login
with online change then click OK.

iii.

Click the Start Application

iv.

Enter values into the variables in the same manner as before. Check
the display to see whether the program is functioning correctly.

v.

Select Online Logout to log out of the program.

button to start the program.

Log out of the application and save the project.

Manual Draft 2

5-31

CoDeSys Program Languages (cont.)


IL (Instruction list) is an Assembler like programming language.

POU IL

LD (Ladder Diagram) enables the programmer to virtually combine relay contacts

POU LD

and coils.

5-32

SoMachine Version 3.0

February 2011

Exercise - Convert to IL and LD


1

Convert an FBD POU to Ladder Diagram (LD) language.


i.

Return to the POU_FBD POU created in Exercise - Program a


Function Block Diagram POU (page 5-27).

ii.

Select FBD/LD/IL View View as ladder logic to change the POU


from FBD language to Ladder Diagram language.

iii.

Select FBD/LD/IL View View as instruction list to change the


POU Instruction List language.

Note:

FBD, LD and IL formats can be converted from one format to another. SFC and
CFC cannot be converted.
2

SoMachine

Log out of the application and save the project.

Manual Draft 2

5-33

CoDeSys Program Languages (cont.)


POU CFC

CFC (Continuous Function Chart) is similar to FBD. Unlike FDB it allows the free
placement of components.

Note:

Local variables are declared in the VAR section.


POU SFC

5-34

SFC (Sequential function chart) is used to program sequential processes.

SoMachine Version 3.0

February 2011

Exercise - Program a Continuous Function


Chart POU
1

SoMachine

Create a program using CFC language to calculate the average of


three variables.
i.

Create a new POU program named POU_CFC using the CFC


language. Create the same program to calculate the average of
three variables.

ii.

The CFC language allows free placement of the components. The


Inputs, Outputs and Boxes must be added to the work area by
using the CFC Toolbox located to the right of the Work area.

iii.

Create this POU by following the program below. Ask the instructor
if additional help is needed.

iv.

Save, Login, and test this POU.


Log out of the application and save the project.

Manual Draft 2

5-35

Watchdog Mechanisms
M238 Watchdog
Operation

A Watchdog is a device used to protect a system from specific software or


hardware failures that may cause the system to stop responding.
There are two types of Watchdog in SoMachine:
Application (configured) watchdog - Each task cycle can be monitored by a
watchdog timer (a maximum duration of the task cycle). This helps debugging
certain application conditions (such as infinite loops, etc.) and provides a
maximal duration for refreshing outputs.
A watchdog can be defined for each task.
System Watchdog - System Overload is reached when all the user tasks use
more than 80% of system resources. This is computed on a 1 second window,
each second.
This system overload mechanism cannot be disabled, so that system tasks can be
executed properly.

In Online mode, task processing can be monitored by clicking on the task .

5-36

Monitoring the task shows you how long the task is taking to execute

Monitoring the actual task execution time helps determine the correct WDT
setting

SoMachine Version 3.0

February 2011

Structuring an Application
POU Program
Structure

A POU can call other POUs (nesting)


-

No limits to number of calls

Could affect Watchdog limits if not taken into account

Program structuring is possible


-

Conditional execution may be added

Watchdog issues are possible

Called POUs can be in any language

POU calling in the application program

SoMachine

Manual Draft 2

5-37

The POU Function


A POU that
Returns a Result

Function
Creation

POU Function A POU that returns a result

Normally used when you need repeat the same calculation with different
vars. Number crunching

Returns the result of the calculation to the calling POU

Arguments are passed to the function, returns a single result

Example -

Function CalcAvg is created in ST language

5-38

SoMachine Version 3.0

February 2011

The POU Function (cont.)


Calling Function

Function CalcAvg called from ST POU and POU running

Values 10, 20, 15 passed to function CalcAvg. Result of 15 is returned


POU Function in
Three Languages

SoMachine

The same POU Function is shown in three different programming languages

Manual Draft 2

5-39

Exercise - POU Function


1

5-40

Create a POU Function and add it to a POU Program.


i.

Right click the Application node and select Add Object POU.

ii.

Name the function CalcAvg. Select Structured Text as the creation


language for this function and return data type of INT

SoMachine Version 3.0

February 2011

Exercise - POU Function (cont.)

iii.

Create the function as shown. The function returns an Integer and


has three input variables. The comments do not need to be added to
the function. Save the function.

iv.

Save and Build the application. Fix any errors that appear.

The next steps will call the function from a new program POU.
Create a new POU program call the function
i.

SoMachine

Open the POU_FBD program. Right click the left margin, and select
Insert Network from the menu.

Manual Draft 2

5-41

Exercise - POU Function (cont.)

5-42

ii.

Right click the left margin and add a box to the network that was
just created.

iii.

When the Input Assistant opens select the item Module Calls in the
Categories pane. Expand the Application branch and select the
function CalcAvg. Click OK.

SoMachine Version 3.0

February 2011

Exercise - POU Function (cont.)

SoMachine

iv.

The CalcAvg function is added. Add the vars shown

v.

Save, login and download this application to your controller. Test


the operation by entering values into the Prepared Value fields and
using the CNTRL + <W> keys to enter values into the Value field.

Manual Draft 2

5-43

Sample Project
Escalator Project

5-44

The Escalator project is a simple project that is designed to start and run an
escalator. This project will be used to consolidate all of the features of SoMachine
that have been demonstrated in this tutorial.

SoMachine Version 3.0

February 2011

Exercise - Start the Escalator Project


1

SoMachine

Create a new Standard Project.


i.

At the Home screen click the Create new machine item in the left
pane.

ii.

Click the Start with standard project item from the expanded menu.

iii.

Select the device TM238LFDC24DT from the Device: drop down list.
Name the POU Escalator_Mgt and select Continuous Function
Chart as the Implementation Language. Click the Create Project
button.

Manual Draft 2

5-45

Exercise - Start the Escalator Project (cont.)

5-46

iv.

Save the project as Escalator in the C:\Class directory.

v.

When the project is opened SoMachine will display the project in the
Properties tab. Add Title, Author and Company information into the
Author Information fields.

vi.

Save the project.

SoMachine Version 3.0

February 2011

Global Variables
Global Variable
List (GVL)

A Global Variable List (GVL) is a list of variables that are available to all parts of
the application. The fact that all POUs as well as other sections of the application,
have access to these variables is what makes them global. A maximum of three
GVL lists may be created per application

Note:
Global Variables are declared in the same manner as local variables but are
located in a GVL file.

SoMachine

Manual Draft 2

5-47

Exercise - Add Global Variables


1

5-48

Add Global Variables to the Escalator project.


i.

Open the Program screen to view the Devices pane.

ii.

Double click the GVL item in the Devices tree. The GVL Tab will
open in the right pane.

iii.

Add these variables to the project.

Save the project.

SoMachine Version 3.0

February 2011

Exercise - Add a POU to the Escalator Project


1

Add a POU to the project.


i.

The Escalator Project already contains a blank POU named


Escalator_Mgt (PRG). Double click the POU to open for editing.

ii.

Add these Local Variables to top pane of the POU.

iii.

Add the CFC Diagram to the lower pane. Note that the comments
are not necessary.

iv.

Notice that the AND function block has a little circle on the lower left
pin.

This is a Negated pin. To negate the pin right click the pin and
select Negate from the menu.

SoMachine

v.

Add the Escalator_Mgt POU to the MAST task.

vi.

Save and build the project.

vii.

Run the project in Simulation mode to test the logic.

Manual Draft 2

5-49

Exercise - Add a POU to the Escalator Project


(cont.)
2

5-50

Add an Action (sub program) using Ladder Logic Diagram for the
Emergency Management.
i.

Right click the Escalator_Mgt POU and select Add Object Action...
from the menu.

ii.

When

iii.

Add this ladder logic to the Action.

the Add Action dialog appears name the Action


Emergency_Stops_Mgt and select Ladder Logic Diagram as the
Implementation language. Click Open.

SoMachine Version 3.0

February 2011

Exercise - Add a POU to the Escalator Project


(cont.)
3

SoMachine

Add an Action using Structured text for the Maintenance.


i.

Right click the Escalator_Mgt POU and select Add Object Action...
from the menu.

ii.

When the Add Action dialog appears name the Action Maintenance
and select Structured Text as the Implementation language. Click
Open.

iii.

Add this code to the action.

Add the Actions to the POU.


i.

Add boxes to the program to add the two Actions to the program.

ii.

Log in to the program and test.

Manual Draft 2

5-51

You might also like