Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based...

46
Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC flexible, WinAC ODK, VB.NET Application June 2011

Transcript of Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based...

Page 1: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

Applikationen & Tools

Answers for industry.

Cover

PC-based Automation

Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC flexible, WinAC ODK, VB.NET

Application June 2011

Page 2: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

2 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

Siemens Industry Online Support

This article is taken from the Siemens Industry Online Support. The following link takes you directly to the download page of this document.

http://support.automation.siemens.com/WW/view/en/21919680

If you have any questions concerning this document please e-mail us to the following address:

[email protected]

Page 3: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

Plant Visualization 3.0 , Entry-ID: 21919680 3

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

s

SIMATIC Plant Visualization

PC-based Automation: Plant Visualization with

WinCC flexible and Visual Basic .NET

Task

1

Solution

2 Visualization with Visual Basic .NET

3

Visualizing with WinCC flexible

4

WinCC flexible vs. Visual Basic

5

Literature

6

History

7

Page 4: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

Warranty and Liability

4 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

Warranty and Liability

Note The Application Examples are not binding and do not claim to be complete regarding the circuits shown, equipping and any eventuality. The Application Examples do not represent customer-specific solutions. They are only intended to provide support for typical applications. You are responsible for ensuring that the described products are used correctly. These application examples do not relieve you of the responsibility to use safe practices in application, installation, operation and maintenance. When using these Application Examples, you recognize that we cannot be made liable for any damage/claims beyond the liability clause described. We reserve the right to make changes to these Application Examples at any time without prior notice. If there are any deviations between the recommendations provided in these application examples and other Siemens publications – e.g. Catalogs – the contents of the other documents have priority.

We do not accept any liability for the information contained in this document.

Any claims against us – based on whatever legal reason – resulting from the use of the examples, information, programs, engineering and performance data etc., described in this Application Example shall be excluded. Such an exclusion shall not apply in the case of mandatory liability, e.g. under the German Product Liability Act (“Produkthaftungsgesetz”), in case of intent, gross negligence, or injury of life, body or health, guarantee for the quality of a product, fraudulent concealment of a deficiency or breach of a condition which goes to the root of the contract (“wesentliche Vertragspflichten”). The damages for a breach of a substantial contractual obligation are, however, limited to the foreseeable damage, typical for the type of contract, except in the event of intent or gross negligence or injury to life, body or health. The above provisions do not imply a change of the burden of proof to your detriment.

Any form of duplication or distribution of these Application Examples or excerpts hereof is prohibited without the expressed consent of Siemens Industry Sector.

Page 5: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

Foreword

Plant Visualization 3.0 , Entry-ID: 21919680 5

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

21

919

680

_W

inA

C_

VE

_D

OK

U_

v30

_e.

do

c

Foreword

Objective of this application

The SIMATIC Windows Automation Center (WinAC) offers you an open, versatile and robust basis to realize your automation solution on a PC-based basis.

It is fully compatible with SIMATIC S7 and, together with interfaces to the open PC world, it enables you to combine your classic automation tasks with the options of the PC world. Using the SIMATIC IPC427C or the SIMATIC HMI IPC477C offers a powerful and very robust platform for your automation solution with WinAC.

Ten examples for quick and easy introduction in the PC-based automation with SIMATIC WinAC have been developed so far. These examples include the sample code and extensive documentation. The specific tasks discussed in these application examples will help you to become familiar with the relevant subjects.

Arrangement of the examples

The automation tasks described in the examples are related to typical tasks occurring in automation technology:

• Control

• Communication

• Visualization

• Technology

Page 6: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

Foreword

6 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

The individual examples

To allow optimum use of PC-based automation, we have developed one example from the “classic” PLC world, one from the “open” PC world and one from the “embedded” world for each of the four typical automation tasks (control, communication, visualization, technology).

The following figure shows all realized and planned examples with their assignment to the particular fields of use. The example on hand, which deals with the topic of “Plant visualization with WinCC flexible 2008 and Visual Basic .NET”, is displayed with a red margin.

Figure 1-1

Exa

mp

les

on t

he t

opic

of

PC

-ba

sed

Au

tom

atio

n

Control Visualization Technology Communication

Exa

mpl

es

from

the

cla

ssic

wor

ldE

xam

ple

s fr

om

the

op

en

wor

ld

Automation with WinACRTX

• Setting up the PCPlattform

• Process connectionfor WinAC RTX

• Configuration ofWinAC

Data exchange via OPCXML

• dynamic recipe data controller

• Data exchange with data base via OPC XML

• Data base interfaceADO.NET

Interaction of WinCCand WinAC

• Tuning for WinACRTX

• connecting WinCCto WinAC RTX

• Visualization withWinCC

Visualization with VisualBasic.NET + OPC XML

• Acces to OPC XMLvia VB .NET

• Setup Webserver withIIS

• Local and remotevisualization

Positioning with WinAC RTX

• Positioning withEasy Motion Control

• Connecting aMICROMASTER 440

SIMATIC Vision Sensors and WinAC ODK

• Configuration of theVision Sensors

• Application of the CCXinterface ofWinAC ODK

• Communication VisionSensor with ODK

Sending E-mail with WinAC RTX

• Application of SMXinterface ofWinAC ODK

• Sending E-mail via theMAPI interface

S7 communication with WinAC RTX

• S7 communicationwith BSEND/BRCV

• via IndustrialEthernet

• Communication:WinAC ↔ S7-300

Exa

mpl

es

from

the

emb

edd

edw

orld

Plant visualization with WinCC flexible 2005 andVisual Basic .NET

• Visualization on the Microbox 420-RTX withVisual Basic .Net viaWinAC ODK

• Visualization on the Panel PC 477 HMI/RTXwith WinCC flexible 2005

planning phase planning phaseAutomation with SIMATIC Microbox 420-RTX

• Basics on Microbox 420-RTX

• Setup forMicrobox 420-RTX

• Remote Control

• DiagMonitor

? ?

Basis of the examples

The common basis of all examples is a virtual “mixing process”. This mixing process is used to apply the different tasks and automation components of the product range of PC based automation.

Page 7: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

Foreword

Plant Visualization 3.0 , Entry-ID: 21919680 7

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

21

919

680

_W

inA

C_

VE

_D

OK

U_

v30

_e.

do

c

System illustration

The following figure shows a schematic illustration of the “mixing process”. The components described in this example application are marked by a red frame.

Figure 1-2

Vision Sensor SIMATIC VS 723

SIMATIC S7-300controller

C++ E-Mail

application

C++controlprogram

WinCCflexible RT

Visual Basic .NET visualization

(local)

ET200I/O

Database(e.g. MS Access)

SIMATICWinAC RTX

SIMATIC NET

Microbox 420-RTX or Panel PC 477 HMI-RTX Plant

Easy Motion Control

WinAC ODK

Micromasterwith motor

WinAC ODK

CP 5611

Visual Basic .NET visualization

(remote)

Ethernet interface

VB.NET visualizationon Microbox

WinAC ODK

Page 8: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

Table of Contents

8 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

Table of Contents Warranty and Liability ................................................................................................. 4 Foreword....................................................................................................................... 5 1 Task..................................................................................................................... 9

