TAlarmHandler, palette SmartSCADA System, unit AlarmHandler.pas

 

   Component inherited from TTable. It saves analog signals values to database. It cerates historian trend. Additional properties of this component are:

- Automatic table creating if it not exists. Field structure corresponds to signals names (signal property name).

- Fixed table size

 

IMPORTANT!

 

Component TAlarmHandler is used to handle alarms in systems. This component is checking system to find any signal whose value override limits. When component find such a signal, alarm is written to AlarmTable.db and if it is defined, alarm message is shown. If alarm is linked to wav file, that file will be played. Component has its own 100ms timer.

Component automatically creates AlarmTable.db in folder defined by alias PROCESS. It is assumed that system uses only alias PROCESS. That means that other aliases are not allowed! Putting this component on the form, component automatically creates alias if it does not exists. Path to alias is set to working folder of project in design time. If alias exists, component change path to working folder of project.

If path of PROCESS alias is changed after exiting from Delphi workspace, after Delphi reloading path will not be changed to project working directory.

This problem can be solved on two ways>

- Using DataBaseDesktop program set path before start,

- By putting new SignalRecorder component, which will automatically change the path.

 

To change alias on start of application, put routine from module TsAliasUtils in project *.dpr file:

SetAlias('PROCESS', DataDir)

o   first parameter is name of existing alias

o   second parameter is desired directory. If this parameter is empty string then path set to project working directory.

 

To check consistency of database, put routine from module TsAliasUtils in project *.dpr file:

ReindexTables('PROCESS')

o   parameter is existing alias.

This routine automatically reindexes all databases from alias and makes copies of all databases in BACKUP folder. If repairing is not possible, then over writes bed database with good one from BACKUP folder.

It is very important to disable this routine in design time because reindexing of tables requires exclusive mode of operation so there is a possibility for error in database access. This specially relates to those tables that are open in design time.

If it is necessary to use this routine in design time, then it is best to keep all tables closed and to open them in run time or to keep modules with these tables closed while reindexing.

 

Component automatically creates fields with selected signals names.

 

 

PROPERTIES

 

Active: boolean

This value activates or deactivates AlarmHandler.

 

AlarmMessages: string

Group of properties that correspond to alarms:

Property

Description

AcceptAlarmMessage

Message text that will be written to database when operator acknowledge alarm.

EnableMessage

This boolean property defines if messages will be shown or not (text and wave). If AlarmHandler is active, alarm messages are written to database regardless to this value.

OnAlarmMessage

Message text that will be written to database when alarm occurs.

OffAlarmMessage

Message text that will be written to database when alarm condition disappears.

Operator

Pointer to Operator component.

 

 

ResetSignalIn: TBooleanSignal

Signal that is received form remote computer and marks that remote computer received signal to reset alarm.

 

ResetSignalOut: TBooleanSignal

Signal that is to be send to remote computer to reset alarm.

 

EnabledMaxNumRecords: Boolean

Determines if database will have fixed size or not.

 

MaxNumRecords: longint

Defines the size of database (number of records).

 

FillTable: boolean

When change this property in design time, database will be filled to defined size. After that, property is reset to false. This is introduced to escape fragmentation of database. (see previous chapter)

 

AlarmStartDelayON: integer

Determines delay of alarm handler start. It is used to avoid false alarm recording (after start before all communications are realized, there is a possibility for false alarming).