In addition to the user interface, scripts
created with the CONTROL language
can run individually in
an 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: Project with Runtime Scripts
These can be opened with the ASCII editor.You can
find the files under:
C:/WinCC_OA_Proj/GettingStarted_<version>/scripts/simDevices.ctl
C:/WinCC_OA_Proj/GettingStarted_<version>/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).
NOTE
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/<version>/scripts
Sub programs in form of function
declarations can be created directly
under main() 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
file config.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/<version>/config/config.level.
[ctrl]
LoadCtrlLibs
= "std.ctl, libCTRL.ctl, hosts.ctl, va.ctl, archiv.ctl, mp.ctl"
[ui_extend]
LoadCtrlLibs
= "para.ctl, ep.ctl, csg.ctl, ngedi.ctl, ini.ctl"
[ui]
LoadCtrlLibs
= "as.ctl, es.ctl, libCTRL.ctl, STD_Symbols.ctl"
LoadCtrlLibs
= "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.ctl"
LoadCtrlLibs
= "ft.ctl, pt.ctl"
[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.
NOTE
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". |