unCoreInternals 9.3.0
UNICOS Data Flow

Introduction

Purpose of this document

UNICOS stands for UNified Industrial COntrol System. The supervision device hierarchy is based on a front-end device containing process devices (time stamping in the front-end is allowed). A front-end device is an entity representing a piece of hardware or software entity holding devices. A front-end is also the entity through which the devices are accessible. Process device or device represents a piece of hardware sensor or software entity. A device is attached to one and only one front-end. Typical examples of front-end devices are PLCs, Front-End Computers (FEC), OPC servers, ELMB; while process devices are Analog Input, Digital Input, ELMB channel, etc. Front-end device and process device can be with or without hardware link. This document describes the internal behavior and data flow of the device and front-end device.

Definitions, Acronyms and Abbreviations

From this point onwards, the following acronyms will be used:

  • DPT: PVSS data point type.
  • DP: PVSS data point, instance of the DPT.
  • DPE: PVSS data point element.
  • Device: instance of the device type.
  • Front-end: instance of the front-end device type
  • Alarm: PVSS alert config on a DPE.

Contact at CERN

Any problem during installation or development can be reported to the following email address: UNICO.nosp@m.S.Su.nosp@m.pport.nosp@m.@cer.nosp@m.n.ch.

Naming Convention

In the following sections the examples are based on the unPackageTemplate component. The following keywords will be used:

  • TAG_prefix: prefix of the package
  • TAG_PREFIX: TAG_prefix in upper case letter
  • TAG_FrontEndType: the front-end device type
  • TAG_FRONTENDTYPE: TAG_FrontEndType in upper case letter
  • TAG_package: the package name
  • TAG_PACKAGE: TAG_package in upper case letter
  • TAG_DeviceType: the device type
  • TAG_DEVICETYPE: TAG_DeviceType in upper case letter
  • TAG_WidgetType: the widget name type

Concept

Note: The proxy configuration is not described in this document. It is mentioned in some sections as it can be part of the device or front-end. Refer to the document device-with-UNICOS.pdf for more information and how to configure the proxy for a front-end and a device.

UNICORE

unCore is the core component of UNICORE. It provides an interface to the device and front-end device for:

  • Import (mass configuration): to import the device and front-end configuration.
  • Export: to export the device and front-end configuration in the same format as the import.
  • Widget (Figure 1): summarized view of the device or front-end device. There can be many widgets for a device type, but just one for the front-end type.
  • Faceplate (Figure 2): detailed view of a device or front-end device. There is one faceplate for a device type and one for a front-end type.
  • Trend configuration: more than one trend configuration is allowed for each device type and front-end type.
  • Device action interface (Figure 3): action on the device. Device access control is allowed with 4 privileges per access control domain and as many access control as needed.
  • File access control: configurable access control for panel files, with 3 privileges per access control domain and as many access control domain as needed.
Device widget
Device faceplate
Device buttons

The unCore triggers the device and front-end device functions and panels. The unCore uses intensively:

  • DistributedControl component (use to check the connection and disconnection of a remote system). Callback functions are called to handle the device and front-end device behaviour. Global variables to the panels or to the libs can be used even without the ‘global’ keyword.
  • evalScript and execScript PVSS functions. Care must be taken with the use global variables in panels and libs and with $-parameters.

Front-End Device

A front-end device is an entity representing a piece of hardware or software entity holding devices. Typical examples of front-end devices are PLCs, Front-End Computers (FEC), OPC servers, ELMB, etc. A front-end device can be with or without hardware link. A front-end can have many devices grouped by:

  • Application: control application. The application is used to grouped devices that are part of the same control system or sub-system. Ex. QSCB cryogenic system, powering subsector, etc.
  • Device type: the type of the device.
  • Device number: from 00000 to 99999.

A front-end is also the entity through which the devices are accessible; the quality of the communication link with the front-end is checked via the systemIntegrity. A front-end device has:

  • One widget.
  • One faceplate.
  • Device user access control, implemented with the file access control. This access control has limited functionalities and is only configurable on the front-end type.
  • Many trending configuration: faceplate and trending plot.
  • Proxy interface.

A front-end device type is composed of a mandatory and optional set of configuration. The mandatory ones are:

  • The front-end device type definition.
  • The UNICORE front-end device definition.
  • The widget.
  • The faceplate.
  • A library with the configuration functions called during the import phase.
  • A library with the export functions called during the export phase.
  • A library with the widget and faceplate front-end functions.
  • The systemIntegrity of the front-end: configuration panels, operational panels and the front-end systemIntegrity library.

The optional ones are:

  • The trending configuration.
  • The proxy configuration.

Each front-end device has two names:

  • The logical name stored in the PVSS alias. This is the name used to identify the front-end. The PVSS system name separator ':' is not allowed in the name, the name must be composed of letters a..z, A..Z, numbers 0..9 and '_'. The syntax is [PVSSsystemName:]PVSSAlias, if the PVSSsystemName is not specified the local PVSSsystemName is used instead. For instance: CFC_SR4_DR4BC_IP4_DR4B, QPS_45:CFC_SR4_DR4BC_IP4_DR4B.
  • The hardware name of the device, this is the PVSS DP name. This is the name of the front-end. The syntax is [PVSSsystemName:]TAG_FrontEndType_PVSSAlias, if the PVSSsystemName is not specified the local PVSSsystemName is used instead. For instance: DQGTW_CFC_SR4_DR4BC_IP4_DR4B, QPS_45:DQGTW_CFC_SR4_DR4BC_IP4_DR4B.

Device (Process Device)

A process device or device represents a piece of hardware sensor or software entity. A device is attached to one and only one front-end in one and only one application. Typical examples of process devices are Analog Input, Digital Input, ELMB channel, etc. A device can be with or without hardware link. A device has:

  • Widget: as many as needed.
  • One faceplate.
  • One device action interface.
  • Device user access control entirely customizable per device and per device type.
  • Selection with automatic de-selection: exclusive lock on the device to have access to the possible device actions.
  • Many trending configuration: faceplate and trending plot.
  • Link interface: as many links as needed.
  • Proxy interface.

A device type is composed of a mandatory and optional set of configuration. The mandatory ones are:

  • The device type definition.
  • The UNICORE device definition.
  • The JCOP device definition.
  • The set of widgets.
  • The faceplate.
  • The device action interface.
  • A library with the configuration functions called during the import phase.
  • A library with the export functions called during the export phase.
  • A library with the widget, faceplate, device action, snapshot, etc. device functions.

The optional ones are:

  • The trending configuration.
  • The proxy configuration.

Each device has two names:

  • The logical name stored in the PVSS alias. This is usually the name used to identify the device. The PVSS system name separator ‘:’ is not allowed in the name. The syntax is [PVSSsystemName:]PVSSAlias, if the PVSSsystemName is not specified the local PVSSsystemName is used instead. For instance: DFBA_CV981, MB.A12R3, P8_82:DFBA_CV981, QPS_34:MB.A12R3.
  • The hardware name of the device, this is the PVSS DP name. This is the name of the device in the hardware hierarchy. The syntax is [PVSSsystemName:]TAG_prefix-FrontEnd-FrontEndApplication-TAG_DeviceType-xxxxx. If the PVSSsystemName is not specified the local PVSSsystemName is used instead. For instance: un-CFP_SHC8_LHC8-QSCB-Analog-00123, qps-CFC_SR3_IP3_DR3B-A34-DQAMCMB-10320, P8_82:un-CFP_SHC8_LHC8-QSCB-Analog-00123, QPS_34:qps-CFC_SR3_IP3_DR3B-A34-DQAMCMB-10320.

To get the front-end from the device name (device PVSSAlias):

  • Get the device DP name (PVSS DP name), for instance via the function unGenericDpFunctions_getWidgetDpName.
  • Get the front-end name, this is the PVSS alias of the front-end DP name, and it is part of the device DP name: ‘FrontEnd’; for instance via the function unGenericObject_GetPLCNameFromDpName.
  • Get the front-end DP name from the front-end name: PVSS alias of the front-end DP name; or get the front-end DP name: TAG_FrontEndType_FrontEnd on the same PVSS system as the device name.

UNICORE Device and Front-End Configuration

Front-End and Device Type

The UNICOS utilities and packages cannot used any type of front-end or device. A set of mandatory DPE must be in the definition of the front-end and device type. All the other type of devices can be used by the UNICOS utilities via the proxy interface: refer to document device-with-UNICOS.pdf for more information on how to use and configure proxy.

For each front-end and device there are three archives associated. These archives are used all over the import procedure and are the only ones allowed to be used to set the front-end and device PVSS archive config: boolean archive, analog archive and event archive. It is up to the package developer to define in which archives the DPEs will be archived, the default behavior can also be overwritten (refer to section 5 for more detail). The archives can be valarch and RDB archive class.

Front-End Device Type

The mandatory DPEs of a font-end device type are (Figure 4):

  • ‘configuration.importTime’: dyn_time, it contains the last time of the import for each application.
  • ‘configuration.archive_bool’: dyn_string, it contains the list of boolean archives for each application.
  • ‘configuration.archive_analog’: dyn_string, it contains the list of analog archives for each application.
  • ‘configuration.archive_event’: dyn_string, it contains the list of event archives for each application.
  • ‘configuration.subApplications’: dyn_string, it contains the list front-end applications.
  • ‘communication.driver_num’: this is the drive number used for the PVSS address config.
  • ‘communication.counter’: this DPE is used in the systemIntegrity. The name can be different but this DPE is mandatory if the front-end systemIntegrity component must check the validity of the front-end communication link. Refer to the section 7.1 for more detail.
Front-end device type

Device Type

The mandatory DPEs of a device type are (Figure 5):

  • ‘statusInformation’: reference to the UNICOS DPType _UnStatusInformation (Figure 6). This DPE uses:
    • selectedManager: to set the select state (section 9.1) of the device.
    • deviceLink: to store the list of devices linked to the device.
    • accessControl.accessControlDomain: to store the list of access control domain of the device (section 9.2).
    • accessControl.operator: to store the list of action for the operator access right privilege of the device (section 9.2).
    • accessControl.expert: to store the list of action for the expert access right privilege of the device (section 9.2).
    • accessControl.admin: to store the list of action for the admin access right privilege of the device (section 9.2).
    • deviceLog: to store the device log.
  • ‘ProcessInput’: struct DPE, internal device information is stored here.

It is recommended to put all the read device data into the ‘ProcessInput’ struct DPE and to put all the set device data into a ‘ProcessOutput’ struct DPE. Other struct DPE can be added below the TAG_DeviceType but the DPEs inside will not be visible from the trending utility (section 4.3). There is no limitation in the depth of the ‘ProcessInput’ struct DPE and the ‘ProcessOutput’ struct DPE.

Device type
Status Information Structure

UNICORE Configuration

The UNICORE front-end and device configuration is used by the UNICOS utilities. The configuration contains a set of functions that are called by the UNICORE and a set of panels that are opened by the UNICORE. This configuration is respectively saved in the DP:

  • TAG_DeviceType_unicosInfo of type _UnObjects (Figure 7) for the device.
  • TAG_FrontEndType_unicosInfo of type _UnFrontEnd (Figure 8) for the front-end.
Device configuration internal DPType
Front-end configuration internal DPType

The configuration can be created/modified/deleted from the ‘Device Internal Configuration’ panel (Figure 10 and Figure 11). It contains:

1.) Function: Acknowledge Alarm. This is a device function. It is called when the acknowledge is done from the alarm list panel and from UNICORE panels and utilities. Refer to the section 9.3.

2.) Function: Faceplate Status Register. This is a front-end and device function. This function is triggered by the UNICORE function unGenericObject_FaceplateStatusInit; this function is usually called when the faceplate is opened to initialize the status tab of the faceplate. Whenever the state of the PVSS system of the front-end/device is modified this function is triggered with the state of the PVSS system. Refer to the section 8.3.

3.) Function: Faceplate Status Disconnect. This is a front-end and device function. This function is triggered in the context of the faceplate when the PVSS system of the front-end/device is disconnected. This function can also be called by other faceplate functions when for instance there are errors during the initialization. Refer to the section 8.3.

4.) Function: Button Register. This is a device function. This function is triggered by the UNICORE function unGenericObject_ButtonInit; this function is usually called when the device action button panel (configuration 19) is opened. Whenever the state of the PVSS system of the device is modified this function is triggered with the state of the PVSS system. Refer to the section 9.2.2.

5.) Function: User Login Get Button State. This is a device function. This function is triggered when the user logs in/out and by the UNICORE function unGenericObject_ButtonInit. This function returns data to be used to set the device action button interface. Refer to the section 9.2.2.

6.) Function: Button Set State. This is a device function. This function is triggered to set the state of the device action button. It gets as argument the current state of the device and the access rights of the device. Refer to section 9.2.2.

7.) Function: Button Disconnect. This is a device function. This function is called in the context of the device action interface when the PVSS system of the device is disconnected and when the user logs in/out when the PVSS system of the device is disconnected. Refer to the section 9.2.2.

8.) Function: Button User Access. This is a device function. This function is triggered when the user logs in/out. It returns the access right of the device. Refer to the section 9.2.1.

9.) Function: Widget Register. This is a front-end and device function. This function is triggered by the UNICORE function unGenericObject_WidgetInit; this function is usually called when the widget is opened. Whenever the state of the PVSS system of the front-end/device is modified this function is triggered with the state of the PVSS system. Refer to the section 8.2.

10.) Function: Widget Disconnect. This is a front-end and device function. This function is triggered in the context of the widget when the device name is not defined or is unknown or the state of the PVSS system of the front-end/device is disconnected. This function can also be called by other widget functions when for instance there are errors during the initialization. Refer to the section 8.2.

11.) Function: Popup Menu Configuration. This is a front-end and device function. This function is triggered by the UNICORE function unGenericObject_WidgetRigthClick. It returns the menu to show via the PVSS function: popupMenu. Refer to the section 8.4.

12.) Function: Handle Popup Menu. This is a front-end and device function. This function is triggered by the UNICORE function unGenericObject_WidgetRigthClick when the user selects an item of the popup menu defined in the configuration 11. Refer to the section 8.4.

13.) Function: Import database Check Config. This is a front-end and device function. This device function is triggered during the check phase of import of the device. Refer to the section 5.3. The front-end functions are composed of two functions (Figure 11):

a. Function: check Delete Command. This function is triggered during the check phase of the import of the front-end. Refer to the section 5.3.

b. Function: check PLC. This function is triggered during the check phase of the import of the front-end. Refer to the section 5.3.

14.) Function: Import database Set Config. This is a front-end and device function. This device function is triggered during the import phase of import of the device. Refer to the sections 5.4 and 5.5. The front-end functions are composed of two functions (Figure 11):

a. Function: delete Command. This function is triggered during the delete phase of the import of the front-end. Refer to the section 5.4.

b. Function: set PLC. This function is triggered during the import phase of the import of the front-end. Refer to the section 5.5.

15.) Function: ObjectList get value and time. This is a front-end and device function. This function is triggered in the snapshot mode in the tree device overview utility. Refer to the section 8.5.

16.) Device can be Selected. This is a device configuration. This is the selectable state of the device. If set to yes all the device instances of the device type can be selected, if set to no, none of them can be selected. Refer to the section 9.1.

17.) Faceplate panel (with relative path). This is a front-end and device configuration. This is the panel file name of the faceplate for the device type. Refer to the section 8.3.

18.) Faceplate Trend panel (with relative path). This is a front-end and device configuration. This is the panel file name of the trend panel for the device type. Refer to the section 8.3.5.

19.) Button panel (with relative path). This is a device configuration. This is panel file name of the device action for the device type. Refer to the section 9.2.

20.) Widget list. This is a front-end and device configuration. This is the list of the panel file name of the widget for the device type. Refer to the section 8.2.

21.) proxy device type. This is a front-end and device configuration. Refer to the document device-with-UNICOS.pdf.

The device configurations 13 and 14 are mandatory in order to be able to import the device and front-end device, all the others are optional.

Device Internal Configuration panel for Front-end
Device Internal Configuration panel for Device
Front-end import internal configuration panel

Trending Configuration

In UNICOS there are two types of trending:

  • Faceplate trending: entirely configurable per device type with customization on the min/max scale for each device.
  • Trending plot (JCOP fwTrending): entirely configurable. The DPE format used in the trending plot is: [PVSSSystemName:]DeviceName.leafProcessInput/OutputDPE, e.g.: QRL81:CT_PT100.PosSt.

There is no specific development to do for the trending, it is only configurable. Any device type leaf DPE below ProcessInput, any device type leaf DPE below ProcessOutput and any front-end type DPE of type bool, int, float, uint and time can be trended.

A device DPE can be trended if it is in the list of DPE of the given device type: section 4.3.1. Once the list is created, the configuration of the faceplate trend for the given device type can be added: section 4.3.2. The DPEs of the proxy can also be trended: refer to the document device-with-UNICOS.pdf.

Trend DPE Configuration

This is the definition of the device type DPE that can be used in the trending. Any device type leaf DPE below ProcessInput, any device type leaf DPE below ProcessOutput and any front-end type DPE of type bool, int, float, uint and time can be trended. One has to add the selected DPE and the corresponding DPE for the DPE trend range in the list of (Figure 12 and Figure 13):

  • Trendable DPE: DPE used in the Trending plot. The list of trendable DPE can also available from the front-end and device right click menu (section 8.4).
  • Faceplate configuration: DPE used in the faceplate trending, section 4.3.2. The color configuration is obsolete.

This configuration is respectively saved in the DP:

  • TAG_DeviceType_unicosInfo of type _UnObjects (Figure 7) for the device.
  • TAG_FrontEndType_unicosInfo of type _UnFrontEnd (Figure 8) for the front-end.

The trending plot configuration (Figure 14) uses the list of trendable DPE for the DP element configuration. In the trending plot the following rule is used to get the range DPE and set the min/max scale:

  • If the DPE is a front-end/device DPE and the range DPE is a front-end/device DPE, the configured front-end/device range DPE will be used.
  • If the DPE is a front-end/device DPE and the range DPE is a proxy front-end/device DPE, the range DPE will be the first proxy front-end/device DPE of same type as the range proxy front-end/device DPE found in the list of proxy.
  • If the DPE is a proxy device DPE and the range DPE is a front-end/device DPE, the configured front-end/device range DPE will be used.
  • If the DPE is a proxy front-end/device DPE and the range DPE is a proxy front-end/device DPE of the same type, the range DPE will be the corresponding proxy front-end/device range DPE.
  • If the DPE is a proxy front-end/device DPE and the range DPE is a proxy front-end/device DPE of a different type, the range DPE will be the first proxy front-end/device DPE of same type as the range proxy front-end/device DPE found in the list of proxy.

If the range DPE has a pv_range config, the pv_range min/max will be used as min/max scale of the curve, if the range DPE has not a pv_range config, the curve will be in auto scale.

Device type trend DPE configuration
Front-end type DPE trend configuration
Trending plot configuration

Faceplate Trend Configuration

The faceplate trend configuration is the tool which is used to define the trend configuration in the faceplate by using:

  • Tab (Figure 15). A call the function unGenericObject_FaceplateTrendInit will put the first trend configuration with the Faceplate Trend panel (configuration 18 section 4.2) in the Tab1 graphical object. A call to the function unGenericObject_TabFaceplateExtendedTrendInit will put all the trend configurations with the Faceplate Trend panel (configuration 18 section 4.2) into a tab graphical object.
  • Trend button (Figure 16).

For each device and front-end type, the configuration (Figure 18 and Figure 19) accepts as many trend configuration as needed with the DPE, range DPE, color, explicit min/max, auto scale config and scale visible/not visible. For each device type it is possible to customize the min/max for each DPE. The same rule as the one described for the trending plot in section 4.3.1 is used to get the range DPE, then the following rule is used to set the min/max scale:

  • If the configured DPE is in the list of Faceplate Trends DPE with a Min and Max value, the min/max scale of the curve will be this defined Min and Max.
  • If there is no Min and Max value and the range DPE has a pv_range config, the pv_range min/max will be used as min/max scale.
  • If there is no pv_range config the configured min/max or auto scale of the faceplate trend configuration will be used.

For a device type the faceplate configuration is saved in the DP TAG_DeviceType_trendConfiguration of type _UnTrendConfiguration and for the front-end type in the DP TAG_FrontEndType_trendConfiguration of type _UnTrendConfiguration (Figure 17).

Examples of such configuration for CPC device and front-end device are shown in Figure 20 and Figure 21.

Tab in a faceplate
Trend button
Trend configuration internal DPType
Device type faceplate trend configuration
Front-end type faceplate trend configuration
CPC AnalogInput device faceplate trend configuration
CPC AnalogInput device faceplate trend button
CPC _UnPlc front-end faceplate trend configuration
CPC _UnPlc front-end faceplate trend button

System Integrity Configuration

The systemIntegrity is a utility used to check the integrity of a component. This utility is used to check the integrity and data quality of the data from the front-end, typically:

  • The communication link with the front-end: this is usually the periodic check of a value (counter) updated by the front-end.
  • Any other relevant data like errors, timing problems, etc.

The systemIntegrity of the front-end type can be modified from the ‘System Integrity Internal Configuration panel’ (Figure 22), it contains:

1.) Function: Initialize unSystemIntegrity. This function is triggered at the startup of the front-end systemIntegrity component, it returns the list enabled front-end.

2.) Function: HandleCommand unSystemIntegrity. This function is triggered whenever a request is sent to the systemIntegrity of the front-end. The mandatory request are:

  • Add systemIntegrity.
  • Delete systemIntegrity.
  • Enable systemIntegrity.
  • Disable systemIntegrity.
  • Diagnostic systemIntegrity.

3.) Function: DataCallback unSystemIntegrity.

4.) Config Data: data usually used by the component for the check. E.g.: timeout, size, etc.

5.) Configuration panel: configuration of the front-end systemIntegrity. E.g.: front-end device, Config Data, etc. The $-param of the panel is $sComponent, this is the system integrity component.

6.) Operation panel: show the _UnSystemAlarm produces by the front-end systemIntegrity. The $-param of the panel is $sComponent, this is the system integrity component.

The systemIntegrity produces system alarm of Type _UnSystemAlarm (Figure 24). The systemIntegrity information for the front-end type is stored in the DP TAG_FrontEndType_systemIntegrityInfo of type _UnSystemIntegrity (Figure 23). The system integrity alarms can be listed in the systemIntegrity alarm screen (Figure 25).

System Integrity Internal Configuration
_UnSystemIntegrity DP type
_UnSystemAlarm DP type
SystemIntegrity alarm screen

Check/Delete/Import

The Import Device utility (Figure 26) is the one that is used to do the front-end and device mass configuration by mean of reading a file containing all the front-end and device information. The file must be for one front-end, one front-end application and as many devices as needed. The driver number, bool archive, analog archive and event archive have to be selected. There are three phases during the import:

1.) Check: cross-check the content of the files and the PVSS DB. Check the front-end and device configuration; check the required space in each selected archive.

2.) Delete: trigger with the line with the ‘Delete’ keyword and if there are devices to delete. There will be an automatic archive file switch for all the valarch archives involved.

3.) Import with check or without check: create the front-end and device and setup the PVSS config.

The required space in the archive is calculated:

  • For the front-end from the output of the front-end function calls: TAG_FrontEndType_getFrontEndArchiveDp and TAG_FrontEndType_getArchiveProxyDPE (refer to section 5.3).
  • For the device from the function call: TAG_DeviceType_getArchiveProxyDPE and the device JCOP definition configuration or the device function call: TAG_DeviceType_getArchiveDPE (refer to section 5.1).

The JCOP device definition must be set for each device in order to calculate the required space in the archive.

The check/delete/import utility is based on a file with one line for the front-end and one line per device. All the necessary front-end/device information must be in the line separated by ‘;’.

The utility will use the first string of the line as a keyword; lines beginning with ‘::’ are not evaluated. The allowed keywords are:

  • Delete: the mandatory field is the front-end instance name (same name as the one used in the ‘PLCCONFIG’ line):
Delete;front-end device name[;front-end application (or *);[device type;[device id;]]]
‘*’ is allowed in the front-end application name, device type and device id. E.g.:
Delete;PLC_81
Delete;PLC_81;Sector81;
Delete;PLC_81;Sector*1;AnalogInput*;
  • PLCCONFIG followed by the front-end instance name and front-end application name and as many front-end configuration parameters as needed.
PLCCONFIG;front-end device name;front-end application;front-end configuration parameter
  • SystemAlarm:
SystemAlarm;device id(not used);alarm name;addres in front-end;true=alarm if value>10/false(default)=alarm if value<=10;description;other field if needed;
  • TAG_DeviceType followed by the mandatory parameters and as many TAG_DeviceType parameters as needed and optionally the 3 archive names. The mandatory fields are: Device number (unique), Device name (Device Identifier) and optionally the list of device link separated by ‘,’, description, Diagnostic panel, HTML page, Default panel, optionally the list of device user access control domain and the list of subsystem1 (Domain), optionally the list of device operator expert and admin action separated and the list of subsystem2 (Nature), TAG_WidgetType. Refer to section 8.2 for the meaning of TAG_WidgetType. subsystem1 and subsystem2 can be “”.
TAG_DeviceType;Device number (unique);Device name (Device Identifier)[,link1,link2,..];description;[Diagnostic panel];[HTML page];[Default panel];[device user acess control domain1,..|]subsystem1[,subsystem11,..];[device operator action1,..|device expert action1,..|device admin action1,..|]subsystem2[,subsystem22,..];TAG_WidgetType;TAG_DeviceType parameters;[[boolean archive name];[analog archive name];[event archive name];]

Below is an example of the file with CPC front-end and device:

#
# Database PVSS generated at 2008.06.01 22:03:40
#
# Device type: S7_PLC
#
#Delete;PLC_81;Sector81;
PLCCONFIG;S7-300;PLC_81;Sector81;0A;0;3;10;0;0;AB;500;137.138.37.232;DB10.DBD0;DB10.DBW20;DB10.DBW30;DB10.DBW40;DB10.DBD4F;0.1;2;
# FESystemAlarm (SystemAlarm)
#For S7-300 1
SystemAlarm;1;TEST_PLC_Comm_Status_with_FES7;DB1.DBW0;TRUE;Communication state with other FE;
#For S7-300 2
SystemAlarm;2;pb1;DB11.DBW30;TRUE;this is a positive alarm;
#For S7-300 3
SystemAlarm;3;pb2;DB11.DBW20;FALSE;this is a negative alarm;
#For S7-300 4
SystemAlarm;4;positive_true;DB11.DBW10;TRUE;hola positive_true;
#
# Database PVSS generated at 2008.06.01 22:03:40
#
# Device type: Alarm
#
Alarm;1001;QXD4N_A_SEPH_P_FS1S7;Full Stop;diagnostic.pnl;info.html;;SEPH;alarm;Alarm;0;DB69.DBW0;DB69.DBD2;DB69.DBW6;;;ValueArchive_0000;1;
Alarm;1002;QXD4N_A_SEPH_P_FS2S7;Full Stop;diagnostic.pnl;info.html;;SEPH;alarm;Alarm;0;DB69.DBW0;DB69.DBD22;DB69.DBW26;;;;1;
Alarm;1001;QQXD4N_A_SEPH_P_FS1S7;Full Stop;diagnostic.pnl;info.html;;SEPH;alarm;Alarm;0;DB669.DBW0;DB669.DBD2;DB669.DBW66;ValueArchive_0000;;ValueArchive_0000;1;
Alarm;1002;QQXD4N_A_SEPH_P_FS2S7;Full Stop;diagnostic.pnl;info.html;;SEPH;alarm;Alarm;0;DB669.DBW0;DB669.DBD22;DB669.DBW266;ValueArchive_0000;;ValueArchive_0000;1;
#
# Database PVSS generated at 2008.06.01 22:03:40
#
# Device type: AnaDig
#
AnaDig;1001;Q_A_ADO1S7;Description Q_A_ADO1;diagnostic.pnl;info.html;NONE;SPARE;anadig;AnaDigValveVertical;%;EXP;100.0;0.0;90.0;10.0;0;0;N;0;0;DB168.DBW0;….38F;;;ValueArchive_0000;1;
AnaDig;1002;Q_A_ADO2S7;Description Q_A_ADO1;diagnostic.pnl;info.html;NONE;SPARE;anadig;AnaDigValveVertical;%;EXP;100.0;0.0;90.0;10.0;0;0;N;0;0;DB168.DBW0;..;
……

In this example SystemAlarm devices are defined, this is a UNICORE standard device to create _UnSystemAlarm DP. They can be used for systemIntegrity alarm like front-end inter-communication alarm, etc. refer to section 7.1.

The check/delete/import utility can run only if:

  • the sim driver is started.
  • the dist manager is stopped.
  • the unicos_scripts.lst and unDeviceListUpdate.ctl scripts are started.
check/delete/import

Refer to Appendix A: TAG_prefixConfigTAG_FrontEndType.ctl and Appendix B: TAG_prefixConfigTAG_DeviceType.ctl for the function templates used in the check/delete/import utility.

JCOP Device Definition

The JCOP device definition: ‘panels/fwDevice/fwDeviceRegisterType.pnl’ (Figure 27 and Figure 28) is used to get the list of DPE having an archive config and evaluate the required size for each archive.

JCOP device register utility
JCOP device definition

Front-End/Device and Archive Name

For the front-end the archive names are the one selected in the Import panel (Figure 26). By default the archive names are the same for the device as ones for the front-end; however they can be overwritten by specifying them in the line to import for the device. The 3 archive names are optional and are at the end of the line of the device; if they are specified and set to ‘’, the front-end archive names will be used instead.

The default behavior for the device type is:

  • bool, char DPE in the Boolean archive
  • float DPE in the Analog archive
  • int, uint, struct DPE in Event archive

The default device behavior can be overwritten by the function: TAG_DeviceType_getArchiveDPE.

Check

