Applies To:
  • CitectSCADA 3.40, 4.20, 5.01

Summary:
I am using the parameter [Alarm]LastAlarmFmt to set the format of the last alarm display. However sometimes when I startup the last alarm format seems to be from my default alarm category and not the format I specified in the parameter. What is wrong? 

Solution:
This is a timing related problem. The cicode in the include project which reads the LastAlarmFmt parameter is sometimes preempted by the first page scan before the parameter can be read. This means that when DisplayLastAlarm is called it will use the default alarm format and not the one specified in the LastAlarmFmt.

This can be fixed by doing the follwing changes in Page.ci in the include project. Take the marked lines out of the following cicode function as shown

FUNCTION
_PageDefInit()

    hAnUAlarm = ParameterGet("Page", "Alarm", "5");
    hAnHAlarm = ParameterGet("Page", "HwAlarm", "6");
    hAnDAlarm = ParameterGet("Page", "DisabledAlarm", "7");
    hAnTime = ParameterGet("Page", "Time", "9");
    hAnDate = ParameterGet("Page", "Date", "10");
    hAnLastAlarm = ParameterGet("Page", "LastAlarm", "11");
    hAnTitle = ParameterGet("Page", "Title", "12");
    hAnName = ParameterGet("Page", "Name", "13");

    hDefaultFont = DspFontHnd("DefaultFont");
    hTimeFont = DspFontHnd(ParameterGet("Font", "Time", "TimeFont"));
    hUnAckFont = DspFontHnd("UnacceptedFont");
    hHwFont = DspFontHnd("HardwareFont");
    hButtonFont = DspFontHnd("ButtonFont");

    OnEvent(10, _PageDefDisplay);

    bMenuShutdown = ParameterGet("Page", "MenuShutdown", "1");
    bMenuDisable = ParameterGet("Page", "MenuDisable", "0");

    hLastAlarmFmt = FmtOpen("LastAlarmFmt", ParameterGet("Alarm", "LastAlarmFmt", "{Tag,16} {Name,32} {Desc,32}"), 1);
    nLastAlmDspMode = ParameterGet("Alarm", "LastAlarmDisplayMode", "0");

END

Then insert the lines into the following function as shown

FUNCTION
DisplayLastAlarm(INT hAn)
    INT nError;
    IF (bLastAlarmInit = 0) THEN
        if (hLastAlarmFmt = 0) THEN
           hLastAlarmFmt = FmtOpen("LastAlarmFmt", ParameterGet("Alarm", "LastAlarmFmt", "{Tag,16} {Name,32} {Desc,32}"), 1);
           nLastAlmDspMode = ParameterGet("Alarm", "LastAlarmDisplayMode", "0");
        END
        AlarmSetInfo(hAn, 5, hLastAlarmFmt);
        AlarmSetInfo(hAn, 6, DspFontHnd("Casanova"));
        AlarmSetInfo(hAn, 8, nLastAlmDspMode);
        bLastAlarmInit = 1;
    END;
    AlarmDspLast(hAn);
END

CIT has confirmed this to be a problem in Citect for Windows versions to 5.01. This problem has been fixed in version 5.10.

 

Keywords:
 

Attachments