Novel techniques while developing on the WinCC OA Experience with the UCPC library.
Dec 28, 2015
Novel techniques while developing on the WinCC OA
Experience with the UCPC library.
Outline
• What is UCPC• CPC6 ideas• CPC6 technics
UCPC Advanced Course: General Introduction3
UNICOS and UCPCUNICOS is a framework to create control applications UCPC: A basic package (Continuous Process Control) to develop integrated
process control applications.
UNICORE
UCPC package
PLCs CPC PLCs (non CPC)
Application packages(PIC, WIC,
CIS,…)
Application packages
(CIET, SURVEY, QPS, ..)
Control layer
UNICOS
Supervision layer
Industrial PC
HVAC
Process Control applications
LHC Collimator
s Interlocks
LHC Gas Control
LHC cryogenics
CERN, Sept/2012
What is CPC
Continuous Process Control is the set of devices implemented in the SCADA (WinCC OA, WinCC Flexible) and PLC (Siemens, Schneider, CoDeSyS)– IO objects (AnalogInput, DigitalOutput, …)– Interface objects (AnalogParameter, WordStatus,
…)– Field objects (Analog, OnOff, MassFlowController,
…)– Control Objects (PCO, PID, AnalogAlarm, …)
What is UCPC WinCC OA
It is a CPC device’s implementation in WinCC OA:– Reuse UNICOS/FW components– Follow UNICOS/FW convention
Axioms/aims
• Keep all scripts in the .ctl, not .pnl• Minimize device implementation code• Use spaces not tabs
Aims
• Keep all scripts in the .ctl, not .pnl– Minimize changeable code in panels– Using g_params mapping instead dedicated
variables:• Old: g_sPosStUnit, g_sPosStFormat, …• New: g_params mapping
• Minimize device implementation code• Use spaces not tabs
Aims
• Keep all scripts in the .ctl, not .pnl• Minimize device implementation code– Use generic UCPC functions in device
implementations, e.g. powerful UCPC core• Use spaces not tabs
Device ctrl scripts
CPC5 CPC6 CPC6 templated0
5000
10000
15000
20000
25000
30000
35000
40000
45000
deviceCPC core
Line
s of
cod
e
Development workflow
Package
PVSSBootstrapper
flex extractor
unPackageCreation
PVSS Project
TemplateDTI
Target: control script
UCPC is the set of device implementations.The device implementation:• Importation and exportation• Animation– Widget– Faceplate– Right click menu
• Access rights• Configuration, …
Device creation effort
ImportationAnimationOthers
PRACTICAL PART
Let’s talk about control code:Outline:– Importation– Animation
Importation: CPC5
• Constants that describe importation line• Generic check function• Front-End specific check functions• Generic set function• Front-End specific set functions
Importation: CPC6
• Constants that describe importation line– Few additional constants for shared fields
• Configuration function– For each DPE specify it properties
• Core does all the work– Based on simple atomic functions– Proxy to the UNICOS core when possible
Importation: CPC5 - set DPEunConfigGenericFunctions_setFloatIntBlock(dsConfigs,PVSS_MODBUS_FLOAT,makeDynString("PosSt", "OutOVSt", "AuPosRSt", "MPosRSt"),makeDynInt(UN_CONFIG_ANALOG_ADDRESS_POSST, UN_CONFIG_ANALOG_ADDRESS_OUTOVST, UN_CONFIG_ANALOG_ADDRESS_AUPOSRST, UN_CONFIG_ANALOG_ADDRESS_MPOSRST),makeDynString("MPosR", "PLiOn", "PLiOff"),makeDynInt(UN_CONFIG_ANALOG_ADDRESS_MPOSR, UN_CONFIG_ANALOG_ADDRESS_PLION, UN_CONFIG_ANALOG_ADDRESS_PLIOFF),makeDynInt(UN_CONFIG_ANALOG_UNIT, UN_CONFIG_ANALOG_FORMAT, UN_CONFIG_ANALOG_DEADBANDE, UN_CONFIG_ANALOG_DEADBANDE_TYPE),makeDynInt(UN_CONFIG_ANALOG_RANGEMIN, UN_CONFIG_ANALOG_RANGEMAX),makeDynString("PosSt", "OutOVSt"),makeDynInt(UN_CONFIG_ANALOG_ARCHIVE_ACTIVE, UN_CONFIG_ANALOG_ARCHIVE_TIME_FILTER),exceptionInfo);
Importation: CPC6 – set DPE
mappingClear(props);props["hasUnit"] = true;props["hasFormat"] = true;props["hasSmooth"] = true;props["hasArchive"] = true;props["hasPvRange"] = true;props["address"] = ".ProcessInput.PosSt";props["dataType"] = CPC_FLOAT;config["PosSt"] = props;
Device check/set algorithm
Setup DPEForeach DPE
setDeviceConfig(aDevice) addressunit
formatsmoothrange
descriptionarchive
alert5 range alert
Setup device
parametersmeta info
sms categoriessms messagemask event
Device specific setup (if define)
PRACTICAL PART II
Outline:– Importation– Animation
Animation: PVSS level
• dpConnect(function, dpe1, dpe2, …)• function(string dpe1_name, int dpe1_value,
string dpe2_name, bool dpe2_value,…)
• dpDisconnect(function, dpe1, dpe2, …)Problems:• DPE list should be consistent• Proxy function in case of floating amount of dpes
Animation: UNICOS level
Unicos requires a callback for system integrity.• Device needs to implement:– RegisterCB(string sDp, bool bSystemConnected) – Disconnection animation
Animation: alert handler
In case when device contains alert handler that could be modified by user• Device needs to implement:– PVSS animation routine on alert handler lock state
Animation: customizable device
In case when device could not have some dpe configured (for example, interlocks could be disabled)• Device needs to implement:– Set of connect/disconnect functions for each
possible combination of configured dpes– Set of animation functions (normally these
functions proxy to the generic one)
Animation: worst case
• Register callback– Connect alert_hdl– Disconnect alert_hdl
• Animate alert_hdl– Connect set1– Disconnect set1– Connect set2– Disconnect set2
• Animate set1 (proxy)• Animate set2• Animate disconnection
Refactored animation
What I care about in device implementation:• List of DPEs that needs for animation• Animation itself
Animation: CPC6
• Function to define DPE list for animation– Insure connect/disconnect operates with the same
dpes • Animation function– Does disconnection animation for free– Clear API for animation
• Static init function– Use one mapping variable (key-value)– Insure that no wrong access in the implementation
Animation: CPC5 – faceplate/PosStif(g_bSystemConnected) unGenericObject_DisplayValue(g_sPosStFormat, g_sPosStUnit, fPosSt, "StatusPosition", "unDisplayValue_Status", bPosStInvalid || (!bSystemIntegrityAlarmEnabled) || (iValAlarm > c_unSystemIntegrity_no_alarm_value));
Animation: CPC6 – faceplate/PosStcpcFaceplate_animateOnlineValue(dpes, values, "PosSt", g_params["PosStUnit"], g_params["PosStFormat"], "cpcColor_Faceplate_Status");
cpcFaceplate_animateAnalogValue(dpes, values, "PosSt", "PosSt", "cpcColor_Faceplate_Status");