The data flow of the check phase is described in Figure 29. All the function calls are done via the ‘evalScript’ PVSS function:

  • TAG_DeviceType_getArchiveDPE: device type function, optional function. This function returns the list of DPE for the three archives: Boolean, analog and event separated by ‘;’. E.g.: ".ProcessInput.DPE1;.ProcessInput.DPE2".
  • TAG_prefixConfigTAG_FrontEndType_checkDeleteCommand: configuration 13, section 4.2. This function must check the content of the ‘Delete’ line and based on the ‘Delete’ line content it must return the list of DP that should be deleted: front-end, proxy DP, _UnSystemAlarm DP and any other DP associated to the front-end. The ‘Delete’ line content is given to the function. The errors must be returned in an exceptionInfo variable.
  • TAG_prefixConfigTAG_FrontEndType_checkFrontEnd: configuration 13, section 4.2. This function must check the content of the ‘PLCCONFIG’ line and optionally the ‘SystemAlarm’ line. Typical checks for the ‘PLCCONFIG’ line are: the front-end name, the driver number, the application name syntax, etc. The ‘PLCCONFIG’ line content is given to the function. The errors must be returned in an exceptionInfo variable.
  • TAG_FrontEndType_getFrontEndArchiveDp. This function must return the list of front-end DPE and related DPE that are archived for the front-end: front-end DPE, _UnSystemAlarm DPE, any other DPE.
  • TAG_FrontEndType_getArchiveProxyDPE. This function returns the list of the front-end proxy DPEs that are archived in the boolean archive, analog archive and event archive.
  • TAG_prefixConfigTAG_DeviceType_checkConfig: configuration 13, section 4.2. This function must check the content of the ‘TAG_DeviceType’ line. A typical check is: unConfigGenericFunctions_checkParameters to check the mandatory parameters. A call to unConfigGenericFunctions_checkDeviceConfig will trigger the function call TAG_FrontEndType_TAG_DeviceType_checkConfig allowing different configuration per TAG_FrontEndType front-end in which the check of the TAG_DeviceType parameters must be done: check deadband, check archives, check range, check float value, check if parameters are missing, etc. The ‘TAG_DeviceType’ line content is given to the function. The errors must be returned in an exceptionInfo variable.
  • TAG_DeviceType_getArchiveProxyDPE. This function returns the list of the device proxy DPEs that are archived in the boolean archive, analog archive and event archive.
Check data flow and function call

Delete

The data flow of the delete phase is described in Figure 30. All the function calls are done via the ‘evalScript’ PVSS function:

  • TAG_prefixConfigTAG_FrontEndType_checkDeleteCommand: refer to section 5.3.
  • TAG_prefixConfigTAG_FrontEndType_deleteCommand: configuration 14, section 4.2. This function must delete all the DPs associated with the front-end and that match with the ‘Delete’ line criteria: front-end, proxy DP, _UnSystemAlarm DP and any other DP associated to the front-end. The ‘Delete’ line content is given to the function. The errors must be returned in an exceptionInfo variable.
Delete data flow and function call

Import

The data flow of the import phase is described in Figure 31. All the function calls are done via the ‘evalScript’ PVSS function:

  • TAG_prefixConfigTAG_FrontEndType_checkDeleteCommand: refer to section 5.3.
  • TAG_prefixConfigTAG_FrontEndType_setFrontEnd: configuration 14, section 4.2.The ‘PLCCONFIG’ line content is given to the function. The errors must be returned in an exceptionInfo variable. This function must:
    • Create the front-end DP, _UnSystemAlarm DP, all the DPs associated with the front-end: proxy, any other DP.
    • Create all the PVSS config of the front-end DPEs, _UnSystemAlarm DPEs and the associated DPs.
    • Set the list of application, import time, selected archives and the driver number and any other DPEs value.
  • TAG_prefixConfigTAG_DeviceType_setConfig: configuration 14, section 4.2. This function must create the TAG_DeviceType device, create the proxy DP and any other associated DP to the TAG_DeviceType; create all the PVSS config of the TAG_DeviceType instance, proxy, DPEs value, etc. according to the content of the ‘TAG_DeviceType’ line. A call to unConfigGenericFunctions_setDeviceConfig will trigger the function call TAG_FrontEndType_TAG_DeviceType_setConfig allowing different set per TAG_FrontEndType front-end in which the set of the TAG_DeviceType PVSS config must be done: set deadband, set archives, set range, set DPEs value, set proxy, etc. The ‘TAG_DeviceType’ line content is given to the function. The errors must be returned in an exceptionInfo variable.
Import data flow function call

Export

The data flow of the export phase is described in Figure 32. The purpose is to create a file with the same format as the one used in the check/delete/import utility. All the function calls are done via the ‘evalScript’ PVSS function:

  • TAG_FrontEndType_Com_ExportConfig: get all the necessary PVSS configs, DPEs value, proxy, etc. to create the ‘Delete’ line, ‘PLCCONFIG’ line and all the ‘SystemAlarm’ lines.
  • TAG_FrontEndType_TAG_DeviceType_ExportConfig: get all the necessary PVSS configs, DPEs value, proxy, etc. to create the ‘TAG_DeviceType’ line for the TAG_FrontEndType.

Refer to Appendix C: TAG_prefixExportDevices.ctl for the function templates used in the export utility.

Export data flow and function call

Front-End

Front-End System Integrity

In UNICOS the quality of the data is also based on the quality of the link between the front-end and the data server. The systemIntegrity (refer to section 4.4) is used to evaluate this quality. This is usually done by checking periodically relevant data from the front-end: data periodically changed in the front-end, driver errors, etc.

At minimum there should be a system alarm for the quality of the communication link with the front-end. The DP name convention is usually: _unSystemAlarm_DS_Comm_FrontEndDpName; this DP will be used in the all the UNICOS utilities: widget, faceplate, etc. for the communication quality of the device data.

The front-end system alarm can be retrieved from the front-end name (front-end PVSSAlias): _unSystemAlarm_DS_Comm_FrontEndDpName.

To get the front-end system alarm from the device name (device PVSSAlias):

  • Get the front-end DP name: section 3.3.
  • Get the system alarm: _unSystemAlarm_DS_Comm_FrontEndDpName.

The data flow of the front-end systemIntegrity phase is described in:

  • Figure 33: systemIntegrity script. The function calls are:

    • TAG_prefixSystemIntegrity_TAG_FrontEndType_Initialize: configuration 1, section 4.4, triggered via the ‘evalScript’ PVSS function. This function must return the list enabled front-end.
    • TAG_prefixSystemIntegrity_TAG_FrontEndType_HandleCommand: configuration 2, section 4.4, triggered via the ‘dpConnect’ PVSS function. This function is triggered whenever a request is sent to the systemIntegrity of the front-end. The mandatory request are:
      • Add systemIntegrity: create the systemIntegrity alarm of the front-end if needed and setup the checking of the front-end communication link and any other needed checking.
      • Delete systemIntegrity: stop the checking of the front-end communication link and any other needed checking and delete the systemIntegrity alarm of the front-end.
      • Enable systemIntegrity: setup the checking of the front-end communication link and any other needed checking.
      • Disable systemIntegrity: stop the checking of the front-end communication link and any other needed checking.
      • Diagnostic systemIntegtrity: return the list of systemIntegrity alarms and their states.

    Other type request can also be implemented if needed.

    • TAG_prefixSystemIntegrity_TAG_FrontEndType_DataCallback: configuration 3, section 4.4, triggered via the ‘dpConnect’ PVSS function on the config data: configuration 4, section 4.4.
  • Figure 34: systemIntegrity configuration, configuration 5, section 4.4, opened via ‘addSymbol’ PVSS function. The $-param of the panel is $sComponent.
  • Figure 35: systemIntegrity operation, configuration 6, section 4.4, opened via ‘addSymbol’ PVSS function. The $-param of the panel is $sComponent.

The checking of the front-end communication link is usually based on a periodical check if the counter value (or equivalent) is updated or modified within a given time. The _unSystemAlarm_DS_Comm_FrontEndDpName systemAlarm DP must be set accordingly. Other checking can be done like driver errors, etc. other system alarms than _unSystemAlarm_DS_Comm_FrontEndDpName should be used, typical example are:

  • PLC comm. Alarm: _unSystemAlarm_PLC_DS_Error_FrontEndDpName.
  • Timing problem: _unSystemAlarm_DS_Time_FrontEndDpName.

Refer to Appendix D: TAG_prefixSystemIntegrity_TAG_FrontEndType.ctl for the function templates used in the systemIntegrity utility.

System Integrity script data flow
System Integrity Configuration data flow
System Integrity Operation data flow

Front-End Diagnostic

The diagnostic of the front-end is useful to understand and fix any problem related to the front-end. The following panel (Figure 36) has to be created: panels/vision/graphicalFrame/TAG_FrontEndType_DiagnosticDetail.pnl. This panel is opened with the ‘addSymbol’ PVSS function from the front-end diagnostic tool (Figure 37); the $-param of the panel is $sFrontEnd, this is the front-end DP name. It must contain all the useful information from the front-end or front-end proxy in order to be able to debug and fix the problem:

  • All the front-end system alarm produced by the front-end systemIntegrity component.
  • Any other information: driver data, front-end feedback, counter value, etc.
  • Any command that can be sent to the front-end: request all the data, etc.
  • The front-end systemIntegrity command: Add systemIntegrity, etc.
Front-end diagnostic example
Front-end diagnostic tool

Front-End Access Control

It is possible to implement an access control on the front-end action in the front-end diagnostic panel via the UNICOS file access control (Figure 38). The configuration is not as flexible as for the device: one can only select one of the three UNICOS user access control privileges (operator, expert or admin) with as many user access control domain as needed. Function like unGenericButtonFunctionsHMI_isAccessAllowed returns the access control state of a given user: the user has or has not the requested privilege.

UNICOS file access control

Widget, Faceplate, Right Click, Snapshot

Refer to Appendix E: TAG_prefixTAG_FrontEndType.ctl and Appendix F: TAG_prefixTAG_DeviceType.ctl for the function templates used for the widget, faceplate, right click and snapshot.

Distributed Control

The widget, faceplate and device action interface use heavily the DistributedControl component. This component was designed to cope with the weakness of PVSS with DP on a remote system which was never connected: in this case the DP is seen as not existing and any dpConnect will return an error, thus the device data will never be shown when this system is connected except if one closes the panel and opens it again. The DistributedControl is based on dpConnect to the internal DP which represents the state of the remote system.

There is always a pair of functions for each case: callback function on the DisctributedControl internal DP and disconnection function:

  • TAG_prefixTAG_DeviceType_FaceplateStatusRegisterCB and TAG_FrontEndType_FaceplateStatusRegisterCB (configuration 2, section 4.2); TAG_prefixTAG_DeviceType_FaceplateStatusDisconnection and TAG_FrontEndType_FaceplateDisconnection (configuration 3, section 4.2) for the device faceplate.
  • TAG_prefixTAG_DeviceType_ButtonRegisterCB (configuration 4, section 4.2); TAG_prefixTAG_DeviceType_ButtonDisconnection (configuration 7, section 4.2) for the device action interface.
  • TAG_prefixTAG_DeviceType_WidgetRegisterCB and TAG_FrontEndType_WidgetRegisterCB (configuration 9, section 4.2); TAG_prefixTAG_DeviceType_WidgetDisconnection and TAG_FrontEndType_WidgetDisconnection (configuration 10, section 4.2) for the device widget.

Widget

A widget (Figure 39) is the summarized view of the device or front-end device. There can be many widgets for a device type, but just one for the front-end type. The quality of the data must be shown in the widget; it is composed of:

  • The front-end communication data link quality: section 7.1.
  • Any other quality of the data: data invalid state, etc.

The front-end widget has one and only one $-param: $sIdentifier.

The device widget can have many $-param but the one that is given during the import phase (section 5) must have one and only one $-param: $sIdentifier.

The front-end widget (Figure 40) contains:

  • A body with summarized information all around.
  • Optionally a widget Area: reference to objects/UN_INFOS/unWidget_SelectArea.pnl with $sDpType set to the device type and $sIdentifier set to $sIdentifier for the right click and double click action on the widget.

The device widget (Figure 40) contains:

  • A body with summarized information all around.
  • Optionally a rectangle name 'SelectArea' for the selection state; all colors set to 'Transparent' and filling set to 'outline' and a rectangle named 'LockBmp', with size 14x16 used to show the lock state of the device.
  • Optionally a widget Area: reference to objects/UN_INFOS/unWidget_SelectArea.pnl with $sDpType set to the device type and $sIdentifier set to $sIdentifier for the right click and double click action on the widget.

Typical examples of widget are shown in Figure 42.

Device and front-end widget
Front-end widget layout
Device widget layout
Widget examples

Widget panels

The front-end widget panel must be in: panels/objects/FRONT_END and named: Widget_TAG_FrontEndType.pnl.

The device widget panels must be in panels/objects/TAG_PACKAGE and named: TAG_prefixWidgetTAG_DeviceTypeTAG_WidgetType.pnl

Widget Param Panels: Each widget must have its corresponding png file in the images folder in order to have a catalog and use the drag&drop feature of PVSS. The parameterization of the widget can also be customized with a dedicated widget param panel (Figure 43) with a device name selector on local and remote system and any other useful configuration.

Widget Param panel

Widget Panel Script: The ‘Initialize’ script of the Body element of the device widget must be like:

bool g_bCallbackConnected;
string g_sWidgetType = "TAG_WidgetType";
string g_sDpName;
bool g_bUnSystemAlarmPlc=false;
bool g_bSystemConnected;
// declare here any global variables that can be use in the TAG_prefixTAG_DeviceType_WidgetConnect,
// TAG_prefixTAG_DeviceType_WidgetDisconnect and TAG_prefixTAG_DeviceType_Widget
main()
{
dyn_string exceptionInfo;
unGenericObject_WidgetInit($sIdentifier, "TAG_DeviceType", exceptionInfo);
}

The ‘Initialize’ script of the Body element of the front-end widget must be like:

bool g_bCallbackConnected;
string g_sWidgetType = "TAG_FrontEndType";
string g_sDpName;
bool g_bUnSystemAlarmPlc=false;
bool g_bSystemConnected;
string g_sCommColor;
// declare here any global variables that can be use in the TAG_FrontEndType_WidgetConnect,
// TAG_FrontEndType_WidgetDisconnect and TAG_FrontEndType_WidgetCB
main()
{
dyn_string exceptionInfo;
unGenericObject_WidgetInit($sIdentifier, "TAG_FrontEndType", exceptionInfo);
}

It contains:

  • $-param: $sIdentifier, this is the device name (section 3.3) or front-end device name (section 3.2).
  • Mandatory variables:
    • g_bCallbackConnected: to keep the state of the remote system, this variable is used by the UNICORE functions.
    • g_sWidgetType: type of widget, set to TAG_WidgetType or TAG_FrontEndType.
    • g_sDpName: device or front-end device DP name.
    • g_bUnSystemAlarmPlc: boolean used to know if the front-end system alarm exists.
  • Any optional variable useful for the widget animation, usually static data like value unit, value description, etc.
  • A call to unGenericObject_WidgetInit.

Widget Libs

The data flow of the widget is described in Figure 44. The function calls are:

  • TAG_prefixTAG_DeviceType_WidgetRegisterCB and TAG_FrontEndType_WidgetRegisterCB (configuration 9, section 4.2): DistributedControl callback function to the device/front-end system. The mandatory variables as well as any other optional variables declared in the widget can be read and set. Based on the result of the function unGenericObject_Connection which gives the state of the remote system, this function must:
    • If the state is DISCONNECT: call TAG_prefixTAG_DeviceType_WidgetDisconnection and TAG_FrontEndType_WidgetDisconnection.
    • If the state is DPCONNECT: do a dpConnect to the device data and the front-end system integrity data and if needed to the proxy data and linked data.
    • If the state is DPDISCONNECT_DISCONNECT: do a dpDisconnect to the dpConnect data done in the DPCONNECT state and call TAG_prefixTAG_DeviceType_WidgetDisconnection and TAG_FrontEndType_WidgetDisconnection.
  • TAG_prefixTAG_DeviceType_WidgetDisconnection and TAG_FrontEndType_WidgetDisconnection (configuration 10, section 4.2): triggered by execScript PVSS call with the g_sWidgetType given as a parameter to the function. There is no access to the mandatory variables and any other optional variables declared in the widget. This function must animate the widget in case of the disconnection of the system or if the device is not existing or has the wrong type. Usually this function sets all the graphical elements to dark violet color and disables them.
Widget data flow

Tips

  • It is better to read all the static information of a device in the TAG_prefixTAG_DeviceType_WidgetRegisterCB/TAG_FrontEndType_WidgetRegisterCB before the dpConnect to the device/front-end device data and not to read them in the device/front-end device data callback. This information can be stored in widget panel variables like g_sWidgetType or into graphical elements of the widgets.
  • There could be a conflict between the data callback function set in TAG_prefixTAG_DeviceType_WidgetRegisterCB/TAG_FrontEndType_WidgetRegisterCB and the TAG_prefixTAG_DeviceType_WidgetDisconnection/TAG_FrontEndType_WidgetDisconnection particularly if the device/front-end device animation callback needs a relatively long time to execute. In this case all the setMultiValue of the widget graphical elements must be encapsulated within a ‘if(g_bSystemConnected)’, g_bSystemConnected represents the state of the remote system, this variable must be declared like the variable g_sWidgetType and must be set in the function: TAG_prefixTAG_DeviceType_WidgetRegisterCB/TAG_FrontEndType_WidgetRegisterCB.
  • A device can have many widgets. But there is only one pair of functions for all the widgets: TAG_prefixTAG_DeviceType_WidgetRegisterCB and TAG_prefixTAG_DeviceType_WidgetDisconnection. In order to extend the list of widget without modifying each time this pair of functions, one can use the ‘evalScript’ or ‘execScript’ PVSS function based on g_sWidgetType in the following functions:
    • In the Device data animation function: call via ‘evalScript’ or ‘execScript’ a function TAG_prefixTAG_DeviceType_TAG_WidgetTypeAnimation, all the parameters needed to set the graphical elements of the widget must be given to this function.
    • In TAG_prefixTAG_DeviceType_WidgetDisconnection: call a function TAG_prefixTAG_DeviceType_TAG_WidgetTypeDisconnection, all the parameters needed to set the graphical elements of the widget must be given to this function.
  • Animate the Data Quality of the widget with the front-end systemIntegrity. If there is a front-end communication systemIntegrity alarm, set the Data Quality to ‘O’.

Widget Lib with alert_hdl DPConnect

In some cases, the animation of the widget depends on the ‘alert_hdl’ PVSS config. One has to use the dpConnect on this type of config with care because any modification on this config can lead to an internal delete and creation of this config. Therefore PVSS will automatically disconnect the widget callback and the animation will never be called afterwards (except if the panel is closed and opened again). To avoid it one has in TAG_prefixTAG_DeviceType_WidgetRegisterCB/TAG_FrontEndType_WidgetRegisterCB to do first a dpConnect to the DPE:_lock._alert_hdl._locked and in this callback, if the lock is true: do a dpDisconenct to the device data and if it is false do a dpConnect to the device data. One should not forget to do a dpDisconnect to the DPE:_lock._alert_hdl._locked and to the device data if needed when the state of the system is disconnected in the function: TAG_prefixTAG_DeviceType_WidgetRegisterCB/TAG_FrontEndType_WidgetRegisterCB.

Refer to Appendix J: Example of widget functions with alert_hdl config for an example of such function.

Faceplate

A faceplate is the detailed view of a device or a front-end device. There is one faceplate for a device type and one for a front-end type. The quality of the data must be shown in the faceplate.

The front-end and device faceplate have one and only one $-param: $sDpName. The front-end faceplate (Figure 45) shows usually the front-end diagnostic. The device faceplate (Figure 46) contains a tab graphical object with at least one tab with the detail view of the device data.

Example of a CPC front-end faceplate
Example of a CPC device faceplate

Faceplate Panels

The front-end faceplate panels must be in: panels/vision/graphicalFrame:

  • FaceplateTAG_FrontEndType.pnl: the front-end faceplate. It is recommended to show in the front-end faceplate panel the front-end diagnostic panel: section 7.2.
  • Eventually if needed a front-end trending panel: TAG_prefixTAG_FrontEndTypeTrendingFaceplate.pnl. Existing trending panel can be used instead like fwTrending/fwTrendingZoomedWindow.pnl.

The device faceplate panels must be in panels/vision/TAG_PACKAGE/TAG_DeviceType:

  • TAG_prefixFaceplateTAG_DeviceType.pnl: the device faceplate.
  • TAG_prefixTAG_DeviceTypeTrendingFaceplate.pnl: the trending panel used in the faceplate. Existing trending panel can be used instead like objects/fwTrending/fwTrendingFaceplate.pnl.
  • TAG_prefixTAG_DeviceType_ButtonPanel.pnl: the device action interface, refer to section 9.2.2).
  • TAG_prefixFaceplateTAG_DeviceType_status.pnl: the panel with all the device data.

The data flow to open the faceplate is shown in Figure 47.

Open faceplate data flow

Front-End Faceplate Panels Script: The ‘Initialize’ script of the front-end faceplate panel must be like:

/* Parameters
$sDpName : the datapoint that is linked to the faceplate
g_bCallbackConnected, bool, to save connection state
*/
bool g_bCallbackConnected;
bool g_bUnSystemAlarmPlc=false;
bool g_bSystemConnected;
string g_sShapeRefName = "plcDpName";
string g_sFileName = "vision/graphicalFrame/TAG_FrontEndType_DiagnosticDetail.pnl";
main()
{
dyn_string exceptionInfo;
unGenericObject_FaceplateStatusInit($sDpName, "TAG_FrontEndType", exceptionInfo);
}

It contains:

  • $-param: $sDpName, this is the front-end device DP name (section 3.2).
  • Mandatory variables:
    • g_bCallbackConnected: to keep the state of the remote system, this variable is used by the UNICORE functions.
    • g_bUnSystemAlarmPlc: boolean used to know if the front-end system alarm exists.
    • g_bSystemConnected: boolean used to keep the connected state of the system where is located the front-end device.
    • g_sShapeRefName: one shape name of the front-end diagnostic panel.
    • g_sFileName: the front-end diagnostic panel.
  • Any optional variable useful for the faceplate animation, usually static data like value unit, value description, etc.
  • A call to unGenericObject_FaceplateStatusInit.

Device Faceplate Panels Script:

The following script can be added in the device faceplate panel:

  • ‘Initialize’ script: if there is a reference to the panel objects/UN_INFO/unFaceplate_DisplayTitle.pnl, the following script can be used to show the device name and if needed to initialize the trend in the faceplate:
main()
{
// dyn_string exceptionInfo;
// string sDpName=$sDpName;
txttitle.text=unGenericDpFunctions_getAlias($sDpName);
// call the faceplate trend initialization
// unGenericObject_FaceplateTrendInit(sDpName, "TAG_DeviceType", exceptionInfo);
// unGenericObject_TabFaceplateExtendedTrendInit(sDpName, "TAG_DeviceType", exceptionInfo);
}
  • ‘Close’ script: if one wants to ask a confirmation before closing the faceplate, the following script can be used.
main()
{
// example of a pop-up window before closing the faceplate if needed
// remove this script if this is not needed
string deviceName, panelName;
dyn_float dfReturn;
dyn_string dsReturn;
deviceName = unGenericDpFunctions_getDpName($sDpName);
panelName = unGenericDpFunctions_getAlias(deviceName) + " " + unGenericDpFunctions_getDescription(deviceName) + " Closing...";
unGraphicalFrame_ChildPanelOnCentralModalReturn("vision/MessageInfo",panelName,makeDynString("$1:Closing faceplate", "$2:Ok","$3:Cancel"), dfReturn, dsReturn);
if(dynlen(dfReturn) > 0)
{
if(dfReturn[1] == 1) // Ok
PanelOff();
}
}

Device Faceplate Status Bar: The ‘initialize’ script of the device faceplate must be like:

/* Parameters
$sDpName : the datapoint that is linked to the faceplate
g_bCallbackConnected, bool, to save connection state
*/
bool g_bCallbackConnected;
bool g_bUnSystemAlarmPlc=false;
bool g_bSystemConnected;
string g_sFrontEndDp, g_sFrontEndAlias, g_sDeviceAlias; // variable used to set the header
// declare here any global variables that can be use in the TAG_prefixTAG_DeviceType_FaceplateConnect,
// TAG_prefixTAG_DeviceType_FaceplateDisconnect and
TAG_prefixTAG_DeviceType_FaceplateStatusAnimationCB
main()
{
dyn_string exceptionInfo;
// initialise here all the graphical element if needed
unGenericObject_FaceplateStatusInit($sDpName, "TAG_DeviceType", exceptionInfo);
}

It contains:

  • $-param: $sDpName, this is the device DP name (section 3.3).
  • Mandatory variables:
    • g_bCallbackConnected: to keep the state of the remote system, this variable is used by the UNICORE functions.
    • g_bUnSystemAlarmPlc: boolean used to know if the front-end system alarm exists.
    • g_bSystemConnected: boolean used to keep the connected state of the system where is located the front-end device.
    • g_sFrontEndDp, g_sFrontEndAlias, g_sDeviceAlias: variable used to set the header in the faceplate.
  • Any optional variable useful for the faceplate animation, usually static data like value unit, value description, etc.
  • A call to unGenericObject_FaceplateStatusInit.

Faceplate Libs

The data flow of the faceplate is described in Figure 48. The function calls are:

  • TAG_prefixTAG_DeviceType_FaceplateStatusRegisterCB and TAG_FrontEndType_FaceplateRegisterCB (configuration 2, section 4.2): DistributedControl callback function to the device/front-end system. The mandatory variables as well as any other optional variables declared in the faceplate status can be read and set. Based on the result of the function unGenericObject_Connection which gives the state of the remote system, this function must:
    • If the state is DISCONNECT: call TAG_prefixTAG_DeviceType_FaceplateStatusDisconnection and TAG_FrontEndType_FaceplateDisconnection.
    • If the state is DPCONNECT: do a dpConnect to the device data and the front-end system integrity data and if needed to the proxy data and linked data.
    • If the state is DPDISCONNECT_DISCONNECT: do a dpDisconnect to the dpConnect data done in the DPCONNECT state and call TAG_prefixTAG_DeviceType_FaceplateStatusDisconnection and TAG_FrontEndType_FaceplateDisconnection.
  • TAG_prefixTAG_DeviceType_FaceplateStatusDisconnection and TAG_FrontEndType_FaceplateDisconnection (configuration 3, section 4.2): triggered by execScript, there is no parameter given to the function. There is no access to the mandatory variables and any other optional variables declared in the faceplate status. This function must animate the faceplate in case of the disconnection of the system or if the device is not existing or has the wrong type. Usually this function sets all the graphical elements to dark violet color and disables them.
Faceplate data flow

Tips

  • It is better to read all the static information of a device in the TAG_prefixTAG_DeviceType_FaceplateStatusRegisterCB before the dpConnect to the device data and not to read them in the device data callback. These information can be stored in the faceplate status panel variables like g_bCallbackConnected or into graphical elements of the faceplate status.
  • There could be a conflict between the data callback function set in TAG_prefixTAG_DeviceType_FaceplateStatusRegisterCB and the TAG_prefixTAG_DeviceType_FaceplateStatusDisconnection particularly if the device animation callback needs a relatively long time to execute. In this case all the setMultiValue of the widget graphical elements must be encapsulated within a ‘if(g_bSystemConnected)’, g_bSystemConnected represents the state of the remote system, this variable must be declared like the variable g_bCallbackConnected and must be set in the function: TAG_prefixTAG_DeviceType_FaceplateStatusRegisterCB.
  • Front-end faceplate: the _UnPlc front-end type functions can be directly called to show the front-end diagnostic panel in the front-end faceplate: _UnPlc_FaceplateRegisterCB and _UnPlc_FaceplateDisconnection.
  • Add a header text in the faceplate status and animate it with the front-end systemIntegrity alarm: set the header text accordingly.

Faceplate Status with alert_hdl DPConnect

In some cases, the animation of the faceplate depends on the ‘alert_hdl’ PVSS config. One has to use the dpConnect on this type of config with care because any modification on this config can lead to an internal delete and creation of this config. Therefore PVSS will automatically disconnect the widget callback and the animation will never be called afterwards (except if the panel is closed and opened again). To avoid it one has in TAG_prefixTAG_DeviceType_FaceplateStatusRegisterCB/TAG_FrontEndType_FaceplateRegisterCB to do first a dpConnect to the DPE:_lock._alert_hdl._locked and in this callback, if the lock is true: do a dpDisconenct to the device data and if it is false do a dpConnect to the device data. One should not forget to do a dpDisconnect to the DPE:_lock._alert_hdl._locked and to the device data if needed when the state of the system is disconnected in the function: TAG_prefixTAG_DeviceType_FaceplateStatusRegisterCB/TAG_FrontEndType_FaceplateRegisterCB.

Refer to Appendix K: Example of faceplate function with alert_hdl config for an example of such function.

Faceplate Trending Panel

The device faceplate trending panel (configuration 18 section 4.2) TAG_prefixTAG_DeviceTypeTrendingFaceplate.pnl and the front-end Faceplate panel TAG_prefixTAG_FrontEndTypeTrendingFaceplate.pnl must have the following three panels in reference:

  • A trend control: panels/fwTrending/fwTrendingControl.pnl with the name set to ‘’.
  • A trend panel: panels/fwTrending/fwTrendingTrend.pnl with the name set to ‘trend’.
  • A trend caption like panels/fwTrending/fwTrendingFaceplateCaption.pnl or panels/fwTrending/fwTrendingFaceplateCaptionLarge.pnl with the name set to ‘trendCaption’.

In the faceplate initialize script (section 4.3.2 and 8.3.1.2), one must call:

  • unGenericObject_FaceplateTrendInit: to put the first trend configuration in the Tab1 graphical object.
  • unGenericObject_TabFaceplateExtendedTrendInit: to put all the trend configuration in the Tab1 graphical object.
Example of a CPC device faceplate trend panel

Right Click

This is a configurable pop-up menu that can be used to trigger action on the device. This is triggered by:

  • A right click event on the panels/objects/UN_INFOS/unWidgetArea.pnl.
  • A call the function: unGenericObject_WidgetRigthClick.

