6.3 Sessions of the project's running — Done
Objectives of this stage is:
- Implementation of execution sessions of the projects at level of the VCA data model in the UI.VCAEngine module:
- Forming of hierarchical tree of widgets of the final visualization based on the project for which the session opens.
- Forming of values' frames for the procedures of final visualization widgets' calculation.
- Processing links on parameters of the data sources of OpenSCADA.
- Implementation of hierarchical calculation of the procedures and updating the widgets links.
- Forming of mechanism of transmission and processing of events in the hierarchical tree.
- Implementation of visualization of the projects' sessions in the visualization module UI.Vision (Qt) as a full featured user interface with elements of visualization of dynamics, history and control:
- Forming of execution window of the project (Runtime).
- Visualization of the project's frames in the "Runtime" mode with periodic update of the content.
- Implementation of transmission and processing of the events.
- Implementation of mechanism of switching/opening/substitution/navigation through the pages of the project taking into account the scenarios(scripts) of processing.
At this stage it was added mechanism of the project's execution in the sessions of the data model of the VCAEngine module, as well as visualization of the project's session, the "Runtime mode in the visualization module on the Qt library Vision with the elements of the data update and interaction with the user.
Forming of hierarchical final visualization widgets' tree based on the project for which the session is opened.
According to Fig.4.11.1 and Part 4.5 objects of the project's session are inherited from abstract object Widget and use appropriate objects of the project. Thus, the session Session uses the project Project and forms the expanded tree on basis of it. Project's page Page is directly used by the session's page SessPage. Remaining objects (SessWdg) are unwrapped in accordance with hierarchy of the page's elements (Part 4.5).
In addition to standard properties of the abstract widget Widget the elements of the page and pages of session get the properties of storage of frame of values of the computational procedure, calculation of procedures and events' processing mechanism. Pages of the session, in addition to all, contain the container of following by the hierarchy pages. The session is calculated with the specified periodicity and in the following sequence:
- "Top level page" -> "Lower level page "
- "Lower level widget" -> "Top level widget"
This policy allows you to pass pages according to the hierarchy, and events in the widgets to rise to the top in one iteration.
Session implements support for the special properties of the pages:
Container — page is container for the underlying pages;
Template — page is template for the underlying pages;
Empty — blank inactive page, this property is used in conjunction with the property Container for logical containers organization.
Based on the properties the following types of pages are implemented:
Standard — standard page (none property is set). Is the full-featured end page.
Container — full-featured page with the container property (Container).
Logical container — logical container which is actually not a page (Container|Empty). It performs the function of intermediate and grouping element in the pages tree.
Template — template page (Template). Pure template page which is used to describe common properties and for extending them privately in the embedded pages.
Container and template — Template and container page (Template|Container). It combines the template and the container functions.
Revision continue here
Providing the values' frames for the final visualization widgets' calculation procedures.
In the section above, we have already noted that the widget of the session contains the frame of values of the calculation procedures. This image is initiated and is used in the case of presence of the calculation procedure. At the time of the initialization the list of parameters of procedure is created and the compilation of the procedures with these parameters is done in the module that implements the selected programming language and that id encoded with the full name of the widget. The compiled function is connected to frame the values of calculation procedures. Next, the calculation is done with the periodicity of the session.
Calculation and processing of the widget as a whole is done in the following order:
- the events, available at the time of calculation, are selected from the attribute "event" of the widget;
- events are loaded into the parameter "event" of the calculation frame;
- the values of input links are loaded into the frame of calculation;
- the values of special variables are loaded in the calculation frame (f_frq, f_start and f_stop);
- the values of selected parameters of the widget are loaded into the calculation frame;
- calculation;
- upload of the calculation frame's values to the selected parameters of the widget;
- upload of the calculation frame's values on the outgoing links;
- upload the event from the parameter "event" of the calculation frame;
- Events' processing and transfer the not processed ones to a higher level.
Processing the links on the data sources of OpenSCADA.
At the execution of the widget of the session it is necessary to make the links' processing. At the moment the connection on the links is made at the time of calculation, which is not a quick operation. Implementation of links processing will be reviewed and optimized in the future.
The support for the following types of links is provided:
- Constant value ("V"). The variable to determine at the time of the configuration on the page in the project.
- The attribute of the parameter of subsystem "Data acquisition" ("P"). The mechanism of access to the values of the parameter of subsystem "Data acquisition" of the OpenSCADA system.
- Attributes of the embedded widget ("W"). Internal direct link between the embedded widgets.
Currently the first two types of links are implemented. The last will be implemented together with the implementation of the basic widget "Link".
Formation of the window of the project execution (RunTime).
On the side of visualization (Vision module) to visualize the process of execution of the project the VisRun object is implemented. At startup it sends the request to create and initialize the session. Further the request on the list of opened pages is made. Based on the information of the VisRun opened pages and their connections, the resulting interface is formed. Fig. 6.3 shows an example of classical SCADA interface with alarm objects, where the main window contains a page inside which is replaced by pressing the buttons of alarm objects and paging.
Fig.6.3 The visualization of the project's execution window. The "RunTime" mode.
Visualization of the project's frames in the "RunTime" mode with periodic update of the content.
The update of the contents of the opened pages of the visualization interface with the periodicity of the execution of the project's session is implemented. In the update process it is done:
- request of the list of opened pages in the model and checking consistency of the really opened pages to this list;
- requests of the modified data on each page and widget;
- update the content of the pages and their widgets in accordance with the received modified data.
By closing the "RunTime" window the closing of the project's session in the data model is made. It will be implemented the opportunity to connect to the earlier opened session and disconnect from the session without closing it.
The mechanism of the request of the only modified data is based on absolute counter of the session's execution. When you make real changes in the attributes of widgets the remembering of the value of this counter is made, which allows us to identify the modified attributes. This approach allows to increase productivity and reduce the load on the traffic in case of access to the model through the network.
Realization of transfer and processing of events.
The visualizer of the ("RunTime") session, because of its direct contact with the user, collects various events. Some of the events are processed by the images of the basic widgets (Text, Box, Document, etc.), which can form other events. Another part is directly transfered to the data model, where they are processed.
To the data model events are transferred immediately upon their receiption, where they are collected in the attribute "event" of the widget until the next iteration of the session's execution. Further, in the process of data session's calculation, the events are extracted from the "event" attribute and are processed in the procedure of the widget or in accordance with the script(scenario) in the "evProc" attribute. The events which are not processed rise to the higher widget of the model.
The implementation of the mechanism of the switching/opening/replacement/navigation through the pages of the project taking into account the processing scenarios(scripts).
Switching, opening, replacement and navigation through the pages is based on processing the events on the scenario(script) in the attribute of the active widget "evProc". Script of this attribute is written in the form of the list of commands with the syntax of: <event>:<srcWdg>:<com>:<prm>
where:
event -- expected event;
srcWdg -- child widget - the source of the event;
com -- session's command;
prm -- parameter of the command;
The following commands are implemented:
open -- The opening of the page. The page to be opened is specified in the parameter prm as in the direct way and as the template (eg:/pg_so/1/*/*).
next -- The opening of the next page. The page to be opened is specified in the parameter prm as in the direct way and as the template (eg:/pg_so/*/*/$).
prev -- The opening of the previous page. Page to be opened is specified in the parameter prm as in the direct way and as the template (eg:/pg_so/*/*/$).
Special characters of the template is interpreted as follows:
pg_so -- Direct name of the necessary page with a prefix. Requires the compulsory compliance and is used to identify the previous opened page.
1 -- The name of the new page in general way without the prefix. The name of the previous page is ignored.
* -- The page is taken with the name of the previously opened page or substituted the first available page if the previous page is not present.
$ -- Indicates the place on the opened page where it is necessary to look for the next or previous.
To understand the mechanism of the templates lets give some real examples:
Switching the alarm objects:Command: open:/pg_so/2/*/*
It was: /pg_so/pg_1/pg_mn/pg_1
It is: /pg_so/pg_2/pg_mn/pg_1
Switching of the view:
Command: open:/pg_so/*/gkadr/*
It was: /pg_so/pg_1/pg_mn/pg_1
It is: /pg_so/pg_1/pg_gkadr/pg_1
Next/previous page:
Command: next:/pg_so/*/*/$
It was: /pg_so/pg_1/pg_mn/pg_1
It is: /pg_so/pg_1/pg_mn/pg_2
In conjunction with the above described mechanism on the side of visualization (RunTime) the logic that controls the way of the opening the pages is built. The logic is based on the following attributes of the basic element "Box":
pgOpen -- The sign "Page is opened".
pgNoOpenProc -- The sign "To process the page even if it is not opened".
pgOpenSrc -- Contains the address of the widget or page that has opened the current page. In the case of embedded container widget here is the the address of the included page.
pgGrp -- Group of pages. It is used for the connection of containers of pages with the pages in the same group.
The logic of determining the opening of the pages works as follows:
- if the page has the group "main" or coincides with the group of the page in the main window, or there is no page in the main window, then open the page in the main window;
- if the page has the group which coincides with the group of one of the containers of the current page, then open in this container;
- if the source of the opening of page coincides with the current page, then open it as an additional window over the current page;
- transfer the call of the request of the opening to the additional windows with the processing at each of the first three items;
- if no one from related windows does not open the new page, then open it as the related window of the main window.
Combination of all these mechanisms now allows you to build complex, multi-level and multi-window user interfaces.