1.1 Overview .............................................................................................. 9 1.2 Focus during visualization with Visual Basic...................................... 10 1.3 Focus during visualization with WinCC flexible.................................. 11

2 Solution............................................................................................................. 13 2.1 Overview of the overall solution ......................................................... 13 2.2 Used Hard- and Software Components ............................................. 14 2.2.1 Hardware and software components for visualization with Visual

Basic................................................................................................... 14 2.2.2 Hardware and software components for visualization with

WinCC flexible.................................................................................... 15 2.3 Example project.................................................................................. 16 2.4 Basic performance data ..................................................................... 16 2.5 Customer benefit ................................................................................ 17

3 Visualization with Visual Basic .NET............................................................. 18 3.1 Basics of WinAC ODK........................................................................ 18 3.2 Principle of operation of Shared Memory Extension Interface

(SMX) ................................................................................................. 19 3.3 Program structure of the example...................................................... 21 3.4 Program description ........................................................................... 23 3.4.1 Exchanging data with the controller ................................................... 23 3.4.2 Data consistency ................................................................................ 25 3.4.3 Check whether the partner reacts (Keep Alive mechanism).............. 27 3.4.4 Wrapper for VB .NET ......................................................................... 28 3.5 Installation of the visualization program............................................. 29 3.6 Operating WinAC RTX ....................................................................... 31 3.7 Operator control and monitoring ........................................................ 32

4 Visualizing with WinCC flexible ..................................................................... 34 4.1 What is WinCC flexible....................................................................... 34 4.2 WinCC flexible and WinAC RTX ........................................................ 35 4.3 Visualizing the data of the SIMATIC DiagMonitor 4.2........................ 37 4.4 Operator control and monitoring ........................................................ 39

5 WinCC flexible vs. Visual Basic ..................................................................... 45 6 Literature .......................................................................................................... 46

6.1 Bibliographic References ................................................................... 46 6.2 Internet links ....................................................................................... 46

7 History............................................................................................................... 46

Page 9: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

1 Task

1.1 Overview

Plant Visualization 3.0 , Entry-ID: 21919680 9

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

1 Task

1.1 Overview

The example on hand describes two visualizations on different hardware and software platforms. The task for both visualizations is to visualize a mixing process on a WinAC RTX as simply as possible, and to control this process. The visualizations should be used locally on the WinAC station.

Technological task and overview

On a SIMATIC IPC427C (referred to as IPC427C below) the mixing process is visualized with Visual Basic .NET via WinAC ODK (referred to as Visual Basic below).

The visualization with WinCC flexible 2008 SP2 (referred to as WinCC flexible below) is described on a SIMATIC HMI IPC477C (referred to as HMI IPC477C below).

Platform differences in the application

This application uses two different hardware and software platforms. The selection of platforms in this application is meant to point out the properties of individual visualizations.

Note Of course, another platform can also be used for visualization. Adjust this application to your platform or vice versa.

You can also use the visualization with WinCC flexible on the IPC427C and the visualization with Visual Basic on the HMI IPC477C.

STEP 7 projects in the application

A STEP 7 project is developed to simulate the control for a mixing plant. The developed STEP 7 project is then expanded individually.

Page 10: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

1 Task

1.2 Focus during visualization with Visual Basic

10 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

1.2 Focus during visualization with Visual Basic

The visualization with Visual Basic is based on an IPC427C. Data exchange between controller (WinAC RTX 2010) and visualization (Windows application) occurs via a shared main memory area, which is provided by the SMX (Shared Memory Extension) interface of the WinAC Open Development Kit.

Components overview

The figure below shows the basic interaction of the components described in this example during visualization on an IPC427C.

Figure 1-1

Visual izationin VB.NET

SM

X in

terf

ace

of W

inA

C O

DKWinAC

WinA C Station (SIMATI C IPC427C)

DB x

SM

X I

nter

face

of W

inA

C O

DK

Visual izationwith VB. NET

Solution Requirements

The solution must fulfill the following requirements:

• Communication of the ODK application with the WinAC RTX controller via the SMX interface of WinAC ODK.

• The partners (WinAC ↔ Visualization) must be informed whether the respective partner has been started and is functioning

• If must be possible to read and write the data consistently.

• Flexible programming of the visualization must be possible.

Quantity framework of the sample application:

A relatively small quantity framework was chosen for the visualization application. The functions applied for the data exchange can be transferred easily to a larger quantity framework.

Table 1-1

Function Data quantity

Cyclic, asynchronous reading • 2 data words (DBW)

• 6 data bits (DBX)

User-controlled, synchronous writing • 4 data words (DBW)

• 1 data bits (DBX)

Page 11: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

1 Task

1.3 Focus during visualization with WinCC flexible

Plant Visualization 3.0 , Entry-ID: 21919680 11

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

1.3 Focus during visualization with WinCC flexible

A SIMATIC HMI IPC477C used for visualization with WinCC flexible. The data exchange between WinAC RTX and WinCC flexible RT occurs via Softbus. A graphic surface represents data from the controller using control elements, such as input fields, buttons, graphic objects and animations.

Components overview

The figure below shows the basic interaction of the components described in this example during visualization on a HMI IPC477C.

Figure 1-2

Softbus

WinAC Station (SIMATIC HMI IPC477C)

Page 12: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

1 Task

1.3 Focus during visualization with WinCC flexible

12 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

Solution Requirements

The solution must fulfill the following requirements:

• Communicaton of the visualization with the WinAC RTX controller via Softbus.

• Data of the SIMATIC PC DiagMonitor V4.2 (referred to as DiagMonitor below) are to be visualized.

• Simple operator control and monitoring

Overview of the example

For visualization with WinCC flexible the following points are realized:

• Current values from the controller are displayed

• The user can change current values

• Recipe data are displayed

• The user can change recipe data

• User can switch between recipes

• Data of the DiagMonitor are visualized

• User can switch between views

Page 13: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

2 Solution

2.1 Overview of the overall solution

Plant Visualization 3.0 , Entry-ID: 21919680 13

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

2 Solution

2.1 Overview of the overall solution

The following figure shows the hardware setup of the sample application and the standard and user software components involved.

Overview of the overall solution of the visualization with Visual Basic

Figure 2-1

• Windows XP em bedded• WinAC RTX 2005• Integrated Ethernet in terfac e• .NET Fram ework• Vis ual ization(VB .NET)

Industria l Ethernet

• STEP 7• .NET Fram ework• Vis ual Stud io .NET• WinAC ODK

PG/PC• Windows Em bedded Standard• WinAC RTX 2010• Integrated Ethernet-In terface• .NET Fram ework• Vis ual ization(VB .NET)

WinAC Station (SIM ATIC IPC427C)

Overview of the overall solution of the visualization with WinCC flexible

Figure 2-2

Industrial Ethernet

• STEP 7• WinCC flexible 2008 Advanced

PG/PC• Windows Embedded Standard• WinAC RTX 2010• WinCC flexible RT 2008• DiagMonitor V4.2

WinAC Station (SIMATIC HMI IPC477C)

Page 14: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

2 Solution

2.2 Used Hard- and Software Components

14 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

2.2 Used Hard- and Software Components