The data flow of the right click is described in Figure 50. The function calls are:

  • TAG_prefixTAG_DeviceType_MenuConfiguration and TAG_FrontEndType_MenuConfiguration (configuration 11, section 4.2): triggered by evalScript PVSS call. This function must return the popup menu in a format understandable by the PVSS popupMenu function. The following functions can be called to build the menu:
    • unGenericObject_addSelectToMenu: add the “Select”/“Deselect” to the menu, UN_POPUPMENU_SELECT_TEXT must be given as argument to the function.
    • unGenericObject_addDefaultUnicosActionToMenu: add “Faceplate”, “Diagnostic” and “Info” to the menu, UN_POPUPMENU_FACEPLATE_TEXT must be given as argument to the function.
    • unGenericObject_addTrendActionToMenu: add the dynamic device DPE trend and the single DPE device trend. This function will add the list of DPE of the device or the front-end that can be trended (section 4.3.1), UN_POPUPMENU_TREND_TEXT must be given as argument to the function.
  • TAG_prefixTAG_DeviceType_HandleMenu and TAG_FrontEndType_HandleMenu (configuration 12, section 4.2): triggered by evalScript PVSS call. This function must handle the selected actions. The following functions can be called to handle the selected menu action:
    • unGenericObject_handleSelect: handle the “Select”/“Deselect”.
    • unGenericObject_handleDefaultUnicos: handle “Faceplate”, “Diagnostic” and “Info”.
    • unGenericObject_handleTrendAction”: handle the dynamic device DPE trend. This function will add in a dynamic trend (objects/fwTrending/fwTrendingFaceplateFullCaption.pnl) the selected DPE (section 4.3.1).
    • unGenericObject_handleSingleDPETrendAction: handle single DPE device trend. This function will open the trend panel objects/fwTrending/fwTrendingFaceplateFullCaption.pnl with the selected DPE (section 4.3.1).
    • unGenericObject_HandleUnicosMenu: handle all the above actions.
Right click data flow

Snapshot

The tree device overview uses dedicated icons per front-end type or device type (Figure 51). If the icons do not exist the default one provided by the core will be used instead.

6 kinds of icons are used for the front-end type:

  • pictures/TAG_FrontEndType/iconWithChildrenClose.bmp: front-end with children, and the front-end tree node closed.
  • pictures/TAG_FrontEndType/iconWithChildrenOpen.bmp: front-end with children, and front-end tree node opened.
  • pictures/TAG_FrontEndType/iconWithChildrenPath.bmp: front-end with children, and one of its children tree node selected.
  • pictures/TAG_FrontEndType/iconWithChildrenSelected.bmp: front-end with children, and front-end tree node selected.
  • pictures/TAG_FrontEndType/iconWithoutChildrenNotSelected.bmp: front-end with no children, and front-end tree node not selected.
  • pictures/TAG_FrontEndType/iconWithoutChildrenSelected.bmp: front-end with no children, and front-end tree node selected.

If necessary 6 icons can also be used for the device type:

  • pictures/TAG_DeviceType/iconWithChildrenClose.bmp: front-end with children, and the front-end tree node closed.
  • pictures/TAG_DeviceType/iconWithChildrenOpen.bmp: front-end with children, and front-end tree node opened.
  • pictures/TAG_DeviceType/iconWithChildrenPath.bmp: front-end with children, and one of its children tree node selected.
  • pictures/TAG_DeviceType/iconWithChildrenSelected.bmp: front-end with children, and front-end tree node selected.
  • pictures/TAG_DeviceType/iconWithoutChildrenNotSelected.bmp: front-end with no children, and front-end tree node not selected.
  • pictures/TAG_DeviceType/iconWithoutChildrenSelected.bmp: front-end with no children, and front-end tree node selected.

The snapshot is triggered by the tree device overview utility to show the state of the device and the front-end.

The data flow of the right click is described in Figure 52. The function calls are TAG_prefixTAG_DeviceType_ObjectListGetValueTime and TAG_FrontEndType_ObjectListGetValueTime (configuration 15, section 4.2): triggered by evalScript PVSS call. This function must return an array of 5 string:

  • [1]: timestamp to put in the ‘Local Time’ or ‘UTC Time’ column of the snapshot table.
  • [2]: value to put in the ‘Value’ column of the snapshot table.
  • [3]: invalid to put in the ‘Inv’ column of the snapshot table.
  • [4]: state to put in the ‘State’ column of the snapshot table.
  • [5]: color, to set the color of the text of the corresponding device when the device is not invalid and the data are not marked as old (same behavior as the ‘O’ in the widget).
Example of icons used in the tree device overview
Snapshot data flow

Device

Refer to Appendix F: TAG_prefixTAG_DeviceType.ctl for the function templates used for the device action.

Device Select

The ‘Select’/’Deselect’ is a kind of lock on the device to have an exclusive access: configuration 16, section 4.2. The select state of the device can be used in the device action and device widget. The following function/panel can select/deselect the device:

  • unGenericObject_ButtonSelectAction: function to select/deselect the device.
  • panels/objects/UN_INFOS/unFaceplate_ButtonSelect.pnl: panel to use in the device action to select/deselect the device.
  • panels/objects/UN_INFOS/unWidget_SelectArea.pnl: select/deselect the device from mouse click, double click and right click.

The data flow of the select/deselect is described in Figure 53. The function call is TAG_prefixTAG_DeviceType_ButtonUserAccess described in section 9.2.1.

Select/deselect data flow

Device Action

Device Access Control

The device access control is the list of possible actions on the device for a given privilege. There are 4 privileges allowed for a device and as many user access control domain as needed. This list of actions per privilege for all the access control domains can be configured:

  • In the device itself: section 4.1.2, this configuration can be modified online via the Device configuration utility (Figure 54). This configuration can also be set during the import (section 5).
  • In the device lib function: TAG_prefixTAG_DeviceType_ButtonUserAccess, configuration 8, section 4.2, triggered by an evalScript PVSS call when the user logs in and logs out (Figure 57) and during the initialization of the device action interface (Figure 56). This function must return the list of allowed actions on the device for a user logged in. This list is either the list of actions per privilege stored in the device or the default one.
Device Configuration utility

Device Action

Device Action Panel (Device Contextual Button Panel): The device action interface or contextual button (Figure 55), configuration 19, section 4.2, is the interface to act on the device. This panel must be named panels/vision/TAG_package/TAG_DeviceType/TAG_prefixTAG_DeviceType_ButtonPanel.pnl. It contains a list of graphical objects used to act on the device, e.g.: button, list, selection list, etc. Buttons from the UN_INFOS catalog can be used. In the ‘ScopeLib’ of the panel the code must be like:

dyn_string g_dsUserAccess; // Current user access
string g_sFaceplateButtonType = "TAG_DeviceType"; // Faceplate type

The ‘Initialize’ script of one graphical object must be like:

// Parameter: $sDpName, string, device name
// Global variables
bool g_bCallbackConnected; // Current connection state
main()
{
dyn_string exceptionInfo;
unGenericObject_ButtonInit($sDpName, g_sFaceplateButtonType, exceptionInfo);
}

The panel contains:

  • $-param: $sDpName, this is the device DP name (section 3.3).
  • Mandatory variables:
    • g_bCallbackConnected: to keep the state of the remote system, this variable is used by the UNICORE functions.
    • g_dsUserAccess: used to keep the user access rights, this is the result of the function call TAG_prefixTAG_DeviceType_ButtonUserAccess.
    • g_sFaceplateButtonType: used to keep the kind of button action of the device, it must be set to TAG_DeviceType.
  • Any optional variable useful for the button animation, usually static data like unit, description, etc.
  • A call to unGenericObject_ButtonInit.
Device Action Interface

Device Action Libs: The data flow of the device action is described in Figure 56 and in Figure 57 when a user logs in or out. The function calls are:

  • TAG_prefixTAG_DeviceType_ButtonRegisterCB: configuration 4, section 4.2, DistributedControl callback function to the device system. The mandatory variables as well as any other optional variables declared in the device action interface panel can be read and set. Based on the result of the function unGenericObject_Connection which gives the state of the remote system, this function must:
    • If the state is DISCONNECT: call TAG_prefixTAG_DeviceType_ButtonDisconnection.
    • If the state is DPCONNECT: get the current user access rights by calling the function TAG_prefixTAG_DeviceType_ButtonUserAccess, the result must be kept in g_dsUserAccess, do a dpConnect to the device data and if needed to the front-end system integrity data, the proxy data and the linked data. In this device callback function, it is recommended to call the TAG_prefixTAG_DeviceType_ButtonSetState with g_dsUserAccess (this variable contains the current user access rights) and with the device data formatted the same way as the result of the function call TAG_prefixTAG_DeviceType_UserLogInGetButtonState.
    • If the state is DPDISCONNECT_DISCONNECT: do a dpDisconnect to the dpConnect data done in the DPCONNECT state and call TAG_prefixTAG_DeviceType_ButtonDisconnection.
  • TAG_prefixTAG_DeviceType_UserLogInGetButtonState: configuration 5, section 4.2, triggered by evalScript PVSS call. This function is called when the user logs in and out; it must return the device data in an array of 6 strings. This array of string will be given with g_dsUserAccess to the function TAG_prefixTAG_DeviceType_ButtonSetState. The format of this array must be the same as the one built in the device data callback function.
  • TAG_prefixTAG_DeviceType_ButtonSetState: configuration 6, section 4.2, triggered by execScript PVSS call. This function sets the attributes of the device action interface graphical object according to the current state of the device and the access rights of the user logged in, e.g.: button text, button enable state, etc.
  • TAG_prefixTAG_DeviceType_ButtonDisconnection: configuration 7, section 4.2, triggered by execScript PVSS call, there is no parameter given to the function. There is no access to the mandatory variables and any other optional variables declared in the device action panel. This function must animate the device action panel in case of the disconnection of the system or if the device is not existing or has the wrong type. Usually this function sets all the graphical elements to dark violet color and disables them.
  • TAG_prefixTAG_DeviceType_ButtonUserAccess: configuration 8, section 4.2, triggered by evalScript PVSS call. This function is called to get the current user access rights of the device. This is the list of authorized action on the device per privilege (section 9.2.1) that will be stored in g_dsUserAccess.
Device Action data flow
User log in/out data flow

Tips

  • In the device action panel, it is better to set the graphical object name to buttonActionName where ActionName is the list of action returned by the function TAG_prefixTAG_DeviceType_ButtonUserAccess. For instance the select button is named buttonSelect and the action is ‘Select’. Function like unGenericObject_ButtonDisconnect can be used to disable the device action buttons.
  • It is recommended to have in the device data used by the functions TAG_prefixTAG_DeviceType_ButtonSetState, TAG_prefixTAG_DeviceType_UserLogInGetButtonState and the device data animation callback the select state of the device: the state of the lock (true/false, DP.statusInformation.selectedManager:_lock._original._locked) and the entity which locked the device (DP.statusInformation.selectedManager). Functions like unSelectDeselectHMI_getSelectedState and unGenericObject_ButtonAnimateSelect can be used to get and animate the select button.

Device Acknowledge

The acknowledge of the device DPE alarm can be triggered:

  • From the panel: panels/objects/UN_INFOS/unFaceplate_ButtonAckAlarm.pnl.
  • By a call the function unGenericObject_Acknowledge. The function unGenericObject_HandleUnicosMenu will call unGenericObject_Acknowledge if the selected choice has a value 2.
  • From the ack alarm of the UNICOS alarm list.

The data flow is described in Figure 58. The function call is: TAG_prefixTAG_DeviceType_AcknowledgeAlarm: configuration 1, section 4.2, triggered by evalScript PVSS call. This function must return the list of device DPE having an alert_hdl PVSS config to acknowledge and UN_ACKNOWLEDGE_PLC (“PLC”) if the acknowledge must be sent to the CPC front-end.

Device acknowledge data flow

Alarm Screen

The UNICOS device alarm screen (Figure 59) is used to display the device alarm. To configure the alarm on a device DPE one has to use one of the following functions: unConfigGenericFunctions_setAlarmDescription, unConfigGenericFunctions_setDigitalAlert and unConfigGenericFunctions_setAnalogAlert. One has to add in the Alarm bits configuration panels (Figure 60) the text that can be used in the Name selection list of the filter of the UNICOS device alarm screen (Figure 59), therefore the filtering on one particular device alarm name will be possible.

UNICOS device alarm screen
UNICOS alarm name definition

Event List

The UNICOS event list (Figure 61) is used to list the UNICOS event of the device. A UNICOS event is a bit transition of a 16 bit integer. Two modes are supported:

  • Event16: only the 16 first bits are used, the comparison to the old bit value is done with the previously archived data.
  • Event32: the old 16 bit event value and the current 16 bit value are mixed in the 32 bit integer value.

The following configurations have to be done:

  • The bit names and transition (Figure 62).
  • The DPE which will be used to store the event (Figure 63).
  • The mode used (Figure 63).
UNICOS device event list
UNICOS device event list bit transition and name configuration
UNICOS device event list DPEs and mode

APPENDIX A: TAG_PREFIXCONFIGTAG_FRONTENDTYPE.CTL

