wincc-oa the jcop framework
TRANSCRIPT
© CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
WinCC-OA
&
The JCOP Framework
Rafal Kulaga (Part 1)
Riku-Pekka Silvola (Part 2)
Industrial Controls & Safety Group,
Beams Department,
CERN
Course materials originally prepared by Paul Burkimsher
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Course Materials
• Please download the course materials (these
slides, the exercises and working solutions)
from:
• https://readthedocs.web.cern.ch/display/ICKB
/PVSS+Service+Training+PVSS-
JCOPFw+Course+Downloads
• or
• http://cern.ch/jcoptrn
• You are currently reading “part1Slides.pdf”
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 6
Practicalities - I
• Timetable for the next 4 days:
– 09:00..12:30 and 14:00..17:30
– Coffee break!
• Building 54, ground floor, far side, on the right (see next
slide)
• Open 07:45..15:45
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 7
Cafeteria
You are here
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Practicalities - II
8
• Fire exit?
• Fire extinguisher?
• Username & password for your machine
• I will close the doors during lunch break
• Any problems downloading the course
materials?
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 9
Introductions
• Who am I?
• Who are you?
– Name / Experiment
– What did you do before WinCC-OA?
– Any experience with programming or SCADA?
– What will you be doing with WinCC-OA?
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 10
Wave Around
• ETM’s “Getting started” in their online help:
Start > All Programs > Siemens Automation >
Runtime Systems > WinCCOA 3.xx > WinCC
OA Online Help > WinCCOA Getting started
• Clara’s Introduction for newcomers:
• http://cern.ch/lhcb-online/ecs/pvssintro.htm
• Other References (in Course Materials folder)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 11
Course Map
• Introduction– LHC-Experiment Control Systems
– What is the JCOP Framework?
– What is WinCC-OA?
– What is FSM?
• WinCC-OA– Concepts and tools provided
– Practical Exercises
• JCOP Framework– Concepts and tools
– Exercises
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 12
Course Syllabus
• Before you signed up, you probably read through the syllabus summary from this link:
• http://readthedocs.web.cern.ch/display/ICKB/PVSS+Service+Training
• …which takes you to the Course brochure:
• https://readthedocs.web.cern.ch/display/ICKB/PVSS+Course+Brochure
• If there is any other topic you want to discuss, tell me over the break and I’ll see what I can do (or at least I’ll tell you why we’re not already covering it)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 13
What is WinCC-OA?
• The Supervisory Control And Data Acquisition
(SCADA) system chosen by JCOP.
– In-depth evaluation of products available (commercial or
open-source) from 1997 to 1999
– JCOP (i.e. the experiments, i.e. you) chose WinCC-OA in
2000
– Commercial product from ETM, Austria (bought later by
Siemens)
– Since then, WinCC-OA has been widely adopted across
CERN, not just used by the experiments
• WinCC-OA is a TOOL, not a control system!
– You have to build your own control system
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Why WinCC OA (PVSS)?
1414
• Scalability:
• Large Distributed Systems
• Openness
• Programming language (CTRL)
• API (Managers & Drivers)
• Multiplatform
• Relations with the company
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 15
Who uses WinCC-OA at CERN?• LHC Experiments (Atlas, CMS, Alice, LHCb)
• Fixed Target experiments (Compass, Harp, NA60…
• … NA62)
• LHC Accelerator (Cryogenics)
• CERN’s Electrical Network
• CERN’s Cooling and Ventilation
… + Radmon, Magnet test, etc.
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
In numbers…
• ~800 active developers worldwide (1400 ever)
• 130 institutes in 30 countries
16
Application WinCC OA
Systems
Parameters
(Million
dpes)
ALICE 100 3
ATLAS 130 12
CMS 90 10
LHCb 160 10
Accelerator
Complex
200 10
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
WinCC-OA == PVSS
• WinCC-OA is marketed by Siemens
• Siemens now owns ETM, the company that
makes it
• Before the takeover, WinCC-OA was called
PVSS
• You will still see the name PVSS all over:
– In the software itself.
– In their documentation.
– Possibly even in my slides…
• PVSS == WinCC-OA
17
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 18
What is JCOP?
• JCOP stands for “Joint Controls Project”
• Grouping of representatives from the 4 big LHC
experiments.
• JCOP aims to reduce the overall manpower
cost required to produce and run the
experiment control systems
• Still very active
– E.g. Planning evolution of the framework, sharing
experience, etc.
– Lately decided for the next WinCC OA version (3.15)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 19
What is JCOP Framework?
• A layer of software components
– Produced in collaboration, components shared
– Produced and deployed using common tools,
components that work together
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
What does a CERN Control System look like?
WTS
cernts
GPNWTS or
App gateway
Office computers
Fieldbus
TN
PLCs
Sensors
&
Actuators
20
MOON
(Monitoring)
Single sign-on
High Voltage
DIM/CMW OPC
Services
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 21
What is WinCC-OA?
• WinCC-OA is a SCADA TOOL– Not a control system.
– You still have to build your own !
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 22
What does the WinCC-OA Scada tool give?
• WinCC-OA has capabilities for:
– Device Description
• Data Points, and Data Point elements
– Device Access
• OPC, ProfiBus, Drivers
– Alarm Handling
• Generation, Masking, etc
– Alarm Display, Filtering, Summarising
– Archiving, Trending, Logging
– User Interface Builder
– Access Control
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 23
What is WinCC-OA not?
• WinCC-OA does not have tools specifically for:
– Abstract behaviour modelling
• Finite State Machines
– Automation & Error Recovery
• Expert System
• But CERN (HEP)-written FSM does
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 24
What is FSM?
• Finite State Machine (FSM)
– Abstract representation of your experiment. What
state is it in? Is it taking data? Is it in standby? Is it
broken? Is it switched off? What triggers it to move
from one of these states to another?
– JCOP chose the State Management Interface
(SMI++) product which was developed for the
DELPHI experiment.
– SMI = tool to build an FSM + Expert system. Vital for
controlling & recovering large experiments
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 25
Course Map
• Introduction– LHC-Experiment Control Systems
– What is the JCOP Framework?
– What is WinCC-OA?
– What is FSM?
OA– Concepts and tools provided
– Practical Exercises
• JCOP Framework– Concepts and tools
– Exercises
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 26
• Constituents of a WinCC OA system
• Different kinds of WinCC-OA Systems:
– Single system, Single machine
– Single system, Multiple machines (Scattered
system)
– Single Redundant (and split) system
– Many Systems (Distributed system)
• How to start up WinCC-OA
Introduction to WinCC-OA
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 27
User Interface Layer
Processing Layer
Driver Layer
CTRL API
EV
D DD
UIM UIM UIM
DM Communication and
Memory Layer
Managers overview: Layers
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 28
Manager basics
• Software technology used: Own process
• Communication: Platform independent TCP
• Efficiency: Event driven data exchange
• The sum of all managers form a System
• Scalability
– Only required Managers are started
– Managers may be spread across several machines
– Load balancing
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 29
Managers II
• Modularity: Autonomous functional units
• Flexibility: The computers forming a system
can run different operating systems
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 30
Manager overview
User Interface Layer
Processing Layer
Driver Layer
CTRL API
EV
D DD
UIM UIM UIM
DM Communication and
Memory Layer
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 31
Managers overview
User Interface Layer
Processing Layer
Driver Layer
CTRL API
EV
D DD
UIM UIM UIM
DM Communication and
Memory Layer
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 32
• Only one Event Manager per
WinCC-OA system
• Receives and evaluates messages
(“Events”) from other managers.
• Distributes those events to other
managers
• Contains and administers the
current process image (held in
data points)
• Administers user authorization
EV
Event Manager
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 33
Managers overview
User Interface Layer
Processing Layer
Driver Layer
CTRL API
EV
D DD
UIM UIM UIM
DM Communication and
Memory Layer
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 34
• Manages a database that reflects your process’ status:
• Archive of most recently known values & alarms
• Historical archive of alarms
• Administers system parameterization
(i.e. it records your system setup.)
• WinCC-OA comes with a (highly optimised) DB “Raima” (on
the local Drive).
• DM link to Oracle is also supported.
Database Manager: Role
DM
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 35
Managers overview
User Interface Layer
Processing Layer
Driver Layer
CTRL API
EV
D DD
UIM UIM UIM
DM Communication and
Memory Layer
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 36
User Interface Manager (UI)
• Graphical visualization of
messages received by EM
• Forwards user input to
the EM
• User logon/logoff
Run-time: Shows panels in the control room
Executes scripts
(programs) “behind”
each widget.
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 37
UI Manager: Graphical Editor
• Widgets (graphical
objects)
• Drag & drop
• Library of standard-
symbols
• Create own symbols
• Symbol-library can
include Generic Panels
• Panels in a panel
• (ActiveX components)
Development-time: Creating panels
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 38
UI Mgr: Predefined panels I
• Configuration via
standard panels:
• Database
actions
• Reports
definition
• ...
System Management:
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 39
UI Mgr: Predefined panels II
• System-State
• Memory usage
• Manager Connections
• Message Statistics
• CTRL-Script Debugger
• ...
Diagnostics & Debugging:
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 40
Managers overview
User Interface Layer
Processing Layer
Driver Layer
CTRL API
EV
D DD
UIM UIM UIM
DM Communication and
Memory Layer
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 41
Control Manager
Executes scripts (programs) not needing a
screen or keyboard
Interpreter with syntax similar to ‘C’ :
• No Pointers
• String Handling
• Dynamic Arrays
Support for concurrency
Scripts triggered on events (including time
events)
Large library of functions
New functions can be added (in C++)
Ctrl
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 42
Managers overview
User Interface Layer
Processing Layer
Driver Layer
CTRL API
EV
D DD
UIM UIM UIM
DM Communication and
Memory Layer
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 43
API Manager
Allows you to incorporate other compiled
code into your system
Application Programming Interface (API)
into C++ classes
All WinCC-OA’s own Managers are based
on this API
You have full WinCC-OA-access !
API
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 44
Managers overview
User Interface Layer
Processing Layer
Driver Layer
CTRL API
EV
D DD
UIM UIM UIM
DM Communication and
Memory Layer
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 45
Communication protocol
On-the-fly processing:
Smoothing & Old/New
(Reduce the data flow)
Value Conversion
(Raw value in mV vs
Engineer’s value in Volts)
Data-Type transformation (eg
Binary-Coded-Decimal to INT)
Standard-Drivers (OPC,
Profibus, S7 etc.)
Driver API for new drivers
D
transformation
conversion
smoothing
old/new
SW telegram
HW/kernel
Driver Managers
WinCC-OA
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 46
Recap: Managers
User Interface Layer
Processing Layer
Driver Layer
CTRL API
EV
D DD
UIM UIM UIM
DM Communication and
Memory Layer
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 47
• Constituent of a WinCC OA system
• In this section, we’ll introduce the different
kinds of WinCC-OA Systems you can build:
– Single system, Single machine
– Single system, Multiple machines (Scattered
system)
– Single Redundant (or split) system
– Many Systems (Distributed system)
• How to start up WinCC-OA
Introduction to WinCC-OA
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 48
Single Machine System - I• All WinCC-OA managers run on the same machine
• Server is also the operator station (GUI, multiple monitors possible)
Server &
Operator Station
PLC, DDC, RTU
Process bus
Alarm printing
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 49
Single Machine System - II• All managers run on the same computer
– off the shelf PC
– high reliability server
• Single system fulfills all process control tasks:
– Data acquisition and conditioning via drivers
– Representation of process (visualization)
– Operation of the complete facility / plant
– Alarming (alarm list, animation)
• …
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 50
Single Machine System - III
– …
– Archiving (measurements, counting values, states)
– Trending (line and bar graphs)
– Reporting (creation, distribution, storage)
– Engineering (creation and maintenance of a
system)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 51
• Constituent of a WinCC OA system
• In this section, we’ll introduce the different
kinds of WinCC-OA Systems you can build:
– Single system, Single machine
– Single system, Multiple machines (Scattered
system)
– Single Redundant (or split) system
– Many Systems (Distributed system)
• How to start up WinCC-OA
Introduction to WinCC-OA
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Scattered system.
• One WinCC-OA system scattered over many
computers
• ~Spreads the processing load (still only on one
EM)
• Ideal for remote access (eg from your office)
52
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Scattered system
• One WinCC-OA system scattered over many
computers
• ~Spreads the processing load
• Ideal for remote access (e.g. from your office)
5353
CTRLControlmanager
APIAPI-Manager
DDriver
DBDatabase-
Manager
UIUserinterface
Runtime
DDriver
DDriver
EVEventmanager
UIUserinterface
Editor
Internet, WAN,…
UIUserinterface
Runtime
EVEventmanager
CTRLControlmanager
UIUserinterface
Editor
APIAPI-Manager
DBDatabase-
Manager
DDriver
DDriver
UIUserinterface
Runtime
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 54
• Architecture of a single system
• In this section, we’ll introduce the different
kinds of WinCC-OA Systems you can build:
– Single system, Single machine
– Single system, Multiple machines (Scattered
system)
– Single Redundant (or split) system
– Many Systems (Distributed system)
• How to start up WinCC-OA
Introduction to WinCC-OA
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Redundant system
• Hardware redundancy (WinCC OA servers)
supported by software
55
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 56
A Redundant System - I
Server 1 Server 2
Engineering
PLC, DDC, RTU
(Primary) (Hot-Standby)
Managment
Operator 1 Operator 2
Process bus
Ethernet-LAN
• Hot-Standby functionality
• Server Failure => Automatic switch over of all operator stations
• Redundant network connections between all stations
• Cover physical faults (e.g. disk crash), not design fault (e.g. bugs in your API manager)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 57
A Redundant System - II• Another reason to have a redundant system: “Split-mode”
• Redundant servers can be disconnected from each other, leaving one running the production system
– One server is master
– Second server can be used for testing & software upgrades
– System is no longer redundant!
• Rejoin systems back into redundancy mode, choosing either one as the new primary
Server 1 Server 2
Engineering
PLC, DDC, RTU
(Primary)
Management
Operator 1 Operator 2
Process bus
Ethernet-LAN
Hot-Standby
Engineering
(Test)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 58
Redundant system in Split Mode
• Features:
– Both servers still receive data from the drivers
(PLC, field bus,…)
– Primary server continues and manages the
operator stations
– Second server can now be used for test purposes
(fully separated)
– Only individually selectable data is exchanged
between the two servers (if needed)
– Each operator station can select whether to
connect to the primary or to the test system
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 59
Redundant split mode - II
• Automatic return into redundant operation on
the basis of a selectable server machine (keep
original configuration or establish test machine
as new primary)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 60
• Constituent of a WinCC OA system
• In this section, we’ll introduce the different
kinds of WinCC-OA Systems you can build:
– Single system, Single machine
– Single system, Multiple machines (Scattered
system)
– Single Redundant (or split) system
– Many Systems (Distributed system)
• How to start up WinCC-OA
Introduction to WinCC-OA
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 61
Distributed System (or “Cluster”)
System 1
System 3
System 2
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 62
Distributed System II
• Two or more autonomous WinCC-OA-Systems are
connected via network (LAN)
• Each system can have its own connections to the
plant (PLC, DDC, field bus,...)
• All process data is mapped to local data points only
(ie data is held only once, anywhere)
• Each system is capable of displaying (and
processing) data from other systems
– Bi-directional communication only (for WinCC OA < 3.14)
– Since 3.15, the communication can be uni-directional
• Each system can issue commands to hardware
connected to another system.
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 63
Distributed System III
• Direct read and write access to online values,
states, alarms or history anywhere in the
Cluster
• A Distribution Manager provides the interface
between systems
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 64
Distributed System IV
• Event driven communication leads to low
network load
– Only requested data is transferred
• Network connection between systems can be
fully redundant
– Integrated connection monitoring
• Interconnected 160 systems at CERN (of the
2048 theoretically possible.)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 65
Distributed System V
EVEvent-
Manager
CTRLControl-
Manager
DDriver
DBDatabase-
Manager
REDURedundancy
Manager EVEvent-
Manager
CTRLControl-
Manager
DDriver
DBDatabase-
Manager
REDURedundancy
Manager
Server 1 Server 2
UIUserinterface
Runtime
Operator 1
UIUserinterface
Runtime
Operator 2
DISTDistribution
Manager
DISTDistribution
Manager
EVEvent-
Manager
CTRLControl-
manager
DDriver
DBDatabase-
Manager
Single Machine Station
DISTDistribution
Manager
UIUserinterface
Runtime
UIUserinterface
Runtime
Operator 2
EVEvent-
Manager
CTRLControl-
Manager
DDriver
DBDatabase-
Manager
Server
DISTDistribution
Manager
UIUserinterface
Runtime
Operator 1
Local Area Network TCP
System 1
System 2
System 3
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 66
• In this section, we’ll introduce the different
kinds of WinCC-OA Systems you can build:
– Single system, Single machine
– Single system, Multiple machines (Scattered
system)
– Single Redundant (or split) system
– Architecture of a single system
– Many Systems (Distributed system)
Introduction to WinCC-OA
• How to start up WinCC-OA
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 67
How to get WinCC-OAhttp://readthedocs.web.cern.ch/display/ICKB/WinCCOA+Service+Download+3.15
(or Google “CERN WinCC OA Download”….)
• WinCC OA 3.11SP1 is now
deprecated (since end of
EYETS)
• WinCC OA 3.15 is the
currently supported version
• Beware of the patches!
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 68
How to get WinCC-OAhttp://readthedocs.web.cern.ch/display/ICKB/WinCC-OA+Service
N.B. NICE
machines can
also get
WinCC-OA via
Cern’s central
CMF
(Computer
Management
Framework)
tool.
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 69
Installation
• Follow the detailed instructions on the
download page!
• Install WinCC-OA
• Install latest Cern Cumulative Patch
– Replacement license request screen (for Cern)
– Selects ISO (rather than UTF) character encoding
– All ETM patches to date (cf installing one at a time!)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 70
Running WinCC-OA
• Even without a license, you get a full version
that will run for 30 minutes…
– For longer, you’ll need a license ;-)
• Linux:
startPA
• …where PA = Project Administrator
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 71
Starting PA on Windows
• Start >
All Programs >
Siemens
Automation >
Runtime Systems >
WinCC OA 3.n >
WinCC OA Project
Administration
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
What might go wrong ?
• You might need to right-
click and explicitly tell it to
“Run as administrator”
72
• To remember this setting:
Right-click > Properties >
Compatibility > Run this
program as an administrator.
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 73
Project Administrator (PA)• Main administration tool
• Overview of all registered
projects
• Facilities for project
organisation
• Project is a development
time concept
• System is a run-time
concept (a running
project!)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
• Let’s begin to make a control system
74
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 75
Exercise #1
• Launch VirtualBox with the provided image
• Then click on the WinCC OA icon or from a
terminal type “startPA”
• Create a Distributed Project
• Lets do it together…
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Launch WinCC OA from VirtualBox
76
Either
or
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Create a distributed project
77
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Create a distributed project (cont)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Create a distributed project (cont)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Create a distributed project (cont)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Create a distributed project (cont)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 82
Summary• Use the Project Administrator to create a new project
• Windows
– Start > All Programs > Siemens Automation > Runtime Systems > WinCC
OA 3.n > WinCC OA Project Administration
• Linux
– StartPA
• Distributed
• Project Name = WinCCOACourse170912 (yymmdd)
• Language = English U.S.
• Path to Project Parent Folder = /home/scada/PVSS_projects
• System number = XX; System name = dist_XX
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
WinCC-OA Console• Recap:
– The PA (Project
Administrator) shows
you a list of projects
on the machine
– Lets you create new
ones (& delete etc)
84
• WinCC-OA Console
– Lets you work with one
selected project:
• Select a project in PA
• Press the WinCC OA logo
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
WinCC-OA Console - II
• Many buttons.
• List of managers
• For now, just
start your
project.
• Project being
worked on
85
Start project
button.
Hopefully all
managers
will go
green!
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
What happened?
• The Graphic Editor
(GEDI) opened.
(Optional!)
• The LogViewer window
opened.
• Linux ran lots of
managers (tasks or
processes) for us.86
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
What do the colours mean?
• From Online Help > Project Administration >
Project Administration > WinCC OA Console >
Start and Stop project
87
Colour Meaning
White Stopped (Manual start is selected)
Red Stopped (Even though automatic
start is selected)
Yellow Starting
Green Running
Red-Yellow blinking Connection error or stopped
unexpectedly
Violet Manager blocked. No “alive”
response for 30 sec
Blue-yellow blinking Restarted too often. Pmon has given
up trying
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 88
What is the Process Monitor?
• Guardian Angel of all the
other WinCC-OA processes
• Purpose:
– Start/stop managers
– Configure (ie setup)
managers in the project
– Monitor managers
• User Interface via
– WinCC-OA Console
– HTTP-interface
– SNMP-interface
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 89
Try http access into PMON !
• NB
– Same info
– Same functionality!
• http://localhost:4999
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
PMON Security• [pmon]
• localAddress = ""
• [pmon]
• # deny access for everyone
• ip_deny = "*"
• # allow access for the local
computer
• ip_allow = "127.0.0.1"
• # allow access for a
specific IP-address
• ip_allow = "192.167.153.122"
• Allow access from any
computer.
• Limit the access on IP
basis with the config
entries ip_allow and
ip_deny
90
© CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
WinCC-OA - dir & Project- dir
Windows
List of installed patches
ReadmeCXXX -> CERN patches
ReadmePXXX -> ETM patches
License file
© CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
WinCC-OA - dir & Project- dir
Linux
© CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
WinCC-OA - dir & Project- dir
Linux
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Backtrack
• We now have a running
project.
• What were all those other
buttons on the PA and the
Console for ?
94
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 95
Licensing
• WinCC-OA is a commercial product, they don’t give away free licenses
• CERN has negotiated CERN HEP licences
• * * * CERN will generate licenses for you. * * *
– * * * No need to go to the company * * *
– (See later for how to…)
• Requires a legal contract between your institute and CERN
• Development machines get a 1 year license (renewable)
• Production machines (incl. testbeams) longer
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 96
Licensing - II
• Is hardware & O/S specific
• New hardware (disk/network card) will require a
new license.
– Laptop users with >1 network card (eg ethernet +
wireless) beware!
• Reinstallation of Windows can cause existing
license not to be recognised.
• Most frequent of the FAQs: – Why does PVSS/WinCC-OA complain I have an invalid license?
• https://readthedocs.web.cern.ch/display/ICKB/invalidLicense
© CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
The license is a file “shield.txt”
Beware of long lines getting
wrapped by your email
client!
The comment should be on
one line.
It is not a free text comment
for you to edit!
Hostname &
License code
Valid until
Licensed features
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 98
Do you need a license today?
• Please check the machine in front of you.
• Can you find the license file?
– <pvss_path>\shield.txt (or just “shield”)
– Typically C:\Siemens\Automation\WinCC_OA\3.15 or /opt/WinCC_OA/3.15
• Has your license expired?
– If so, now is the time to apply for a new one ;-)
– The licenses are already generated for the VM (3 months expiration policy)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Get a License (Standard procedure)
• License your
installation (“Get
hardware code.”)
• Customised for
CERN
99
CERN
panel !
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 100
If you see something like this:
• Please don’t send it to ETM! • Why would you ever see it?
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 101
Email problems?
• … instead use
the old way and
get your license
via the web
page:• https://readthedocs.web.cern.ch/displ
ay/ICKB/WinCC-OA+Service
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Other PA buttons
• Copy the project.
(First stop the
project!)
103
• Register an existing
project tree into the
Windows registry (or
into Linux WinCC-OA
“Registry” file)
• Delete the selected
project (from
registry; from disk)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
PA: Project Properties button
• Config file contains
the fundamental
definitions of your
project
104
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Initial config file
• Fundamental
project
definitions.
• Optional,
additional
definitions get
added later.
105
C:\Projects \311SupportProject\config\config
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Initial config file (cont)
• Add the following
config entry
• It adds the
solutions to all
exercises into
your development
environment
106
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
PA Project Properties (cont)
• “Runnable” means that
this project is not a sub-
project ie not just a
library of panels and
scripts.
• Pmon port = Port of
Project’s parent
process.
• means “OK”
107
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
PA Project Properties: Buttons
• Open the Online Help
• Open Diagnostics Tool
• Delete
<proj_path>/log/*.log
• Upgrade project (from
previous WinCC-OA/PVSS
version)
• Integrate a sub-project
(library project)
108
• (Username/password to access PA)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
A word about the Online for WinCC OA 3.15
• On linux to get the documentation from the command line:– /opt/WinCC_OA/3.15/bin/assistant -collectionFile /opt/WinCC_OA/3.15/help/en_US.utf8/WinCC_OA.qhc
109
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
PA Project Properties: Buttons
• Open the Online Help
• Open Diagnostics Tool
• Delete
<proj_path>/log/*.log
• Upgrade project (from
previous WinCC-OA/PVSS
version)
• Integrate a sub-project
(library project)
110
• (Username/password to access PA)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Diagnostics Tool
• When you need to report a problem to
[email protected] , please include
this project summary report:
111
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
PA Project Properties: Buttons
• Open the Online Help
• Open Diagnostics Tool
• Delete
<proj_path>/log/*.log
• Upgrade project (from
previous WinCC-OA/PVSS
version)
• Integrate a sub-project
(library project)
112
• (Username/password to access PA)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
PA Project Properties: Buttons
• Open the Online Help
• Open Diagnostics Tool
• Delete
<proj_path>/log/*.log
• Upgrade project (from
previous WinCC-OA/PVSS
version)
• Integrate a sub-project
(library project)
113
• (Username/password to access PA)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
PA Project Properties: Buttons
• Open the Online Help
• Open Diagnostics Tool
• Delete
<proj_path>/log/*.log
• Upgrade project (from
previous WinCC-OA/PVSS
version)
• Integrate a sub-project
(=library project)
114
• (Username/password to access Project)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 115
Console Buttons
Lock the console
Edit the project’s config fileC:\Projects
\311SupportProject\config\config
(be careful when project is running)
Open a Project Administrator
(Choose) Project to control
Start the whole project
Stop the whole project
Open the log-file viewer
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 116
More Console Buttons
Switch language
Get hardware code for a license
“About” button
Open Online Help
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 117
Console Managers
List of managers
Start the selected manager
Stop the selected manager
Kill the selected manager
Edit properties of selected
managerSet the debug level
Append (insert) a new manager
Move manager up/downDelete manager
All information is stored in
<proj_path>/config/progs
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 118
WinCC-OA details
• Well done! You have a running project
• Graphic Editor – drawing pretty pictures
• WinCC-OA Data Model
• PARA Module (implementation of the data
model)
• Connecting the pictures to the data
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 119
WinCC-OA Graphics
• The Graphic EDItor
– Known as “GEDI”
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
WCCOAui –m gedi
• Usual menus and
toolbar
equivalents.
(Customisable,
see Edit menu)
• Project View
• Property Editor
• Tear-off
• Generic panels
(pre-drawn
graphic objects)
120
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Live Demo
• New Panel
• Add shape; Shape properties;
• Frames
• (Events, see next slide)
• Layout (alignment, mirroring)
• Save panel (into panels folder, see Project View)
• View-panes and toolbars can be closed and reopened
by right-clicking in menu bar.
• Status bar (at bottom) allows pixel accurate
positioning.
121
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Layout Management• Available at CERN since WinCC OA 3.15
– Not available on WinCC OA 3.11
– On 3.11, all panel sizes are fixed!
• Horizontal, vertical and grid layout available
– Horizontal and vertical layout are meant to be used directly in Gedi
– Grid layout is meant to be used programmatically
• Panels, tab widgets, but also rectangle are containers
• To enable layout in a panel, don’t forget to assign a layout to
the panel itself
• Example implemented in Solutions/DemoPanelWithLayout.pnl122
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Layout Demo
123
Place all graphical elements
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Layout Demo
124
Assign a layout policy
to each elements or
group of elements
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Layout Demo
125
• Apply a layout policy to
the panel itself
• In this case a vertical
layout is applied
• The panel is now layed-
out!
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Layout Demo
126
• Layout of
each element
can be
configured at
a finer grain
• But be-ware of
the results,
they may be
unexpected….
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Layout Demo
• How to have the table column adjusted as
well?
– uiConnect() function in initScript (more on this
later)
127
main()
{
uiConnect("myCallbackFunction", "windowResized");
}
myCallbackFunction(mapping event)
{
int iWidth = event["size"]["width"];
TABLE1.columnWidth(0, iWidth);
}
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Events & Event-Routines
• Very important attribute
of every graphic widget:
– It is sensitive to:
• Mouse-click event
• Mouse-over event
• etc. etc.
• In GEDI you can see the
full list of events to
which the currently
selected widget is
sensitive.
128
• There is a CTRL script
corresponding to each Event.
And a Wizard to help
generate the code.
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Full list of all possibilities:
129
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 130
Saving your panel
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 131
Running your panel
• During
development
the easiest
way is to
press the
button “Save
and run”.
• “Save & Run” runs the panel in the UI task’s GEDI program.
• A panel in a production system would run in a dedicated UI task.
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 134
Using the GEDI
• In the next few exercises, we are going to be
building and running an HV control panel.
• Eventually you will get to something like this:
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 135
Exercise #2
• hvChannel.pnl (beginnings)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 136
Exercise #2a (Text)• Draw Text Widget
• Select Text widget:
• Widget Name =
“channelNameTitle”
• Background Color =
Transparent
• Foreground Color = (default)
_WindowText
• Text = “Channel Name”
• Font = (Arial, Style = normal,
size=10)
• Fit size = TrueSave the panel as “hvChannel.pnl”
• Text Format = (String, Alignment Centre)
Yellow dot is
Reference
Point (for
Rotation)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 137
Exercise #2b (TextField)
• Draw TextField
widget
• Select Text Field
widget
• Widget Name =
channelNameField
Save the panel!
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
• But: This panel
doesn’t do anything
yet!
• We will be running
the panel and
displaying the name
of an HV channel in
the TextField
widget…138
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
• … and if we are going to display the name of
an HV channel in this widget…
• …How do we create a HV channel in the first
place in WinCC-OA?
139
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 141
WinCC-OA details
• Graphic Editor – drawing pretty pictures
• WinCC-OA Data Model
• PARA Module (implementation of the data
model)
• Connecting the pictures to the data
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 142
WinCC-OA Device Orientation
• Old-style control systems used flat namespaces of
variables (“tags”) to represent the physical quantities
being monitored and controlled. Experience showed
that these systems were very difficult to maintain.
• “Device Orientation” means that variables can be
grouped, allocated in memory and used collectively.
• The group description is the “DataPoint Type” (DPT)
• An instance in memory is a “DataPoint” (DP)
• The individual variables themselves are now referred
to as “DataPoint Elements” (DPEs)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 143
Example DPT: FcHvChannelType
info
actualvMon
channelName
isOn
FcHvChannelType
settings v0
onOff
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 144
Example DP : muonHvChannel1
DPEs
info
actualvMon
channelName
isOn
settings v0
onOff
muonHvChannel1
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 145
DPE Configs
• For each datapoint element (DPE), apart from
the “value” there is actually further information
we can keep about the DPE:
– The corresponding hardware register address
– A value range, outside which we should indicate an
alarm
– Whether the value is to be stored in an archive
– Whether the value is to be smoothed
• All this meta information (about the DPE) is
held in “configs”
• (DPT) DP > DPE(s) > Config(s)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 146
WinCC-OA details
• Graphic Editor – drawing pretty pictures
• WinCC-OA Data Model
• PARA Module (implementation of the data
model)
• Connecting the pictures to the data
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 147
• UI Tool to define your Data Point Types (DPTs),
• Instantiate your Data Points (DPs)
• Define any Configs on the DPElements (DPEs).
• Explorer-style tree view of
DPTs/DPs/DPEs/Configs
• Accessed with in GEDI or, from the menu,
GEDI > Module > Para
PARAmeterization Module
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 148
Filter-In (=select).
Show only selected
datapoints, ie those
whose names match
the selection criteria.
Show _datapoint
names (System
datapoints)
Predefined
standard
datapoint types
(DPTs)
Standard DPTs
for playing
More Predefined
standard
DPTs
PARA in detail
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 149
To define our own DPT (for HV)
right
click
• Open DPType Editor :
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 150
Name the root
node (DPT) FcHvChannelType Add child-
structure
nodes and
child-leaf
nodes…
Defining a DPT (cont)
right
click
right
click
...Right-
click on a
leaf to set
its type.
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 151
Save...
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 152
Our DPT...
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 153
Instantiate a datapoint of this DPT
right
click
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 154
Storage is allocated as per DPT
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 156
Exercise #3
• Exercise to define a DPT and instantiate
a DP
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 157
Exercise #3• Use PARA to define “FcHvChannelType” DPT.
Which basic
types for these
DPEs?
info
actualvMon
channelName
isOn
settings v0
onOff
FcHvChannelType
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 158
Exercise #3• …Set the types of the leaves (DPEs)
Which basic
types for these
DPEs?
info
actualvMon
channelName
isOn
settings v0
onOff
FcHvChannelType
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 159
Exercise #3
Once you have
defined the
DPT…
…in PARA, right
click on the DPT
and allocate
memory (create)
a DP of this type,
called
muonHvChannel1
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
You do it !
160
info
actualvMon
channelName
isOn
settings v0
onOff
muonHvChannel1
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
• Click on muonHvChannel1.actual.vMon (or on the
_original config of vMon)
• The raw value coming from the hardware device is
stored in the vMon DPE’s “_original” config.
161
:_original.._value config?
• You can also edit
its value directly,
using PARA.
– PARA is useful for
testing and
debugging your
system!
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Animation• We’ve drawn a picture
• We’ve allocated storage for a
data point (DP)
• We want to link the picture to a
data point element so that the
picture always shows the latest
value of the DPE - even if the
DPE value changes...
162
info
actualvMon
channelName
isOn
settings v0
onOff
muonHvChannel1
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 164
WinCC-OA details
• Graphic Editor – drawing pretty pictures
• WinCC-OA Data Model
• PARA Module (implementation of the data
model)
• Connecting the data to the pictures
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 165
How do we link a DP to the picture?
• Use Scripts
• Scripts are short ‘C’ programs. (CTRL
language)
– Scripts are interpreted
– Scripts are executed concurrently
• Scripts can be executed :
– in the UI manager or
– in a CTRL manager or
– in the Event Manager (!)
• Scripts are only executed when an “event”
happens.
info
actualvMon
channelName
isOn
settings v0
onOff
muonHvChannel1
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
• Solution:
We arrange that the event occurrence
(i.e. DP value change) will trigger a callback script (that we write)
…in which we update the screen
with the new value.166
How do we link a DP to the picture?
• Requirement:
Value-change event should update the value displayed on the panel.
info
actualvMon
channelName
isOn
settings v0
onOff
muonHvChannel1
…
• …
• …
…
• …
• …
…
• …
• …
info
actualvMon
channelName
isOn
settings v0
onOff
muonHvChannel1
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 167
CTRL Code: A script to update the screen
• The callback script is very simple.
• It is always called with 2 parameters:
void displayValueCB(string dpeName,
float newValue)
{ this.text = newValue; } // Update display.
My callback function name
dpeName that changed
What it changed to
The “text” attribute of THIS (TextField!) widget
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 168
How do we setup the callback? (2 steps)
• Recall, we want:– DPE value-change-event to
trigger our script
• Setup:– Link the DPE to ourFunctionName()
by calling the library routine: dpConnect(“functionName”,dpe)
• Result:Now and for evermore:
A value-change in that DPE will trigger ourFunctionName()
which contains our code to update the screen.
…
• …
• …
…
• …
• …
…
• …
• …
info
actualvMon
channelName
isOn
settings v0
onOff
muonHvChannel1
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
But who calls dpConnect()?
• Answer: The initialise script.
• Recall: Every widget has a list of
“events” that it knows about.
• There is a corresponding script that
runs whenever the “event” happens.
• Think of it like this: Each widget has
a whole list of scripts (hiding) behind
it, one script for each event that the
currently selected widget is
sensitive to (eg mouse clicks).
• (The List differs slightly for each
different widget type!)169
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Example: Event list (scripts) behind a Button
• A Button can be:
– Initialised.
When the panel first
opens, the “Initialize”
script runs.
So, for example, you
could set the button label
dynamically.
– Clicked on.
• The “Clicked” script
runs when you click on
the button.
– etc.170
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Available Events for a TextField
• A TextField can be:
– TextField can be
Initialised.
When the panel first
opens, the “Initialize”
script runs.
– Text Field can even be
clicked on!
“Clicked” script runs
– TextField can be typed
into.
“Command” script runs
when you press “return”.171
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
So, who does call dpConnect()?
• Our TextField’s initialize script calls
dpConnect() when the panel first
opens.
172
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 173
Opening the panel calls initialize’s main()
Your Panel
// Initialize
main()
{ dpConnect
(“workFunctionCB”, dpeName );
}
workFunctionCB(..)
{
…
}
We have 2 initialization functions declared
“behind” the TextField’s initialize widget, main() and workFunctionCB(..)
Step 1: When panel opens,
TextField’s Initialize script main()
runs:
WinCC-OA database
of DPs (datapoints)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 174
Your Panel
// Initialize
main()
{ dpConnect
(“workFunctionCB”, dpeName );
}
workFunctionCB(..)
{
…
}
main() calls dpConnect() to connect the
DP to the workFunctionCB()
WinCC-OA database
of DPs (datapoints)
Initialize main() executes once.
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 175
Your Panel
// Initialize
main()
{ dpConnect
(“workFunctionCB”, dpeName );
}
workFunctionCB(..)
{
…
}
Step 2: Value changes. Is an “event”.
Triggers workFunctionCB().
We have already seen the body of workFunctionCB which draws the
value on the panel…
WinCC-OA database
of DPs (datapoints)
Result: A DPE Value-change now triggers workFunctionCB()
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 176
What does the CTRL code look like?
• Widget’s Initialize routine main() calls dpconnect() to link a call-back function to the DPE.
void main() {
status = dpConnect("displayValueCB","sys1:muonHvChannel1.info.channelName”);
}
callback function name DPE name
dpeName that changed
What it changed to
The “text” attribute of THIS (TextField!) widget
• We use a wizard to generate these scripts!
void displayValueCB(string dpeName,
float newValue)
{ this.text = newValue; } // Update display.
• Whenever DPE value changes, the call-back function gets called to update the displayed value.
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 177
Recap?
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 178
Exercise #4
• Animate Text Display on hvChannel.pnl
• Wait... I have some more slides first.
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Exercise #4. You will do it soon. Just watch for now.
• Open your
“hvChannel.pnl”
• Select the text
field (click on
white box)
• Write initialize
script code to
display the value.
• Wizards!
• Display value of “muonHvChannel1.info.channelName”
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
And here I have a problem!• Wizard in PVSS 3.8 :
– aimed at new users, like you
– wasn’t very clever and it didn’t do very much
– very simple to use
– got people going quickly
• Wizard in WinCC-OA 3.11
– Is much more powerful, many more options
– But more powerful => Less intuitive . For experts.
– “Under rapid development” (i.e. buggy)
• I’d better mention both!
180
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
First : Enable Old Wizard• (Because this wizard works!)
• GEDI > Menu > Wizards > Untick “ScriptWizard”
181
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
• In the Event
Initialize line
You will click on
the wizard
button.
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
…and follow the wizard
• Select “Display a value”
• Choose the DPE whose value you want to display
– FcHvChannelType > muonHvChannel1.info.channelName
• Click “Finish”
• Look at the code that the wizard
generated, by pressing the Edit button:
183
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
channelNameField initialize
184
i.e.
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Old wizard generates:
EP_textFieldIn()
{ dyn_errClass err;
if( !dpExists(
“muonHvChannel1.info.channelName:_online.._value"))
{ setValue("", "color", "_dpdoesnotexist");
return;
}
dpConnect("EP_textFieldInCB",
"muonHvChannel1.info.channelName:_online.._value");
err = getLastError();
if (dynlen(err) > 0)
{ setValue("", "color", "_dpdoesnotexist"); }
}185
EP_textFieldInCB(string dp, string
sNewValue)
{ this.text = sNewValue; }
main() //
Initialize Script
{ EP_textFieldIn();
}
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 186
Don’t do it yet. Keep watching!
• I want you to understand how the text stored in the “muonHvChannel1.info.channelName” datapointelement (DPE) gets transferred to the “channelNameField” text field on the panel.
• Note the new syntax possibility:this.text = sNewValue;
• The wizard also generates this declaration:
dyn_errClass err;
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
A note on dynamic arrays• We will talk again about dynamic arrays in a later exercise but
just so you know, consider:
dyn_int myArray;
myArray is a dynamic array of ints. By dynamic we mean that
we never have to specify the number of elements in the
array. Storage is allocated as needed. So the Type
dyn_int declares an array (of unspecified length) of integers,
dyn_float declares an array (of unspecified length) of floats
So dyn_errClass err declares a variable called “err” which
is an array (of unspecified length) of variables of errClass
type.
187
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
• “Save and run” will
prove that your code
works:
188
• If your
muonhvChannel1.
info.channelName
is still blank, give
it a value!
(Use PARA.)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
• Open your
“hvChannel.pnl”
• Select the
channelNameField
text field (click on
white box)
• In the Event
Initialize line,
click on the OLD
wizard.
• Display value of “muonHvChannel1.info.channelName”
Exercise #4. Now, you do it.
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 190
Exercise #4
• Animate Text Display on hvChannel.pnl
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Development-time vs run-time
• You’ve been developing using GEDI in the UI
• You’ve been running your panel in the UI
• What’s the difference?
191
CTRL API
EV
D DD
UIM UIM UIM
DM
• Not a lot!
• Save & Run runs the
panel in the Gedi UI
task.
• A production panel runs
in a dedicated UI task.
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Extending Exercise #4
• Let’s add two LEDs onto our panel to show the
status of our HV channel:
192
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Do it
• Draw two LEDs (circles)
• Animate them.
– Meaning, you need a script behind each circle to:
• Make the connection to the DPE.
• Update the circle’s background colour whenever the
boolean value in the DPE muonHvChannel1.actual.isOn
changes.
• Again, just use the (old) wizard !
• Do it…• Beware: The wizard defaults to animating the colour dependent
on the DPE’s alert status, not on the DPE’s value! You want
animation on the value!193
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Off LED, initialize script
194
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Design Issues
• Why would it be a bad idea to have this
simpler (and space-saving) solution?
195
• According to http://en.wikipedia.org/wiki/Color_blindness,
7-10% of your colleagues would have difficulty with it.
• WinCC-OA Console got it right!
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Next, we’ll add Off and On buttons:
• Add button widgets to
set the on/off request
DPE in our HV channel.
• At run-time, clicking on a
button causes its
“Clicked” script to run
• “Frame” widget just
makes it pretty.
196
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Recall: Event Scripts
TextField Events looked
like this:
197
• We will program the button’s “Clicked” Script to set the DPE.
(Which DPE?) We use the Wizard to actually generate the code.
Button Events look like
this:
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 198
“Clicked-event” causes script to run.
WinCC-OA database
of DPs (datapoints)
Your Panel
// Clicked
main()
{
…
}
As before, there is a
script “behind” the
widget. (The button’s
“clicked” script)
Pressing button
is an “event”.
Clicked script code
executes. We need it’s
code to write a value to
the DPE.
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 199
Code Example 2: Script behind a Switch On button
// Switch On button’s Event Clicked script
main()
{ // Set a data point element (DPE) to a value dpSetWait(
“sys1:muonHvChannel1.settings.onOff:_original.._value”,
TRUE
);
} // END main
• You can also edit the script yourself.
• Exists a sophisticated library of functions for more complex processing.
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Do it
• Button Widget.
• Clicked Script (Wizard).
200
• muonHvChannel1.settings.onOff
• Does it work? (Yes! It does! Don’t try to “fix” yours !!!)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Why doesn’t it (appear to) work?
• What if you added 2 more
LEDs like these? (Do it…)
201
muonHvChannel1.actual.isOn
muonHvChannel1.settings.onOff
• Do you believe it’s working this time?
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Other “button” possibilities - I
• You may prefer
a single button
that stays down.
• Set the “toggle
button” attribute
to true.
• Animate it to
toggle the value
of the DPE
settings.onOff
202
(Demo)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Other “button” possibilities - II
Rocker switches (demo)
Also see the “catalog” of
widgets in
GEDI > View > Catalog for All
Objects
203
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 205
Leds are clickable too
• We could even remove the
buttons altogether(!) and instead
make the Off/On LEDs sensitive
to being clicked on.
– Click on the Off LED -> Switch Off
– Click on the On LED -> Switch On
• Add a text field at the bottom
too, to display value of
settings.onOff (Use the wizard.)
• Do it!
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 206
Display numeric values
• Add a vMon TextField to display
actual.vMon Use wizard, just
like for Channel Name.
• Add a v0 TextField to display v0
• Do it!
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 207
Yet more functionality
• But we want to type in a value into the v0
request-field at run-time…
• Use “command”
event script
• When you type
a new value into
a text field and
press return, its
“Command”
script runs
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 208
• We want to type a value into the v0 request
field and have it written to the DPE
“muonHvChannel1.settings.v0”
• Run the
“command” event
script wizard to
generate the code.
• Do it!
• Look at the
generated code…
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Now debug your panel…
• …using PARA as your debugging tool.
• Look to see that v0 values that you enter on the
panel go to the DPE…
• …and that new DPE values (that you set
manually using PARA) do indeed show up on
the panel.
209
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 212
• When you type a new value
into a TextField and move
away, its
“KeyboardFocusOut” event
script runs immediately.
Other gestures
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 213
Texts:
“Fit Size= True”
Look and feel
• Output-only fields:– Read only needs “Editable=False”
– Greyed out
needs “Enabled=False”
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Enabled vs Editable - I
• Disabled makes the widget unresponsive.
– The background is always grey and the text is
always faint.
214
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Enabled vs Editable - II
• Enabled means that the widget is alive.
– You can select/copy (^C) from the widget.
– By default, the background is white and text is
black.
– You may change these attributes (colours).
215
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Enabled vs Editable - III
• Editable means you can edit it
• So, if you want a read-only field that you can
COPY from (but not PASTE into) it must be
enabled + not editable
• To make it look read-only though you must
also explicitly set the background to grey.
216
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Enabled vs Editable - IV
• See demonstration panel in
CourseMaterialsForStudents\Components\Solu
tions\panels\Solutions\enabledEditableTest.pnl
217
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
More Aesthetics
• Programmers usually don’t make “good”
panels.
• What makes a panel “good”?
• Hard to say, but I know one when I see one!
– Consistency (Fonts, sizes, colours)
– Neatness (Alignment, spacing)
– Intuitive (Easy for new operators)
– Efficient (Quick, for experts)
• I let our UI expert loose on my panel…
• His panel does the same, but looks much better!218
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Mine vs His
• Consistency in
– Font sizes
– Label locations
• New users can
enter v0 then
press the green
tick.
• Experts know to
press return
• Close button
219
vs
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
He spent time doing…
• Pixel-accurate alignment
• Following conventions
– Using templates
• eg the TextField + the green tick
220
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 221
Good practice
• It is important to keep your
“business logic” out of the UI.
• UI code should be related to UI
widgets:
– To display values.
– To change the colour of a widget.
– To accept input.
• Do not add computations, eg
comparing voltage levels.
Computation (logic) does not
belong in the UI.
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
What else makes a panel a good panel?
• Define tooltips for your widgets:
222
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
More GEDI features
• Select grey panel background :
– List of events! (Initialize, Clicked, ScopeLib)
– The grey background will respond (trigger a
routine) if you click on it!
• ScopeLib is where you put routines that are
common to >1 widget. Will be in panel-scope
(and callable) from any widget in the panel.
223
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
More GEDI features
• GEDI allows setting properties for >1 selected
widget (“multi-select and set”).
• Eg: Set the static background colour to be
something else:
224
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
More GEDI features
225
• If you multi-select
widgets having a
property in common
(eg static background
colour) but where that
property currently
does not have the same value in all of the
selected widgets, then the property tab shows
the property in grey. It will still allow you to
multi-set them all to be the same though
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
aestheticFullHvChannel.pnl
• The code generated by the wizard when I ran it
is available to you in the course materials:
• Either in my panel: \CourseMaterialsForStudents\Components\Solutions\
panels\Solutions\aestheticFullHvChannel.pnl
• I have also copy-pasted the scripts into: CourseMaterialsForStudents\Exercises\Exercise
FullHvChannelPanel\theScriptsBehindTheWidgets.txt
226
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
The code of the green tick
• The green tick widget is a button.
• It’s clicked script calls getValue() to get the text value
from another text widget! The one called v0TextField.
(NB v0TextField is in the UI.)
• …and writes it to the DPE (in the EM) called
muonHvChannel1.settings.v0:_original.._value
• The command script of the v0TextField does the
same.
• The scripts also check that the format of what was
typed agrees with the type of the DPE.
227
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 228
Review: Storage of values
• There are 3 different “places” where we can store values. You need to distinguish:– A number in a data point element.
• DPs (and hence DPEs) are held in the Event Manager process’s memory space.
– A number in a widget on a panel. • Widgets are held in a User Interface Manager.
– A “C” variable in the script behind a widget.
• Items in different managers are only visible in their own manager! You often need to copy values from one manager (process) to another! (dpSetWait(), dpGet() )
• FAQ:Where does PVSS/WCCOA store values?
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 229
Naming widgets - reminder
• Be sure to nameevery widget, else:– You won’t be able to
access them from other widgets in the panel
– You won’t get meaningful error messages out of WinCC-OA !
1) Select the widget
2) Name the widget
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 230
My widget names…
channelNameTextField
channelNameTitle
v0TextField
vMonTextField
offLed
onLed
settingsOffLed
settingsOnLed
settingsOnOffTextField
v0ApplyButton
…you will see these
in my code later.
closeButton
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 231
Event triggers summary
• Event scripts can be triggered by:
– User input (eg button push)
– Data point element attribute change (e.g. value-
change or alarm-state change)
– Clock (every M s or N ms)
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Tips re Developing Scripts
• Syntax of DP(E) names
• Good practice
• Editing and debugging scripts
• The log viewer
232
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 233
DP name syntax (in scripts)
[sysName:]dpName.[dpElement(s)]:_config. [detail] ._attribute
eg dist_1:myHvChannel.actual.vMon:_original.._value
sysName: Name of the WinCC-OA system
dpName: Name of the data point
At least one dot ! (Else interpreted as an alias)
dpElement: Node names down to the DPE name inclusive
config: Specifies a group of “attributes”
attribute: Value of a specific attribute in the group
detail: “Detail” number for when an attribute “value”
must take on multiple values, eg
:_alert_hdl.1._came_time for the warning on this DPE
:_alert_hdl.2._came_time for the error on this DPE
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 234
Editing Scripts
• In the Events list,
we pressed
to look at (and edit)
the scripts that the
wizard generates.
But there’s a much
more powerful
editor…
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 235
GEDI > Edit > Edit panel scripts
• Tools menu
• Buttons to
show:
– Single
script
– All scripts
of 1
widget
– All scripts
of all
widgets
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 236
Useful tools in the editors
• Imagine you are typing a script, e.g. the
“Clicked” script behind a button. The editors
have a Tools menu:
...which contains some
very(!) useful selectors
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 237
A Tip: The log viewer
• When you run your panel with “Save and Run”
(Quicktest), always keep the log viewer handy!
• That’s where WinCC-OA tells you
about any problems…
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
The LogViewer Window
• Shows all messages that have been added to
the PVSS_II.log file since the log viewer window
was opened.
238
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
Are we done with GEDI yet?
239
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
For completeness: New Wizard
• We will skim over some of its exotic features
– And stick to the ones that work !!
• WinCC-OA is good for backwards
compatibility and, as you saw, the old wizard
code still works
240
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
New Wizard is a Code Generator
• It is no longer a series of compulsory
questions ending up with a “Finish” button.
• It is a random (?!?) collection of different pages
of declarations. When you’re done declaring,
you can ask it to generate corresponding code.
• You can change the declarations/conditions
and re-generate the code at any time.
• I’ll cover the minimum you must declare (less
than that and the code generator will give you
rubbish )
241
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
The Widget’s Initialize Wizard - I
242
• Select the TextField
widget.
• This is important! Wizard
operations are always
applied to the current
widget!
• Assuming GEDI > Wizards
> ScriptWizard is ticked…
• Click on the Initialize
script-Wizard button.
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
The Widget’s Initialize Wizard - II
We cover
$parameters
tomorrow…
243
• For now, Click on the “Connect” tab.
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
The Widget’s Initialize Wizard - III
• Declare to
code
generator
which DPE
to connect
to the
current
widget thus:
Press the
“Add DPE”
button244
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
The Widget’s Initialize Wizard - IV
• Select the DPE
• Specifically, we want to
connect the current
(TextField) widget to
the DPE that contains
the HV Channel’s name.
• Select “Absolute DPE”
• Use DPE Selector tool
245
• Include System Name?
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
• Just clicking OK gives:
246
• Need a Name (Handle) for each definition of a
connection between the widget and the DPE.
The Widget’s Initialize Wizard - V
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
• What next?
• What do
we want to
happen
between
this DPE
and the
current
widget?
A callback routine needs some animation code.247
The Widget’s Initialize Wizard - VI
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
The Widget’s Initialize Wizard-VII
248
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
• Under “Value
to display”
select the
connection
“handle”.
• When the callback is executed, it writes the
value-coming-from-the-DPE-connection into
the TextField.249
The Widget’s Initialize Wizard-VIII
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
• Note that channelNameField is now
referenced and is shown in the list.
250
The Widget’s Initialize Wizard - IX
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
• The automatically
generated code looks
quite different from the
old Wizard. Ready for
Ultralight (web-client).
Have a look!
• NB: Several wizard bugs
in 3.11 have been
fixed in 3.11SP1• SD = Symbol Dynamics
251
The Widget’s Initialize Wizard - X
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018
CERN WinCC-OA 3.15 & JCOP-Framework Course April 2018 253
Recap
• WinCC-OA Architecture (Managers, standalone
system, scattered single system, distributed
systems)
• Practicalities: installation, licensing, creating a
new project
• PARA module DPTs and DPs
• UI - GEDI : Static panels.
• Scripts in panels to animate them
CERN
LHCb
ALICE
ATLAS
CCC
We are
here
CMS