The hardware and software components for the different stations are listed in the following tables. The hardware and software components are displayed in separate tables for both visualizations.

2.2.1 Hardware and software components for visualization with Visual Basic

The following hardware and software components are used in this application for visualization with Visual Basic on the SIMATIC IPC427C.

Hardware components of the SIMATIC PC station (WinAC station)

Table 2-1

Component Qty. MLFB / Order number Note

SIMATIC IPC427C 1 6ES7647-7B...-...0

SIMATIC S7-300, STROMVERSG. PS 307

1 6ES7307-1EA01-0AA0

USB keyboard 1 Standard PC keyboard

USB mouse 1 Standard PC mouse

Monitor 1 With DVI interface, if possible

Graphics adapter DVI on VGA 1 Only required, if your monitor is not equipped with a DVI interface

Hardware components for the PG/PC

Table 2-2

Component Qty. MLFB / Order number Note

Programming device Field PG M3

1 6ES7715..

Crossed Ethernet cable 0.5 m 1 6XV1850-2HE50

Page 15: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

2 Solution

2.2 Used Hard- and Software Components

Plant Visualization 3.0 , Entry-ID: 21919680 15

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

Software components of the SIMATIC PC station (WinAC station)

Table 2-3

Component Qty. MLFB / Order number Note

Windows Embedded Standard 2009

1

SIMATIC WinAC RTX 2010 1 6ES7671-0RC08-0YA0

Software components on the PG/PC

Table 2-4

Component Qty. MLFB / Order number Note

STEP 7 V5.5 1 6ES7810-4CC10-0YA5

SIMATIC WinAC ODK V4.2 1 6ES7806-1CC03-0BA0 Provides the SMX interface

Microsoft Visual Studio .NET 2008 Professional

1 Optional, can be ordered from your administrator or at www.microsoft.com

2.2.2 Hardware and software components for visualization with WinCC flexible

The following hardware and software components are used in this application for visualization with WinCC flexible on the HMI IPC477C.

Hardware components of the SIMATIC PC station (WinAC station)

Table 2-5

Component Qty. MLFB / Order number Note

SIMATIC HMI IPC477C 1 6AV7884-.....-...0 Konfigurator: siehe FAQ ID 28055912

SIMATIC S7-300, LASTSTROMVERSG. PS 307

1 6ES7307-1EA00-0AA0

USB keyboard 1 Standard PC keyboard

USB mouse 1 Standard PC mouse

Hardware components for the PG/PC

Table 2-6

Component Qty. MLFB / Order number Note

Programming device Field PG M3

1 6ES7715..

Crossed Ethernet cable 0.5 m 1 6XV1850-2HE50

Page 16: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

2 Solution

2.3 Example project

16 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

Software components of the SIMATIC PC station (WinAC station)

Table 2-7

Component Qty. MLFB / Order number Note

Windows Embedded Standard 2009

1

SIMATIC WinAC RTX 2010 1 6ES7671-0RC08-0YA0

SIMATIC WinCC flexible 2008 Runtime

1

SIMATIC NET PC Software V7.1 + SP2

1 6GK1704-1PW71-3AA0

DiagMonitor V4.2 1 6ES7648-6CA04-2YX0

Software components on the PG/PC

Table 2-8

Component Qty. MLFB / Order number Note

STEP 7 V5.5 1 6ES7810-4CC10-0YA5

SIMATIC WinCC flexible 2008 Advanced

1 6AV6613-0AA51-3CA5

2.3 Example project

The present application consists of the components listed in the following table. These components are part of the present application example (available for download on the Internet).

Table 2-9

Component Note

21919680_WinAC_VE_VB_CODE_v30.zip This ZIP file contains: • A complete STEP 7 project

• The source code of the visualization in Visual Basic .NET

• The executable visualization program of this application

21919680_WinAC_VE_WinCC_CODE_v30.zip This ZIP file contains: • A complete STEP 7 project with

Integrated WinCC flexible visualization

21919680_WinAC_VE_DOKU_v30_d.pdf This document

2.4 Basic performance data

For performance data on WinAC RTX please refer to the application “Automating with WinAC RTX” or to the manual. Both entries can be downloaded from the A&D Service and Support portal on the internet.

Page 17: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

2 Solution

2.5 Customer benefit

Plant Visualization 3.0 , Entry-ID: 21919680 17

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

2.5 Customer benefit

Customer benefit of this application (Visual Basic)

• Performant data exchange via PC internal memory

• Visual Basic .NET enables programming the visualization user interface

• The visualization user interface can allows flexible adjustment to customer requirements.

Customer benefit of this application (WinCC flexible)

• Rapid familiarization due to the example project

• WinCC flexible enables simple visualization

Customer benefit of SIMATIC IPC427C and SIMATIC HMI IPC477C

• Very robust, thus also appropriate for harsh industrial environment

– regarding EMC

– regarding temperature conditions

– regarding shocks and vibrations

• Embedded system: Access protection against system modifications by viruses or unauthorized access

• Maintenance-free since available without mechanically moved parts

• Easy mounting (mounted onto the wall or onto a top hat rail)

• Expandable by open interfaces (PROFIBUS, PC/104, USB)

• Ready to be switched on, including preinstalled software components

Page 18: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

3 Visualization with Visual Basic .NET

3.1 Basics of WinAC ODK

18 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

3 Visualization with Visual Basic .NET This chapter describes the visualization with Visual Basic .NET via WinAC ODK on Microbox 420-RTX. The basics of WinAC ODK are explained below. The basics of WinAC RTX are described in the application example with the entry ID: 21004855 . Furthermore, the structure of the “Visual Basic .NET“ example program is displayed and important code sections are described.

3.1 Basics of WinAC ODK

What is WinAC ODK V 4.2?

The WinAC Open Development Kit is a software tool which enables connecting Windows application (in the following referred to as ODK application) to WinAC. This enables WinAC control programs to use the full performance range offered by the Windows operating system and the Windows applications.

Functionality of WinAC ODK

ODK generates a quantity framework in programming language C++, to which the user can program his desired functionalities. This quantity framework facilitates the introduction into programming. However, it does not necessarily have to be used.

Components of the WinAC ODK V 4.2

WinAC ODK V 4.2 includes three components, of which CCX and SMX are described below:

• Custom Code Extension Interface (CCX)

• Shared Memory Extension Interface (SMX)

• Controller Management Interface (CMI)

Custom Code Extension Interface (CCX)

It enables the access to data in WinAC from the S7 program to the ODK application and in opposite direction. The S7 programmer uses system function blocks (SFB) for these accesses.

CCX can only be used together with the software PLC (WinAC RTX).

Shared Memory Extension Interface (SMX)

Interfaces are provided, which enable the data exchange between WinAC and the ODK application. To the S7 programmer, this data exchange appears as access to I/O data.

This application is based on SMX which will be described in detail.

Controller Management Interface (CMI)

The Controller Management Interface (CMI) serves the integration of the WinAC panel functionality into a Windows application. This enables integrating the control elements (e.g. RUN / STOP switch, LEDs) into your own C++ programs.

Page 19: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

3 Visualization with Visual Basic .NET

3.2 Principle of operation of Shared Memory Extension Interface (SMX)

Plant Visualization 3.0 , Entry-ID: 21919680 19

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

