alarm

Funkce

Slouží pro zpracování nadefinovaného seznamu alarmů a poruch. Podle definice chování při jednotlivých vzniklých stavech může akusticky upozorňovat obsluhu, tisknout na tiskárnu a archivovat vzniklé stavy do DBF souboru nebo do libovolného databázového systému přes rozhraní ODBC a podobně jako přístroj archiver, může aktivovat i nějakou další činnost.


Syntax

  alarm alarm_name;
    rem = string;
    bubble = string;
    timer = timer_name;
    owner = owner_name;
    position = integer, integer, integer, integer;
    win_disable = [ identifier, ... ];
    win_title = string;
    access = integer;
    tab_select = integer;
    send_same_data;
    driver_exception = driver_name;
    file_name = string;
    file_type = identifier;
    file_length = integer;
    file_start = integer, integer, integer, integer;
    file_history = integer;
    file_access = real;
    file_name_type = identifier;
    file_mask_expression = real_expression;
    file_delete = boolean_expression;
    content = [ identifier, ... ];
    date_item
      name = string;
      expression = real_expression;
      disable;
    end_date_item;
    time_item
      name = string;
      expression = real_expression;
      disable;
    end_time_item;
    odbc
      enable;
      dsn = string;
      user_name = string;
      password = string;
      file_extension = string;    
    end_odbc;
    font = font_identifier, integer, style_identifier;
    record_structure = [ identifier, ... ];
    message_content = [ identifier, ... ];
    sort_mode = identifier;
    condition = boolean_expression;
    output = boolean_dataelement;
    journal = journal_name;
    disable_backup;
    receivers = [ identifier, ... ];
    synchronize
      output = string_dataelement;
      receivers = [ identifier, ... ];
    end_synchronize;
    item
      text = string;
      group = string;
      alarm_id = string;
      priority = integer;
      condition = boolean_expression;
      finish_condition = boolean_expression;
      expression = any_expression;
      rise_action = [ identifier, ... ];
      rise_sound = file_name;
      rise_output = boolean_dataelement;
      rise_time = real_expression;
      finish_action = [ identifier, ... ];
      finish_sound = file_name;
      finish_output = boolean_dataelement;
      finish_time = real_expression;
      confirm_action = [ identifier, ... ];
      confirm_sound = file_name;
      confirm_output = boolean_dataelement;
      text_for_true = string;
      text_for_false = string;
      receivers = [ identifier, ... ];
    end_item;
    item
      ...
    end_item;
    mask_item
      text = string;
      group = string;
      alarm_id = string;
      priority = integer;
      condition = boolean_expression;
      finish_condition = boolean_expression;
      value = data_element;
      rise_action = [ identifier, ... ];
      rise_sound = file_name;
      rise_output = boolean_dataelement;
      rise_time = real_expression;
      finish_action = [ identifier, ... ];
      finish_sound = file_name;
      finish_output = boolean_dataelement;
      finish_time = real_expression;
      confirm_action = [ identifier, ... ];
      confirm_sound = file_name;
      confirm_output = boolean_dataelement;
      text_for_true = string;
      text_for_false = string;
      receivers = [ identifier, ... ];
    end_mask_item;
    mask_item
      ...
    end_mask_item;
    array_item
      index_range = integer, integer;
      text = string;
      group = string;
      alarm_id = string;
      priority = integer;
      condition = boolean_expression;
      finish_condition = boolean_expression;
      value = array_data_element;
      rise_action = [ identifier, ... ];
      rise_sound = file_name;
      rise_output = boolean_dataelement;
      rise_time = real_expression;
      finish_action = [ identifier, ... ];
      finish_sound = file_name;
      finish_output = boolean_dataelement;
      finish_time = real_expression;
      confirm_action = [ identifier, ... ];
      confirm_sound = file_name;
      confirm_output = boolean_dataelement;
      text_for_true = string;
      text_for_false = string;
      receivers = [ identifier, ... ];
    end_array_item;
    array_item
      ...
    end_array_item;
    colors
      text = color;
      background = color;
      top_shadow = color;
      bottom_shadow = color;
      select = color;
      button_up_background = color;
      button_up_top_shadow = color;
      button_up_bottom_shadow = color;
      button_down_background = color;
      button_down_top_shadow = color;
      button_down_bottom_shadow = color;
      active_alarm = color;
      active_confirmed_alarm = color;
      inactive_alarm = color;
      inactive_confirmed_alarm = color;
    end_colors;
  end_alarm;


Specifické parametry přístroje

Podrobný popis parametrů pro definici archivních souborů je uveden v kapitole Databáze a archivace dat.


Poznámka

Některé parametry mají implicitní nastavení

    position = 0, 0, 350, 125;
    access = <none>
    tab_select = <none>
    content = tool_bar, list_box;
    file_type = relative;
    file_length = hour;
    file_start = 0, 0, 1, 1;
    file_history = 10;
    file_access = 4294967295;
    file_name_type = new_code;
    date_item
      name = 'DATE';
    end_date_item;
    time_item
      name = 'TIME';
    end_time_item;
    record_structure = classify, text, value, operator, priority, none;
    message_content = date, time, priority, text, operator, none, none;
    sort_mode = by_priority;
    colors
      text = black;
      background = lgray;
      top_shadow = dgray;
      bottom_shadow = white;
      select = black;
      button_up_background = lgray;
      button_up_top_shadow = white;
      button_up_bottom_shadow = dgray;
      button_down_background = lgray;
      button_down_top_shadow = dgray;
      button_down_bottom_shadow = white;
      active_alarm = black;
      active_confirmed_alarm = black;
      inactive_alarm = black;
      inactive_confirmed_alarm = black;
    end_colors;

