Control Manager (Runtime Scripts)

In addition to the user interface, scripts created with the CONTROL language can run individually in their own manager even without any relation to the graphical user interface. Almost the same possibilities are provided (except for access functions to graphic attributes as well as panel functions). The CONTROL manager communicates with other WinCC OA managers through data point elements (process image).

The scripts are saved as ASCII files in the .../scripts/ directory of the project or the project hierarchy. The GettingStarted project uses two runtime scripts for the simulation of device reactions and of the physical model.

Figure 1. Project with Runtime Scripts

These can be opened with the ASCII editor.You can find the files under:

C:/WinCC_OA_Proj/GettingStarted_3.18/scripts/simDevices.ctl

C:/WinCC_OA_Proj/GettingStarted_3.18/scripts/simModel.ctl

A file (*.ctl) that was defined as runtime script for processing in a CONTROL manager, comprises at least a main()program. This is generally composed of a number of event oriented processing regulations (dpConnect() with associated call back functions). Furthermore, also periodic processes can be integrated (while or do construct with loop delay).

If a runtime script is composed of a number of assignments without use of registrations(dpConnect(), dpQueryConnect()...) and without endless loop, the processing will be completed after the last assignment. If this is the only script that runs in the associated CONTROL manager, subsequently also the manager will be stopped. The programmer has to take care of the permanent activity.

You can find some examples for runtime scripts in the version directory - when installing in the standard directory, you can find them in:

C:/Siemens/Automation/WinCC_OA/3.18/scripts

Sub programs in form of function declarations can be created directly undermain() program, exactly like in the Event-Scripts in the graphic. As a result, these will only exist in the context of the main() program and of all other script locally defined functions.

Alternatively functions can also be defined globally in own libraries as ASCII files in the directory .../scripts/libs/of the current project hierarchy. The availability must then be defined through the entry in the configuration fileconfig.level or through the key word #uses for each manager. For an example for such configuration file and definition of availability of function libraries, see C:/Siemens/Automation/WinCC_OA/3.18/config/config.level.

[ctrl]

LoadCtrlLibs = "std.ctl, libCTRL.ctl, hosts.ctl, va.ctl, archiv.ctl, mp.ctl"

LoadCtrlLibs = "sdSymbolDynamics.ctl"

LoadCtrlLibs = "panel.ctl"

LoadCtrlLibs = "cns.ctl"

ctrlDLL = "CtrlCNS"

[ui_extend]

LoadCtrlLibs = "para.ctl, ep.ctl, csg.ctl, ngedi.ctl, ini.ctl"

[ui]

LoadCtrlLibs = "as.ctl, es.ctl, libCTRL.ctl, STD_Symbols.ctl, STD_ComplexSymbols.ctl, da.ctl"

LoadCtrlLibs = "login.ctl, panel.ctl, std.ctl, dist.ctl"

LoadCtrlLibs = "hosts.ctl, va.ctl, ac.ctl, dpGroups.ctl"

LoadCtrlLibs = "pager.ctl, archiv.ctl, Clk.ctl, tools.ctl, mp.ctl, ax.ctl"

LoadCtrlLibs = "pmon.ctl, userMan.ctc"

LoadCtrlLibs = "pt.ctl, _consts.ctl"

LoadCtrlLibs = "ptms.ctl, ptnavi.ctl"

LoadCtrlLibs = "sdSymbolDynamics.ctl"

LoadCtrlLibs = "cns.ctl"

LoadCtrlLibs = "cnsTree.ctl"

LoadCtrlLibs = "cnsEditor.ctl"

ctrlDLL = "CtrlCNS"

[event]

LoadCtrlLibs = "STD_Symbols.ctl"

[ascii]

LoadCtrlLibs = "ASCIILib.ctl, da.ctl, mp.ctl, para.ctl"

Script global variables are declared in the runtime script before the main() program. If variables should be available in all scripts of the manager, these have to be declared before the function declarations of the functions in a library or through the CONTROL command addGlobal() at runtime.

As described in the chapter creating the simulation, both scripts for the simulation run in a single CONTROL manager. You can define what scripts should be run in a CONTROL manager as call parameters in the console - in the available project through script lists (-f sim.lst) - see also figure on the page "Creating the simulation".

Notes and Restrictions

  • The file extension for a script does not have to be specified. Per default scripts are browsed in the following order: 1. given name

    2. <Name>.ctl

    3. <Name>.ctc

  • A script can be called with additional parameters. These parameters must not include spaces. Any spaces will be interpreted as splitters and result in multiple parameters.

    e.g.: "Te st" will be passed as two parameters, "Te" and "st" respectively.