3.2 Principle of operation of Shared Memory Extension Interface (SMX) This chapter provides an overview of this principle of operation of the SMX interface of WinAC ODK.

Overview

The Shared Memory Extension (SMX) provides an interface for the data exchange between the S7 program, the WinAC RTX controller and a Windows program. Both applications run on the same PC.

The Windows program can, for example, be implemented in Visual Basic or C++. It is referred to as ODK program below.

Data exchange occurs via a shared memory area. The access to this area is controlled by the SMX. The memory area has a size of 4kByte for outputs and 4kByte for inputs. The S7 program can write data into the output area, which can be read by the ODK program. The ODK program writes data into the input area and the S7 program reads data from there.

The WinAC RTX uses part of the main memory as shared memory.

Access to the shared memory

The following figure illustrates the interaction between the S7 program of your WinAC controller and the ODK program via SMX when accessing the shared memory.

Figure 3-1

Shared memoryfor Data exchange

ODK programSTEP 7 program(WinAC RTX)

WinAC ODK SMX implementation

Write

Write

Read

Read

4 KB outputrange

4 KB inputrange

Note: The SMX methods for data access runs the conversion of the S7 data format into the PC data format.

1 2

34

L MW 14T PEW 5000

L PEW 4096T MW 16

Page 20: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

3 Visualization with Visual Basic .NET

3.2 Principle of operation of Shared Memory Extension Interface (SMX)

20 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

Explanations

The following table gives you information on realizing the read and write processes displayed in the above figure.

Table 3-1

No. Description

1 For writing data from the S7 program into the shared memory you use the transfer operation. As a target you select an address in the output area of SMX.

2 For reading data from the shared memory into your ODK program you use the global read function of SMX. A separate read function is realized for each S7 data type (e.g. ReadS7BYTE). The global read functions automatically execute the required conversion of S7 data types into the respective PC data types.

3 For writing data from your ODK program into the shared memory you use the global write functions of SMX. A separate write function is realized for each S7 data type (e.g. WriteS7BYTE). The global write functions automatically execute the required conversion of PC data types into the respective S7 data types.

4 For reading data from the shared memory into your S7 program you use the load operation. As a source you choose an address in the input area of SMX.

Cyclical reading of data

Both partners must ensure that the shared memory is read sufficient times. “Sufficient times“ depends on the respective application and follows the frequency of the data changes.

To ensure that short signals are also recognized, a synchronization (e.g. by means of handshake) must be implemented in both partners.

Addressing of the shared memory

The following table lists the address areas of the individual WinAC controllers for access to the shared memory. The address area has a size of 4094 bytes and is used exclusively for data exchange via SMX.

Table 3-2

Controller Address area STEP 7 Address area C++

WinAC RTX PEW / PAW 16384 – 20478 0 – 4094

WinAC ODK Application Wizard

With the ODK Application Wizard you generate a project for using the SMX interface of WinAC ODK. It has a number of functions implemented for using the SMX Interfaces.

The ODK Application Wizard is available for C/C++, C# and Visual Basic. Projects for the following Compiler can be created: Microsoft Visual C++ 6.0, Microsoft Visual C++ .NET, Microsoft Visual Studio 2005 and 2008.

For using the ODK program with WinAC RTX no WinAC ODK needs to be installed on the SIMATIC IPC427C.

Page 21: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

3 Visualization with Visual Basic .NET

3.3 Program structure of the example

Plant Visualization 3.0 , Entry-ID: 21919680 21

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

3.3 Program structure of the example This example shows how process data are transferred from WinAC RTX to Visual Basic and how vice versa operator information reaches WinAC RTX.

Structure model

The following graphic illustrates the processes realized in this example.

Figure 3-2

SIMATIC IPC427C

WinAC RTXODK

program(Visualizationwith VB .NET)Shared Memory

output range

Operating system Windows XP embedded

Shared Memoryinput range

ReadS7Word (..)....

WriteS7Word (..)

Process data

DB xy

T PAW 16384...

L PEW 16384

FC xy

Explanation of the program structure

In the WinAC RTX controller a program runs which controls a virtual mixing process. The produced process data are collected in a DB.

Once per OB1 cycle, WinAC RTX calls a function which writes these process data into an output area. From there it can be read by the Visual Basic program via read functions.

The Visual Basic program in return writes control information into the input area using write functions. There they are read into the controller by means of a function and are saved into a data block. The S7 program can read data from there and react to it.

Reading must occur cyclically on both sides (polling).

Page 22: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

3 Visualization with Visual Basic .NET

3.3 Program structure of the example

22 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

Architecture of Visual Basic visualization

The figure below shows the principle setup of the application.

Figure 3-3

ODK Program

Visual Basic .NET Application Interface to WinAC

User-Interface

Visual-BasicTank Control

Visual BasicCode

Wrapper for VB.NET

WinAC ODK,SMX

Interface(C++)

Shared MemoryWinAC RTX

Explanation of the architecture

The individual parts shown in the above figure are described in the following table.

Table 3-3

Number Function

Tank Control: Represents a software block that visualizes a tank with heater, cooler and mixer. This block can be integrated into any other software projects. It is part of the Visual Studio project map.

User interface: Interface of ODK program for the user. It is a window containing the visualization and control elements.

Visual Basic Code: Takes on time control and preparation of process values, so they can be displayed in the user interface.

Wrapper for VB.NET: The SMX interface of WinAC ODK is suitable for C++. To be able to use it in Visual Basic .NET, some file formats must be reconverted. This task is performed by the wrapper.

SMX interface of WinAC ODK: A library of WinAC ODK, which connects the ODK application to the Shared Memory.

Page 23: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

3 Visualization with Visual Basic .NET

3.4 Program description

Plant Visualization 3.0 , Entry-ID: 21919680 23

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

.NET Framework

The .NET Framework is a virtual runtime environment by the software producer Microsoft for application software. It provides a platform-specific Just-In-Time Compiler as well as collections of objects. This opens up a new kind of programming.

3.4 Program description

This chapter only explains some selected program sections which are important for the functionality of the ODK program. The complete source code can be downloaded from the internet together with this application.

3.4.1 Exchanging data with the controller

This chapter describes how the ODK program can exchange data with the controller.

Structure of the shared memory (output area of WinAC RTX)

The following table shows how this application assigns the shared memory. Some process values are stored here which are transferred by WinAC RTX for visualization.

Table 3-4

Offs. Variable name WinAC Variable

Meaning

0 Act_Temp PAW 16384 Actual temperature

2 Act_Niveau PAW 16386 Actual level

4 Bit variables: Bit 0: bitAct_InValve1 Bit 1: bitAct_InValve2 Bit 2: bitAct_OutValve Bit 3: bitAct_Heater Bit 4: bitAct_Cooler Bit 5: bitAct_Mixer

PAB 16388 Inlet valve 1 Inlet valve 2 Outlet valve Heater on / off Cooler on / off Mixer on / off

5 Bit variables: Bit 0: ConsistentReadAck Bit 1: ConsistentWriteAck

PAB 16389 Enable for consistent writing consistent reading

6 KeepAlive data for VB PAW 16390 WinAC keep alive signs