/**@file
// TAG_prefixConfigTAG_FrontEndType.ctl
This library contains the function to configure the TAG_FrontEndType.
@par Creation Date
dd/mm/yyyy
@par Modification History
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@author
the author (DEP-GROUP)
*/
//@{
// put here any constant if not in the constant declaration file
//@}
//@{
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixConfigTAG_FrontEndType_checkDeleteCommand
/** check the content of the delete command
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param dsConfig input, config line as dyn_string
@param dsDeleteDps output, list of dp that will be deleted
@param exceptionInfo output, for errors
*/
TAG_prefixConfigTAG_FrontEndType_checkDeleteCommand(dyn_string dsConfig, dyn_string &dsDeleteDps, dyn_string &exceptionInfo)
{
string sFeName, sFESubApplication = "", sDeviceType = "", sNumber = "", sDpFEName;
dyn_string dsAlarmDps;
if (dynlen(dsConfig) >= 2) // At least, delete instruction and front-end name
{
// get FE Name
sFeName = dsConfig[2];
if ((sFeName != "") && (dsConfig[1] == UN_DELETE_COMMAND))
{
if (dynlen(dsConfig) >= 3)
{
// get Application
sFESubApplication = dsConfig[3];
}
if (dynlen(dsConfig) >= 4)
{
// get DeviceType
sDeviceType = dsConfig[4];
}
if (dynlen(dsConfig) >= 5)
{
// get device number
sNumber = dsConfig[5];
}
unGenericDpFunctions_getPlcDevices("", sFeName, sFESubApplication, sDeviceType, sNumber, dsDeleteDps);
// if only delete key word then delete also modbus and systemalarm
if ((sFeName != "") && (sFESubApplication == "") && (sDeviceType == "") && (sNumber == ""))
{
// sDpFe is TAG_FrontEndType_feName
sDpFEName = c_TAG_prefixSystemIntegrity_TAG_FRONTENDTYPE+sFeName;
if (dpExists(sDpFEName))
{
// add here any other DP tp delete
dsAlarmDps = dpNames(c_unSystemAlarm_dpPattern + "*" + substr(sDpFEName, strpos(sDpFEName, ":") + 1) +
"*",c_unSystemAlarm_dpType);
dynAppend(dsDeleteDps, dsAlarmDps);
}
}
}
else
{
fwException_raise(exceptionInfo,"ERROR","TAG_prefixConfigTAG_FrontEndType_checkDeleteCommand:" +
getCatStr("unGeneration","BADINPUTS"),"");
}
}
else
{
fwException_raise(exceptionInfo,"ERROR","TAG_prefixConfigTAG_FrontEndType_checkDeleteCommand:" +
getCatStr("unGeneration","BADINPUTS"),"");
}
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix import TAG_FrontEndType "+sFeName,
"TAG_prefixConfigTAG_FrontEndType_checkDeleteCommand", dsConfig, dsDeleteDps);
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixConfigTAG_FrontEndType_checkFrontEnd
/** check the content of the front-end
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sKeyWord input, keyword
@param dsConfig input, config of the front-end
@param dsDeleteDps input, the list of dp to delete
@param exceptionInfo output, for errors
*/
TAG_prefixConfigTAG_FrontEndType_checkFrontEnd(string sKeyWord, dyn_string dsConfig, dyn_string dsDeleteDps, dyn_string &exceptionInfo)
{
switch(sKeyWord) {
case UN_PLC_COMMAND:
TAG_prefixConfigTAG_FrontEndType_checkApplication(dsConfig, dsDeleteDps, exceptionInfo);
break;
case UN_FESYSTEMALARM_COMMAND:
// unConfigGenericFunctions_checkFESystemAlarm(dsConfig, exceptionInfo);
break;
default:
fwException_raise(exceptionInfo, "ERROR", getCatStr("unGeneration","UNKNOWNFUNCTION"), "");
break;
}
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixConfigTAG_FrontEndType_deleteCommand
/** execute the delete command
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param dsConfig input, config of the front-end
@param exceptionInfo output, for errors
*/
TAG_prefixConfigTAG_FrontEndType_deleteCommand(dyn_string dsConfig, dyn_string &exceptionInfo)
{
string sFEApplication = "", sDeviceType = "", sNumber = "", sh = "";
dyn_string dsDpeList, exceptionInfoTemp;
TAG_prefixConfigTAG_FrontEndType_checkDeleteCommand(dsConfig, dsDpeList, exceptionInfoTemp);
if (dynlen(exceptionInfoTemp) > 0)
{
dynAppend(exceptionInfo, exceptionInfoTemp);
fwException_raise(exceptionInfo,"ERROR","TAG_prefixConfigTAG_FrontEndType_deleteCommand:" +
getCatStr("unGeneration","BADINPUTS"),"");
}
else
{
if (dynlen(dsConfig) >= 2) // At least, delete instruction and fe name
{
if (dynlen(dsConfig) >= 3)
{
sFEApplication = dsConfig[3];
}
if (dynlen(dsConfig) >= 4)
{
sDeviceType = dsConfig[4];
}
if (dynlen(dsConfig) >= 5)
{
sNumber = dsConfig[5];
}
if(shapeExists("progressBar"))
sh = "progressBar";
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix import TAG_FrontEndType "+dsConfig[2],
"TAG_prefixConfigTAG_FrontEndType_deleteCommand", dsConfig);
unGenericDpFunctions_deletePlcDevices(dsConfig[2], sFEApplication, sDeviceType, sNumber, "progressBar", exceptionInfo);
if ((dsConfig[2] != "") && (sFEApplication == "") && (sDeviceType == "") && (sNumber == ""))
{
TAG_prefixConfigTAG_FrontEndType_deleteFrontEnd(dsConfig[2], exceptionInfo);
}
}
}
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixConfigTAG_FrontEndType_setFrontEnd
/** execute the set: set the front-end config
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sKeyWord input, keyword
@param dsConfig input, config line as dyn_string
@param exceptionInfo output, for errors
*/
TAG_prefixConfigTAG_FrontEndType_setFrontEnd(string sKeyWord, dyn_string dsConfig, dyn_string &exceptionInfo)
{
string sDeviceType, sFeName, sFeType, sAnalogArchive, sDpName;
int iNumber, driver;
bool bEvent16;
// int iWorldFIP;
switch(sKeyWord) {
case UN_PLC_COMMAND:
TAG_prefixConfigTAG_FrontEndType_setApplication(dsConfig, exceptionInfo);
break;
case UN_FESYSTEMALARM_COMMAND:
/* if(dynlen(dsConfig) == UN_TAG_FRONTENDTYPE_SETFESYSTEM_ALARM_LENGTH) {
sDeviceType = dsConfig[UN_TAG_FRONTENDTYPE_FESYSTEMALARM_DEVICENAME];
sFeName = dsConfig[UN_TAG_FRONTENDTYPE_FESYSTEMALARM_PLCNAME];
sFeType = dsConfig[UN_TAG_FRONTENDTYPE_FESYSTEMALARM_TYPE];
iNumber = dsConfig[UN_TAG_FRONTENDTYPE_FESYSTEMALARM_PLCNUMBER];
driver = dsConfig[UN_TAG_FRONTENDTYPE_FESYSTEMALARM_DRIVER];
bEvent16 = dsConfig[UN_TAG_FRONTENDTYPE_FESYSTEMALARM_EVENT16];
sAnalogArchive = dsConfig[UN_TAG_FRONTENDTYPE_FESYSTEMALARM_ARCHIVE];
iWorldFIP = dsConfig[UN_TAG_FRONTENDTYPE_SETFESYSTEM_ALARM_ADDRESS];
unConfigGenericFunctions_setFESystemAlarm(dsConfig, makeDynString(sDeviceType, sFeName, sFeType, iNumber, driver, bEvent16,
sAnalogArchive), exceptionInfo);
sDpName = c_unSystemAlarm_dpPattern + FE_pattern + sDeviceType + ".";
unConfigGenericFunctions_setDescription(sDpName, iWorldFIP, exceptionInfo);
}
else
fwException_raise(exceptionInfo,"ERROR","TAG_prefixConfigTAG_FrontEndType_setFrontEnd: " + getCatStr("unGeneration","BADINPUTS"),"");
*/
break;
default:
fwException_raise(exceptionInfo, "ERROR", getCatStr("unGeneration","UNKNOWNFUNCTION"), "");
break;
}
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixConfigTAG_FrontEndType_checkApplication
/** check the content of the front-end config
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param dsConfig input, config of the front-end + additional parameters (driver number, boolean archive name, analog archive name)
@param dsDeleteDps input, the list of dp to delete
@param exceptionInfo output, for errors
*/
TAG_prefixConfigTAG_FrontEndType_checkApplication(dyn_string dsConfig, dyn_string dsDeleteDps, dyn_string &exceptionInfo)
{
dyn_string dsConfigLine, dsConfigAdditionalData;
int i, iRes, iDriverNum;
string sFeDP, sHostname, sAliasDp, tempDp;
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix import TAG_FrontEndType "+dsConfig[UN_CONFIG_PLC_NAME],
"TAG_prefixConfigTAG_FrontEndType_checkApplication", UN_CONFIG_CVT_LENGTH, dsConfig);
if (dynlen(dsConfig) == (UN_CONFIG_TAG_FRONTENDTYPE_LENGTH + UN_CONFIG_PLC_ADDITIONAL_LENGTH))
{
dsConfigLine = dsConfig;
for(i=1;i<=UN_CONFIG_PLC_ADDITIONAL_LENGTH;i++)
{
dynAppend(dsConfigAdditionalData, dsConfigLine[UN_CONFIG_TAG_FRONTENDTYPE_LENGTH+1]);
dynRemove(dsConfigLine,UN_CONFIG_TAG_FRONTENDTYPE_LENGTH+1);
}
TAG_prefixConfigTAG_FrontEndType_checkData(dsConfigLine, exceptionInfo);
TAG_prefixConfigTAG_FrontEndType_checkAdditionalData(dsConfigAdditionalData, exceptionInfo);
// first check if the FE name is correct:
tempDp = dsConfigLine[UN_CONFIG_PLC_NAME];
if(!unConfigGenericFunctions_nameCheck(tempDp)) {
fwException_raise(exceptionInfo,"ERROR","TAG_prefixConfigTAG_FrontEndType_checkApplication: " + dsConfigLine[UN_CONFIG_PLC_NAME] +
getCatStr("unGeneration","BADPLCNAME"),"");
return;
}
// check if the FE Application Name is correct:
tempDp = dsConfigLine[UN_CONFIG_PLC_SUBAPPLICATION];
if(!unConfigGenericFunctions_nameCheck(tempDp)) {
fwException_raise(exceptionInfo,"ERROR","TAG_prefixConfigTAG_FrontEndType_checkApplication: " +
dsConfigLine[UN_CONFIG_PLC_SUBAPPLICATION] + getCatStr("unGeneration","BADPLCAPPLICATIONNAME"),"");
return;
}
// check if the front-end configurations are correct
// sFEDp is TAG_FrontEndType_feName
sFeDP = getSystemName() + c_TAG_prefixSystemIntegrity_TAG_FRONTENDTYPE + dsConfigLine[UN_CONFIG_PLC_NAME];
// sAliasDp = dpAliasToName(dsConfigLine[UN_CONFIG_PLC_NAME]);
sAliasDp = unGenericDpFunctions_dpAliasToName(dsConfigLine[UN_CONFIG_PLC_NAME]);
//DebugN(sAliasDp, dsConfigLine[UN_CONFIG_PLC_NAME]);
if (substr(sAliasDp, strlen(sAliasDp) - 1) == ".")
{
sAliasDp = substr(sAliasDp, 0, strlen(sAliasDp) - 1);
}
if ((sAliasDp != "") && (sAliasDp != sFeDP))
{
if (dynContains(dsDeleteDps, sAliasDp) <= 0) // Alias exists, is not used by the "TAG_FrontEndType" config datapoint and will not be deleted
{
fwException_raise(exceptionInfo,"ERROR","TAG_prefixConfigTAG_FrontEndType_checkApplication: " + dsConfigLine[UN_CONFIG_PLC_NAME]
+ getCatStr("unGeneration","BADHOSTNAMEALIAS") + sAliasDp,"");
}
}
if (dpExists(sFeDP) && (dynContains(dsDeleteDps, sFeDP) <= 0))
{
sHostname = unGenericDpFunctions_getAlias(sFeDP);
iRes = dpGet(sFeDP + ".communication.driver_num", iDriverNum);
if (iRes >= 0)
{
if (iDriverNum != dsConfigAdditionalData[UN_CONFIG_PLC_ADDITIONAL_DRIVER_NUM])
{
fwException_raise(exceptionInfo,"ERROR","TAG_prefixConfigTAG_FrontEndType_checkApplication: " +
getCatStr("unGeneration","BADEXISTINGPLCDRIVER"),"");
}
if (sHostname != dsConfigLine[UN_CONFIG_PLC_NAME])
{
fwException_raise(exceptionInfo,"ERROR","TAG_prefixConfigTAG_FrontEndType_checkApplication: " +
getCatStr("unGeneration","BADEXISTINGPLCHOSTNAME"),"");
}
}
}
}
else
{
fwException_raise(exceptionInfo,"ERROR","TAG_prefixConfigTAG_FrontEndType_checkApplication: " +
getCatStr("unGeneration","BADINPUTS"),"");
}
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixConfigTAG_FrontEndType_checkData
/** check the front-end config
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param dsConfig input, config of the front-end + additional parameters (driver number, boolean archive name, analog archive name)
@param exceptionInfo output, for errors
*/
TAG_prefixConfigTAG_FrontEndType_checkData(dyn_string dsConfig, dyn_string &exceptionInfo)
{
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix import TAG_FrontEndType "+dsConfig[UN_CONFIG_PLC_NAME],
"TAG_prefixConfigTAG_FrontEndType_checkData", dsConfig);
if (dynlen(dsConfig) != UN_CONFIG_TAG_FRONTENDTYPE_LENGTH)
{
fwException_raise(exceptionInfo,"ERROR","TAG_prefixConfigTAG_FrontEndType_checkData:" + getCatStr("unGeneration","BADINPUTS"),"");
}
else
{
unConfigGenericFunctions_checkPLCType(dsConfig[UN_CONFIG_PLC_TYPE], exceptionInfo);
if (strrtrim(dsConfig[UN_CONFIG_PLC_NAME]) == "")
{
fwException_raise(exceptionInfo,"ERROR","TAG_prefixConfigTAG_FrontEndType_checkData:" +
getCatStr("unGeneration","ERRORPLCNAME"),"");
}
if (strrtrim(dsConfig[UN_CONFIG_PLC_SUBAPPLICATION]) == "")
{
fwException_raise(exceptionInfo,"ERROR","TAG_prefixConfigTAG_FrontEndType_checkData:" +
getCatStr("unGeneration","ERRORSUBAPPLI"),"");
}
}
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixConfigTAG_FrontEndType_checkAdditionalData
/** check the front-end config
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param dsAdditionalConfig input, additional parameters (driver number, boolean archive name, analog archive name)
@param exceptionInfo output, for errors
*/
TAG_prefixConfigTAG_FrontEndType_checkAdditionalData(dyn_string dsAdditionalConfig, dyn_string &exceptionInfo)
{
unsigned uDriver;
if (dynlen(dsAdditionalConfig) != UN_CONFIG_PLC_ADDITIONAL_LENGTH)
{
fwException_raise(exceptionInfo,"ERROR","TAG_prefixConfigTAG_FrontEndType_checkAdditionalData:" +
getCatStr("unGeneration","BADINPUTS"),"");
}
else
{
unConfigGenericFunctions_checkUnsigned(dsAdditionalConfig[UN_CONFIG_PLC_ADDITIONAL_DRIVER_NUM], uDriver, exceptionInfo);
if (dsAdditionalConfig[UN_CONFIG_PLC_ADDITIONAL_ARCHIVE_BOOL] == "")
{
fwException_raise(exceptionInfo,"ERROR","TAG_prefixConfigTAG_FrontEndType_checkAdditionalData: bool archive" +
getCatStr("unGeneration","ERRORARCHIVEEMPTY"),"");
}
if (dsAdditionalConfig[UN_CONFIG_PLC_ADDITIONAL_ARCHIVE_ANALOG] == "")
{
fwException_raise(exceptionInfo,"ERROR","TAG_prefixConfigTAG_FrontEndType_checkAdditionalData: analog archive" +
getCatStr("unGeneration","ERRORARCHIVEEMPTY"),"");
}
if (dsAdditionalConfig[UN_CONFIG_PLC_ADDITIONAL_ARCHIVE_EVENT] == "")
{
fwException_raise(exceptionInfo,"ERROR","TAG_prefixConfigTAG_FrontEndType_checkAdditionalData: event archive" +
getCatStr("unGeneration","ERRORARCHIVEEMPTY"),"");
}
}
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixConfigTAG_FrontEndType_setApplication
/** check the front-end config
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param dsConfigAndAdditionnal input, config of the front-end + additional parameters (driver number, boolean archive name, analog archive
name)
@param exceptionInfo output, for errors
*/
TAG_prefixConfigTAG_FrontEndType_setApplication(dyn_string dsConfigAndAdditionnal, dyn_string &exceptionInfo)
{
int iRes, i, position, iDriverNumber;
string sDpName, addressReference, tempDp, sSection, sDriverLine;
dyn_string dsConfig, dsAdditionalParameters, dsSubApplications, dsImportTimes, dsBoolArchives, dsAnalogArchives, exceptionInfoTemp;
dyn_string dsEntry, dsEventArchives, dsConfigSection;
// Check
if (dynlen(dsConfigAndAdditionnal) == (UN_CONFIG_TAG_FRONTENDTYPE_LENGTH + UN_CONFIG_PLC_ADDITIONAL_LENGTH))
{
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix import TAG_FrontEndType
"+dsConfigAndAdditionnal[UN_CONFIG_PLC_NAME], "TAG_prefixConfigTAG_FrontEndType_setApplication", dsConfigAndAdditionnal);
// 1. Separate config file info and additional parameters
dsConfig = dsConfigAndAdditionnal;
dynClear(dsAdditionalParameters);
for(i=1;i<=UN_CONFIG_PLC_ADDITIONAL_LENGTH;i++)
{
dynAppend(dsAdditionalParameters, dsConfig[UN_CONFIG_TAG_FRONTENDTYPE_LENGTH+1]);
dynRemove(dsConfig,UN_CONFIG_TAG_FRONTENDTYPE_LENGTH+1);
}
// check if the FE Application Name is correct:
tempDp = dsConfigAndAdditionnal[UN_CONFIG_PLC_SUBAPPLICATION];
if(!unConfigGenericFunctions_nameCheck(tempDp)) {
fwException_raise(exceptionInfo,"ERROR","TAG_prefixConfigTAG_FrontEndType_setApplication: " +
dsConfigAndAdditionnal[UN_CONFIG_PLC_SUBAPPLICATION] + getCatStr("unGeneration","BADPLCAPPLICATIONNAME"),"");
return;
}
// 3. Set FE configuration in TAG_FrontEndType
// create the TAG_FrontEndType instance
sDpName = c_TAG_prefixSystemIntegrity_TAG_FRONTENDTYPE + dsConfig[UN_CONFIG_PLC_NAME];
tempDp = sDpName;
unConfigGenericFunctions_createDp(sDpName, TAG_PREFIX_TAG_FRONTENDTYPE_DPTYPE, exceptionInfoTemp);
if (dynlen(exceptionInfoTemp) <= 0)
{
// set the device name (alias) and the appl, archive, time.
sDpName = getSystemName() + sDpName;
unConfigGenericFunctions_setAlias(sDpName, dsConfig[UN_CONFIG_PLC_NAME], exceptionInfo);
iRes = dpGet(sDpName + ".configuration.subApplications", dsSubApplications,
sDpName + ".configuration.importTime", dsImportTimes,
sDpName + ".configuration.archive_bool", dsBoolArchives,
sDpName + ".configuration.archive_analog", dsAnalogArchives,
sDpName + ".configuration.archive_event", dsEventArchives);
position = dynContains(dsSubApplications, dsConfig[UN_CONFIG_PLC_SUBAPPLICATION]);
if (position <= 0)
{
position = dynlen(dsSubApplications) + 1;
}
dsSubApplications[position] = dsConfig[UN_CONFIG_PLC_SUBAPPLICATION];
dsImportTimes[position] = getCurrentTime();
dsBoolArchives[position] = dsAdditionalParameters[UN_CONFIG_PLC_ADDITIONAL_ARCHIVE_BOOL];
dsAnalogArchives[position] = dsAdditionalParameters[UN_CONFIG_PLC_ADDITIONAL_ARCHIVE_ANALOG];
dsEventArchives[position] = dsAdditionalParameters[UN_CONFIG_PLC_ADDITIONAL_ARCHIVE_EVENT];
iRes = dpSetWait(sDpName + ".configuration.importTime", dsImportTimes,
sDpName + ".configuration.archive_bool", dsBoolArchives,
sDpName + ".configuration.archive_analog", dsAnalogArchives,
sDpName + ".configuration.archive_event", dsEventArchives,
sDpName + ".configuration.subApplications",dsSubApplications,
sDpName + ".communication.driver_num", dsAdditionalParameters[UN_CONFIG_PLC_ADDITIONAL_DRIVER_NUM]);
if (iRes < 0)
{
fwException_raise(exceptionInfo,"ERROR","TAG_prefixConfigTAG_FrontEndType_setApplication: " + getCatStr("unPVSS","DPSETFAILED"),"");
}
// create any other DP if needed
// unConfigGenericFunctions_createDp(...);
// set the FE configuration
// dpSetWait(sDpName+".configuration..", ...);
// set the FE DPE
// 4. Create _UnSystemAlarm device
unSystemIntegrity_createSystemAlarm(tempDp,
DS_pattern,
getCatStr("unSystemIntegrity", "PLC_DS_DESCRIPTION") + dsConfig[UN_CONFIG_PLC_NAME] + " -> DS driver " +
dsAdditionalParameters[UN_CONFIG_PLC_ADDITIONAL_DRIVER_NUM],
exceptionInfo);
// set the archive config of the _UnSystemAlarm device
fwArchive_set(c_unSystemAlarm_dpPattern+DS_pattern+tempDp+".alarm",
dsAdditionalParameters[UN_CONFIG_PLC_ADDITIONAL_ARCHIVE_BOOL],
DPATTR_ARCH_PROC_SIMPLESM,
DPATTR_COMPARE_OLD_NEW,
0,
0,
exceptionInfo);
// create any other _UnSystemAlarm device
// unSystemIntegrity_createSystemAlarm(tempDp, pattern, ...);
/* fwArchive_set(c_unSystemAlarm_dpPattern+pattern+tempDp+".alarm",
dsAdditionalParameters[UN_CONFIG_PLC_ADDITIONAL_ARCHIVE_BOOL],
DPATTR_ARCH_PROC_SIMPLESM,
DPATTR_COMPARE_OLD_NEW,
0,
0,
exceptionInfo);*/
// 5. set config file driver sdection if needed
iDriverNumber = dsAdditionalParameters[UN_CONFIG_PLC_ADDITIONAL_DRIVER_NUM];
iRes=fwInstallation_getSection("DriverType"+iDriverNumber, dsConfigSection);
if(dynlen(dsConfigSection) <= 0) {
// add in the section the data
// set the section in the config file
iRes = fwInstallation_setSection("DriverType"+iDriverNumber, dsConfigSection);
// create any internal DP the driver may need
}
// create any internal DP the front-end may need
// do any setting the the front-end may need
// set address config on counter
/*fwPeriphAddress_set(sDpName+".communication.counter",
makeDynString(fwPeriphAddress_TYPE_?,
dsAdditionalParameters[UN_CONFIG_PLC_ADDITIONAL_DRIVER_NUM],
dsConfig[...],
....),
exceptionInfo);*/
// set address config on any other fe DPE.
/*fwPeriphAddress_set(sDpName+"....",
makeDynString(fwPeriphAddress_TYPE_?,
dsAdditionalParameters[UN_CONFIG_PLC_ADDITIONAL_DRIVER_NUM],
dsConfig[...],
....),
exceptionInfo);*/
// set any other config
}
else
{
dynAppend(exceptionInfo, exceptionInfoTemp);
}
}
else
{
fwException_raise(exceptionInfo,"ERROR","TAG_prefixConfigTAG_FrontEndType_setApplication: " + getCatStr("unGeneration","BADINPUTS"),"");
}
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixConfigTAG_FrontEndType_deleteFrontEnd
/** delete the front-end and its devices
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sFeName input, the front-end name
@param exceptionInfo output, for errors
*/
TAG_prefixConfigTAG_FrontEndType_deleteFrontEnd(string sFeName, dyn_string& exceptionInfo)
{
string sDpFeName, exceptionText;
int i, length, iRes;
dyn_string dsAlarmDps;
sDpFeName = c_TAG_prefixSystemIntegrity_TAG_FRONTENDTYPE+sFeName;
if (!dpExists(sDpFeName))
sDpFeName = "";
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix import TAG_FrontEndType "+sFeName,
"TAG_prefixConfigTAG_FrontEndType_deleteFrontEnd", sFeName, sDpFeName);
if (sDpFeName != "")
{
if (unGenericDpFunctions_getSystemName(sDpFeName) == getSystemName())
{
// 1. delete any associated front-end DP
// dpGet(sDpPlcName+"....", sDp);
// dpDelete(sPlcModPlc);
// 2. Delete TAG_FrontEndType
iRes = dpDelete(substr(sDpFeName, strpos(sDpFeName, ":") + 1));
if (iRes < 0)
{
fwException_raise(exceptionInfo, "ERROR", "TAG_prefixConfigTAG_FrontEndType_deleteFrontEnd: " + substr(sDpFeName, strpos(sDpFeName,
":") + 1) + getCatStr("unGeneral", "UNOBJECTNOTDELETED"), "");
}
// 3. Delete system alarm devices
dsAlarmDps = dpNames(c_unSystemAlarm_dpPattern + "*" + substr(sDpFeName, strpos(sDpFeName, ":") + 1) + "*",c_unSystemAlarm_dpType);
length = dynlen(dsAlarmDps);
for(i=1;i<=length;i++)
{
// remove them first from the application DP list
_unSystemIntegrity_modifyApplicationAlertList(dsAlarmDps[i], false, exceptionInfo);
iRes = dpDelete(dsAlarmDps[i]);
if (iRes < 0)
{
fwException_raise(exceptionInfo, "ERROR", "TAG_prefixConfigTAG_FrontEndType_deleteFrontEnd: " + dsAlarmDps[i] +
getCatStr("unGeneral", "UNOBJECTNOTDELETED"), "");
}
}
}
else
{
fwException_raise(exceptionInfo, "ERROR", "TAG_prefixConfigTAG_FrontEndType_deleteFrontEnd: " + sDpFeName + getCatStr("unGeneral",
"UNOBJECTNOTDELETEDBADSYSTEM"), "");
}
}
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_FrontEndType_checkFESystemAlarm
/** check FE system alarm config line (called by unConfigGenericFunctions_checkFESystemAlarm)
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param dsConfig input, the FE system alarm config
@param exceptionInfo output, for errors
*/
TAG_FrontEndType_checkFESystemAlarm(dyn_string dsConfig, dyn_string &exceptionInfo)
{
if(dynlen(dsConfig) == UN_TAG_FRONTENDTYPE_CHECKFESYSTEM_ALARM_LENGTH) {
// check here the content of the FE system alarm line
}
else
fwException_raise(exceptionInfo,"ERROR","TAG_FrontEndType_checkFESystemAlarm:" + getCatStr("unGeneration","BADINPUTS"),"");
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_FrontEndType_setFESystemAlarm
/** set FE system alarm config line (called by unConfigGenericFunctions_setFESystemAlarm)
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param dsConfig input, the FE system alarm config
@param dsAdditionalParameters input, additional parameter (FE systemalarm type, number, driver number, device name, front-end name, archive
name)
@param dsAddress output, list of address config
*/
TAG_FrontEndType_setFESystemAlarm(dyn_string dsConfig, dyn_string dsAdditionalParameters, dyn_string &dsAddress)
{
int iDriverNum = dsAdditionalParameters[UN_CONFIG_ADDITIONAL_FESYSTEMALARM_DRIVER];
dsAddress = makeDynString(fwPeriphAddress_TYPE_,
iDriverNum,
dsConfig[UN_TAG_FRONTENDTYPE_SETFESYSTEM_ALARM_FIELD1]
// ....
);
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_FrontEndType_getFrontEndArchiveDp
/** return the list of front-end and all all other front-end dependant DPEs
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sKeyWord input, the keyword
@param sDp input, front-end DP
@param sFEType input, type of front-end
@param dsArchiveDp output, the list of front-end and all all other front-end dependant DPEs to be archived
*/
TAG_FrontEndType_getFrontEndArchiveDp(string sKeyWord, string sDp, string sFEType, dyn_string &dsArchiveDp)
{
switch(sKeyWord) {
case UN_PLC_COMMAND:
// return here the list of all the DPE which will have an _archive config during set front-end
// with UN_PLC_COMMAND keyword
// front-end DPE, system alarm DPE, etc.
dsArchiveDp = makeDynString(getSystemName()+c_unSystemAlarm_dpPattern+DS_pattern+sDp+".alarm");
break;
case UN_FESYSTEMALARM_COMMAND:
dsArchiveDp = makeDynString(sDp+".alarm");
break;
default:
dsArchiveDp = makeDynString();
break;
}
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_FrontEndType_getArchiveProxyDPE
/** return a dyn_dyn_string with the list of proxy DPE linked (or that will be linked)
to the front-end for the three archives: boolean, analog and event
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param dsConfigLine input, the front-end configuration
@return the list of DPE per archive (3)
*/
dyn_dyn_string TAG_FrontEndType_getArchiveProxyDPE(dyn_string dsConfigLine)
{
dyn_dyn_string dds;
//return here for the boolean archive the list of proxy DPEs linked to the front-end
dds[UN_CONFIG_ADDITIONAL_ARCHIVE_BOOL] = makeDynString();
//return here for the analog archive the list of proxy DPEs linked to the front-end
dds[UN_CONFIG_ADDITIONAL_ARCHIVE_ANALOG] = makeDynString();
//return here for the event archive the list of proxy DPEs linked to the front-end
dds[UN_CONFIG_ADDITIONAL_ARCHIVE_EVENT] = makeDynString();
return dds;
}
//------------------------------------------------------------------------------------------------------------------------
//@}

APPENDIX B: TAG_PREFIXCONFIGTAG_DEVICETYPE.CTL

/**@file
// TAG_prefixConfigTAG_DeviceType.ctl
This library contains the function to configure the TAG_DeviceType.
@par Creation Date
dd/mm/yyyy
@par Modification History
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@author
the author (DEP-GROUP)
*/
//@{
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixConfigTAG_DeviceType_checkConfig
/** check the device configuration
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param dsConfigs input, config line as dyn_string
@param exceptionInfo output, for errors
*/
TAG_prefixConfigTAG_DeviceType_checkConfig(dyn_string dsConfigs, dyn_string &exceptionInfo)
{
if (dynlen(dsConfigs) >= UN_CONFIG_COMMON_LENGTH)
{
// 1. Common
unConfigGenericFunctions_checkParameters(dsConfigs, "TAG_DeviceType", exceptionInfo);
// 2. call the device check function
unConfigGenericFunctions_checkDeviceConfig(dsConfigs, "TAG_DeviceType", exceptionInfo);
}
else
{
fwException_raise(exceptionInfo,"ERROR","TAG_prefixConfigConfigTAG_DeviceType_checkConfig: " +
getCatStr("unGeneration","BADINPUTS"),"");
}
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixConfigTAG_DeviceType_setConfig
/** set the device configuration
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param dsConfigs input, config line as dyn_string
@param exceptionInfo output, for errors
*/
TAG_prefixConfigTAG_DeviceType_setConfig(dyn_string dsConfigs, dyn_string &exceptionInfo)
{
string sDpName;
// 1. Initialization : checking + dpCreate
unConfigGenericFunctions_checkAll(dsConfigs, "TAG_DeviceType", exceptionInfo);
if (dynlen(exceptionInfo) <= 0) // Good inputs
{
sDpName = dsConfigs[UN_CONFIG_OBJECTGENERAL_DPNAME];
unConfigGenericFunctions_createDp(sDpName, "TAG_DeviceType", exceptionInfo);
if (dynlen(exceptionInfo) <= 0) // Creation ok or dp already exists
{
// 2. Generate device
// 2.1. Parameters
unConfigGenericFunctions_setCommon(dsConfigs, exceptionInfo);
// 2.2 call the device check function
unConfigGenericFunctions_setDeviceConfig(dsConfigs, "TAG_DeviceType", exceptionInfo);
}
}
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_FrontEndType_TAG_DeviceType_checkConfig
/** check the TAG_DeviceType device configuration for the TAG_FrontEndType front-end
@par Constraints
None
@par Usage
Internal
@par PVSS managers
Ui, CTRL
@param dsConfigs input, config line as dyn_string
@param exceptionInfo output, for errors
*/
TAG_FrontEndType_TAG_DeviceType_checkConfig(dyn_string dsConfigs, dyn_string &exceptionInfo)
{
bool bOk=false;
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix import TAG_FrontEndType_TAG_DeviceType",
"TAG_FrontEndType_TAG_DeviceType_checkConfig", dsConfigs);
if (dynlen(dsConfigs) == (TAG_PREFIX_CONFIG_TAG_DEVICETYPE_LENGTH + UN_CONFIG_COMMON_LENGTH))
bOk = true;
else if (dynlen(dsConfigs) == (TAG_PREFIX_CONFIG_TAG_DEVICETYPE_LENGTH + UN_CONFIG_COMMON_LENGTH +
UN_CONFIG_ADDITIONAL_ARCHIVE_LENGTH)) {
bOk = true;
unConfigGenericFunctions_checkArchive(dsConfigs[TAG_PREFIX_CONFIG_TAG_DEVICETYPE_LENGTH + UN_CONFIG_COMMON_LENGTH +
UN_CONFIG_ADDITIONAL_ARCHIVE_BOOL],
dsConfigs[TAG_PREFIX_CONFIG_TAG_DEVICETYPE_LENGTH + UN_CONFIG_COMMON_LENGTH +
UN_CONFIG_ADDITIONAL_ARCHIVE_ANALOG],
dsConfigs[TAG_PREFIX_CONFIG_TAG_DEVICETYPE_LENGTH + UN_CONFIG_COMMON_LENGTH +
UN_CONFIG_ADDITIONAL_ARCHIVE_EVENT],
exceptionInfo);
}
else
bOk = false;
if(bOk) {
// check all the device configuration
// if the archive config is defined check if the archive config is Ok
//unConfigGenericFunctions_checkArchiveParameters(0, dsConfigs[UN_CONFIG_COMMON_LENGTH +
TAG_PREFIX_CONFIG_TAG_DEVICETYPE_ARCHIVEACTIVE], exceptionInfo);
}
else
{
fwException_raise(exceptionInfo,"ERROR","TAG_FrontEndType_TAG_DeviceType_checkConfig: " + getCatStr("unGeneration","BADINPUTS"),"");
}
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_FrontEndType_TAG_DeviceType_setConfig
/** set the TAG_DeviceType device configuration for the TAG_FrontEndType front-end
@par Constraints
None
@par Usage
Internal
@par PVSS managers
Ui, CTRL
@param dsConfigs input, config line as dyn_string
@param exceptionInfo output, for errors
*/
TAG_FrontEndType_TAG_DeviceType_setConfig(dyn_string dsConfigs, dyn_string &exceptionInfo)
{
string sDpName;
bool bArchive;
int iArchiveTimeFilter, iArchiveType, iSmoothProcedure;
float fDeadband;
sDpName = dsConfigs[UN_CONFIG_OBJECTGENERAL_DPNAME];
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix import TAG_FrontEndType_TAG_DeviceType "+sDpName,
"TAG_FrontEndType_TAG_DeviceType_setConfig", dsConfigs);
// if archive name are in the config->overwrite panel setting.
if(dynlen(dsConfigs) == (TAG_PREFIX_CONFIG_TAG_DEVICETYPE_LENGTH + UN_CONFIG_ALLCOMMON_LENGTH +
UN_CONFIG_ADDITIONAL_ARCHIVE_LENGTH)) {
if(dsConfigs[TAG_PREFIX_CONFIG_TAG_DEVICETYPE_LENGTH + UN_CONFIG_ALLCOMMON_LENGTH +
UN_CONFIG_ADDITIONAL_ARCHIVE_BOOL] != "")
dsConfigs[UN_CONFIG_OBJECTGENERAL_ARCHIVE_BOOL] = dsConfigs[TAG_PREFIX_CONFIG_TAG_DEVICETYPE_LENGTH +
UN_CONFIG_ALLCOMMON_LENGTH + UN_CONFIG_ADDITIONAL_ARCHIVE_BOOL];
if(dsConfigs[TAG_PREFIX_CONFIG_TAG_DEVICETYPE_LENGTH + UN_CONFIG_ALLCOMMON_LENGTH +
UN_CONFIG_ADDITIONAL_ARCHIVE_ANALOG] != "")
dsConfigs[UN_CONFIG_OBJECTGENERAL_ARCHIVE_ANALOG] = dsConfigs[TAG_PREFIX_CONFIG_TAG_DEVICETYPE_LENGTH +
UN_CONFIG_ALLCOMMON_LENGTH + UN_CONFIG_ADDITIONAL_ARCHIVE_ANALOG];
if(dsConfigs[TAG_PREFIX_CONFIG_TAG_DEVICETYPE_LENGTH + UN_CONFIG_ALLCOMMON_LENGTH +
UN_CONFIG_ADDITIONAL_ARCHIVE_EVENT] != "")
dsConfigs[UN_CONFIG_OBJECTGENERAL_ARCHIVE_EVENT] = dsConfigs[TAG_PREFIX_CONFIG_TAG_DEVICETYPE_LENGTH +
UN_CONFIG_ALLCOMMON_LENGTH + UN_CONFIG_ADDITIONAL_ARCHIVE_EVENT];
}
/* set all the device config that have to be set:
-DPE alias: use unConfigGenericFunctions_setAlias
-DPE description: use unConfigGenericFunctions_setDescription
-periph address: use JCOP function
-pv_range: use JCOP function
-alarm:
-archive:
// get archive config
unConfigGenericFunctions_getArchiving(dsConfigs[UN_CONFIG_ALLCOMMON_LENGTH +
TAG_PREFIX_CONFIG_TAG_DEVICETYPE_ARCHIVEACTIVE],
bArchive, iArchiveTimeFilter, iArchiveType, iSmoothProcedure);
unConfigGenericFunctions_getArchivingDeadband(dsConfigs[UN_CONFIG_ALLCOMMON_LENGTH +
TAG_PREFIX_CONFIG_TAG_DEVICETYPE_ARCHIVEACTIVE], fDeadband);
// set archive config
if(bArchive)
fwArchive_set(sDpName + "...", dsConfigs[UN_CONFIG_OBJECTGENERAL_ARCHIVE_BOOL],
iArchiveType, iSmoothProcedure, fDeadband, iArchiveTimeFilter,exceptionInfo);
else
fwArchive_delete(sDpName + ".ProcessOutput.value", exceptionInfo);
-DPE value
-proxy: create the proxy DP, set the proxy configuration, DPE config, etc.
-set the faceplate limits for the DPE in faceplate: use unGenericDpFunctions_setFaceplateRange
-etc.
*/
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_DeviceType_getArchiveDPE
/** return the list of TAG_DeviceType DPE per archive (Bool, Ana, Event)
@par Constraints
None
@par Usage
Internal
@par PVSS managers
Ui, CTRL
@return output, list of DPE
*/
/* Comment this function if you want to use the default setting:
Bool archive: bool, char DPE
Ana archive: float DPE, int and uint DPE except evStsReg*
Event archive: evStsReg* int and uint, struct DPE
*/
dyn_string TAG_DeviceType_getArchiveDPE()
{
dyn_string dsRet;
dyn_string dsArchiveElements, exceptionInfo, dsDpel;
dyn_int diDpelType;
int i, len, j, k, length, lengthk, pos;
string archiveBoolNames, archiveEventNames, archiveAnalogNames;
string sDeviceType="TAG_DeviceType";
// dsRet[1] = ".ProcessInput.DPE1"+ ";"+".ProcessInput.DPE2";
// dsRet[2] = archiveAnalogNames;
// dsRet[3] = archiveEventNames;
// the following code can also be used
// in this example:
// Bool archive: bool, char DPE
// Ana archive: float DPE, blob DPE, all int DPE except evStsReg*
// Event archive: evStsReg* int, uint, struct DPE
// get all the DPE having an archive config from the JCOP device definition
fwDevice_getArchiveElements(sDeviceType, dsArchiveElements, exceptionInfo);
// get all the DPE from the device type
unGenericDpFunctions_getDPE(sDeviceType, dsDpel, diDpelType);
length = dynlen(dsArchiveElements);
lengthk = dynlen(dsDpel);
//DebugN(length, lengthk);
for(j=1;j<=length;j++)
{
for(k=1;k<=lengthk;k++) {
//DebugN(dsDpel[k], dsArchiveElements[j]);
if((sDeviceType+dsArchiveElements[j]) == dsDpel[k]) {
switch(diDpelType[k]){
case DPEL_CHAR:
case DPEL_BOOL:
archiveBoolNames = archiveBoolNames + dsArchiveElements[j] + ";";
break;
case DPEL_FLOAT:
archiveAnalogNames = archiveAnalogNames + dsArchiveElements[j] + ";";
break;
case DPEL_INT:
// if DPE like evStsReg --> put it in event archive
if (patternMatch(".ProcessInput.evStsReg*", dsArchiveElements[j]))
{
archiveEventNames = archiveEventNames + dsArchiveElements[j] + ";";
}
else
{
archiveAnalogNames = archiveAnalogNames + dsArchiveElements[j] + ";";
}
break;
case DPEL_UINT:
case DPEL_BOOL_STRUCT:
archiveEventNames = archiveEventNames + dsArchiveElements[j] + ";";
break;
case DPEL_BLOB:
archiveAnalogNames = archiveAnalogNames + dsArchiveElements[j] + ";";
break;
}
}
}
}
dsRet[1] = archiveBoolNames;
dsRet[2] = archiveAnalogNames;
dsRet[3] = archiveEventNames;
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix import TAG_DeviceType", "TAG_DeviceType_getArchiveDPE", dsRet);
return dsRet;
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_DeviceType_getArchiveProxyDPE
/** return a dyn_dyn_string with the list of proxy DPE linked (or that will be linked)
to the device for the three archives: boolean, analog and event
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param dsConfigLine input, the device configuration
@return the list of DPE per archive (3)
*/
dyn_dyn_string TAG_DeviceType_getArchiveProxyDPE(dyn_string dsConfigLine)
{
dyn_dyn_string dds;
//return here for the boolean archive the list of proxy DPEs linked to the device
dds[UN_CONFIG_ADDITIONAL_ARCHIVE_BOOL] = makeDynString();
//return here for the analog archive the list of proxy DPEs linked to the device
dds[UN_CONFIG_ADDITIONAL_ARCHIVE_ANALOG] = makeDynString();
//return here for the event archive the list of proxy DPEs linked to the device
dds[UN_CONFIG_ADDITIONAL_ARCHIVE_EVENT] = makeDynString();
return dds;
}
//------------------------------------------------------------------------------------------------------------------------
//@}

APPENDIX C: TAG_PREFIXEXPORTDEVICES.CTL

/**@file
// TAG_prefixExportDevices.ctl
This library contains the export functions of the package.
@par Creation Date
dd/mm/yyyy
@par Modification History
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@author
the author (DEP-GROUP)
*/
//@{
//------------------------------------------------------------------------------------------------------------------------
// TAG_FrontEndType_Com_ExportConfig
/** check the content of the delete command
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param dsParam input, parameters from the export panel (FE, application, device type)
@param exceptionInfo output, for errors
*/
TAG_FrontEndType_Com_ExportConfig(dyn_string dsParam, dyn_string &exceptionInfo)
{
int iRes;
string sPlcName, sPlcDrv;
string sType, sDp, sCounterAddress;
dyn_string dsDpParameters;
dyn_string dsAnalogArchive, dsEventArchive, dsBoolArchive, dsSubApplications;
dyn_string exInfo;
int pos;
if (dynlen(dsParam)==UN_CONFIG_EXPORT_LENGTH)
{
sPlcName = dsParam[UN_CONFIG_EXPORT_PLCNAME];
sDp = c_TAG_prefixSystemIntegrity_TAG_FRONTENDTYPE + sPlcName;
iRes = dpGet(sDp + ".configuration.subApplications", dsSubApplications,
sDp + ".configuration.archive_bool", dsBoolArchive,
sDp + ".configuration.archive_analog", dsAnalogArchive,
sDp + ".configuration.archive_event", dsEventArchive,
sDp + ".communication.driver_num", sPlcDrv);
TextFieldDriver.text = sPlcDrv;
if (dynlen(dsBoolArchive)>0 && dynlen(dsAnalogArchive)>0 && dynlen(dsEventArchive)>0)
{
pos = dynContains(dsSubApplications, dsParam[UN_CONFIG_EXPORT_APPLICATION]);
if(pos >=1 )
{
TextFieldBoolArchive.text = dsBoolArchive[pos];
TextFieldAnalogArchive.text = dsAnalogArchive[pos];
TextFieldEventArchive.text = dsEventArchive[pos];
}
else
{
TextFieldBoolArchive.text = dsBoolArchive[1];
TextFieldAnalogArchive.text = dsAnalogArchive[1];
TextFieldEventArchive.text = dsEventArchive[1];
}
}
//Delete
dynClear(dsDpParameters);
TAG_prefixExportDevice_writeDeviceTypeLineFormat(TAG_PREFIX_TAG_FRONTENDTYPE_DPTYPE, UN_DELETE_COMMAND);
dynAppend(dsDpParameters, "#" + UN_DELETE_COMMAND);
dynAppend(dsDpParameters, dsParam[UN_CONFIG_EXPORT_PLCNAME]);
dynAppend(dsDpParameters, dsParam[UN_CONFIG_EXPORT_APPLICATION]);
unExportDevice_writeDsStringToFile(dsDpParameters, UN_PARAMETER_DELIMITER);
//PLCCONFIG
TAG_prefixExportDevice_writeDeviceTypeLineFormat(TAG_PREFIX_TAG_FRONTENDTYPE_DPTYPE, UN_PLC_COMMAND);
dynClear(dsDpParameters);
dynAppend(dsDpParameters, UN_PLC_COMMAND);
dynAppend(dsDpParameters, TAG_PREFIX_TAG_FRONTENDTYPE_DPTYPE);
dynAppend(dsDpParameters, dsParam[UN_CONFIG_EXPORT_PLCNAME]);
dynAppend(dsDpParameters, dsParam[UN_CONFIG_EXPORT_APPLICATION]);
// get all the TAG_FrontEndType configuration
// dpGet(...);
// write to file
unExportDevice_writeDsStringToFile(dsDpParameters, UN_PARAMETER_DELIMITER);
// get the front-end system alarm
/* fputs("#" + "\n" , g_fileToExport);
dsAlarmDps = dpNames(c_unSystemAlarm_dpPattern + FE_pattern + c_TAG_prefixSystemIntegrity_TAG_FRONTENDTYPE +
dsParam[UN_CONFIG_EXPORT_PLCNAME] + "_*", c_unSystemAlarm_dpType);
iLen=dynlen(dsAlarmDps);
if(iLen > 0) {
TAG_prefixExportDevice_writeDeviceTypeLineFormat(UN_FESYSTEMALARM_COMMAND, "");
}
for(i=1; i<=iLen; i++)
{
if (dpExists(dsAlarmDps[i]))
{
sSplitModPlc = substr(dsAlarmDps[i], strpos(dsAlarmDps[i], dsParam[UN_CONFIG_EXPORT_PLCNAME]) +
strlen(dsParam[UN_CONFIG_EXPORT_PLCNAME]) + 1);
// get the number (stored in the description)
sNbr = unGenericDpFunctions_getDescription(dsAlarmDps[i]+".");
unConfigGenericFunctions_checkUnsigned(sNbr, uNbr, exInfo);
//DebugN(sNbr, uNbr);
if(uNbr > 0) {
//Get Alarm Address
dpGet(dsAlarmDps[i] + ".alarm:_address.._drv_ident" , sAlarmAddress);
TAG_prefixConfigGenericFunctions_getAddressConfig(dsAlarmDps[i] + ".alarm", dsAddressDpParameters);
//Get alarm type
dpGet(dsAlarmDps[i] + ".alarm:_alert_hdl.._type", sAlarmType);
if(sAlarmType == DPCONFIG_ALERT_NONBINARYSIGNAL)
{
fwAlertConfig_getLimits(dsAlarmDps[i] + ".alarm", limitNumbers, alertLimits, exceptionInfo);
alertRanges = (dynMax(limitNumbers) + 1);
dsAlertText = makeDynString();
for(j=1; j<=alertRanges; j++)
{
dpGet(dsAlarmDps[i] + ".alarm:_alert_hdl." + j + "._text", sAlertText);
dynAppend(dsAlertText, sAlertText);
}
//DebugN(dsAlertText);
if(dynlen(dsAlertText) > 0)
{
if (dsAlertText[1]==UN_SYSTEMINTEGRITY_OK)
{
sType = "TRUE";
}
else
{
sType = "FALSE";
}
}
else
sType = UN_CONFIG_EXPORT_UNDEF;
}
else
sType = UN_CONFIG_EXPORT_UNDEF;
dynClear(dsDpParameters);
dynAppend(dsDpParameters, UN_FESYSTEMALARM_COMMAND);
dynAppend(dsDpParameters, sNbr); //???? nbr
dynAppend(dsDpParameters, sSplitModPlc); //identifier
dynAppend(dsDpParameters, sNbr); //???? nbr
dynAppend(dsDpParameters, sType); //alarm type
dynAppend(dsDpParameters, unGenericDpFunctions_getDescription(dsAlarmDps[i] + ".alarm")); //description
dynAppend(dsDpParameters, dsAddressDpParameters); //address
fputs("#For TAG_FrontEndType " + sNbr + "\n" , g_fileToExport);
// write to file
unExportDevice_writeDsStringToFile(dsDpParameters, UN_PARAMETER_DELIMITER);
}
}
}
*/
}
else
fwException_raise(exceptionInfo, "ERROR", "TAG_FrontEndType_Com_ExportConfig(): Wrong Parameters", "");
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixExportDevice_writeDeviceTypeLineFormat
/** returns the format of the config line for a device type
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDeviceType input, device type
@param sCommand input, keyword (for front-end only)
*/
TAG_prefixExportDevice_writeDeviceTypeLineFormat(string sDeviceType, string sCommand)
{
string sFormat, sMandatory, sDeviceConfig;
sMandatory = sDeviceType+";Device number (unique);Device name (Device Identifier);description;Diagnostic panel;HTML page;Default
panel;subsystem1 (Domain);subsystem2 (Nature);Widget Name";
switch(sDeviceType)
{
case TAG_PREFIX_TAG_FRONTENDTYPE_DPTYPE:
switch(sCommand)
{
case UN_PLC_COMMAND:
sFormat = UN_PLC_COMMAND+";"+TAG_PREFIX_TAG_FRONTENDTYPE_DPTYPE+";Front-end device name;Front-end application;";
sDeviceConfig = "";
fputs("#format: " +sFormat + sDeviceConfig + "\n" , g_fileToExport);
break;
case UN_DELETE_COMMAND:
sFormat = UN_DELETE_COMMAND+";Front-end device name;Front-end application (or *);[Device type;[Device id;]]";
fputs("#format: " +sFormat + "\n" , g_fileToExport);
break;
default:
break;
}
break;
case UN_FESYSTEMALARM_COMMAND:
// sFormat = UN_FESYSTEMALARM_COMMAND+";WorldFip number;Device Name (device Identifier);WorldFip number;alarm type
(FALSE=alarm if value<10/TRUE=alarm if value>10);description;CMW Device;CMW property;CMW tag;CMW context filter;";
fputs("#format: " +sFormat + "\n" , g_fileToExport);
break;
case "TAG_DeviceType":
sDeviceConfig = "";
sFormat = sMandatory+";"+sDeviceConfig;
fputs("#format: " +sFormat + "\n" , g_fileToExport);
break;
default:
fputs("#no format: \n" , g_fileToExport);
break;
}
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_FrontEndType_TAG_DeviceType_ExportConfig
/** returns the format of the config line for a device type
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param dsDpList input, list of device dp
@param exceptionInfo output, the errors are returned here
*/
void TAG_FrontEndType_TAG_DeviceType_ExportConfig(dyn_string dsDpList, dyn_string &exceptionInfo)
{
dyn_string dsAllCommonParameters, dsDpParameters, dsArchiveNames, dsAddressDpParameters;
string sDeviceType, sArchiveActive, sArchiveName;
float fArchiveTimeFilter;
int i,iLeni, j, iLenj;
sDeviceType="TAG_DeviceType";
iLeni=dynlen(dsDpList);
if(iLeni > 0) {
TAG_prefixExportDevice_writeDeviceTypeLineFormat(sDeviceType, "");
}
for(i=1; i<=iLeni; i++)
{
if (dpExists(dsDpList[i]))
{
dynClear(dsAllCommonParameters);
dynClear(dsDpParameters);
dynClear(dsArchiveNames);
//Get all common Parameters
unExportDevice_getAllCommonParameters(dsDpList[i], sDeviceType , dsAllCommonParameters);
dsDpParameters = dsAllCommonParameters;
//Get the device configuration
/*
- archive config
unExportDevice_getArchiveParametersDpe(dsDpList[i]+"...", sArchiveActive, fArchiveTimeFilter, "");
- address config
fwPeriphAddress_get(dsDpList[i] + "...", bCPUExist, daCPUCounterConfig, bIsActive, exceptionInfo);
- smoothing config
unExportDevice_fwSmoothing_getTemp(dsDpList[i] + "...", bIsSmoothDefined, iSmoothProcedure, fDeadbandTemp, fTimeInterval);
unExportDevice_getDeadBand(fDeadbandTemp, bIsSmoothDefined, sMax, sMin, iSmoothProcedure, fDeadband, iDeadBandType);
- pv_range
fwPvRange_get(dsDpList[i] + "...", bDoesExist , fMinValue , fMaxValue , bNegateRange , bIgnoreOutside , bInclusiveMin , bInclusiveMax
, exceptionInfo);
- etc.
*/
//Get Archive Names for TAG_PREFIX devices
TAG_prefixConfigGenericFunctions_getArchiveNames(dsDpList[i], sDeviceType, dsArchiveNames);
iLenj=dynlen(dsArchiveNames);
for(j=1; j<=iLenj ; j++)
{
dynAppend(dsDpParameters, dsArchiveNames[j]);
}
// write the data to the file
unExportDevice_writeDsStringToFile(dsDpParameters, UN_PARAMETER_DELIMITER);
}//dp doesn't exist
}//end for
}
//------------------------------------------------------------------------------------------------------------------------
//@}

APPENDIX D: TAG_PREFIXSYSTEMINTEGRITY_TAG_FRONTENDTYPE.CTL

/**@file
// TAG_prefixSystemIntegrity_TAG_FrontEndType.ctl
This library contains the system integrity functions of the TAG_FrontEndType.
@par Creation Date
dd/mm/yyyy
@par Modification History
@par Constraints
None
@par Usage
Public
@par PVSS managers
CTRL
@author
the author (DEP-GROUP)
*/
//@{
// global declaration
global dyn_string g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSList; // list of the TAG_FrontEndType-DS dp checked
global dyn_int g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSThreadId; // list of the TAG_FrontEndType-DS thread Id checking the counter
global int g_TAG_prefixSystemIntegrity_TAG_FrontEndTypeCheckingDelay;
//@}
//@{
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixSystemIntegrity_TAG_FrontEndType_Initialize
/** Get the list of TAG_FrontEndType checked and enabled by the systemIntegrity.
@par Constraints
None
@par Usage
Public
@par PVSS managers
CTRL
@param dsResult output, list of enabled front-end systemIntegrity
*/
TAG_prefixSystemIntegrity_TAG_FrontEndType_Initialize(dyn_string &dsResult)
{
dyn_string dsList;
int len, i;
string dpToCheck;
bool enabled;
dpGet(UN_SYSTEM_INTEGRITY_TAG_FRONTENDTYPE+UN_SYSTEMINTEGRITY_EXTENSION+".config.data", dsList);
TAG_prefixSystemIntegrity_TAG_FrontEndType_DataCallback("", dsList);
dsList = dpNames(c_unSystemAlarm_dpPattern+DS_pattern+"*", c_unSystemAlarm_dpType);
len = dynlen(dsList);
for(i = 1; i<=len; i++) {
dpToCheck = dpSubStr(dsList[i], DPSUB_DP);
dpToCheck = substr(dpToCheck, strlen(c_unSystemAlarm_dpPattern+DS_pattern),strlen(dpToCheck));
if(dpExists(dpToCheck)) {
if(dpTypeName(dpToCheck) == TAG_PREFIX_TAG_FRONTENDTYPE_DPTYPE) {
dpGet(dsList[i]+".enabled", enabled);
if(enabled)
dynAppend(dsResult, dpToCheck);
}
}
}
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixSystemIntegrity_TAG_FrontEndType_DataCallback
/** Callback on the configuration data
@par Constraints
None
@par Usage
Public
@par PVSS managers
CTRL
@param sDpe1 input, dpe
@param dsConfigData input, configuration data
*/
TAG_prefixSystemIntegrity_TAG_FrontEndType_DataCallback(string sDpe1, dyn_string dsConfigData)
{
dyn_string dsTemp=dsConfigData;
// check the size of the configuration data and add default value if some data are missing
while(dynlen(dsTemp) <=1)
dynAppend(dsTemp, "0");
g_TAG_prefixSystemIntegrity_TAG_FrontEndTypeCheckingDelay = dsTemp[1];
if(g_TAG_prefixSystemIntegrity_TAG_FrontEndTypeCheckingDelay <= 0)
g_TAG_prefixSystemIntegrity_TAG_FrontEndTypeCheckingDelay = c_TAG_prefixSystemIntegrity_defaultTAG_FRONTENDTYPECheckingDelay;
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "pops systemIntegrity", "TAG_prefixSystemIntegrity_TAG_FrontEndType_DataCallback",
dsConfigData, g_TAG_prefixSystemIntegrity_TAG_FrontEndTypeCheckingDelay);
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixSystemIntegrity_TAG_FrontEndType_HandleCommand
/** Callback on the systemIntegrity command.
@par Constraints
None
@par Usage
Public
@par PVSS managers
CTRL
@param sDpe1 input, dpe
@param command input, type of command
@param sDpe2 input, dpe
@param parameters input, parameters of the command
*/
TAG_prefixSystemIntegrity_TAG_FrontEndType_HandleCommand(string sDpe1, int command, string sDpe2, dyn_string parameters)
{
dyn_string exceptionInfo;
int i, len =dynlen(parameters);
dyn_string dsResult;
string sResult;
switch(command) {
case UN_SYSTEMINTEGRITY_ADD: // add the _UnSystemAlarm DP
for(i=1; i<=len; i++) {
TAG_prefixSystemIntegrity_TAG_FrontEndType_checking(parameters[i], true, true, exceptionInfo);
}
break;
case UN_SYSTEMINTEGRITY_DELETE: // delete the _UnSystemAlarm DP
for(i=1; i<=len; i++) {
TAG_prefixSystemIntegrity_TAG_FrontEndType_checking(parameters[i], false, false, exceptionInfo);
// remove all _UnSystemAlarm dp from the alert list of applicationDP if it is in
_unSystemIntegrity_modifyApplicationAlertList(c_unSystemAlarm_dpPattern+DS_pattern+parameters[i], false, exceptionInfo);
// delete all the _UnSystemAlarm dps
if(dpExists(c_unSystemAlarm_dpPattern+DS_pattern+parameters[i]))
dpDelete(c_unSystemAlarm_dpPattern+DS_pattern+parameters[i]);
}
break;
case UN_SYSTEMINTEGRITY_ENABLE: // enable the _UnSystemAlarm DP
for(i=1; i<=len; i++) {
if(dpExists(c_unSystemAlarm_dpPattern+DS_pattern+parameters[i]))
TAG_prefixSystemIntegrity_TAG_FrontEndType_checking(parameters[i], false, true, exceptionInfo);
}
break;
case UN_SYSTEMINTEGRITY_DISABLE: // disable the _UnSystemAlarm DP
for(i=1; i<=len; i++) {
if(dpExists(c_unSystemAlarm_dpPattern+DS_pattern+parameters[i]))
TAG_prefixSystemIntegrity_TAG_FrontEndType_checking(parameters[i], false, false, exceptionInfo);
}
break;
case UN_SYSTEMINTEGRITY_DIAGNOSTIC: // give the list of _UnSystemAlarm DP and the state
dpSet(UN_SYSTEM_INTEGRITY_TAG_FRONTENDTYPE+UN_SYSTEMINTEGRITY_EXTENSION+".diagnostic.commandResult", command,
UN_SYSTEM_INTEGRITY_TAG_FRONTENDTYPE+UN_SYSTEMINTEGRITY_EXTENSION+".diagnostic.result",
g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSList);
break;
case 10: // extended diagnostic
dynAppend(dsResult, getCurrentTime());
dynAppend(dsResult, "g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSList:");
len = dynlen(g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSList);
for(i=1;i<=len;i++) {
sResult = g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSList[i];
dynAppend(dsResult, sResult);
}
dynAppend(dsResult, "g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSThreadId:");
len = dynlen(g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSThreadId);
for(i=1;i<=len;i++) {
sResult = g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSThreadId[i];
dynAppend(dsResult, sResult);
}
dynAppend(dsResult, "g_TAG_prefixSystemIntegrity_TAG_FrontEndTypeCheckingDelay:" +
g_TAG_prefixSystemIntegrity_TAG_FrontEndTypeCheckingDelay);
dpSet(UN_SYSTEM_INTEGRITY_TAG_FRONTENDTYPE+UN_SYSTEMINTEGRITY_EXTENSION+".diagnostic.commandResult", command,
UN_SYSTEM_INTEGRITY_TAG_FRONTENDTYPE+UN_SYSTEMINTEGRITY_EXTENSION+".diagnostic.result", dsResult);
DebugTN(dsResult);
break;
case 11:
if(dynlen(parameters) >= 2)
{
g_b32DebugLevel = parameters[1];
g_sDebugFilter = parameters[2];
}
else
{
g_b32DebugLevel = 0;
g_sDebugFilter = "";
}
break;
default:
break;
}
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "pops systemIntegrity",
"TAG_prefixSystemIntegrity_TAG_FrontEndType_HandleCommand", command, parameters);
if(dynlen(exceptionInfo) > 0) {
if(isFunctionDefined("unMessageText_sendException")) {
unMessageText_sendException("*", "*", "TAG_prefixSystemIntegrity_TAG_FrontEndType_HandleCommand", "user", "*", exceptionInfo);
}
// handle any error uin case the send message failed
if(dynlen(exceptionInfo) > 0) {
DebugN(getCurrentTime(), exceptionInfo);
}
}
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixSystemIntegrity_TAG_FrontEndType_checking
/** This function register/de-register the callback funtion of TAG_FrontEndType manager and creates the _unSystemAlarm_TAG_FrontEndType dp
with the alarm config but it does not delete it.
@par Constraints
None
@par Usage
Internal
@par PVSS managers
CTRL
@param sDp input, data point name
@param bCreate input, true create the dp and the alarm config if it does not exist, enable it
@param bRegister input, true do a dpConnect, false do a dpDisconnect
@param exceptionInfo output, exception are returned here
*/
TAG_prefixSystemIntegrity_TAG_FrontEndType_checking(string sDp, bool bCreate, bool bRegister, dyn_string &exceptionInfo)
{
string sDpToChek, dp, dpPlc, plcHostname, description;
int res, thId, pos, drvNum, len,i;
bool bError = false;
dyn_string plc_plc_list;
string alertPanel,alertHelp;
bool configExists, isActive;
int alertConfigType;
dyn_string alertTexts,alertClasses,summaryDpeList,alertPanelParameters;
dyn_float alertLimits;
// remove the system name
res = strpos(sDp, ":");
if(res >= 0)
dp = substr(sDp, res+1, strlen(sDp));
else
dp = sDp;
sDpToChek = dp;
dp = c_unSystemAlarm_dpPattern+DS_pattern+dp;
// in case the Dp is not of type _UnPlc do nothing. Should not happen, just for security.
if(dpTypeName(sDpToChek) != TAG_PREFIX_TAG_FRONTENDTYPE_DPTYPE)
return;
dpGet(sDpToChek+".communication.driver_num", drvNum);
if(bCreate) {
// get the plc hostname and the driver number
plcHostname = unGenericDpFunctions_getAlias(sDpToChek);
// create all the _UnSystemIntegrity Dp and its alarm config if it is not existing
if(!dpExists(dp)) {
description = getCatStr("unSystemIntegrity", "PLC_DS_DESCRIPTION")+plcHostname+" -> DS driver "+ drvNum;
unSystemIntegrity_createSystemAlarm(sDpToChek, DS_pattern, description, exceptionInfo);
}
}
if(bRegister) {
// connect to the callback function if not already done
pos = _unSystemIntegrity_isInList(g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSList, dp);
if(pos <= 0) {
// add it in the list, because one of the callback function needs it.
pos = _unSystemIntegrity_setList(g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSList, dp, true);
// start the thread for checking the counter
thId = startThread(UN_SYSTEM_INTEGRITY_TAG_FRONTENDTYPE_check, sDpToChek, drvNum);
g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSThreadId[pos] = thId;
if(thId<0)
bError = true;
if(!bError) {
// do here any dpConnect to the front-end DPE, or proxy DPE
// keep the DPs in global list to be able to dpDisconnect it later
}
if(bError) {
pos = _unSystemIntegrity_isInList(g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSList, dp);
if(pos > 0) {
// kill the threads if they were started
res = stopThread(g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSThreadId[pos]);
// and then remove it from the list
pos = _unSystemIntegrity_setList(g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSList, dp, false);
//DebugN("rmv", res);
dynRemove(g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSThreadId, pos);
}
fwException_raise(exceptionInfo, "ERROR",
"TAG_prefixSystemIntegrity_TAG_FrontEndType_checking():"+getCatStr("unSystemIntegrity", "CANNOT_DP_CONNECT") +dp,"");
}
else {
//DebugN("Enable", g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSThreadId, "end");
// set the enable to true and activate the alarm if it is not activated of all the _UnSystemIntegrity DP.
dpSet(dp+".enabled", true);
unAlarmConfig_mask(dp+".alarm", false, exceptionInfo);
// get all the PLC-PLC dp, and enable them
plc_plc_list = dpNames(c_unSystemAlarm_dpPattern+PLC_PLC_pattern+sDpToChek+"*", c_unSystemAlarm_dpType);
len = dynlen(plc_plc_list);
for(i=1;i<=len;i++) {
dpSet(plc_plc_list[i]+".enabled", true);
unAlarmConfig_mask(plc_plc_list[i]+".alarm", false, exceptionInfo);
}
// get all the FESystemAlarm dp, and enable them, check the Ok state and set the correct value
plc_plc_list = dpNames(c_unSystemAlarm_dpPattern+FE_pattern+sDpToChek+"*", c_unSystemAlarm_dpType);
len = dynlen(plc_plc_list);
for(i=1;i<=len;i++) {
dpSet(plc_plc_list[i]+".enabled", true);
unAlarmConfig_mask(plc_plc_list[i]+".alarm", false, exceptionInfo);
}
// set the GQ bit so all data will bypass the smoothing
dpSet("_Driver" + drvNum + ".SM:_original.._value", 1);
dpSet("_Driver" + drvNum + ".GQ:_original.._value", 1);
}
}
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix systemIntegrity", "TAG_prefixSystemIntegrity_TAG_FrontEndType_checking
register", sDp,
g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSThreadId, g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSThreadId);
}
else {
// disconnect the callback function
pos = _unSystemIntegrity_isInList(g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSList, dp);
if(pos > 0) {
// kill the thread
res = stopThread(g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSThreadId[pos]);
if(res < 0)
bError = true;
// do here any dpDisconnect to the front-end DPE, or proxy DPE
// use the global list set during the dpConnect
if(bError) {
fwException_raise(exceptionInfo, "ERROR",
"TAG_prefixSystemIntegrity_TAG_FrontEndType_checking():"+getCatStr("unSystemIntegrity", "CANNOT_DP_DISCONNECT") +dp,"");
}
else {
// remove from list
pos = _unSystemIntegrity_setList(g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSList, dp, false);
//DebugN("rmv", res);
dynRemove(g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSThreadId, pos);
// set the enable to false and de-activate the alarm and acknowledge it if necessary of all the _UnSystemIntegrity DP.
dpSet(dp+".enabled", false, dp+".alarm", c_unSystemIntegrity_no_alarm_value);
unAlarmConfig_mask(dp+".alarm", true, exceptionInfo);
// get all the PLC-PLC dp, and disable them
plc_plc_list = dpNames(c_unSystemAlarm_dpPattern+PLC_PLC_pattern+sDpToChek+"*", c_unSystemAlarm_dpType);
len = dynlen(plc_plc_list);
for(i=1;i<=len;i++) {
// do not reset the alarm value because this DPE should be connected to an address config
dpSet(plc_plc_list[i]+".enabled", false);
unAlarmConfig_mask(plc_plc_list[i]+".alarm", true, exceptionInfo);
}
// get all the FESystemAlarm dp, and disable them, check the Ok state and set the correct value
plc_plc_list = dpNames(c_unSystemAlarm_dpPattern+FE_pattern+sDpToChek+"*", c_unSystemAlarm_dpType);
len = dynlen(plc_plc_list);
for(i=1;i<=len;i++) {
// do not reset the alarm value because this DPE should be connected to an address config
dpSet(plc_plc_list[i]+".enabled", false);
unAlarmConfig_mask(plc_plc_list[i]+".alarm", true, exceptionInfo);
}
}
}
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix systemIntegrity", "TAG_prefixSystemIntegrity_TAG_FrontEndType_checking
deregister", sDp,
g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSList, g_TAG_prefixSystemIntegrity_TAG_FrontEndType_DSThreadId);
}
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixSystemIntegrity_TAG_FrontEndTypeCheck
/** This function checks if the counter of the TAG_FrontEndType dp is modified periodically.
A _UnSystemAlarm is set if the counter is not updated periodically.
@par Constraints
None
@par Usage
Internal
@par PVSS managers
CTRL
@param sFeDp input, data point name
@param iDrvNum input, the driver number
*/
TAG_prefixSystemIntegrity_TAG_FrontEndTypeCheck(string sFeDp, int iDrvNum)
{
int waitingTime, oldAlarmValue = -1, oldTimingAlarm = -1;
int oldValue = -1, newValue, alarmValue, iTime;
bool bEnabled;
string sModPlc;
int res, iPlcNumber;
while(true) {
// if 0 set it to g_TAG_prefixSystemIntegrity_TAG_FrontEndTypeCheckingDelay
waitingTime = g_TAG_prefixSystemIntegrity_TAG_FrontEndTypeCheckingDelay;
if(waitingTime <= 0)
waitingTime = c_TAG_prefixSystemIntegrity_defaultTAG_FRONTENDTYPECheckingDelay;
// wait
delay(waitingTime);
// get the value of the counter and the timeout PLCChecking
dpGet(sFeDp+".communication.counter", newValue);
if(newValue == oldValue) {
// the counter was not modified, set an alarm
alarmValue = c_unSystemIntegrity_alarm_value_level1;
}
else {
// the counter was modified, reset the alarm
alarmValue = c_unSystemIntegrity_no_alarm_value;
}
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix systemIntegrity "+sFeDp,
"TAG_prefixSystemIntegrity_TAG_FrontEndTypeCheck check", sFeDp,
waitingTime, oldValue, newValue, oldAlarmValue, alarmValue);
if(oldAlarmValue != alarmValue) {
dpSet(c_unSystemAlarm_dpPattern+DS_pattern+sFeDp+".alarm", alarmValue);
// set the GQ bit so all data will bypass the smoothing
dpSet("_Driver" + iDrvNum + ".SM:_original.._value", 1);
dpSet("_Driver" + iDrvNum + ".GQ:_original.._value", 1);
}
oldValue = newValue;
oldAlarmValue = alarmValue;
}
}
//------------------------------------------------------------------------------------------------------------------------
//@}

APPENDIX E: TAG_PREFIXTAG_FRONTENDTYPE.CTL

/**@file
// TAG_prefixTAG_FrontEndType.ctl
This library contains the widget, faceplate, etc. functions of TAG_FrontEndType.
@par Creation Date
dd/mm/yyyy
@par Modification History
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@author
the author (DEP-GROUP)
*/
//@{
//------------------------------------------------------------------------------------------------------------------------
// TAG_FrontEndType_ObjectListGetValueTime
/** Function called from snapshot utility of the treeDeviceOverview to get the time and value
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDeviceName input, device name
@param sDeviceType input, device type
@param dsReturnData output, return data, array of 5 strings
*/
TAG_FrontEndType_ObjectListGetValueTime(string sDeviceName, string sDeviceType, dyn_string &dsReturnData)
{
string sTime="0", sSystemName, sFrontEnd;
int iCom;
bool bEnable;
string sWarningLetter, sWarningColor, sBodyColor="unDataNoAccess", sText = "???", sCompleteText;
dyn_string dsColor;
// get the systemName
sSystemName = unGenericDpFunctions_getSystemName(sDeviceName);
// get the PLC name
sFrontEnd = unGenericObject_GetPLCNameFromDpName(sDeviceName);
if(dpExists(sSystemName+c_unSystemAlarm_dpPattern+DS_pattern+sFrontEnd+".alarm")) {
dpGet(sSystemName+c_unSystemAlarm_dpPattern+DS_pattern+sFrontEnd+".alarm", iCom,
sSystemName+c_unSystemAlarm_dpPattern+DS_pattern+sFrontEnd+".enabled", bEnable,
sSystemName+c_unSystemAlarm_dpPattern+DS_pattern+sFrontEnd+".alarm:_online.._stime", sTime);
unGenericObject_getFrontEndColorState(makeDynString(sSystemName+c_unSystemAlarm_dpPattern+DS_pattern+sFrontEnd+".alarm"),
dsColor);
unGenericObject_getFrontState(makeDynString("COM ERR"),
makeDynString(dsColor[1]),
makeDynInt(iCom),
iCom, bEnable, sText, sBodyColor, sWarningLetter, sWarningColor, sCompleteText);
/*** if there are more than one systemIntegrity alarm
unGenericObject_getFrontEndColorState(makeDynString(sSystemName+c_unSystemAlarm_dpPattern+DS_pattern+sFrontEnd+".alarm",
sSystemName+c_unSystemAlarm_dpPattern+PM_STATE_pattern+sFrontEnd+".alarm",
sSystemName+c_unSystemAlarm_dpPattern+DS_Time_pattern+sFrontEnd+".alarm"), dsColor);
// give as a dyn_string the list of possible text, the selected one and the color will be the one with the highest alarm value
unGenericObject_getFrontState(makeDynString("COM ERR", "PM ERR", "TIME ERR"),
makeDynString(dsColor[1], dsColor[2], dsColor[3]),
makeDynInt(3*iCom, 2*iPM, iTime),
iCom, bEnable, sText, sBodyColor, sWarningLetter, sWarningColor, sCompleteText);
*/
}
dsReturnData[1] = sTime;
dsReturnData[2] = sText;
dsReturnData[3] = "FALSE";
dsReturnData[4] = sCompleteText;
dsReturnData[5] = sBodyColor;
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix snapshot TAG_FrontEndType "+sDeviceName,
"TAG_FrontEndType_ObjectListGetValueTime", sDeviceName, dsReturnData);
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_FrontEndType_MenuConfiguration
/** pop-up menu
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDpName input, device DP name
@param sDpType input, device type
@param dsAccessOk input, the access control
@param menuList output, pop-up menu to show, dyn_string to be given to the popupMenu function
*/
TAG_FrontEndType_MenuConfiguration(string sDpName, string sDpType, dyn_string dsAccessOk, dyn_string &menuList)
{
// return the common menu list
_UnPlc_MenuConfiguration(sDpName, sDpType, dsAccessOk, menuList);
// add any other menu choice
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_FrontEndType_HandleMenu
/** handle the answer of the popup menu
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDpName input, device DP name
@param sDpType input, device type
@param menuList input, the access control
@param menuAnswer input, selected menu value
*/
TAG_FrontEndType_HandleMenu(string sDpName, string sDpType, dyn_string menuList, int menuAnswer)
{
// handle the action of common menu list
_UnPlc_HandleMenu(sDpName, sDpType, menuList, menuAnswer);
// handle all the other action of menu list
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_FrontEndType_WidgetRegisterCB
/** widget DistributedControl callback
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDp input, the DistributedControl system name DP name
@param bSystemConnected input, the state of the system name
*/
TAG_FrontEndType_WidgetRegisterCB(string sDp, bool bSystemConnected)
{
string deviceName, sSystemName;
int iAction;
dyn_string exceptionInfo;
string sFrontEnd, sSystInt;
bool bRemote;
// get the device DP name from the $-param $sIdentifier of the widget
deviceName = unGenericDpFunctions_getWidgetDpName($sIdentifier);
if (deviceName == "") // In case of disconnection
{
deviceName = g_sDpName;
}
g_bUnSystemAlarmPlc = false;
// get the systemName
sSystemName = unGenericDpFunctions_getSystemName(deviceName);
// get the PLC name
sFrontEnd = unGenericObject_GetPLCNameFromDpName(deviceName);
unDistributedControl_isRemote(bRemote, sSystemName);
if(bRemote)
g_bSystemConnected = bSystemConnected;
else
g_bSystemConnected = true;
if(sFrontEnd != ""){
sSystInt = sSystemName+c_unSystemAlarm_dpPattern+DS_pattern+sFrontEnd;
//DebugN(sSystemName, sFrontEnd);
if(dpExists(sSystInt)) {
g_bUnSystemAlarmPlc = true;
}
}
// check the state of the system
unGenericObject_Connection(deviceName, g_bCallbackConnected, bSystemConnected, iAction, exceptionInfo);
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix widget TAG_FrontEndType "+deviceName,
"TAG_FrontEndType_WidgetRegisterCB", sDp, deviceName, g_bCallbackConnected, iAction);
switch(iAction)
{
case UN_ACTION_DISCONNECT:
TAG_FrontEndType_WidgetDisconnection(g_sWidgetType);
break;
case UN_ACTION_DPCONNECT:
g_sDpName = deviceName;
TAG_FrontEndType_WidgetConnect(deviceName, sFrontEnd, sSystInt);
break;
case UN_ACTION_DPDISCONNECT_DISCONNECT:
TAG_FrontEndType_WidgetDisconnect(deviceName, sFrontEnd, sSystInt);
TAG_FrontEndType_WidgetDisconnection(g_sWidgetType);
break;
case UN_ACTION_NOTHING:
default:
break;
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_FrontEndType_WidgetDisconnection
/** set the widget when the system considered disconnected
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sWidgetType input, the type of widget
*/
TAG_FrontEndType_WidgetDisconnection(string sWidgetType)
{
/** multiple widget is not allowed for front-end **/
_UnPlc_WidgetDisconnection(sWidgetType);
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix widget TAG_FrontEndType", "TAG_FrontEndType_WidgetDisconnection",
sWidgetType);
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_FrontEndType_WidgetConnect
/** dpConnect to the front-end device data
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param deviceName input, front-end device DP name
@param sFrontEnd input, front-end device name
@param sSystInt input, front-end device system integrity DP
*/
TAG_FrontEndType_WidgetConnect(string deviceName, string sFrontEnd, string sSystInt)
{
int iRes;
string sSystemName;
dyn_string dsColor;
// check if the device name is of type "TAG_FrontEndType" if not like of no front-end. -> not available.
if(dpTypeName(deviceName) != "TAG_FrontEndType")
g_bUnSystemAlarmPlc = false;
sSystemName = unGenericDpFunctions_getSystemName(deviceName);
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix widget TAG_FrontEndType "+deviceName,
"TAG_FrontEndType_WidgetConnect", deviceName, g_bUnSystemAlarmPlc);
if(g_bUnSystemAlarmPlc)
{
// set all widget global variable usefull for the callback, e.g.: description, format, unit, etc.
unGenericObject_getFrontEndColorState(makeDynString(sSystInt+".alarm"), dsColor);
g_sCommColor = dsColor[1];
iRes = dpConnect("TAG_FrontEndType_WidgetCB", sSystInt+".alarm", sSystInt+".enabled");
g_bCallbackConnected = (iRes >= 0);
}else{
TAG_FrontEndType_WidgetDisconnection(g_sWidgetType);
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_FrontEndType_WidgetDisconnect
/** dpDisconnect to the front-end device data
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param deviceName input, front-end device DP name
@param sFrontEnd input, front-end device name
@param sSystInt input, front-end device system integrity DP
*/
TAG_FrontEndType_WidgetDisconnect(string deviceName, string sFrontEnd, string sSystInt)
{
int iRes;
string sSystemName;
sSystemName = unGenericDpFunctions_getSystemName(deviceName);
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix widget TAG_FrontEndType "+deviceName,
"TAG_FrontEndType_WidgetDisconnect", deviceName, g_bUnSystemAlarmPlc);
if(g_bUnSystemAlarmPlc)
{
iRes = dpDisconnect("TAG_FrontEndType_WidgetCB", sSystInt+".alarm", sSystInt+".enabled");
g_bCallbackConnected = !(iRes >= 0);
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_FrontEndType_WidgetCB
/** callback function on the front-end device data
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDpSystemIntegrityAlarmValue input, front-end device system integrity alarm DPE
@param iFESystemIntegrityAlarmValue input, front-end device system integrity alarm value
@param sDpSystemIntegrityAlarmEnabled input, front-end device system integrity enable DPE
@param bFESystemIntegrityAlarmEnabled input, front-end device system integrity enable value
*/
TAG_FrontEndType_WidgetCB(string sDpSystemIntegrityAlarmValue, int iFESystemIntegrityAlarmValue,
string sDpSystemIntegrityAlarmEnabled, bool bFESystemIntegrityAlarmEnabled)
{
/** multiple widget is not allowed for front-end **/
// encapsulate all the setValue or function call with the following if(g_bSystemConnected)
string sWarningLetter, sWarningColor, sBodyColor="white", sText = "???", sCompleteText;
if(g_bSystemConnected) {
unGenericObject_getFrontState(makeDynString("COM ERR"),
makeDynString(g_sCommColor),
makeDynInt(iFESystemIntegrityAlarmValue),
iFESystemIntegrityAlarmValue, bFESystemIntegrityAlarmEnabled,
sText, sBodyColor, sWarningLetter, sWarningColor, sCompleteText);
/*** if there are more than one systemIntegrity alarm
unGenericObject_getFrontState(makeDynString("COM ERR", "PM ERR", "TIME ERR"),
makeDynString(g_sCommColor, g_sPMColor, g_sTimeColor),
makeDynInt(3*iFESystemIntegrityAlarmValue, 2*iAlarmPM, iAlarmTime),
iFESystemIntegrityAlarmValue, bFESystemIntegrityAlarmEnabled,
sText, sBodyColor, sWarningLetter, sWarningColor, sCompleteText);
*/
setMultiValue("WidgetArea", "visible", true,
"WarningText", "text", sWarningLetter, "WarningText", "foreCol", sWarningColor,
"Body1", "foreCol", sBodyColor, "Body1", "text", sText);
}
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix widget TAG_FrontEndType "+sDpSystemIntegrityAlarmValue,
"TAG_FrontEndType_WidgetCB", sDpSystemIntegrityAlarmValue,
iFESystemIntegrityAlarmValue, bFESystemIntegrityAlarmEnabled, g_bSystemConnected,
sWarningLetter, sText);
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_FrontEndType_FaceplateRegisterCB
/** faceplate DistributedControl callback
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDp input, the DistributedControl system name DP name
@param bSystemConnected input, the state of the system name
*/
TAG_FrontEndType_FaceplateRegisterCB(string sDp, bool bSystemConnected)
{
_UnPlc_FaceplateRegisterCB(sDp, bSystemConnected);
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_FrontEndType_FaceplateDisconnection
/** set the faceplate when the system considered disconnected
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
*/
TAG_FrontEndType_FaceplateDisconnection()
{
_UnPlc_FaceplateDisconnection();
}
//---------------------------------------------------------------------------------------------------------------------------------------
//@}

APPENDIX F: TAG_PREFIXTAG_DEVICETYPE.CTL

/**@file
// TAG_prefixTAG_DeviceType.ctl
This library contains the widget, faceplate, etc. functions of TAG_DeviceType.
@par Creation Date
dd/mm/yyyy
@par Modification History
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@author
the author (DEP-GROUP)
*/
//@{
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_AcknowledgeAlarm
/** Gice the list of TAG_DeviceType DPE with alarm config that can be acknowledge
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDpName input, device name DP name
@param sDpType input, device type
@param dsNeedAck output, the lsit of DPE
*/
TAG_prefixTAG_DeviceType_AcknowledgeAlarm(string sDpName, string sDpType, dyn_string &dsNeedAck)
{
dsNeedAck = makeDynString("ProcessInput....");
// if the acknoledge must be sent to the PLC: CPC Front-end: add UN_ACKNOWLEDGE_PLC
//dsNeedAck = makeDynString("ProcessInput....", UN_ACKNOWLEDGE_PLC);
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix AcknowledgeAlarm TAG_DeviceType "+sDpName,
"TAG_prefixTAG_DeviceType_AcknowledgeAlarm", sDpName, sDpType, dsNeedAck);
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_ObjectListGetValueTime
/** Function called from snapshot utility of the treeDeviceOverview to get the time and value
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDeviceName input, device name
@param sDeviceType input, device type
@param dsReturnData output, return data, array of 5 strings
*/
TAG_prefixTAG_DeviceType_ObjectListGetValueTime(string sDeviceName, string sDeviceType, dyn_string &dsReturnData)
{
string sTime, sValue, sState, sColor;
bool bOk, bBad;
dpGet(sDeviceName+".ProcessInput....", sValue,
sDeviceName+".ProcessInput....", sState,
sDeviceName+".ProcessInput....:_online.._stime", sTime,
sDeviceName+".ProcessInput....:_online.._bad", bBad);
dsReturnData[1] = sTime;
dsReturnData[2] = sValue;
dsReturnData[3] = bBad;
dsReturnData[4] = sState;
dsReturnData[5] = sColor;
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix snapshot TAG_DeviceType "+sDeviceName,
"TAG_prefixTAG_DeviceType_ObjectListGetValueTime", sDeviceName, dsReturnData);
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_FaceplateStatusRegisterCB
/** faceplate DistributedControl callback of the faceplate status panel
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDp input, the DistributedControl system name DP name
@param bSystemConnected input, the state of the system name
*/
TAG_prefixTAG_DeviceType_FaceplateStatusRegisterCB(string sDp, bool bSystemConnected)
{
string deviceName, sSystemName;
int iAction, iRes;
dyn_string exceptionInfo;
bool bRemote;
deviceName = unGenericDpFunctions_getDpName($sDpName);
sSystemName = unGenericDpFunctions_getSystemName(deviceName);
unDistributedControl_isRemote(bRemote, sSystemName);
if(bRemote)
g_bSystemConnected = bSystemConnected;
else
g_bSystemConnected = true;
unGenericObject_Connection(deviceName, g_bCallbackConnected, bSystemConnected, iAction, exceptionInfo);
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix faceplate TAG_DeviceType "+sDp,
"TAG_prefixTAG_DeviceType_FaceplateStatusRegisterCB", sDp, deviceName, g_bCallbackConnected, iAction);
switch (iAction)
{
case UN_ACTION_DISCONNECT:
TAG_prefixTAG_DeviceType_FaceplateStatusDisconnection();
break;
case UN_ACTION_DPCONNECT:
TAG_prefixTAG_DeviceType_FaceplateConnect(deviceName);
break;
case UN_ACTION_DPDISCONNECT_DISCONNECT:
TAG_prefixTAG_DeviceType_FaceplateDisconnect(deviceName);
TAG_prefixTAG_DeviceType_FaceplateStatusDisconnection();
break;
case UN_ACTION_NOTHING:
default:
break;
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_FaceplateStatusDisconnection
/** set the faceplate when the device system is disconnected
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
*/
TAG_prefixTAG_DeviceType_FaceplateStatusDisconnection()
{
// 2. animate FE Connection
TAG_prefixGenericFunctions_FaceplateStatusDisconnect();
// there is no need to do here execScript because there is one faceplate per device type
// set all the graphical element to the state data not connnected
// ex. of functions that can be used
//unGenericObject_ColorBoxDisconnect, unGenericObject_DisplayValueDisconnect, etc.
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix faceplate TAG_DeviceType",
"TAG_prefixTAG_DeviceType_FaceplateStatusDisconnection");
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_FaceplateConnect
/** dpConnect to the device data
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param deviceName input, the device DP name
*/
TAG_prefixTAG_DeviceType_FaceplateConnect(string deviceName)
{
int iAction, iRes;
dyn_string exceptionInfo;
string sFrontEnd, sSystemName;
g_sDeviceAlias = unGenericDpFunctions_getAlias(deviceName);
g_bUnSystemAlarmPlc = false;
// get the systemName
sSystemName = unGenericDpFunctions_getSystemName(deviceName);
// get the PLC name
sFrontEnd = unGenericObject_GetPLCNameFromDpName(deviceName);
g_sFrontEndDp = sSystemName+sFrontEnd;
g_sFrontEndAlias = unGenericDpFunctions_getAlias(g_sFrontEndDp);
if(sFrontEnd != ""){
sFrontEnd = sSystemName+c_unSystemAlarm_dpPattern+DS_pattern+sFrontEnd;
//DebugN(sSystemName, sFrontEnd);
if(dpExists(sFrontEnd)) {
g_bUnSystemAlarmPlc = true;
}
}
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix faceplate TAG_DeviceType "+deviceName,
"TAG_prefixTAG_DeviceType_FaceplateConnect", deviceName, sFrontEnd, g_bUnSystemAlarmPlc);
if(g_bUnSystemAlarmPlc) {
// set all faceplate global variable usefull for the callback, e.g.: description, format, unit, etc.
// set graphical element of the faceplate to the init state if needed
// if there are many dpConnect possibilities: e.g. dpConnect with or without _alert_hdl config
// keep the kind of dpConnect in a variable global to the faceplate and do a swith for the dpConnect
// and do to the correct dpDisconnect in the TAG_prefixTAG_DeviceType_FaceplateDisconnect
iRes = dpConnect("TAG_prefixTAG_DeviceType_FaceplateStatusAnimationCB",
deviceName + ".ProcessInput.data",
deviceName + ".ProcessInput.data:_online.._invalid",
deviceName + ".ProcessInput.iData",
sFrontEnd+".alarm",
sFrontEnd+".enabled");
g_bCallbackConnected = (iRes >= 0);
}
else
TAG_prefixTAG_DeviceType_FaceplateStatusDisconnection();
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_FaceplateDisconnect
/** dpDisconnect to the device data
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param deviceName input, the device DP name
*/
TAG_prefixTAG_DeviceType_FaceplateDisconnect(string deviceName)
{
int iRes;
string sFrontEnd, sSystemName;
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix faceplate TAG_DeviceType "+deviceName,
"TAG_prefixTAG_DeviceType_FaceplateDisconnect", deviceName, g_bUnSystemAlarmPlc);
if(g_bUnSystemAlarmPlc) {
// get the systemName
sSystemName = unGenericDpFunctions_getSystemName(deviceName);
// get the PLC name
sFrontEnd = unGenericObject_GetPLCNameFromDpName(deviceName);
sFrontEnd = sSystemName+c_unSystemAlarm_dpPattern+DS_pattern+sFrontEnd;
// if there were many dpConnect possibilities: e.g. dpConnect with or without _alert_hdl config
// re-use the kind of dpConnect kept in a variable global to the faceplate set during TAG_prefixTAG_DeviceType_FaceplateConnect
// and do to the correct dpDisconnect
iRes = dpDisconnect("TAG_prefixTAG_DeviceType_FaceplateStatusAnimationCB",
deviceName + ".ProcessInput.data",
deviceName + ".ProcessInput.data:_online.._invalid",
deviceName + ".ProcessInput.iData",
sFrontEnd+".alarm",
sFrontEnd+".enabled");
g_bCallbackConnected = !(iRes >= 0);
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_FaceplateStatusAnimationCB
/** callback function on the device data
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDp1 input, the DPE1
@param blobData input, device data
@param sDpInvalid input, the invalid DPE
@param bInvalid input, data validity
@param sDp2 input, the DPE2
@param iData input, device status data
@param sDpFESystemIntegrityAlarmValue input, front-end device system integrity alarm DPE
@param iFESystemIntegrityAlarmValue input, front-end device system integrity alarm value
@param sDpFESystemIntegrityAlarmEnabled input, front-end device system integrity enable DPE
@param bFESystemIntegrityAlarmEnabled input, front-end device system integrity enable value
*/
TAG_prefixTAG_DeviceType_FaceplateStatusAnimationCB(string sDp1, blob blobData,
string sDpInvalid, bool bInvalid,
string sDp2, int iData,
string sDpFESystemIntegrityAlarmValue, int iFESystemIntegrityAlarmValue,
string sDpFESystemIntegrityAlarmEnabled, bool bFESystemIntegrityAlarmEnabled)
{
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix faceplate TAG_DeviceType "+sDp1,
"TAG_prefixTAG_DeviceType_FaceplateStatusAnimationCB", sDp1, bInvalid, blobData, iData, g_bSystemConnected,
iFESystemIntegrityAlarmValue, bFESystemIntegrityAlarmEnabled);
if(g_bSystemConnected)
TAG_prefixGenericFunctions_FaceplateStatusHeader(g_sFrontEndDp, g_sFrontEndAlias, g_sDeviceAlias, iFESystemIntegrityAlarmValue,
bFESystemIntegrityAlarmEnabled, bInvalid);
// animate all the graphical element of the faceplate
// all the variables global to the faceplate can be used
// encapsulate all the setValue or function call with the following if(g_bSystemConnected)
/* e.g.:
if(g_bSystemConnected)
unGenericObject_DisplayValue(...);
*/
// ex. of functions that can be used: unGenericObject_DisplayValue, unGenericObject_ColorBoxAnimate,
// unGenericObject_ColorBoxAnimateAlarm, unGenericObject_ColoredSquareAnimate,
// unGenericObject_DisplayRange, etc.
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_ButtonRegisterCB
/** Contextual button DistributedControl callback of the contextual device button panel
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDp input, the DistributedControl system name DP name
@param bSystemConnected input, the state of the system name
*/
TAG_prefixTAG_DeviceType_ButtonRegisterCB(string sDp, bool bSystemConnected)
{
string deviceName, sDpType, sFunction;
int iAction, iRes, iManReg01;
dyn_string exceptionInfo, dsFunctions, dsUserAccess;
deviceName = unGenericDpFunctions_getDpName($sDpName);
unGenericObject_Connection(deviceName, g_bCallbackConnected, bSystemConnected, iAction, exceptionInfo);
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix button TAG_DeviceType "+deviceName,
"TAG_prefixTAG_DeviceType_ButtonRegisterCB", sDp, deviceName, g_bCallbackConnected, iAction);
switch (iAction)
{
case UN_ACTION_DISCONNECT:
TAG_prefixTAG_DeviceType_ButtonDisconnection();
break;
case UN_ACTION_DPCONNECT:
sDpType="TAG_DeviceType";
unGenericObject_GetFunctions(sDpType, dsFunctions, exceptionInfo);
sFunction = dsFunctions[UN_GENERICOBJECT_FUNCTION_BUTTONUSERACCESS];
if (sFunction != "")
{
evalScript(dsUserAccess, "dyn_string main(string deviceNameTemp, string sDpTypeTemp) {" +
"dyn_string dsUserAccessReturn;" +
"if (isFunctionDefined(\"" + sFunction + "\"))" +
" {" +
sFunction + "(deviceNameTemp, sDpTypeTemp, dsUserAccessReturn);" +
" }" +
"return dsUserAccessReturn; }", makeDynString(), deviceName, sDpType);
// keep the list of the device allowed action
g_dsUserAccess=dsUserAccess;
}
else
fwException_raise(exceptionInfo,"ERROR", "TAG_prefixTAG_DeviceType_ButtonRegisterCB:" +
getCatStr("unGeneration","UNKNOWNFUNCTION"), "EMPTY");
// set all contextual panel global variable usefull for the TAG_prefixTAG_DeviceType_ButtonAnimationCB, e.g.: description, format, unit, etc.
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix button TAG_DeviceType "+deviceName,
"TAG_prefixTAG_DeviceType_ButtonRegisterCB Connect", deviceName, sDpType, dsUserAccess);
iRes = dpConnect("TAG_prefixTAG_DeviceType_ButtonAnimationCB",
deviceName + ".statusInformation.selectedManager:_lock._original._locked",
deviceName + ".statusInformation.selectedManager",
deviceName + ".ProcessInput.data",
deviceName + ".ProcessInput.iData",
deviceName + ".ProcessInput.data:_online.._invalid");
g_bCallbackConnected = (iRes >= 0);
break;
case UN_ACTION_DPDISCONNECT_DISCONNECT:
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix button TAG_DeviceType "+deviceName,
"TAG_prefixTAG_DeviceType_ButtonRegisterCB Disconnect", deviceName);
iRes = dpDisconnect("TAG_prefixTAG_DeviceType_ButtonAnimationCB",
deviceName + ".statusInformation.selectedManager:_lock._original._locked",
deviceName + ".statusInformation.selectedManager",
deviceName + ".ProcessInput.data",
deviceName + ".ProcessInput.iData",
deviceName + ".ProcessInput.data:_online.._invalid");
g_bCallbackConnected = !(iRes >= 0);
TAG_prefixTAG_DeviceType_ButtonDisconnection();
break;
case UN_ACTION_NOTHING:
default:
break;
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_UserLoginGetButtonState
/** return the device data, this function is called when the user logs in and logs out
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param deviceName input, the device DP name
@param sType input, the device type
@param dsReturnData output, the device data, [1] = lock state, [2] = lock by, [3] .. [6] device data
*/
TAG_prefixTAG_DeviceType_UserLoginGetButtonState(string deviceName, string sType, dyn_string &dsReturnData)
{
int iRes;
string sDpLock, sDpSelectedManager, sSelectedManager;
bool bLocked;
// read the device data (6 string)
sDpLock = deviceName + ".statusInformation.selectedManager:_lock._original._locked";
sDpSelectedManager = deviceName + ".statusInformation.selectedManager";
if (dpExists(deviceName))
{
iRes = dpGet(sDpLock, bLocked, sDpSelectedManager, sSelectedManager);
}
else
{
iRes = -1;
}
if (iRes < 0) // Errors during dpget
{
bLocked = false;
sSelectedManager = "";
}
dsReturnData=makeDynString(bLocked, sSelectedManager, "..", "..", "..", "..");
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix button TAG_DeviceType "+deviceName,
"TAG_prefixTAG_DeviceType_UserLoginGetButtonState", deviceName, sType, dsReturnData);
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_ButtonSetState
/** Set the state of the contextual button of the device
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param deviceName input, the device DP name
@param sDpType input, the device type
@param dsUserAccess input, list of allowed action on the device
@param dsData input, the device data [1] = lock state, [2] = lock by, [3] .. [6] device data
*/
TAG_prefixTAG_DeviceType_ButtonSetState(string deviceName, string sDpType, dyn_string dsUserAccess, dyn_string dsData)
{
bool bSelected;
dyn_string dsButtons;
int i, length;
string localManager;
bool bLocked, buttonEnabled;
string sSelectedManager, sDeviceValue1, sDeviceValue2, sDeviceValue3, sDeviceValue4;
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix button TAG_DeviceType "+deviceName,
"TAG_prefixTAG_DeviceType_ButtonSetState", deviceName, sDpType, dsUserAccess, dsData);
bLocked = dsData[1];
sSelectedManager = dsData[2];
sDeviceValue1 = dsData[3];
sDeviceValue2 = dsData[4];
sDeviceValue3 = dsData[5];
sDeviceValue4 = dsData[6];
// dsButtons = list of all the possible actions except Select
// use the name of the graphical element without "button"
// use the name of the graphical elements.
dsButtons = makeDynString("Cmd1","...");
length = dynlen(dsButtons);
// 1. Selection state
localManager = unSelectDeselectHMI_getSelectedState(bLocked, sSelectedManager);
bSelected = (localManager == "S");
// 2. for each possible action check if the action is in the list dsUserAccess
// crosscheck if needed with the state of the device
for(i=1;i<=length;i++)
{
buttonEnabled = (dynContains(dsUserAccess, dsButtons[i]) > 0); // User access
switch(dsButtons[i])
{
case "..":
// calculate the enable state of the button from the device data
buttonEnabled = buttonEnabled & bSelected & (sDeviceValue1 == "..");
break;
case "..":
break;
default:
break;
}
setValue(UN_FACEPLATE_BUTTON_PREFIX + dsButtons[i], "enabled", buttonEnabled);
}
// 3. Button Select state
unGenericObject_ButtonAnimateSelect(localManager, (dynContains(dsUserAccess, UN_FACEPLATE_BUTTON_SELECT) > 0));
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_ButtonDisconnection
/** set the state of the device action button when the device system is disconnected
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
*/
TAG_prefixTAG_DeviceType_ButtonDisconnection()
{
// set all the device action button to disabled
unGenericObject_ButtonDisconnect(makeDynString(UN_FACEPLATE_BUTTON_SELECT, "Cmd1", ".."));
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "pops button TAG_DeviceType", "TAG_prefixTAG_DeviceType_ButtonDisconnection");
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_ButtonUserAccess
/** returns the list of allowed action on the device for a user logged in
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDpName input, the device DP name
@param sDpType input, the device type
@param dsAccess input, list of allowed action on the device
*/
TAG_prefixTAG_DeviceType_ButtonUserAccess(string sDpName, string sDpType, dyn_string &dsAccess)
{
bool operator, expert, admin;
int i, length;
dyn_bool dbPermissions;
dyn_string exceptionInfo;
string sOperAction, sExpAction, sAdminAction;
bool bActionDefined = false;
// get the configured list of authorized action per privilege
unGenericDpFunctions_getAccessControlPriviledgeRigth(sDpName, g_dsDomainAccessControl, dbPermissions, sOperAction, sExpAction,
sAdminAction, exceptionInfo);
if((sOperAction != UNICOS_ACCESSCONTROL_DOMAINNAME) || (sExpAction != UNICOS_ACCESSCONTROL_DOMAINNAME) ||
(sAdminAction != UNICOS_ACCESSCONTROL_DOMAINNAME))
bActionDefined=true;
operator = dbPermissions[2];
expert = dbPermissions[3];
admin = dbPermissions[4];
dsAccess = makeDynString();
// for each privilege get the list of allowed actions if there are action defined on the device
// if there are no action defined for the device get the default one
// in the example, the default behavior is
// the Select and Cmd1 buttons are allowed if one has the expert privilege
if (operator)
{
if(bActionDefined)
dynAppend(dsAccess, strsplit(sOperAction, UN_ACCESS_CONTROL_SEPARATOR));
else
dynAppend(dsAccess, makeDynString(".."));
}
if (expert)
{
if(bActionDefined)
dynAppend(dsAccess, strsplit(sExpAction, UN_ACCESS_CONTROL_SEPARATOR));
else
dynAppend(dsAccess, makeDynString("Cmd1", UN_FACEPLATE_BUTTON_SELECT, ".."));
}
if(admin){
if(bActionDefined)
dynAppend(dsAccess, strsplit(sAdminAction, UN_ACCESS_CONTROL_SEPARATOR));
else
dynAppend(dsAccess, makeDynString(".."));
}
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix button TAG_DeviceType "+sDpName,
"TAG_prefixTAG_DeviceType_ButtonUserAccess", sDpName, sDpType, dbPermissions, sOperAction, sExpAction, sAdminAction, dsAccess);
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_ButtonAnimationCB
/** callback function on the device data
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDpLock input, the lock DPE
@param bLocked input, selected lock state of the device
@param sDpSelect input, the select DPE
@param sSelectedManager input, user and Ui that selected the device
@param sDp1 input, the DPE1
@param blobData input, device data
@param sDp2 input, the DPE2
@param iData input, device status data
@param sDpInvalid input, the invalid DPE
@param bInvalid input, data validity
*/
TAG_prefixTAG_DeviceType_ButtonAnimationCB(string sDpLock, bool bLocked, string sDpSelect, string sSelectedManager,
string sDp1, blob blobData, string sDp2, int iData,
string sDpInvalid, bool bInvalid)
{
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix button TAG_DeviceType "+sDp1,
"TAG_prefixTAG_DeviceType_ButtonAnimationCB", sDp1, blobData, iData, bInvalid, g_dsUserAccess);
// call the set button state with the device data and the current allowed action on the device
// which is in g_dsUserAccess
TAG_prefixTAG_DeviceType_ButtonSetState(unGenericDpFunctions_getDpName(sDp1), "TAG_DeviceType", g_dsUserAccess,
makeDynString(bLocked, sSelectedManager, "..", "..", "..", ".."));
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_WidgetRegisterCB
/** widget DistributedControl callback
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDp input, the DistributedControl system name DP name
@param bSystemConnected input, the state of the system name
*/
TAG_prefixTAG_DeviceType_WidgetRegisterCB(string sDp, bool bSystemConnected)
{
string deviceName, sSystemName;
int iAction;
dyn_string exceptionInfo;
string sFrontEnd;
bool bRemote;
deviceName = unGenericDpFunctions_getWidgetDpName($sIdentifier);
if (deviceName == "") // In case of disconnection
{
deviceName = g_sDpName;
}
g_bUnSystemAlarmPlc = false;
// get the systemName
sSystemName = unGenericDpFunctions_getSystemName(deviceName);
// get the PLC name
sFrontEnd = unGenericObject_GetPLCNameFromDpName(deviceName);
unDistributedControl_isRemote(bRemote, sSystemName);
if(bRemote)
g_bSystemConnected = bSystemConnected;
else
g_bSystemConnected = true;
if(sFrontEnd != ""){
sFrontEnd = sSystemName+c_unSystemAlarm_dpPattern+DS_pattern+sFrontEnd;
//DebugN(sSystemName, sFrontEnd);
if(dpExists(sFrontEnd)) {
g_bUnSystemAlarmPlc = true;
}
}
unGenericObject_Connection(deviceName, g_bCallbackConnected, bSystemConnected, iAction, exceptionInfo);
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix widget TAG_DeviceType "+deviceName,
"TAG_prefixTAG_DeviceType_WidgetRegisterCB", sDp, deviceName, g_bCallbackConnected, iAction);
switch(iAction)
{
case UN_ACTION_DISCONNECT:
TAG_prefixTAG_DeviceType_WidgetDisconnection(g_sWidgetType);
break;
case UN_ACTION_DPCONNECT:
g_sDpName = deviceName;
TAG_prefixTAG_DeviceType_WidgetConnect(deviceName, sFrontEnd);
break;
case UN_ACTION_DPDISCONNECT_DISCONNECT:
TAG_prefixTAG_DeviceType_WidgetDisconnect(deviceName, sFrontEnd);
TAG_prefixTAG_DeviceType_WidgetDisconnection(g_sWidgetType);
break;
case UN_ACTION_NOTHING:
default:
break;
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_WidgetDisconnection
/** set the widget when the system is disconnected
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sWidgetType input, the type of widget
*/
TAG_prefixTAG_DeviceType_WidgetDisconnection(string sWidgetType)
{
/** use the exec mechanism to allow multiple widget. **/
string sFunction = "TAG_prefixTAG_DeviceType_"+sWidgetType+"Disconnection";
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix widget TAG_DeviceType", "TAG_prefixTAG_DeviceType_WidgetDisconnection",
sWidgetType);
if (isFunctionDefined(sFunction) && (sFunction != ""))
{
execScript("main(string sWidgetType) {" + sFunction + "(sWidgetType);}", makeDynString(), sWidgetType);
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_WidgetConnect
/** dpConnect to the device data
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param deviceName input, front-end device DP name
@param sFrontEnd input, front-end device name
*/
TAG_prefixTAG_DeviceType_WidgetConnect(string deviceName, string sFrontEnd)
{
int iRes;
string sSystemName;
// check if the device name is of type "TAG_DeviceType" if not like no front-end. -> not available.
if(dpTypeName(deviceName) != "TAG_DeviceType")
g_bUnSystemAlarmPlc = false;
sSystemName = unGenericDpFunctions_getSystemName(deviceName);
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix widget TAG_DeviceType "+deviceName,
"TAG_prefixTAG_DeviceType_WidgetConnect", deviceName, g_bUnSystemAlarmPlc);
if(g_bUnSystemAlarmPlc)
{
// set all widget global variable usefull for the callback, e.g.: description, format, unit, etc.
// if there are many dpConnect possibilities: e.g. dpConnect with or without _alert_hdl config
// keep the kind of dpConnect in a variable global to the widget and do a swith for the dpConnect
// and do to the correct dpDisconnect in the TAG_prefixTAG_DeviceType_WidgetDisconnect
iRes = dpConnect("TAG_prefixTAG_DeviceType_WidgetCB",
deviceName + ".statusInformation.selectedManager:_lock._original._locked",
deviceName + ".statusInformation.selectedManager",
deviceName + ".ProcessInput.data",
deviceName + ".ProcessInput.data:_online.._invalid",
sFrontEnd+".alarm",
sFrontEnd+".enabled");
g_bCallbackConnected = (iRes >= 0);
}else{
TAG_prefixTAG_DeviceType_WidgetDisconnection(g_sWidgetType);
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_WidgetDisconnect
/** dpDisconnect to the device data
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param deviceName input, front-end device DP name
@param sFrontEnd input, front-end device name
*/
TAG_prefixTAG_DeviceType_WidgetDisconnect(string deviceName, string sFrontEnd)
{
int iRes;
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix widget TAG_DeviceType "+deviceName,
"TAG_prefixTAG_DeviceType_WidgetDisconnect", deviceName, g_bUnSystemAlarmPlc);
if(g_bUnSystemAlarmPlc)
{
// if there were many dpConnect possibilities: e.g. dpConnect with or without _alert_hdl config
// re-use the kind of dpConnect kept in a variable global to the widget set during TAG_prefixTAG_DeviceType_WidgetConnect
// and do to the correct dpDisconnect
iRes = dpDisconnect("TAG_prefixTAG_DeviceType_WidgetCB",
deviceName + ".statusInformation.selectedManager:_lock._original._locked",
deviceName + ".statusInformation.selectedManager",
deviceName + ".ProcessInput.data",
deviceName + ".ProcessInput.data:_online.._invalid",
sFrontEnd+".alarm",
sFrontEnd+".enabled");
g_bCallbackConnected = !(iRes >= 0);
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_WidgetCB
/** callback function on the device data
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDpLocked input, the lock DPE
@param bLocked input, the lock state
@param sDpSelectedManager input, the selected manager DPE
@param sSelectedManager input, the selected manager
@param sDp1 input, the DPE1
@param blobData input, device data
@param sDpInvalid input, the invalid DPE
@param bInvalid input, data validity
@param sDpFESystemIntegrityAlarmValue input, front-end device system integrity alarm DPE
@param iFESystemIntegrityAlarmValue input, front-end device system integrity alarm value
@param sDpFESystemIntegrityAlarmEnabled input, front-end device system integrity enable DPE
@param bFESystemIntegrityAlarmEnabled input, front-end device system integrity enable value
*/
TAG_prefixTAG_DeviceType_WidgetCB(string sDpLocked, bool bLocked,
string sDpSelectedManager, string sSelectedManager,
string sDp1, blob blobData,
string sDpInvalid, bool bInvalid,
string sDpFESystemIntegrityAlarmValue, int iFESystemIntegrityAlarmValue,
string sDpFESystemIntegrityAlarmEnabled, bool bFESystemIntegrityAlarmEnabled)
{
/** use the exec mechanism to allow multiple widget. **/
string sFunction = "TAG_prefixTAG_DeviceType_"+g_sWidgetType+"Animation";
string selectColor, sWarningLetter, sWarningColor;
bool bSelectVisible;
// 1. set the widget.
unGenericObject_WidgetSelectAnimation(bLocked, sSelectedManager, selectColor, bSelectVisible);
// if bInvalid --> N letter and everything blue
if (bInvalid){
sWarningLetter = UN_WIDGET_TEXT_INVALID;
sWarningColor = "unDataNotValid";
}
else {
// if Front-end problem or problems-> O letter
if((!bFESystemIntegrityAlarmEnabled) || (iFESystemIntegrityAlarmValue > c_unSystemIntegrity_no_alarm_value))
{
sWarningLetter = UN_WIDGET_TEXT_OLD_DATA;
sWarningColor = "unDataNotValid";
}
}
if(g_bSystemConnected)
setMultiValue("WarningText", "text", sWarningLetter,
"WarningText", "foreCol", sWarningColor,
"SelectArea", "foreCol", selectColor,
"LockBmp", "visible", bSelectVisible,
"WidgetArea", "visible", true);
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix widget TAG_DeviceType "+sDp1, "TAG_prefixTAG_DeviceType_WidgetCB",
sDp1, blobData, g_sWidgetType,
sWarningLetter, sWarningColor, g_bSystemConnected,
selectColor, bSelectVisible);
if (isFunctionDefined(sFunction) && (sFunction != ""))
{
// set here all the common graphical element value or
// give to the function all the variables
execScript("main(blob blobData, bool bSystemConnected, string sWidgetType, int iFESystemIntegrityAlarmValue, bool
bFESystemIntegrityAlarmEnabled) {" +
sFunction + "(blobData, bSystemConnected, sWidgetType, iFESystemIntegrityAlarmValue, bFESystemIntegrityAlarmEnabled);}",
makeDynString(), blobData, g_bSystemConnected, g_sWidgetType, iFESystemIntegrityAlarmValue, bFESystemIntegrityAlarmEnabled);
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_MenuConfiguration
/** pop-up menu
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDpName input, device DP name
@param sDpType input, device type
@param dsAccessOk input, the access control
@param menuList output, pop-up menu to show, dyn_string to be given to the popupMenu function
*/
TAG_prefixTAG_DeviceType_MenuConfiguration(string sDpName, string sDpType, dyn_string dsAccessOk, dyn_string &menuList)
{
dyn_string dsMenuConfig = makeDynString(UN_POPUPMENU_SELECT_TEXT, UN_POPUPMENU_FACEPLATE_TEXT,
UN_POPUPMENU_TREND_TEXT);
unGenericObject_addSelectToMenu(sDpName, sDpType, dsMenuConfig, dsAccessOk, menuList);
unGenericObject_addUnicosActionToMenu(sDpName, sDpType, dsMenuConfig, dsAccessOk, menuList);
unGenericObject_addDefaultUnicosActionToMenu(sDpName, sDpType, dsMenuConfig, dsAccessOk, menuList);
unGenericObject_addTrendActionToMenu(sDpName, sDpType, dsMenuConfig, dsAccessOk, menuList, true);
// to add a device type menu add the menu from UN_POPUPMENU_MIN
/** e.g.: device menu enable/disabled depending on the device access right
int pos, iMenu=UN_POPUPMENU_MIN;
string sAccess, sOperAction, sExpAction, sAdminAction, sMenu;
dyn_string exceptionInfo, dsArchiveName;
dyn_bool dbPermissions;
pos = dynContains(menuList, "PUSH_BUTTON, Device configuration, 10, 1");
if(pos > 0) {
// get the access rigth on the device
unGenericDpFunctions_getAccessControlPriviledgeRigth(sDpName, g_dsDomainAccessControl, dbPermissions, sOperAction, sExpAction,
sAdminAction, exceptionInfo);
sAccess = "0";
if(dbPermissions[4]) {
sAccess = "1";
}
sprintf(sMenu, "%d", (iMenu+1));
dynInsertAt(menuList, "SEPARATOR", pos);
dynInsertAt(menuList, "PUSH_BUTTON, device menu, "+sMenu+", "+sAccess, pos);
dynInsertAt(menuList, "SEPARATOR", pos);
}
*/
/** e.g.: add all the device actions
dyn_string dsUserAccess;
int pos,i, len, iMenu=UN_POPUPMENU_MIN;
string sMenu;
pos = dynContains(menuList, "PUSH_BUTTON, Device configuration, 10, 1");
if(pos > 0) {
// get the allowed device actions for the user logged in
popsCVTDO_ButtonUserAccess(sDpName, "TAG_DeviceType", dsUserAccess);
// remove Select if it is in the list
len = dynContains(dsUserAccess, UN_POPUPMENU_SELECT_TEXT);
if(len > 0)
dynRemove(dsUserAccess, len);
len = dynlen(dsUserAccess);
if(len > 0)
dynInsertAt(menuList, "SEPARATOR", pos);
// add all the device actions
for(i=1;i<=len;i++)
{
sprintf(sMenu, "%d", (iMenu+1));
iMenu++;
dynInsertAt(menuList, "PUSH_BUTTON, "+dsUserAccess[i]+", "+sMenu+", 1", pos);
}
if(len > 0)
dynInsertAt(menuList, "SEPARATOR", pos);
}
*/
/** e.g.: add all the device actions depending on the current device value
dyn_string dsUserAccess;
int pos,i, len, iMenu=UN_POPUPMENU_MIN;
string sMenu, sAccess, sMenuText;
int iData;
bool bSelected;
bool bActionOk;
dyn_string dsButtons = makeDynString("AckAlarm", "AckDefault", "Set");
pos = dynContains(menuList, "PUSH_BUTTON, Device configuration, 10, 1");
if(pos > 0) {
// get the allowed device actions for the user logged in
popsCVTDO_ButtonUserAccess(sDpName, "TAG_DeviceType", dsUserAccess);
bSelected = dynContains(menuList, "PUSH_BUTTON, Deselect, 1, 1");
dpGet(sDpName+".ProcessInput.iData", iData);
// remove Select if it is in the list
len = dynContains(dsUserAccess, UN_POPUPMENU_SELECT_TEXT);
if(len > 0)
dynRemove(dsUserAccess, len);
len = dynlen(dsButtons);
if(dynlen(dsUserAccess) > 0)
dynInsertAt(menuList, "SEPARATOR", pos);
// add the device actions
for(i=1;i<=len;i++)
{
sprintf(sMenu, "%d", (iMenu+1));
iMenu++;
sAccess = "0";
bActionOk = (dynContains(dsUserAccess, dsButtons[i]) > 0); // User access
switch(dsButtons[i])
{
case "..":
bActionOk = bActionOk & bSelected & (iData == "..");
sMenuText = "Action ..";
break;
default:
bActionOk = false;
sMenuText = "";
break;
}
if(bActionOk)
sAccess = "1";
if(sMenuText != "")
dynInsertAt(menuList, "PUSH_BUTTON, "+sMenuText+", "+sMenu+", "+sAccess, pos);
}
if(dynlen(dsUserAccess) > 0)
dynInsertAt(menuList, "SEPARATOR", pos);
}
*/
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix rigthClick TAG_DeviceType "+sDpName,
"TAG_prefixTAG_DeviceType_MenuConfiguration", sDpName, sDpType, dsAccessOk, menuList);
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_HandleMenu
/** handle the answer of the popup menu
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param deviceName input, device DP name
@param sDpType input, device type
@param menuList input, the access control
@param iMenuAnswer input, selected menu value
*/
TAG_prefixTAG_DeviceType_HandleMenu(string deviceName, string sDpType, dyn_string menuList, int iMenuAnswer)
{
string sDeviceName = unGenericDpFunctions_getAlias(deviceName);
int iUN_POPUPMENU_MIN = UN_POPUPMENU_MIN;
dyn_string exceptionInfo;
dyn_string dsTemp, dsSplit;
int len, i, iMenu;
// handle unicos menu
if(iMenuAnswer < iUN_POPUPMENU_MIN)
unGenericObject_HandleUnicosMenu(deviceName, sDpType, menuList, iMenuAnswer, exceptionInfo);
else { // handle device actions
/** e.g.: handle the device actions
// find the corresponding device action text
dsTemp = dynPatternMatch("PUSH_BUTTON, *, 1", menuList);
len = dynlen(dsTemp);
for(i=1;i<=len;i++)
{
dsSplit = strsplit(dsTemp[i], ",");
sscanf(dsSplit[3], "%d", iMenu);
if(iMenu == iMenuAnswer) {
switch(strltrim(dsSplit[2], " "))
{
case "..":
// do the action
break;
}
}
}
*/
}
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix rigthClick TAG_DeviceType "+deviceName,
"TAG_prefixTAG_DeviceType_HandleMenu", deviceName, sDpType, menuList, iMenuAnswer);
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_TAG_WidgetTypeAnimation
/** animate the device TAG_WidgetType widget
!!!!! function trigger by exec call, $-param and variable of the widget cannot be used, all the necessary data
must be given to the function. The use of global var (global keyword declaration) is allowed
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param blobData input, device data
@param bSystemConnected input, connection state of the system, true=system connected/false=system not connected
@param sWidgetType input, the type of widget
@param iFESystemIntegrityAlarmValue input, front-end device system integrity alarm value
@param bFESystemIntegrityAlarmEnabled input, front-end device system integrity enable value
*/
TAG_prefixTAG_DeviceType_TAG_WidgetTypeAnimation(blob blobData, bool bSystemConnected, string sWidgetType, int
iFESystemIntegrityAlarmValue, bool bFESystemIntegrityAlarmEnabled)
{
/*!!!!!!!! all parameters must be given: function launched by exec ***/
// encapsulate all the setValue or function call with the following if(bSystemConnected)
if(bSystemConnected) {
setMultiValue("Body1", "foreCol", blobData, "Body1", "text", blobData);
}
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix widget TAG_DeviceType TAG_Widget",
"TAG_prefixTAG_DeviceType_TAG_WidgetTypeAnimation", sWidgetType, blobData, bSystemConnected,
iFESystemIntegrityAlarmValue, bFESystemIntegrityAlarmEnabled);
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_TAG_WidgetTypeDisconnection
/** animate the the device TAG_WidgetType widget when the system is disconnected
!!!!! function trigger by exec call, $-param and variable of the widget cannot be used, all the necessary data
must be given to the function. The use of global var (global keyword declaration) is allowed
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sWidgetType input, the type of widget
*/
TAG_prefixTAG_DeviceType_TAG_WidgetTypeDisconnection(string sWidgetType)
{
// set all the graphical element of the widget
setMultiValue("Body1", "backCol", "unDataNoAccess",
"WarningText", "text", "",
"WidgetArea", "visible", false,
"SelectArea", "foreCol", "",
"LockBmp", "visible", false);
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix widget TAG_DeviceType TAG_Widget",
"TAG_prefixTAG_DeviceType_TAG_WidgetTypeDisconnection", sWidgetType);
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_WidgetRegisterAlertCB
/** widget DistributedControl callback
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDp input, the DistributedControl system name DP name
@param bSystemConnected input, the state of the system name
*/
TAG_prefixTAG_DeviceType_WidgetRegisterAlertCB(string sDp, bool bSystemConnected)
{
string deviceName, sSystemName;
int iAction, iRes;
dyn_string exceptionInfo;
string sFrontEnd;
bool bRemote;
deviceName = unGenericDpFunctions_getWidgetDpName($sIdentifier);
if (deviceName == "") // In case of disconnection
{
deviceName = g_sDpName;
}
g_bUnSystemAlarmPlc = false;
// get the systemName
sSystemName = unGenericDpFunctions_getSystemName(deviceName);
// get the PLC name
sFrontEnd = unGenericObject_GetPLCNameFromDpName(deviceName);
unDistributedControl_isRemote(bRemote, sSystemName);
if(bRemote)
g_bSystemConnected = bSystemConnected;
else
g_bSystemConnected = true;
if(sFrontEnd != ""){
sFrontEnd = sSystemName+c_unSystemAlarm_dpPattern+DS_pattern+sFrontEnd;
//DebugN(sSystemName, sFrontEnd);
if(dpExists(sFrontEnd)) {
g_bUnSystemAlarmPlc = true;
}
}
g_sDeviceName = deviceName;
g_sFrontEnd = sFrontEnd;
unGenericObject_Connection(deviceName, g_bCallbackConnected, bSystemConnected, iAction, exceptionInfo);
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix widget TAG_DeviceType "+deviceName,
"TAG_prefixTAG_DeviceType_WidgetRegisterCB", sDp, deviceName, g_bCallbackConnected, g_bDisconnectCB, iAction);
switch (iAction)
{
case UN_ACTION_DISCONNECT:
TAG_prefixTAG_DeviceType_WidgetDisconnection(g_sWidgetType);
break;
case UN_ACTION_DPCONNECT:
g_sDpName = deviceName;
if(g_bUnSystemAlarmPlc) {
iRes = dpConnect("TAG_prefixTAG_DeviceType_WidgetLockCallBack", deviceName + ".ProcessInput.data:_lock._alert_hdl._locked");
g_bCallbackConnected = (iRes >= 0);
}
else
TAG_prefixTAG_DeviceType_WidgetDisconnection(g_sWidgetType);
break;
case UN_ACTION_DPDISCONNECT_DISCONNECT:
if(g_bUnSystemAlarmPlc) {
iRes = dpDisconnect("TAG_prefixTAG_DeviceType_WidgetLockCallBack", deviceName + ".ProcessInput.data:_lock._alert_hdl._locked");
g_bCallbackConnected = !(iRes >= 0);
}
if(g_bDisconnectCB)
TAG_prefixTAG_DeviceType_WidgetDisconnectAlert(deviceName, sFrontEnd);
TAG_prefixTAG_DeviceType_WidgetDisconnection(g_sWidgetType);
break;
case UN_ACTION_NOTHING:
default:
break;
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_WidgetLockCallBack
/** dpConnect to the device data
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDpe input, device DPE name
@param bLockState input, state of the alert lock
*/
TAG_prefixTAG_DeviceType_WidgetLockCallBack(string sDpe, bool bLockState)
{
int iRes;
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix widget TAG_DeviceType "+g_sDeviceName,
"TAG_prefixTAG_DeviceType_WidgetLockCallBack", sDpe, bLockState, g_bDisconnectCB, g_sDeviceName, g_sFrontEnd);
if(bLockState) { // lock set so disconnect if not already disconnected
// no need to check if it was already set before because it is not possible to do 2 dpSet on the lock the Ev reject the message
if(g_bDisconnectCB) {
TAG_prefixTAG_DeviceType_WidgetDisconnectAlert(g_sDeviceName, g_sFrontEnd);
}
TAG_prefixTAG_DeviceType_WidgetDisconnection(g_sWidgetType);
// set the WidgetArea to true, so that even if there is a problem with the lock, one can do a rigth click and correct the lock state
setValue("WidgetArea", "visible", true);
}
else { // lock not set so connect if not already connected
// no need to check if it was already set before because it is not possible to do 2 dpSet on the lock the Ev reject the message
if(!g_bDisconnectCB) {
TAG_prefixTAG_DeviceType_WidgetConnectAlert(g_sDeviceName, g_sFrontEnd);
}
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_WidgetConnectAlert
/** dpConnect to the device data
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param deviceName input, front-end device DP name
@param sFrontEnd input, front-end device name
*/
TAG_prefixTAG_DeviceType_WidgetConnectAlert(string deviceName, string sFrontEnd)
{
int iRes;
string sSystemName;
// check if the device name is of type "TAG_DeviceType" if not like no front-end. -> not available.
if(dpTypeName(deviceName) != "TAG_DeviceType")
g_bUnSystemAlarmPlc = false;
sSystemName = unGenericDpFunctions_getSystemName(deviceName);
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix widget TAG_DeviceType "+deviceName,
"TAG_prefixTAG_DeviceType_WidgetConnectAlert", deviceName, g_bUnSystemAlarmPlc);
if(g_bUnSystemAlarmPlc)
{
// set all widget global variable usefull for the callback, e.g.: description, format, unit, etc.
// if there are many dpConnect possibilities: e.g. dpConnect with or without _alert_hdl config
// keep the kind of dpConnect in a variable global to the widget and do a swith for the dpConnect
// and do to the correct dpDisconnect in the TAG_prefixTAG_DeviceType_WidgetDisconnectAlert
iRes = dpConnect("TAG_prefixTAG_DeviceType_WidgetCB",
deviceName + ".statusInformation.selectedManager:_lock._original._locked",
deviceName + ".statusInformation.selectedManager",
deviceName + ".ProcessInput.data",
deviceName + ".ProcessInput.data:_online.._invalid",
sFrontEnd+".alarm",
sFrontEnd+".enabled");
g_bDisconnectCB = (iRes >= 0);
}else{
TAG_prefixTAG_DeviceType_WidgetDisconnection(g_sWidgetType);
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_WidgetDisconnectAlert
/** dpDisconnect to the device data
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param deviceName input, front-end device DP name
@param sFrontEnd input, front-end device name
*/
TAG_prefixTAG_DeviceType_WidgetDisconnectAlert(string deviceName, string sFrontEnd)
{
int iRes;
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix widget TAG_DeviceType "+deviceName,
"TAG_prefixTAG_DeviceType_WidgetDisconnectAlert", deviceName, g_bUnSystemAlarmPlc);
if(g_bUnSystemAlarmPlc)
{
// if there were many dpConnect possibilities: e.g. dpConnect with or without _alert_hdl config
// re-use the kind of dpConnect kept in a variable global to the widget set during TAG_prefixTAG_DeviceType_WidgetConnectAlert
// and do to the correct dpDisconnect
iRes = dpDisconnect("TAG_prefixTAG_DeviceType_WidgetCB",
deviceName + ".statusInformation.selectedManager:_lock._original._locked",
deviceName + ".statusInformation.selectedManager",
deviceName + ".ProcessInput.data",
deviceName + ".ProcessInput.data:_online.._invalid",
sFrontEnd+".alarm",
sFrontEnd+".enabled");
g_bDisconnectCB = !(iRes >= 0);
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_FaceplateStatusRegisterAlertCB
/** faceplate DistributedControl callback of the faceplate status panel
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDp input, the DistributedControl system name DP name
@param bSystemConnected input, the state of the system name
*/
TAG_prefixTAG_DeviceType_FaceplateStatusRegisterAlertCB(string sDp, bool bSystemConnected)
{
string deviceName, sSystemName;
int iAction, iRes;
dyn_string exceptionInfo;
bool bRemote;
deviceName = unGenericDpFunctions_getDpName($sDpName);
sSystemName = unGenericDpFunctions_getSystemName(deviceName);
unDistributedControl_isRemote(bRemote, sSystemName);
if(bRemote)
g_bSystemConnected = bSystemConnected;
else
g_bSystemConnected = true;
unGenericObject_Connection(deviceName, g_bCallbackConnected, bSystemConnected, iAction, exceptionInfo);
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix faceplate TAG_DeviceType "+sDp,
"TAG_prefixTAG_DeviceType_FaceplateStatusRegisterAlertCB", sDp, deviceName, g_bCallbackConnected, g_bDisconnectCB, iAction);
switch (iAction)
{
case UN_ACTION_DISCONNECT:
TAG_prefixTAG_DeviceType_FaceplateStatusDisconnection();
break;
case UN_ACTION_DPCONNECT:
TAG_prefixTAG_DeviceType_FaceplateConnectAlert(deviceName);
break;
case UN_ACTION_DPDISCONNECT_DISCONNECT:
TAG_prefixTAG_DeviceType_FaceplateDisconnectAlert(deviceName);
TAG_prefixTAG_DeviceType_FaceplateStatusDisconnection();
break;
case UN_ACTION_NOTHING:
default:
break;
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_FaceplateConnectAlert
/** dpConnect to the device data
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param deviceName input, the device DP name
*/
TAG_prefixTAG_DeviceType_FaceplateConnectAlert(string deviceName)
{
int iAction, iRes;
dyn_string exceptionInfo;
string sFrontEnd, sSystemName;
g_sDeviceAlias = unGenericDpFunctions_getAlias(deviceName);
g_bUnSystemAlarmPlc = false;
// get the systemName
sSystemName = unGenericDpFunctions_getSystemName(deviceName);
// get the PLC name
sFrontEnd = unGenericObject_GetPLCNameFromDpName(deviceName);
g_sFrontEndDp = sSystemName+sFrontEnd;
g_sFrontEndAlias = unGenericDpFunctions_getAlias(g_sFrontEndDp);
if(sFrontEnd != ""){
sFrontEnd = sSystemName+c_unSystemAlarm_dpPattern+DS_pattern+sFrontEnd;
//DebugN(sSystemName, sFrontEnd);
if(dpExists(sFrontEnd)) {
g_bUnSystemAlarmPlc = true;
}
}
g_sDeviceName = deviceName;
g_sFrontEnd = sFrontEnd;
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix faceplate TAG_DeviceType "+deviceName,
"TAG_prefixTAG_DeviceType_FaceplateConnectAlert", deviceName, sFrontEnd, g_bUnSystemAlarmPlc, g_bDisconnectCB);
if(g_bUnSystemAlarmPlc) {
iRes = dpConnect("TAG_prefixTAG_DeviceType_FaceplateLockCallBack", deviceName + ".ProcessInput.data:_lock._alert_hdl._locked");
g_bCallbackConnected = (iRes >= 0);
}
else
TAG_prefixTAG_DeviceType_FaceplateStatusDisconnection();
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_FaceplateDisconnectAlert
/** dpDisconnect to the device data
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param deviceName input, the device DP name
*/
TAG_prefixTAG_DeviceType_FaceplateDisconnectAlert(string deviceName)
{
int iRes;
string sFrontEnd, sSystemName;
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix faceplate TAG_DeviceType "+deviceName,
"TAG_prefixTAG_DeviceType_FaceplateDisconnectAlert", deviceName, g_bUnSystemAlarmPlc, g_bDisconnectCB);
if(g_bUnSystemAlarmPlc) {
// get the systemName
sSystemName = unGenericDpFunctions_getSystemName(deviceName);
// get the PLC name
sFrontEnd = unGenericObject_GetPLCNameFromDpName(deviceName);
sFrontEnd = sSystemName+c_unSystemAlarm_dpPattern+DS_pattern+sFrontEnd;
iRes = dpDisconnect("TAG_prefixTAG_DeviceType_FaceplateLockCallBack", deviceName + ".ProcessInput.data:_lock._alert_hdl._locked");
g_bCallbackConnected = !(iRes >= 0);
if(g_bDisconnectCB) {
// if there were many dpConnect possibilities: e.g. dpConnect with or without _alert_hdl config
// re-use the kind of dpConnect kept in a variable global to the faceplate set during TAG_prefixTAG_DeviceType_FaceplateConnect
// and do to the correct dpDisconnect
iRes = dpDisconnect("TAG_prefixTAG_DeviceType_FaceplateStatusAnimationCB",
deviceName + ".ProcessInput.data",
deviceName + ".ProcessInput.data:_online.._invalid",
deviceName + ".ProcessInput.iData",
sFrontEnd+".alarm",
sFrontEnd+".enabled");
g_bDisconnectCB = !(iRes >= 0);
}
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_FaceplateLockCallBack
/** dpConnect to the device data
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDpe input, device DPE name
@param bLockState input, state of the alert lock
*/
TAG_prefixTAG_DeviceType_FaceplateLockCallBack(string sDpe, bool bLockState)
{
int iRes;
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix faceplate TAG_DeviceType "+g_sDeviceName,
"TAG_prefixTAG_DeviceType_FaceplateLockCallBack", sDpe, bLockState, g_bDisconnectCB, g_sDeviceName, g_sFrontEnd);
if(bLockState) { // lock set so disconnect if not already disconnected
// no need to check if it was already set before because it is not possible to do 2 dpSet on the lock the Ev reject the message
if(g_bDisconnectCB) {
iRes = dpDisconnect("TAG_prefixTAG_DeviceType_FaceplateStatusAnimationCB",
g_sDeviceName + ".ProcessInput.data",
g_sDeviceName + ".ProcessInput.data:_online.._invalid",
g_sDeviceName + ".ProcessInput.iData",
g_sFrontEnd+".alarm",
g_sFrontEnd+".enabled");
g_bDisconnectCB = !(iRes >= 0);
}
TAG_prefixTAG_DeviceType_FaceplateStatusDisconnection();
}
else { // lock not set so connect if not already connected
// no need to check if it was already set before because it is not possible to do 2 dpSet on the lock the Ev reject the message
if(!g_bDisconnectCB) {
// set all faceplate global variable usefull for the callback, e.g.: description, format, unit, etc.
// set graphical element of the faceplate to the init state if needed
// if there are many dpConnect possibilities: e.g. dpConnect with or without _alert_hdl config
// keep the kind of dpConnect in a variable global to the faceplate and do a swith for the dpConnect
// and do to the correct dpDisconnect in the TAG_prefixTAG_DeviceType_FaceplateDisconnect
iRes = dpConnect("TAG_prefixTAG_DeviceType_FaceplateStatusAnimationCB",
g_sDeviceName + ".ProcessInput.data",
g_sDeviceName + ".ProcessInput.data:_online.._invalid",
g_sDeviceName + ".ProcessInput.iData",
g_sFrontEnd+".alarm",
g_sFrontEnd+".enabled");
g_bDisconnectCB = (iRes >= 0);
}
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
//@}

APPENDIX G: TAG_PREFIXCONFIGGENERICFUNCTIONS.CTL

/**@file
// TAG_prefixGenericFunctions.ctl
This library contains the generic functions of the package.
@par Creation Date
dd/mm/yyyy
@par Modification History
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@author
the author (DEP-GROUP)
*/
//@{
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixGenericFunctions_addDefaultUser
/** add/reset default user, password not change if already set.
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
*/
TAG_prefixGenericFunctions_addDefaultUser()
{
string acComponent="fwAccessControl";
string acVersion="3.2.7", sPassword;
int acInstalled, iPos;
dyn_string exceptionInfo, dsUserName, dsPassword;
bool bIntegratedMode;
fwInstallation_componentInstalled(acComponent, acVersion, acInstalled);
if (!acInstalled)
{
DebugTN("TAG_prefixGenericFunctions_setDefaultUser: Access Control component " + acVersion + " not installed!");
return;
}
bIntegratedMode=_fwAccessControl_integratedMode();
if(!bIntegratedMode)
{
// use here the fwAccessControl functions to create domains, privileges, groups, users
DebugTN("TAG_prefixGenericFunctions_setDefaultUser: QPS domain, group and user updated");
}
else
DebugTN("TAG_prefixGenericFunctions_setDefaultUser: fwAccessControl mode activated, the changes are automatically populated from the AC
server.");
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixGenericFunctions_FaceplateStatusHeader
/** set the text and the colors of the header in the faceplate status tab (state of the FE connection)
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sFEDp input, front-end DP name
@param sFEAlias input, front-end name (alias)
@param sDeviceAlias input, device name (alias)
@param iAlarm input, front-end comm system integrity alarm level
@param bSystemAlarmEnable input, front-end comm system integrity enable/disable
@param bInvalid input, device invalid state
*/
TAG_prefixGenericFunctions_FaceplateStatusHeader(string sFEDp, string sFEAlias, string sDeviceAlias, int iAlarm, bool bSystemAlarmEnable, bool
bInvalid)
{
bool bOk=false, bFrontEnd=false;
time tLast;
string sBackColor, sForeColor, sText, sTime, sName;
sName=sFEAlias;
if (sName=="")
sName="?";
else if (sName!=sFEDp)
bFrontEnd=true;
if(bInvalid)
{
sBackColor="unDataNotValid";
sForeColor="_3DText";
sTime="";
sText="DATA INVALID";
}
else if(!bSystemAlarmEnable)
{
//SystemAlarm disabled
//sBackColor="unAlarmMasked";
sBackColor="unDataNotValid";
sForeColor="_3DText";
sTime="";
sText=sName + " DATA Connection DISABLED";
}
else
{
if(iAlarm > c_unSystemIntegrity_no_alarm_value)
{
//Connection stopped
sBackColor="unDataNotValid";
sForeColor="_3DText";
sText=sName + " NO DATA Connection";
if(bFrontEnd)
{
if (dpExists(sFEDp))
{
dpGet(sFEDp + ".communication.counter:_online.._stime", tLast);
sTime=" since: " + (string)tLast;
}
else
{
sTime="?";
}
}
else
sTime="";
}
else
{
//Connection FE OK
sBackColor="_3DFace";
sForeColor="_3DText";
sText=sName + " DATA Connection OK";
sTime="";
bOk=true;
}
}
sText=sText + sTime;
if(shapeExists("txtFEstatus"))
{
setMultiValue("txtFEstatus", "backCol", sBackColor,
"txtFEstatus", "foreCol", sForeColor,
"txtFEstatus", "text", sText);
}
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixGenericFunctions_FaceplateStatusDisconnect
/** set the text and the colors of the header in the faceplate status tab (state of the FE connection) in
case of disconnection of the remote system
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
*/
void TAG_prefixGenericFunctions_FaceplateStatusDisconnect()
{
string sBackColor, sForeColor, sText;
sBackColor="_3DFace";
sForeColor="unDataNoAccess";
sText="DATA not connected";
if(shapeExists("txtFEstatus"))
{
setMultiValue("txtFEstatus", "backCol", sBackColor,
"txtFEstatus", "foreCol", sForeColor,
"txtFEstatus", "text", sText);
}
}
//------------------------------------------------------------------------------------------------------------------------
//@}

APPENDIX H: TAG_PREFIXCONSTANT_DECLARATIONS.CTL

/**@file
// TAG_prefixConstant_declarations.ctl
This library contains the definition of the constants.
@par Creation Date
dd/mm/yyyy
@par Modification History
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@author
the author (DEP-GROUP)
*/
//@{
// put here the constants
const string TAG_PREFIX_DPNAME_PREFIX = "TAG_prefix";
// constants for the check/import of the FrontEndType
const string TAG_PREFIX_TAG_FRONTENDTYPE_DPTYPE = "TAG_FrontEndType";
// total length of the PLCONFIG line (dyn_string) withoout PLCONFIG
const unsigned UN_CONFIG_TAG_FRONTENDTYPE_LENGTH = FELENGTH;
// put here below an index for each front-end config (not the 3 mandatory fields: front-end type, front-end instance, application)
const unsigned UN_CONFIG_TAG_FRONTENDTYPE_FIELD1 = FELENGTH-3;
const unsigned UN_CONFIG_TAG_FRONTENDTYPE_FIELD2 = FELENGTH-2;
const unsigned UN_CONFIG_TAG_FRONTENDTYPE_FIELD3 = FELENGTH-1;
const unsigned UN_CONFIG_TAG_FRONTENDTYPE_FIELD4 = FELENGTH;
// put here the FE system alarm const for check if needed
//const unsigned UN_TAG_FRONTENDTYPE_CHECKFESYSTEM_ALARM_LENGTH = x; // x parameters
//const unsigned UN_TAG_FRONTENDTYPE_CHECKFESYSTEM_ALARM_FRONTEND = 1; // front-end type
//const unsigned UN_TAG_FRONTENDTYPE_CHECKFESYSTEM_ALARM_NAME = 2; // name
//const unsigned UN_TAG_FRONTENDTYPE_CHECKFESYSTEM_ALARM_ADDRESS = 3; // Address in front-end
//const unsigned UN_TAG_FRONTENDTYPE_CHECKFESYSTEM_ALARM_OKALARM = 4; // true=alarm if value>10, false (default) = alarm if
value<=10
//const unsigned UN_TAG_FRONTENDTYPE_CHECKFESYSTEM_ALARM_DESCRIPTION = 5; // description
//const unsigned UN_TAG_FRONTENDTYPE_CHECKFESYSTEM_ALARM_FIELD1 = 6; //
//const unsigned UN_TAG_FRONTENDTYPE_CHECKFESYSTEM_ALARM_FIELD2 = 7; //
//const unsigned UN_TAG_FRONTENDTYPE_CHECKFESYSTEM_ALARM_FIELD3 = 8; //
//const unsigned UN_TAG_FRONTENDTYPE_CHECKFESYSTEM_ALARM_FIELD4 = 9; //
//const unsigned UN_TAG_FRONTENDTYPE_SETFESYSTEM_ALARM_LENGTH = y; // y=x+7 parameters
//const unsigned UN_TAG_FRONTENDTYPE_SETFESYSTEM_ALARM_NAME = 1; // name
//const unsigned UN_TAG_FRONTENDTYPE_SETFESYSTEM_ALARM_ADDRESS = 2; // Address in front-end
//const unsigned UN_TAG_FRONTENDTYPE_SETFESYSTEM_ALARM_OKALARM = 3; // true=alarm if value>10, false (default) = alarm if
value<=10
//const unsigned UN_TAG_FRONTENDTYPE_SETFESYSTEM_ALARM_DESCRIPTION = 4; // description
//const unsigned UN_TAG_FRONTENDTYPE_SETFESYSTEM_ALARM_FIELD1 = 5; //
//const unsigned UN_TAG_FRONTENDTYPE_SETFESYSTEM_ALARM_FIELD2 = 6; //
//const unsigned UN_TAG_FRONTENDTYPE_SETFESYSTEM_ALARM_FIELD3 = 7; //
//const unsigned UN_TAG_FRONTENDTYPE_SETFESYSTEM_ALARM_FIELD4 = 8; //
//const unsigned UN_TAG_FRONTENDTYPE_FESYSTEMALARM_DEVICENAME = 9;
//const unsigned UN_TAG_FRONTENDTYPE_FESYSTEMALARM_PLCNAME = 10;
//const unsigned UN_TAG_FRONTENDTYPE_FESYSTEMALARM_TYPE = 11;
//const unsigned UN_TAG_FRONTENDTYPE_FESYSTEMALARM_PLCNUMBER = 12;
//const unsigned UN_TAG_FRONTENDTYPE_FESYSTEMALARM_DRIVER = 13;
//const unsigned UN_TAG_FRONTENDTYPE_FESYSTEMALARM_EVENT16 = 14;
//const unsigned UN_TAG_FRONTENDTYPE_FESYSTEMALARM_ARCHIVE = 15;
// constant for DQGTW system integrity
const string c_TAG_PREFIX_FRONTEND_UNSYSTEMALARM = "_unSystemAlarm";
const string c_TAG_prefixSystemIntegrity_TAG_FRONTENDTYPE = "TAG_FrontEndType_";
const string UN_SYSTEM_INTEGRITY_TAG_FRONTENDTYPE = "TAG_FrontEndType";
const string UN_SYSTEM_INTEGRITY_TAG_FRONTENDTYPE_check = "TAG_prefixSystemIntegrity_TAG_FrontEndTypeCheck";
const int c_TAG_prefixSystemIntegrity_defaultTAG_FRONTENDTYPECheckingDelay = 10; // default value for the checking in sec.
// constant for the check/import of the DeviceType
const unsigned TAG_PREFIX_CONFIG_TAG_DEVICETYPE_LENGTH = DeviceTypeConfigLenght; // device config lenght without the mandatory field
// if the archive Y/N is configurable for the device,
// the constant UN_CONFIG_TAG_FRONTENDTYPE_TAG_DEVICETYPE_ARCHIVE_ACTIVE is mandatory
// if yes then the import takes the default configuration from the JCOP device definition
// if no then the import does not add the DPEs
// if the archive is not configurable for the device, the import takes the default configuration from the JCOP device definition
const unsigned TAG_PREFIX_CONFIG_TAG_DEVICETYPE_ARCHIVEACTIVE = DeviceTypeConfigLenght-2;
const unsigned TAG_PREFIX_CONFIG_TAG_DEVICETYPE_FIELD1 = DeviceTypeConfigLenght-1;
const unsigned TAG_PREFIX_CONFIG_TAG_DEVICETYPE_FIELD2 = DeviceTypeConfigLenght;
// constant for the import database panel
const unsigned UN_CONFIG_TAG_FRONTENDTYPE_TAG_DEVICETYPE_ARCHIVE_ACTIVE = 1; // mandatory if the archive is parametrizable
const unsigned UN_CONFIG_TAG_FRONTENDTYPE_TAG_DEVICETYPE_LENGTH = DeviceTypeConfigLenght-2;
// constant for export
// constant for widget
// constant for faceplate
// constant for device action interface
// any other constants
//@}
//@{
// put here the global variables
//global dyn_string g_ds_TAG_PREFIX_myVariable;
//@}

APPENDIX I: TAG_PREFIXGENERICFUNCTIONS.CTL

/**@file
// TAG_prefixGenericFunctions.ctl
This library contains the generic functions of the package.
@par Creation Date
dd/mm/yyyy
@par Modification History
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@author
the author (DEP-GROUP)
*/
//@{
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixGenericFunctions_addDefaultUser
/** add/reset default user, password not change if already set.
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
*/
TAG_prefixGenericFunctions_addDefaultUser()
{
string acComponent="fwAccessControl";
string acVersion="3.2.7", sPassword;
int acInstalled, iPos;
dyn_string exceptionInfo, dsUserName, dsPassword;
bool bIntegratedMode;
fwInstallation_componentInstalled(acComponent, acVersion, acInstalled);
if (!acInstalled)
{
DebugTN("TAG_prefixGenericFunctions_setDefaultUser: Access Control component " + acVersion + " not installed!");
return;
}
bIntegratedMode=_fwAccessControl_integratedMode();
if(!bIntegratedMode)
{
// use here the fwAccessControl functions to create domains, privileges, groups, users
DebugTN("TAG_prefixGenericFunctions_setDefaultUser: QPS domain, group and user updated");
}
else
DebugTN("TAG_prefixGenericFunctions_setDefaultUser: fwAccessControl mode activated, the changes are automatically populated from the AC
server.");
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixGenericFunctions_FaceplateStatusHeader
/** set the text and the colors of the header in the faceplate status tab (state of the FE connection)
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sFEDp input, front-end DP name
@param sFEAlias input, front-end name (alias)
@param sDeviceAlias input, device name (alias)
@param iAlarm input, front-end comm system integrity alarm level
@param bSystemAlarmEnable input, front-end comm system integrity enable/disable
@param bInvalid input, device invalid state
*/
TAG_prefixGenericFunctions_FaceplateStatusHeader(string sFEDp, string sFEAlias, string sDeviceAlias, int iAlarm, bool bSystemAlarmEnable, bool
bInvalid)
{
bool bOk=false, bFrontEnd=false;
time tLast;
string sBackColor, sForeColor, sText, sTime, sName;
sName=sFEAlias;
if (sName=="")
sName="?";
else if (sName!=sFEDp)
bFrontEnd=true;
if(bInvalid)
{
sBackColor="unDataNotValid";
sForeColor="_3DText";
sTime="";
sText="DATA INVALID";
}
else if(!bSystemAlarmEnable)
{
//SystemAlarm disabled
//sBackColor="unAlarmMasked";
sBackColor="unDataNotValid";
sForeColor="_3DText";
sTime="";
sText=sName + " DATA Connection DISABLED";
}
else
{
if(iAlarm > c_unSystemIntegrity_no_alarm_value)
{
//Connection stopped
sBackColor="unDataNotValid";
sForeColor="_3DText";
sText=sName + " NO DATA Connection";
if(bFrontEnd)
{
if (dpExists(sFEDp))
{
dpGet(sFEDp + ".communication.counter:_online.._stime", tLast);
sTime=" since: " + (string)tLast;
}
else
{
sTime="?";
}
}
else
sTime="";
}
else
{
//Connection FE OK
sBackColor="_3DFace";
sForeColor="_3DText";
sText=sName + " DATA Connection OK";
sTime="";
bOk=true;
}
}
sText=sText + sTime;
if(shapeExists("txtFEstatus"))
{
setMultiValue("txtFEstatus", "backCol", sBackColor,
"txtFEstatus", "foreCol", sForeColor,
"txtFEstatus", "text", sText);
}
}
//------------------------------------------------------------------------------------------------------------------------
// TAG_prefixGenericFunctions_FaceplateStatusDisconnect
/** set the text and the colors of the header in the faceplate status tab (state of the FE connection) in
case of disconnection of the remote system
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
*/
void TAG_prefixGenericFunctions_FaceplateStatusDisconnect()
{
string sBackColor, sForeColor, sText;
sBackColor="_3DFace";
sForeColor="unDataNoAccess";
sText="DATA not connected";
if(shapeExists("txtFEstatus"))
{
setMultiValue("txtFEstatus", "backCol", sBackColor,
"txtFEstatus", "foreCol", sForeColor,
"txtFEstatus", "text", sText);
}
}
//------------------------------------------------------------------------------------------------------------------------
//@}

APPENDIX J: Example of Widget Functions with alert_hdl Config

//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_WidgetRegisterAlertCB
/** widget DistributedControl callback
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDp input, the DistributedControl system name DP name
@param bSystemConnected input, the state of the system name
*/
TAG_prefixTAG_DeviceType_WidgetRegisterAlertCB(string sDp, bool bSystemConnected)
{
string deviceName, sSystemName;
int iAction, iRes;
dyn_string exceptionInfo;
string sFrontEnd;
bool bRemote;
deviceName = unGenericDpFunctions_getWidgetDpName($sIdentifier);
if (deviceName == "") // In case of disconnection
{
deviceName = g_sDpName;
}
g_bUnSystemAlarmPlc = false;
// get the systemName
sSystemName = unGenericDpFunctions_getSystemName(deviceName);
// get the PLC name
sFrontEnd = unGenericObject_GetPLCNameFromDpName(deviceName);
unDistributedControl_isRemote(bRemote, sSystemName);
if(bRemote)
g_bSystemConnected = bSystemConnected;
else
g_bSystemConnected = true;
if(sFrontEnd != ""){
sFrontEnd = sSystemName+c_unSystemAlarm_dpPattern+DS_pattern+sFrontEnd;
//DebugN(sSystemName, sFrontEnd);
if(dpExists(sFrontEnd)) {
g_bUnSystemAlarmPlc = true;
}
}
g_sDeviceName = deviceName;
g_sFrontEnd = sFrontEnd;
unGenericObject_Connection(deviceName, g_bCallbackConnected, bSystemConnected, iAction, exceptionInfo);
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix widget TAG_DeviceType "+deviceName,
"TAG_prefixTAG_DeviceType_WidgetRegisterCB", sDp, deviceName, g_bCallbackConnected, g_bDisconnectCB, iAction);
switch (iAction)
{
case UN_ACTION_DISCONNECT:
TAG_prefixTAG_DeviceType_WidgetDisconnection(g_sWidgetType);
break;
case UN_ACTION_DPCONNECT:
g_sDpName = deviceName;
if(g_bUnSystemAlarmPlc) {
iRes = dpConnect("TAG_prefixTAG_DeviceType_WidgetLockCallBack", deviceName + ".ProcessInput.data:_lock._alert_hdl._locked");
g_bCallbackConnected = (iRes >= 0);
}
else
TAG_prefixTAG_DeviceType_WidgetDisconnection(g_sWidgetType);
break;
case UN_ACTION_DPDISCONNECT_DISCONNECT:
if(g_bUnSystemAlarmPlc) {
iRes = dpDisconnect("TAG_prefixTAG_DeviceType_WidgetLockCallBack", deviceName + ".ProcessInput.data:_lock._alert_hdl._locked");
g_bCallbackConnected = !(iRes >= 0);
}
if(g_bDisconnectCB)
TAG_prefixTAG_DeviceType_WidgetDisconnectAlert(deviceName, sFrontEnd);
TAG_prefixTAG_DeviceType_WidgetDisconnection(g_sWidgetType);
break;
case UN_ACTION_NOTHING:
default:
break;
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_WidgetLockCallBack
/** dpConnect to the device data
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDpe input, device DPE name
@param bLockState input, state of the alert lock
*/
TAG_prefixTAG_DeviceType_WidgetLockCallBack(string sDpe, bool bLockState)
{
int iRes;
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix widget TAG_DeviceType "+g_sDeviceName,
"TAG_prefixTAG_DeviceType_WidgetLockCallBack", sDpe, bLockState, g_bDisconnectCB, g_sDeviceName, g_sFrontEnd);
if(bLockState) { // lock set so disconnect if not already disconnected
// no need to check if it was already set before because it is not possible to do 2 dpSet on the lock the Ev reject the message
if(g_bDisconnectCB) {
TAG_prefixTAG_DeviceType_WidgetDisconnectAlert(g_sDeviceName, g_sFrontEnd);
}
TAG_prefixTAG_DeviceType_WidgetDisconnection(g_sWidgetType);
// set the WidgetArea to true, so that even if there is a problem with the lock, one can do a rigth click and correct the lock state
setValue("WidgetArea", "visible", true);
}
else { // lock not set so connect if not already connected
// no need to check if it was already set before because it is not possible to do 2 dpSet on the lock the Ev reject the message
if(!g_bDisconnectCB) {
TAG_prefixTAG_DeviceType_WidgetConnectAlert(g_sDeviceName, g_sFrontEnd);
}
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_WidgetConnectAlert
/** dpConnect to the device data
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param deviceName input, front-end device DP name
@param sFrontEnd input, front-end device name
*/
TAG_prefixTAG_DeviceType_WidgetConnectAlert(string deviceName, string sFrontEnd)
{
int iRes;
string sSystemName;
// check if the device name is of type "TAG_DeviceType" if not like no front-end. -> not available.
if(dpTypeName(deviceName) != "TAG_DeviceType")
g_bUnSystemAlarmPlc = false;
sSystemName = unGenericDpFunctions_getSystemName(deviceName);
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix widget TAG_DeviceType "+deviceName,
"TAG_prefixTAG_DeviceType_WidgetConnectAlert", deviceName, g_bUnSystemAlarmPlc);
if(g_bUnSystemAlarmPlc)
{
// set all widget global variable usefull for the callback, e.g.: description, format, unit, etc.
// if there are many dpConnect possibilities: e.g. dpConnect with or without _alert_hdl config
// keep the kind of dpConnect in a variable global to the widget and do a swith for the dpConnect
// and do to the correct dpDisconnect in the TAG_prefixTAG_DeviceType_WidgetDisconnectAlert
iRes = dpConnect("TAG_prefixTAG_DeviceType_WidgetCB",
deviceName + ".statusInformation.selectedManager:_lock._original._locked",
deviceName + ".statusInformation.selectedManager",
deviceName + ".ProcessInput.data",
deviceName + ".ProcessInput.data:_online.._invalid",
sFrontEnd+".alarm",
sFrontEnd+".enabled");
g_bDisconnectCB = (iRes >= 0);
}else{
TAG_prefixTAG_DeviceType_WidgetDisconnection(g_sWidgetType);
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_WidgetDisconnectAlert
/** dpDisconnect to the device data
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param deviceName input, front-end device DP name
@param sFrontEnd input, front-end device name
*/
TAG_prefixTAG_DeviceType_WidgetDisconnectAlert(string deviceName, string sFrontEnd)
{
int iRes;
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix widget TAG_DeviceType "+deviceName,
"TAG_prefixTAG_DeviceType_WidgetDisconnectAlert", deviceName, g_bUnSystemAlarmPlc);
if(g_bUnSystemAlarmPlc)
{
// if there were many dpConnect possibilities: e.g. dpConnect with or without _alert_hdl config
// re-use the kind of dpConnect kept in a variable global to the widget set during TAG_prefixTAG_DeviceType_WidgetConnectAlert
// and do to the correct dpDisconnect
iRes = dpDisconnect("TAG_prefixTAG_DeviceType_WidgetCB",
deviceName + ".statusInformation.selectedManager:_lock._original._locked",
deviceName + ".statusInformation.selectedManager",
deviceName + ".ProcessInput.data",
deviceName + ".ProcessInput.data:_online.._invalid",
sFrontEnd+".alarm",
sFrontEnd+".enabled");
g_bDisconnectCB = !(iRes >= 0);
}
}
//---------------------------------------------------------------------------------------------------------------------------------------

APPENDIX K: Example of Faceplate Function with alert_hdl Config

//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_FaceplateStatusRegisterAlertCB
/** faceplate DistributedControl callback of the faceplate status panel
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDp input, the DistributedControl system name DP name
@param bSystemConnected input, the state of the system name
*/
TAG_prefixTAG_DeviceType_FaceplateStatusRegisterAlertCB(string sDp, bool bSystemConnected)
{
string deviceName, sSystemName;
int iAction, iRes;
dyn_string exceptionInfo;
bool bRemote;
deviceName = unGenericDpFunctions_getDpName($sDpName);
sSystemName = unGenericDpFunctions_getSystemName(deviceName);
unDistributedControl_isRemote(bRemote, sSystemName);
if(bRemote)
g_bSystemConnected = bSystemConnected;
else
g_bSystemConnected = true;
unGenericObject_Connection(deviceName, g_bCallbackConnected, bSystemConnected, iAction, exceptionInfo);
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix faceplate TAG_DeviceType "+sDp,
"TAG_prefixTAG_DeviceType_FaceplateStatusRegisterAlertCB", sDp, deviceName, g_bCallbackConnected, g_bDisconnectCB, iAction);
switch (iAction)
{
case UN_ACTION_DISCONNECT:
TAG_prefixTAG_DeviceType_FaceplateStatusDisconnection();
break;
case UN_ACTION_DPCONNECT:
TAG_prefixTAG_DeviceType_FaceplateConnectAlert(deviceName);
break;
case UN_ACTION_DPDISCONNECT_DISCONNECT:
TAG_prefixTAG_DeviceType_FaceplateDisconnectAlert(deviceName);
TAG_prefixTAG_DeviceType_FaceplateStatusDisconnection();
break;
case UN_ACTION_NOTHING:
default:
break;
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_FaceplateConnectAlert
/** dpConnect to the device data
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param deviceName input, the device DP name
*/
TAG_prefixTAG_DeviceType_FaceplateConnectAlert(string deviceName)
{
int iAction, iRes;
dyn_string exceptionInfo;
string sFrontEnd, sSystemName;
g_sDeviceAlias = unGenericDpFunctions_getAlias(deviceName);
g_bUnSystemAlarmPlc = false;
// get the systemName
sSystemName = unGenericDpFunctions_getSystemName(deviceName);
// get the PLC name
sFrontEnd = unGenericObject_GetPLCNameFromDpName(deviceName);
g_sFrontEndDp = sSystemName+sFrontEnd;
g_sFrontEndAlias = unGenericDpFunctions_getAlias(g_sFrontEndDp);
if(sFrontEnd != ""){
sFrontEnd = sSystemName+c_unSystemAlarm_dpPattern+DS_pattern+sFrontEnd;
//DebugN(sSystemName, sFrontEnd);
if(dpExists(sFrontEnd)) {
g_bUnSystemAlarmPlc = true;
}
}
g_sDeviceName = deviceName;
g_sFrontEnd = sFrontEnd;
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix faceplate TAG_DeviceType "+deviceName,
"TAG_prefixTAG_DeviceType_FaceplateConnectAlert", deviceName, sFrontEnd, g_bUnSystemAlarmPlc, g_bDisconnectCB);
if(g_bUnSystemAlarmPlc) {
iRes = dpConnect("TAG_prefixTAG_DeviceType_FaceplateLockCallBack", deviceName + ".ProcessInput.data:_lock._alert_hdl._locked");
g_bCallbackConnected = (iRes >= 0);
}
else
TAG_prefixTAG_DeviceType_FaceplateStatusDisconnection();
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_FaceplateDisconnectAlert
/** dpDisconnect to the device data
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param deviceName input, the device DP name
*/
TAG_prefixTAG_DeviceType_FaceplateDisconnectAlert(string deviceName)
{
int iRes;
string sFrontEnd, sSystemName;
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix faceplate TAG_DeviceType "+deviceName,
"TAG_prefixTAG_DeviceType_FaceplateDisconnectAlert", deviceName, g_bUnSystemAlarmPlc, g_bDisconnectCB);
if(g_bUnSystemAlarmPlc) {
// get the systemName
sSystemName = unGenericDpFunctions_getSystemName(deviceName);
// get the PLC name
sFrontEnd = unGenericObject_GetPLCNameFromDpName(deviceName);
sFrontEnd = sSystemName+c_unSystemAlarm_dpPattern+DS_pattern+sFrontEnd;
iRes = dpDisconnect("TAG_prefixTAG_DeviceType_FaceplateLockCallBack", deviceName + ".ProcessInput.data:_lock._alert_hdl._locked");
g_bCallbackConnected = !(iRes >= 0);
if(g_bDisconnectCB) {
// if there were many dpConnect possibilities: e.g. dpConnect with or without _alert_hdl config
// re-use the kind of dpConnect kept in a variable global to the faceplate set during TAG_prefixTAG_DeviceType_FaceplateConnect
// and do to the correct dpDisconnect
iRes = dpDisconnect("TAG_prefixTAG_DeviceType_FaceplateStatusAnimationCB",
deviceName + ".ProcessInput.data",
deviceName + ".ProcessInput.data:_online.._invalid",
deviceName + ".ProcessInput.iData",
sFrontEnd+".alarm",
sFrontEnd+".enabled");
g_bDisconnectCB = !(iRes >= 0);
}
}
}
//---------------------------------------------------------------------------------------------------------------------------------------
// TAG_prefixTAG_DeviceType_FaceplateLockCallBack
/** dpConnect to the device data
@par Constraints
None
@par Usage
Public
@par PVSS managers
Ui, CTRL
@param sDpe input, device DPE name
@param bLockState input, state of the alert lock
*/
TAG_prefixTAG_DeviceType_FaceplateLockCallBack(string sDpe, bool bLockState)
{
int iRes;
unGenericDpFunctions_debugTN(DEBUG_ONLY_BIT0, "TAG_prefix faceplate TAG_DeviceType "+g_sDeviceName,
"TAG_prefixTAG_DeviceType_FaceplateLockCallBack", sDpe, bLockState, g_bDisconnectCB, g_sDeviceName, g_sFrontEnd);
if(bLockState) { // lock set so disconnect if not already disconnected
// no need to check if it was already set before because it is not possible to do 2 dpSet on the lock the Ev reject the message
if(g_bDisconnectCB) {
iRes = dpDisconnect("TAG_prefixTAG_DeviceType_FaceplateStatusAnimationCB",
g_sDeviceName + ".ProcessInput.data",
g_sDeviceName + ".ProcessInput.data:_online.._invalid",
g_sDeviceName + ".ProcessInput.iData",
g_sFrontEnd+".alarm",
g_sFrontEnd+".enabled");
g_bDisconnectCB = !(iRes >= 0);
}
TAG_prefixTAG_DeviceType_FaceplateStatusDisconnection();
}
else { // lock not set so connect if not already connected
// no need to check if it was already set before because it is not possible to do 2 dpSet on the lock the Ev reject the message
if(!g_bDisconnectCB) {
// set all faceplate global variable usefull for the callback, e.g.: description, format, unit, etc.
// set graphical element of the faceplate to the init state if needed
// if there are many dpConnect possibilities: e.g. dpConnect with or without _alert_hdl config
// keep the kind of dpConnect in a variable global to the faceplate and do a swith for the dpConnect
// and do to the correct dpDisconnect in the TAG_prefixTAG_DeviceType_FaceplateDisconnect
iRes = dpConnect("TAG_prefixTAG_DeviceType_FaceplateStatusAnimationCB",
g_sDeviceName + ".ProcessInput.data",
g_sDeviceName + ".ProcessInput.data:_online.._invalid",
g_sDeviceName + ".ProcessInput.iData",
g_sFrontEnd+".alarm",
g_sFrontEnd+".enabled");
g_bDisconnectCB = (iRes >= 0);
}
}
}
//---------------------------------------------------------------------------------------------------------------------------------------