Příklad

Příklad nastavení parametrů přístroje:

  alarm Alarm;
    owner = AlarmPanel;
    position = 16, 44, 360, 28;
    file_type = permanent;
    file_length = minute;
    file_name = 'ALARMS';
    record_structure = date, time, classify, text;
    output = ActiveAlarms;
    receivers = MeterLastAlarm;
    item
      text = 'Alarm 1';
      priority = 0;
      condition = Alarm1On;
      expression = Noise;
      rise_action = write, set_channel, display;
      rise_output = Alarm1Active;
      finish_action = write, beep, set_channel;
      finish_output = Alarm1Finished;
      confirm_action = write, beep, set_channel;
      confirm_output = Alarm1Confirmed;
      receivers = Alarm1LedOn;
    end_item;
    colors
      text = lyellow;
      background = red;
      top_shadow = lred;
      bottom_shadow = black;
    end_colors;
  end_alarm;

Nativní procedury přístroje

CheckAlarms()

Vyhodnotí všechny nadefinované alarmy.

ConfirmAlarm()

Potvrzení vybraného alarmu v list boxu.

ConfirmAlarmId( AlarmId : string )

Potvrzení alarmu specifikovaného parametrem AlarmId.

ConfirmAllAlarms()

Potvrzení všech alarmů zobrazených v list boxu.

ConfirmGroupAlarms( Group : string )

Potvrzení všech alarmů zobrazených v list boxu patřících do skupiny Group.

DeleteAlarms( Active, ActiveConfirmed, Inactive, InactiveConfirmed : boolean )

Odstraní specifikované alarmy.

Active - aktivní nepotvrzené alarmy
ActiveConfirmed - aktivní potvrzené alarmy
Inactive - neaktivní (již skončené) nepotvrzené alarmy
InactiveConfirmed - neaktivní (již skončené) potvrzené alarmy

GetLastAlarm( &Message : string )

V parametru Message vrací zprávu naposled vzniklého alarmu

GetNoOfActiveAlarms( &Total, &Confirmed : number )

V parametru Total vrací počet aktivních alarmů a v parametru Confirmed počet aktivních potvrzených alarmů.

GetNoOfInactiveAlarms( &Total, &Confirmed : number )

V parametru Total vrací počet neaktivních alarmů a v parametru Confirmed počet neaktivních potvrzených alarmů.

GoToLastAlarm()

Vybere a zobrazí v seznamu v ListBoxu naposled vzniklý alarm.

ShowAlarms( Active, ActiveConfirmed, Inactive, InactiveConfirmed : boolean )

Definuje, které alarmy mají být zobrazovány v seznamu v ListBoxu.

Active - aktivní nepotvrzené alarmy
ActiveConfirmed - aktivní potvrzené alarmy
Inactive - neaktivní (již skončené) nepotvrzené alarmy
InactiveConfirmed - neaktivní (již skončené) potvrzené alarmy

HideAlarmManager()

Uzavře okno Správce alarmů.

ShowAlarmManager()

Zobrazí okno Správce alarmů.

Hide()

Skrytí viditelného přístroje.

Show()

Zobrazení skrytého přístroje.

Synchronize( AlarmId, SyncTime, SyncDate : string )

Potvrzení alarmu specifikovaného parametrem AlarmId. Slouží pro synchronizaci alarmů. Parametry SyncTime a SyncDate mohou obsahovat čas a datum potvrzení alarmu - pokud nejsou zadány, použije se čas a datum z příslušného počítače.

Událostní procedury přístroje

Přístroj může volat standardní událostní procedury:

OnActivate()
OnMouseDown( MouseX, MouseY : integer; LeftButton, MiddleButton, RightButton : boolean ) 
OnMouseDoubleClick( MouseX, MouseY : integer; LeftButton, MiddleButton, RightButton : boolean ) 
OnMouseUp( MouseX, MouseY : integer; LeftButton, MiddleButton, RightButton : boolean ) 
OnMouseMove( MouseX, MouseY : integer; LeftButton, MiddleButton, RightButton : boolean ) 
OnSelect() 
OnDeselect() 
OnShow() 
OnHide() 
OnNewPosition( RectX, RectY, RectW, RectD : integer ) 
OnWindowMinimize() 
OnWindowMaximize() 
OnWindowRestore( WasMinimized, WasMaximized : boolean ) 
OnWindowClose() 

Podrobnější informace k těmto procedurám lze nalézt v kapitole Programování a procedury.

Specifické událostní procedury přístroje

procedure OnAlarmRise( Date, Time, Text, Group, Id, Value string; Priority : real )

Procedura je volána po vzniku alarmu.

Date - datum vzniku alarmu
Time - čas vzniku alarmu
Text - textové hlášení spojené s tímto alarmem
Group - název skupiny alarmů
Id - identifikace alarmu
Value - sledovaná hodnota při vzniku alarmu
Priority - priorita

procedure OnAlarmFinish( Date, Time, Text, Group, Id, Value : string; Priority : real )

Procedura je volána po skončení alarmu.

Date - datum skončení alarmu
Time - čas skončení alarmu
Text - textové hlášení spojené s tímto alarmem
Group - název skupiny alarmů
Id - identifikace alarmu
Value - sledovaná hodnota při skončení alarmu
Priority - priorita

procedure OnAlarmConfirmation( Date, Time, Text, Group, Id, Value : string; Priority : real )

Procedura je volána po potvrzení alarmu.

Date - datum potvrzení alarmu
Time - čas potvrzení alarmu
Text - textové hlášení spojené s tímto alarmem
Group - název skupiny alarmů
Id - identifikace alarmu
Value - sledovaná hodnota při potvrzení alarmu
Priority - priorita