8 Act_Niveau1 PAW 16392 Selected level 1 (default 25%)

10 Act_Niveau2 PAW 16394 Selected level 2 (default 55%)

12 Act_TempMax PAW 16396 Selected max. temperature (default 60°C)

14 Act_TempOut PAW 16398 Selected outlet-temperature (default 30°C)

Page 24: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

3 Visualization with Visual Basic .NET

3.4 Program description

24 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

Structure of the shared memory (input area of WinAC RTX)

The following table illustrates the structure of shared memory. Some control values are stored here which are transferred from the visualization to WinAC RTX for visualization. Table 3-5

Offs. Variable name WinAC Variable

Meaning

0 Set_Temp_max PEW 16384 Set temperature max.

2 Set_Temp_Out PEW 16386 Set temperature outlet

4 Set_Niveau1 PEW 16388 Set Niveau 1

6 Set_Niveau2 PEW 16390 Set Niveau 2

8 Bit variables: bit 0: ConsistentReadReq bit 1: ConsistentWriteReq bit 2: Start/Stop Bit

PEB 16392 Request for consistent writing consistent reading Start process

10 KeepAlive data for WinAC

PEW 16394 Alive sign for the visualization

Explanation on the source code

Using the example of two variables, the following table shows how they are transferred.

Table 3-6

Variable Code in WinAC Code in the ODK application

Act_Niveau Extract from the FC 4: U “WritingDisabled” // for consistency

SPB over

L „Data_Act_Val“.Act_Niveau

T PAW16386

over: ....

Load from the data block and transfer to the output area

Extract from Visualisierung.vb: BeginConsistentRW (TRUE)

SMXFunctions.DLL_ReadS7INT (hSMXHandle, 2, iAct_Niveau)

EndConsistentRW (TRUE)

Read integer from WinAC RTX and ensure that the data are consistent.

Rat_Temp_Max Extract from the FC 5: U “ReadingDisabled” // consistency

SPB over

L PEW 16384

T „Data_Act_Val“.Rat_Temp_Max

over ….

Load from the input area and transfer to the data block.

Extract from Visualisierung.vb: BeginConsistentRW (FALSE)

SMXFunctions.DLL_WriteS7INT (hSMXHandle, 0, iTempMax)

EndConsistentRW (FALSE)

Write integer into WinAC RTX and ensure that the data are consistent.

Page 25: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

3 Visualization with Visual Basic .NET

3.4 Program description

Plant Visualization 3.0 , Entry-ID: 21919680 25

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

3.4.2 Data consistency

General information

Due to the fact, that data can be read and written at the same time in the input area as well as in the output area of the shared memory, data consistency must be ensured in particular. The SMX interface does not support this. Data consistency can, however, be very easily realized in the program. How this works is described below.

Implemented mechanism

To ensure data consistency, a piece of code must be programmed in the ODK program as well as in WinAC. The figure below shows the time sequence of a consistent read process.

Figure 3-2

Output area

BeginConsistent-Read Data

record

Consistent reading

Writing not permitted!

ODK program

S7 Programin WinAC

Request Bit

Acknowledge Bit

EndConsistentRead

Time

Consistent reading

Reading a number of values consistently in the ODK program involves the following mechanism sequence:

1. The ODK program places a request by calling the BeginConsistentRead () function. This sets a request bit in the shared memory.

2. The S7 program in the WinAC RTX controller recognizes the request bit and responds by setting the acknowledge bit in the shared memory. As long as this bit is set, WinAC RTX does not perform any write access in the shared memory.

3. The ODK program recognizes the set acknowledge bit. Then any number of variables can be read consistently from the output area of the shared memory.

4. After the end of consistent reading, the ODK program calls the EndConsistentRead () function. This resets the request bit.

5. The S7 program in the WinAC RTX controller recognizes the reset request bit and in response resets the acknowledge bit in the shared memory. WinAC RTX can now perform write accesses in the shared memory again.

The BeginConsistentRead () and EndConsistentRead () functions are part of the application and are implemented in VB.NET. The request and acknowledge bits are data bits in the shared memory.

If the acknowledge bit is not set, data can be written and read. Data consistency, however, is then no longer guaranteed.

Page 26: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

3 Visualization with Visual Basic .NET

3.4 Program description

26 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

Realization in VB .NET Code

The respective Visual Basic .NET Code has the following structure:

Figure 3-3

Read Acknowledge Bit

Cons. reading active?

Set Request Bit

Wait forAcknowledge Bit

Consistent reading

Reset Request Bit

Acknowledge Bit? Timeout?

yes

yesyes

no

no

no

Consistent writing is performed according to the same principle.

Realization in the S7 program of WinAC RTX

WinAC RTX checks in each OB1 cycle whether the request bit has been set. If it has been set, the acknowledge bit is set in the shared memory. Write operations are no longer performed.

After the request bit has been reset, WinAC RTX resets the acknowledge bit and writes back into the shared memory.

Page 27: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

3 Visualization with Visual Basic .NET

3.4 Program description

Plant Visualization 3.0 , Entry-ID: 21919680 27

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

3.4.3 Check whether the partner reacts (Keep Alive mechanism)

The SMX interface of WinAC ODK gives no feedback whether the partner has been started or functions correctly. Often, however it is necessary to know this. A visualization must know, for example, whether WinAC RTX is in RUN mode. This can be achieved via the software mechanism described below.

KeepAlive sign in WinAC RTX

In WinAC RTX a so-called KeepAlive counter was implemented, which counts up 1 for every cycle. This count value is written to the shared memory.

In the Visual Basic Code it is checked cyclically, whether the WinAC RTX count level has changed in the last 200 ms. If this is the case, there is certainty, that the WinAC RTX is connected and in RUN mode.

If the counter has not changed, then there is an error which is displayed as text in the visualization. The following error causes are possible:

• WinAC RTX is in STOP mode

• The WinAC RTX controller has not been started

• WinAC RTX receives a wrong S7 program which has not implemented the KeepAlive counter.

• The OB1 cycle takes longer than 200 ms. In this case, the monitoring time in the Visual Basic program can be extended.

Alive sign of the visualization

The Visual Basic program also has a KeepAlive counter which counts up cyclically and is written to the shared memory.

WinAC RTX checks in each OB1 cycle whether the counter value has changed. If this is not the case, an error counter is counted up. For each change of the KeepAlive counter of the visualization, the error counter is reset.

If the error counter exceeds a fixed error state, then the VBisAlive variable is reset. This indicates that the connection with the visualization is interrupted.

Since the OB1 cycle is shorter than the time between the incrementing of the KeepAlive counter in Visual Basic, the error counter in WinAC RTX is continuously counted up and reset again.

Page 28: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

3 Visualization with Visual Basic .NET

3.4 Program description

28 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

3.4.4 Wrapper for VB .NET

Task of the wrapper

The wrapper represents an “intermediate layer“ which converts incompatible data types and forwards the calls to the SMX interface.

Example for the call of an SMX function

The following image represents how calls are forwarded from the wrapper to the SMX interface and how the data types are transformed.

Figure 3-4

Wrapper forVB.NET(C++)

WinAC ODK,SMX

interface(C++)

Visual BasicCode

(VB .NET) DLL_ReadS7BOOL(Int32, Int32, Int32, Int32)

ReadS7Bool(int, long, int, int *)

Usage of the wrapper

The wrapper encapsulates all of the functions of the SMX interface. You can apply it in your own applications for using the SMX interface of WinAC ODK in Visual Basic .NET applications. It is included in this application as source code.

Page 29: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

3 Visualization with Visual Basic .NET

3.5 Installation of the visualization program

Plant Visualization 3.0 , Entry-ID: 21919680 29

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

3.5 Installation of the visualization program

In this chapter, you will learn how to install the example program. It is assumed, that the data are located on the SIMATIC IPC427C.

Installation of Microsoft .NET Framework

The application on hand uses .NET Framework. It must be installed on the IPC427C.

Table 3-7

No. Action

1 Check whether .NET Framework has already been installed. Select Start Settings Control Panel Add or Remove Programs, to display the installed software of IPC427C. If you find Microsoft .NET Framework in the list you can skip the following steps in this table.

2 Download Microsoft .NET Framework from the internet from the internet. You can find it under the following link: http://msdn.microsoft.com/netframework/downloads

3 Execute the installation file on the SIMATIC IPC427C. Then follow the instructions of the setup program.

Copy the example program

No setup is required for the installation of the visualization program. Follow the instructions in the table to copy the program files on the IPC427C.

Table 3-8

No. Action

1 Extract the zip-file “21919680_WinAC_VE_CODE_v30.zip“ in any directory. The extracted data contains the ”Visualization for Microbox“ directory.

2 This directory contains the files required for the application. Copy this directory to SIMATIC IPC427C if not already done so.

3 The application is started by executing the “SMX Visualisation.exe“ file which is located in the above directory.

Page 30: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

3 Visualization with Visual Basic .NET

3.5 Installation of the visualization program

30 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

Configuring the Station Configuration Editor

The configuration of the WinAC station with the Station Configuration Editor corresponds to plugging S7-400 hardware components to a rack. Thereby components from the PC station (hardware and software components) are, in software technology terms, allocated to a virtual slot.

Table 3-9

No. Action

1 Start the Station Configuration Editor of SIMATIC IPC427C via “START Station Configuration Editor”.

2 Ensure that the components „WinLC RTX“ and „IE General“ are existing in the component configurator.

Note: “IE General” in the Station Configuration Editor is required, for example, when loading your station via Ethernet. Alternative: If you do not wish to remove the components, add them to the hardware configuration in your STEP 7 project.( IE General => Ethernet with IP General: 192.168.1.1)

3 Click the “Station name” button. In the new dialog, enter the name “SIMATIC”. This name is configured as station name in the STEP 7 project. Exit the dialog box by clicking OK.

Note If WinLC RTX has not been entered in the Station Configuration Editor, then “WinLC RTX” appears neither in the start menu nor as an icon on the desktop.

Page 31: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

3 Visualization with Visual Basic .NET

3.6 Operating WinAC RTX

Plant Visualization 3.0 , Entry-ID: 21919680 31

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

Loading the STEP 7 project

The STEP 7 project is available in archived form. It has to be loaded into the WinAC RTX of the SIMATIC IPC427C. The following section describes how the STEP 7 can be loaded into WinAC. For further information, refer to the entry ID 23942303.

Table 3-10

No. Action

1 In the previously extracted folder “S7Proj” of this application, you will find the MB_Visu_S7_Prj.zip file. This is the archived STEP 7 project. Open STEP 7 and retrieve this archive via “File Retrieve”. Open the project.

2 Connect your PG with the SIMATIC IPC427C via Ethernet cable with the Ethernet-Port.

3 Configure the PG/PC interface of the PG to the TCP/IP interface according to your network card.

4 Load the project from STEP 7 into the WinAC on the SIMATIC IPC427C.

3.6 Operating WinAC RTX

This section provides a brief overview of the use of WinAC RTX. Only the functions which are absolutely necessary are explained in the following. It is recommended to read the SIMATIC WinAC RTX manual for the use of WinAC RTX.

Starting WinAC RTX

WinLC RTX is started via: “Start SIMATIC PC Based Control WinLC RTX”. Thus, the operator panel of the controller is started simultaneously.

WinAC RTX icons on the Windows task bar

If WinAC RTX is started, you can see one of the following icons on the task bar:

Table 3-11

Symbol Meaning

WinAC is started

WinAC is in operating status "STOP"

WinAC is in operating status "RUN"

Operating WinAC RTX

The buttons of the WinLC RTX control panel are explained in the following table.

Table 3-12

Button Function

Setting the RUN mode

Setting the STOP mode

A memory reset of the controller is performed.

Page 32: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

3 Visualization with Visual Basic .NET

3.7 Operator control and monitoring

32 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

3.7 Operator control and monitoring

Introduction

This chapter explains the application of the example program for visualizing the mixing process.

A precondition for operator control and monitoring is the installation of the hardware and software, which was described in this document.

Description of the process

The S7 control program simulates a mixing process. Liquids are hereby fed into a tank via two inlet valves. The liquid is then mixed and heated. After the set temperature has been reached, the liquid is cooled down again and then drained via an outlet valve.

Starting the example program

For starting the visualization program please execute the program “SMX Visualisation.exe” which you copied.

HMI

The following figure shows the user interface of the example program.

Figure 3-5

Page 33: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

3 Visualization with Visual Basic .NET

3.7 Operator control and monitoring

Plant Visualization 3.0 , Entry-ID: 21919680 33

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

Description of the user interface

The following table explains the relevant control elements of the user interface.

Table 3-13

No. Description

1 Connecting and disconnecting with WinAC RTX

2 Selecting the update time of the process variables

3 Status information for the connection

4 Display of current tank filling level.

5 Input field: Setpoint filling height of the first liquid (value range: 0-90) Input field: Setpoint value for entire filling height of the tank (value range: 0-100) Set Niveau: Writes the setpoint values for the filling heights into WinAC RTX.

6 Display of current temperature

7 Input field: Setpoint value of maximum heating temperature (value range: 0-200) Input field: Setpoint value of outlet temperature (value range: 0-100) Set temperature: Writes the setpoint values for the temperatures into WinAC RTX

controller.

8 “Start Process”, “Stop Process”: Starts and stops the mixing process. If the process is stopped via the “Stop Process“ button, the current mixing process is completed first and then no new process started again.

9 Animated visualization of tanks, valves, heater, cooler, mixer, filling level and temperature.

Starting and operating the visualization

The following instructions show you how the visualization is operated.

Table 3-14

No. Action

1 Starting the example program “SMX Visualisation.exe“. WinAC RTX must be started to be in RUN mode.

2 In the “Update Rate“ field you select an update time.

3 Should the status not display “Connected“, you can connect the visualization via

the button.

4 Start the mixing process by clicking this button .

5 You can now adjust the set values within in your value ranges at random: 1. Write a value into the input field. 2. Press the respective button for setting the set values.

8 Disconnect by clicking the button.

9 Close the example program.

Page 34: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

4 Visualizing with WinCC flexible

4.1 What is WinCC flexible

34 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

4 Visualizing with WinCC flexible This chapter describes the visualization with WinCC flexible 2008 SP2. Here you obtain information on the interaction of the components WinCC flexible (RT) and WinAC RTX.

4.1 What is WinCC flexible

WinCC flexible 2008 SP2 is introduced in the following section. Selected areas used in this application are described below. Further information on WinCC flexible is available in the manual on WinCC flexible.

WinCC flexible - an HMI system

WinCC flexible is an HMI system which enables you to visualize automation processes. Data from one or several S7 controllers are clearly displayed in form of a graphic user interface. The graphic user interface serves as interface between the user and the plant control. Using the control elements of the user interface enables operator control and monitoring for a plant.

Installation of WinCC flexible

Install WinCC flexible on your PG. Installation of WinCC flexible RT on the PG is not mandatory. The installation process of WinCC flexible is a self-explanatory standard installation. This application does not describe the installation process in greater detail. For a more detailed installation instruction please refer to the WinCC flexible manual.

WinCC flexible RT

It is an environment in which a WinCC flexible project is loaded and executed. This environment contains libraries with control elements and functions, which are made available to the projects during its execution.

Installation of WinCC flexible RT

WinCC flexible RT has already been installed and licensed on the SIMATIC IPC427C (incl. WinCC flexible 2008 Runtime, WinCC flexible /Recipes for PC, WinCC flexible / OPC-Server for PC).

WinCC flexible Runtime must be added on Index 4 in the Component Configurator.

Afterwards you can upload the WinCC flexible project to your SIMATIC HMI IPC477C.

Integration of WinCC flexible into the SIMATIC Manager

The SIMATIC Manager is the shared platform for configuration of SIMATIC automation components. The SIMATIC automation components also include WinCC.flexible.

The integration of WinCC flexible in the SIMATIC Manager offers the following advantages:

• Simple transfer of variables and texts into the WinCC flexible project.

• Direct access to STEP 7 icons during process connection

Page 35: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

4 Visualizing with WinCC flexible

4.2 WinCC flexible and WinAC RTX

Plant Visualization 3.0 , Entry-ID: 21919680 35

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

4.2 WinCC flexible and WinAC RTX

Connection between WinCC flexible RT and WinAC RTX

In this application example, the connection between WinAC and WinCC flexible RT has been configured via softbus.

Note A connection between WinCC flexible RT and WinAC RTX via Softbus is only possible if both are running on the same computer.

Connect WinCC flexible with WinAC RTX via Softbus

Proceed as follows for configuring a connection between WinAC RTX and WinCC flexible via Softbus.

Table 4-1

Step Action

1. Open your STEP 7 project in the SIMATIC Manager. Select the PC station for the communication with WinCC flexible via Softbus. Start the HW-Config editor via double-clicking the “Configuration” element in the right view.

2. Add “WinCC flexible RT“. Close the HW-Config editor. Confirm “Save changes” dialog with “Yes”.

Page 36: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

4 Visualizing with WinCC flexible

4.2 WinCC flexible and WinAC RTX

36 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

Step Action

3. In the SIMATIC Manager you select “WinCC flexible RT” for the station selected above. Select “Communication”, “Connections”. By double-clicking “Connections” in the right view you start WinCC flexible.

The connection via Softbus is initiated automatically. The new WinCC flexible project is integrated in the SIMATIC Manager at the same time.

4. Save the WinCC flexible project. Now you can expand the WinCC flexible project.

Page 37: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

4 Visualizing with WinCC flexible

4.3 Visualizing the data of the SIMATIC DiagMonitor 4.2

Plant Visualization 3.0 , Entry-ID: 21919680 37

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

4.3 Visualizing the data of the SIMATIC DiagMonitor 4.2

Example project for WinCC flexible 2008

In the installation directory of the SIMATIC DiagMonitor V4.2 you find an example project for the visualization of PC Monitoring with WinCC flexible 2008. In this example project two stations can be monitored.

The DiagMonitor uses an OPC connection with WinCC flexible. You can expand the example project. For further information please read the PDF and TXT documentation located in the same directory.

Visualizing the DiagMonitor

In the DiagMonitor only one OPC connection can be specified. For this reason, the data of the DiagMonitor must be forwarded if you require the data elsewhere.

Note Further information on installing the DiagMonitor is available in entry ID 23942303. This document also describes how an OPC connection can be established between DiagMonitor and WinAC RTX (Incl. configuration of the data block for data of DiagMonitor).

In this application example, data of the DiagMonitors can be visualized in two ways. Below, these options are described in greater detail. The first introduced solution is realized in this application.

Page 38: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

4 Visualizing with WinCC flexible

4.3 Visualizing the data of the SIMATIC DiagMonitor 4.2

38 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

OPC connection between DiagMonitor and WinAC RTX

The DiagMonitor writes its data to a data block in WinLC RTX via an OPC connection. The data can now be visualized by WinCC flexible like any other data of the controller.

Figure 4-1

DiagMonitor

OPC Server

WinAC RTX

WinCC flexible RT

S7 Connection

Data block

Softbus

OPC Connection

Advantages:

• The data also exist in the controller if the visualization has failed.

• Several visualizations can access this data simultaneously

• Other visualizations, e.g. with Visual Basic, can access data

Disadvantages:

• The data written into the block differ from the data for OPC connection with WinCC flexible:

• The example project of the DiagMonitor cannot be used. The images can be accepted into your WinCC flexible project.

Page 39: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

4 Visualizing with WinCC flexible

4.4 Operator control and monitoring

Plant Visualization 3.0 , Entry-ID: 21919680 39

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

OPC connection between DiagMonitor and WinCC flexible RT

The DiagMonitor writes its data to WinCC flexible via an OPC connection. The data can be forwarded from WinCC flexible to the WinLC.

Figure 4-2

DiagMonitor

WinAC RTX

WinCC flexible RTas OPC Server

Softbus

OPC Connection

Advantages:

• The example project of the DiagMonitor can be used.

• During controller failure the data of the DiagMonitor still exist.

Disadvantages:

• If data of the DiagMonitor are required in the controller, the data must be forwarded.

• During failure of the visualization the forwarding process is interrupted

4.4 Operator control and monitoring

This section provides information on how you can use the example project on the SIMATIC HMI IPC477C. Furthermore, images of the visualization are described individually.

STEP 7 Project

The STEP 7 project is available in archived form. Retrieve the STEP 7 project.

Additional you have to make settings in the component configurator.

Here the most important settings in the Station Configuration Editor:

• Station name “SIMATIC”

• OPC Server

• WinLC RTX

• IE General (Ethernet with IP address 192.168.1.1)

• WinCC flexible RT

Page 40: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

4 Visualizing with WinCC flexible

4.4 Operator control and monitoring

40 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

Loading the STEP 7 project

Load the STEP 7 project into the WinAC RTX of the SIMATIC HMI IPC477C. How to load the STEP 7 project into WinAC via Ethernet is explained in chapter 3.5 or under entry ID 23942303.

WinCC flexible example project

The WinCC flexible example project is integrated in the STEP 7 project. A connection between WinCC flexible RT and WinAC RTX has been configured via Softbus. Transfer the example project to SIMATIC HMI IPC477C.

Note If you change the station name in the STEP 7 project, please ensure that you also change the configured connection between WinCC flexible RT and WinAC in the integrated WinCC flexible project.

Transfer the example project

This application describes how the WinCC flexible example project can be transferred on the SIMATIC HMI IPC477C via Ethernet. Please proceed as follows:

Note The following assumptions are made:

• Ethernet interface with IP address 192.168.1.x exists on the PC (x stands for a number between 3 and 255)

• Ethernet on the SIMATIC HMI IPC477C has the IP address 192.168.1.1

• The mentioned interfaces are combined into one network

Table 4-2

Step Action

1. On the SIMATIC HMI IPC477C you start the WinCC flexible 2008 Runtime Loader via Start -> SIMATIC -> WinCC flexible Runtime Loader, if not already started.

2. On the PC you start WinCC flexible 2008 with your project by double-clicking a WinCC flexible element (e.g. an image) in the STEP 7 project in the SIMATIC Manager.

Page 41: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

4 Visualizing with WinCC flexible

4.4 Operator control and monitoring

Plant Visualization 3.0 , Entry-ID: 21919680 41

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

Step Action

3. Select Project -> Transfer -> Transfer Settings… from the menu.

4. Set the interface, for example, Ethernet with IP address 192.168.1.1 and click “Transfer”

User interface of the example project

The user interface consists of the images “Main” and “DiagMonitor”. The user interface starts in resolution 640x480 and provides a virtual number block for the input of numbers into an input field. The images are further explained below.

Navigating in the user interface

There is one button „Stop Runtime“ on the picture and another to change the pictures. WinCC flexible RT is closing by clicking “Stop Runtime”. By clicking the button “Close” (“X” by MS Windows) on the right side on the top, where the Windows-Buttons are, has the same effect.

Page 42: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

4 Visualizing with WinCC flexible

4.4 Operator control and monitoring

42 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

“WinAC_main” screen

This screen displays the sequence of the mixing process as an animation. On the left side, some values are displayed with input fields, where some are defined as “Output”. This means, they cannot be changed by the user.

Figure 4-3

Monitoring the mixing process

On top, the tank has two valves used to fill the tank with two liquids successively. If the filling level has been reached, the tank content is heated. As soon as the maximum temperature is reached, the tank content is cooled down. During the “heating” and “cooling” processes, the tank content is mixed. Then the entire tank content is emptied.

Operating the mixing process

If a new process has not been started yet, click the “Start Process” button to start a new process. Clicking the “Stop Process” notifies the controller that after the current process now new process should be started.

Page 43: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

4 Visualizing with WinCC flexible

4.4 Operator control and monitoring

Plant Visualization 3.0 , Entry-ID: 21919680 43

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

Work steps during the mixing process

The entire mixing process is divided into several logic processes (e.g. heating, cooling, outlet etc.). The controller processes the following steps:

• Inlet Niveau 1

• Inlet Niveau 2

• Heating and mixing

• Cooling and mixing

• Outlet

• Mixing process finished

Change current recipe data

You can change recipe data with the recipe display in the middle of the picture. You can create, save and transfer more recipes. If a new recipe has been loaded, there is a field blinking for this display. The new recipe will be considered at the beginning of the next process.

Switching to the next process step

Clicking “Next Step” enables you to jump to the next step of a process. The current process will then be interrupted. This may cause unexpected events.

Page 44: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

4 Visualizing with WinCC flexible

4.4 Operator control and monitoring

44 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

“WinAC_recipe” screen

Data of the DiagMonitor are shown on this picture. This picture is from the example project of the DiagMonitor and is adapted. Data on this picture can not be changed by the user.

Figure 4-4

The temperatures of the monitoring objects are shown incites and digital. The display “KeepAlive” shows an object, which is inverted by every access on the data of the DiagMonitor. The KeepAlive count gets incremented with every access.

Note Because of the visualization is used on a embedded system, the values of the fan are 0. The reason is that the SIMATIC HMI IPC477C has no fan. The user is informed by a text.

Page 45: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

5 WinCC flexible vs. Visual Basic

Plant Visualization 3.0 , Entry-ID: 21919680 45

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

5 WinCC flexible vs. Visual Basic Both visualizations are compared below and the respective visualization properties are listed in a table.

General comparison

The following table represents the properties of the visualizations, irrespective of the hardware and software platform they are used on.

Table 5-1

Visual Basic .NET WinCC flexible 2008

Programming skills are required. No programming skills are required. If some scripts are generated, then Visual Basic Script skills will be required.

No integration in SIMATIC Manager. Integration in SIMATIC Manager.

COM (Component Object Model by Microsoft Corporation) skills are required.

Skills in operating the software are required (control elements, interaction of elements such as text fields, buttons).

The format during data transmission has not been defined in detail and must be defined by the developer before transmission

• flexible

• prone to errors

Simple access to all data of the controller is possible after a connection with the affected station has been configured

• Less flexible

• Less prone to errors

If more than one station is visualized, a complex system will be required (Client/Server architecture)

Several connections can be configured.

The shared memory has only a limited data volume that it can transmit.

No limitation

IDE must have been installed on the PG (e.g. Visual Studio .NET by Microsoft Corporation).

WinCC flexible Advanced must be installed on the PG.

The visualization system requires the installation of NET Frameworks by Microsoft.

The visualization system requires the installation and configuration of WinCC flexible RT.

Data from another Application (e.g. from SIMATIC PC DiagMonitor V4.2) can be visualized, by reading in the WinAC RTX and then transferring over the shared memory.

For data of another application (e.g. from SIMATIC PC DiagMonitor V4.2) existing screens can be adopted to your project.

Elements, such as animated screen objects, must be generated.

Pre-configured screen objects are provided

Page 46: Applikationen & Tools - Siemens · Applikationen & Tools Answers for industry. Cover PC-based Automation Plant Visualization with WinCC flexible and Visual Basic .NET WinAC RTX, WinCC

6 Literature

46 Plant Visualization

3.0 , Entrys-ID: 21919680

Co

pyr

igh

t

Sie

me

ns

AG

20

11

All

righ

ts r

ese

rve

d

6 Literature

6.1 Bibliographic References This list is by no means exhaustive and only gives a selection of appropriate sources.

Table 6-1

Topic Title

/1/ STEP 7 Automatisieren mit STEP 7 in AWL und SCL Hans Berger published by: Publicis MCD Verlag ISBN 3-89578-113-4

/2/ WinCC flexible WinCC flexible Manual. Entry-ID: 18796010

/3/ WinCC flexible ”WinCC flexible Getting Started First Time User“. Entry-ID: 18660846

6.2 Internet links This list is by no means exhaustive and only gives a selection of appropriate sources.

Table 6-2

Topic Title

\1\ Reference to this documentation

http://support.automation.siemens.com/WW/view/en/21919680

\2\ Siemens Industry Online Support

http://www.ad.siemens.de/support

\3\

7 History Table 7-1

Version Date Modification

V1.0 28.09.2005 First version

V2.0 29.05.2007 Updated with Microbox 420-RTX, extended by WinCC flexible visualization for Panel PC 477-HMI/RTX

V3.0 15.06.2011 Updated with SIMATIC IPC427C and SIMATIC HMI IPC477C

V3.0 5/2012 Correction in table 3-6 line 2, column 3