Commit f4127671 authored by Claes Sjofors's avatar Claes Sjofors

Emon, system events added

parent 6f68db59
......@@ -41,6 +41,7 @@
#include "pwr.h"
#include "pwr_basecomponentclasses.h"
#include "co_dcli.h"
#include "co_cdh.h"
#include "rt_io_base.h"
#include "rt_io_rack_init.h"
#include "rt_io_rack_close.h"
......@@ -917,10 +918,14 @@ static pwr_tStatus IoRackRead (
// Server error soft limit reached, tell log (once)
if ( op->ErrorCount >= op->ErrorSoftLimit && error_count < op->ErrorSoftLimit) {
errh_Warning( "IO Server ErrorSoftLimit reached, '%s'", rp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( rp->Objid);
}
// Server error hard limit reached, tell log (once)
if ( op->ErrorCount >= op->ErrorHardLimit && error_count < op->ErrorHardLimit) {
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( rp->Objid);
if( op->StallAction == pwr_eStallActionEnum_EmergencyBreak) {
errh_Error( "IO Server ErrorHardLimit reached '%s', IO stopped", rp->Name);
......
......@@ -37,6 +37,7 @@
#include "pwr.h"
#include "pwr_basecomponentclasses.h"
#include "co_dcli.h"
#include "co_cdh.h"
#include "rt_io_base.h"
#include "rt_io_agent_init.h"
#include "rt_io_agent_close.h"
......@@ -754,10 +755,14 @@ static pwr_tStatus IoAgentRead( io_tCtx ctx, io_sAgent *ap) {
// Agent error soft limit reached, tell log (once)
if ( op->ErrorCount >= op->ErrorSoftLimit && error_count < op->ErrorSoftLimit) {
errh_Warning( "IO Agent ErrorSoftLimit reached, '%s'", ap->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( ap->Objid);
}
// Agent error hard limit reached, tell log (once)
if ( op->ErrorCount >= op->ErrorHardLimit && error_count < op->ErrorHardLimit) {
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( ap->Objid);
if( op->StallAction == pwr_eStallActionEnum_EmergencyBreak) {
errh_Error( "IO Agent ErrorHardLimit reached '%s', IO stopped", ap->Name);
......@@ -833,10 +838,14 @@ static pwr_tStatus IoAgentRead( io_tCtx ctx, io_sAgent *ap) {
// Slave error soft limit reached, tell log (once)
if ( ((pwr_sClass_Epl_CN *)rp->op)->ErrorCount >= ((pwr_sClass_Epl_CN *)rp->op)->ErrorSoftLimit && error_count < ((pwr_sClass_Epl_CN *)rp->op)->ErrorSoftLimit) {
errh_Warning( "IO Rack ErrorSoftLimit reached, '%s'", rp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( ap->Objid);
}
// Slave error hard limit reached, tell log (once)
if ( ((pwr_sClass_Epl_CN *)rp->op)->ErrorCount >= ((pwr_sClass_Epl_CN *)rp->op)->ErrorHardLimit && error_count < ((pwr_sClass_Epl_CN *)rp->op)->ErrorHardLimit) {
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( ap->Objid);
if( ((pwr_sClass_Epl_CN *)rp->op)->StallAction == pwr_eStallActionEnum_EmergencyBreak) {
errh_Error( "IO Rack ErrorHardLimit reached '%s', IO stopped", rp->Name);
......
......@@ -40,6 +40,7 @@
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "co_time.h"
#include "co_cdh.h"
#include "rt_io_base.h"
#include "rt_io_card_init.h"
#include "rt_io_card_close.h"
......@@ -425,12 +426,16 @@ static pwr_tStatus IoCardRead( io_tCtx ctx,
if ( op->Super.ErrorCount >= op->Super.ErrorSoftLimit &&
error_count < op->Super.ErrorSoftLimit) {
errh_Warning( "IO Card ErrorSoftLimit reached, '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
// if ( op->Reconnect)
// local->Disconnected = 1;
}
if ( op->Super.ErrorCount >= op->Super.ErrorHardLimit) {
errh_Error( "IO Card ErrorHardLimit reached '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
......@@ -532,12 +537,16 @@ static pwr_tStatus IoCardWrite( io_tCtx ctx,
if ( op->Super.ErrorCount >= op->Super.ErrorSoftLimit &&
error_count < op->Super.ErrorSoftLimit) {
errh_Warning( "IO Card ErrorSoftLimit reached, '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
// if ( op->Reconnect)
// local->Disconnected = 1;
}
if ( op->Super.ErrorCount >= op->Super.ErrorHardLimit) {
errh_Error( "IO Card ErrorHardLimit reached '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
......
......@@ -43,6 +43,7 @@
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "co_time.h"
#include "co_cdh.h"
#include "rt_io_base.h"
#include "rt_io_card_init.h"
#include "rt_io_card_close.h"
......@@ -216,11 +217,15 @@ static pwr_tStatus IoCardRead( io_tCtx ctx,
if ( op->Super.ErrorCount >= op->Super.ErrorSoftLimit &&
error_count < op->Super.ErrorSoftLimit) {
errh_Warning( "IO Card ErrorSoftLimit reached, '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->Super.ErrorCount >= op->Super.ErrorHardLimit) {
errh_Error( "IO Card ErrorHardLimit reached '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
op->Status = IO__ERRDEVICE;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
......
......@@ -43,6 +43,7 @@
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "co_time.h"
#include "co_cdh.h"
#include "rt_io_base.h"
#include "rt_io_card_init.h"
#include "rt_io_card_close.h"
......@@ -200,10 +201,14 @@ static pwr_tStatus IoCardWrite( io_tCtx ctx,
if ( op->Super.ErrorCount >= op->Super.ErrorSoftLimit &&
error_count < op->Super.ErrorSoftLimit) {
errh_Warning( "IO Card ErrorSoftLimit reached, '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->Super.ErrorCount >= op->Super.ErrorHardLimit) {
errh_Error( "IO Card ErrorHardLimit reached '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
......
......@@ -249,12 +249,16 @@ static pwr_tStatus IoCardRead( io_tCtx ctx,
if ( op->ErrorSoftLimit &&
op->ErrorCount == op->ErrorSoftLimit && !local->softlimit_logged) {
errh_Warning( "IO Card ErrorSoftLimit reached, '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
local->softlimit_logged = 1;
}
if ( op->ErrorHardLimit &&
op->ErrorCount >= op->ErrorHardLimit) {
errh_Error( "IO Card ErrorHardLimit reached '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
......
......@@ -406,11 +406,15 @@ static pwr_tStatus IoCardRead( io_tCtx ctx,
if ( op->ErrorCount == op->ErrorSoftLimit && !local->softlimit_logged) {
errh_Warning( "IO Card ErrorSoftLimit reached, '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
local->softlimit_logged = 1;
}
if ( op->ErrorCount >= op->ErrorHardLimit) {
errh_Error( "IO Card ErrorHardLimit reached '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
......
......@@ -334,10 +334,14 @@ static pwr_tStatus IoCardRead( io_tCtx ctx,
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Warning( "IO Card ErrorSoftLimit reached, '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit) {
errh_Error( "IO Card ErrorHardLimit reached '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
......
......@@ -239,10 +239,14 @@ static pwr_tStatus IoCardRead( io_tCtx ctx,
if ( op->Super.ErrorCount >= op->Super.ErrorSoftLimit &&
error_count < op->Super.ErrorSoftLimit) {
errh_Warning( "IO Card ErrorSoftLimit reached, '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->Super.ErrorCount >= op->Super.ErrorHardLimit) {
errh_Error( "IO Card ErrorHardLimit reached '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
......
......@@ -51,6 +51,7 @@
#include "pwr_basecomponentclasses.h"
#include "pwr_otherioclasses.h"
#include "co_time.h"
#include "co_cdh.h"
#include "rt_io_base.h"
#include "rt_io_card_init.h"
#include "rt_io_card_close.h"
......@@ -837,10 +838,14 @@ static pwr_tStatus IoCardRead( io_tCtx ctx,
if ( op->ErrorCount >= op->ErrorSoftLimit &&
error_count < op->ErrorSoftLimit) {
errh_Warning( "IO Card ErrorSoftLimit reached, '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit) {
errh_Error( "IO Card ErrorHardLimit reached '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
......@@ -1126,10 +1131,14 @@ static pwr_tStatus IoCardWrite( io_tCtx ctx,
if ( op->ErrorCount >= op->ErrorSoftLimit &&
error_count < op->ErrorSoftLimit) {
errh_Warning( "IO Card ErrorSoftLimit reached, '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit) {
errh_Error( "IO Card ErrorHardLimit reached '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
......
......@@ -345,6 +345,16 @@ static pwr_tStatus IoRackRead (
sp->ErrorCount++;
}
if (sp->ErrorCount == sp->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", rp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( rp->Objid);
}
if ( sp->ErrorCount == sp->ErrorHardLimit) {
errh_Error( "IO Error hard limit reached on card '%s', stall action %d", rp->Name, sp->StallAction);
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( rp->Objid);
}
if (sp->ErrorCount > sp->ErrorSoftLimit && sp->StallAction >= pwr_ePbStallAction_ResetInputs) {
memset(&sp->Inputs, 0, sp->BytesOfInput);
}
......
This diff is collapsed.
......@@ -497,6 +497,12 @@ typedef unsigned int pwr_tDisableAttr; //!< DisableAttr type.
/*_*
@aref emergbreakselectenum EmergBreakSelectEnum
*/
typedef enum {
pwr_eEmergBreakSelectEnum_NoAction = 0,
pwr_eEmergBreakSelectEnum_Reboot = 1,
pwr_eEmergBreakSelectEnum_FixedOutputValues = 2,
pwr_eEmergBreakSelectEnum_StopIO = 3
} pwr_eEmergBreakSelectEnum;
typedef pwr_tEnum pwr_tEmergBreakSelectEnum; //!< Node attribute enum.
/*_*
......
......@@ -246,6 +246,10 @@ static int compKey( tree_sTable *tp, tree_sNode *x, tree_sNode *y)
(unsigned long)s - (unsigned long)xKey->text);
return strcmp(xKey->text, yKey->text);
}
case 'C': {
int len = strlen( yKey->text);
return strncmp(xKey->text, yKey->text, len);
}
}
return 0;
}
......@@ -291,6 +295,12 @@ char *Lng::translate( const char *text)
strcpy( result, record->transl);
break;
}
case 'C': {
int len = strlen( record->key.text);
strcpy( result, record->transl);
strcat( result, &text[len]);
break;
}
default:
strcpy( result, record->transl);
}
......@@ -340,6 +350,12 @@ int Lng::translate( char *text, char *out)
strcpy( result, record->transl);
break;
}
case 'C': {
int len = strlen( record->key.text);
strcpy( result, record->transl);
strcat( result, &text[len]);
break;
}
default:
strcpy( result, record->transl);
}
......
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2014 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/* rt_c_iohandler.c
Functions for the class IOHandler. */
#include <stdio.h>
#include <string.h>
#include "pwr.h"
#include "rt_gdh.h"
#include "pwr_baseclasses.h"
#include "rt_c_iohandler.h"
static pwr_sClass_IOHandler *iop = 0;
/*_*
@aref iohandler IOHandler
*/
void
pwrb_IOHandler_Exec (
void (* handler_event_cb)(int, int),
int swap
)
{
static pwr_tBoolean old_CardErrorSoftLimit = 0;
static pwr_tBoolean old_CardErrorHardLimit = 0;
if ( !iop || swap) {
pwr_tOid oid;
pwr_tStatus sts;
sts = gdh_GetClassList( pwr_cClass_IOHandler, &oid);
if ( ODD(sts))
gdh_ObjidToPointer( oid, (void **) &iop);
if ( EVEN(sts)) return;
}
if ( !iop)
return;
if ( handler_event_cb) {
if ( iop->CardErrorSoftLimit && !old_CardErrorSoftLimit)
(handler_event_cb)(pwr_eSystemEventTypeEnum_IOErrorSoftLimit, 1);
else if ( !iop->CardErrorSoftLimit && old_CardErrorSoftLimit)
(handler_event_cb)(pwr_eSystemEventTypeEnum_IOErrorSoftLimit, 0);
if ( iop->CardErrorHardLimit && !old_CardErrorHardLimit)
(handler_event_cb)(pwr_eSystemEventTypeEnum_IOErrorHardLimit, 1);
else if ( !iop->CardErrorHardLimit && old_CardErrorHardLimit)
(handler_event_cb)(pwr_eSystemEventTypeEnum_IOErrorHardLimit, 0);
}
old_CardErrorSoftLimit = iop->CardErrorSoftLimit;
old_CardErrorHardLimit = iop->CardErrorHardLimit;
}
/*
* Proview Open Source Process Control.
* Copyright (C) 2005-2014 SSAB EMEA AB.
*
* This file is part of Proview.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Proview. If not, see <http://www.gnu.org/licenses/>
*
* Linking Proview statically or dynamically with other modules is
* making a combined work based on Proview. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* Proview give you permission to, from the build function in the
* Proview Configurator, combine Proview with modules generated by the
* Proview PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of Proview (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
/* rt_c_iohandler.h
Functions for the class IOHandler. */
#include "pwr.h"
void
pwrb_IOHandler_Exec (
void (* handlerEvent_bc)(int, int),
int swap
);
......@@ -46,6 +46,8 @@
#include "rt_gdh.h"
#include "rt_pwr_msg.h"
#include "pwr_systemclasses.h"
#include "pwr_baseclasses.h"
#include "rt_c_node.h"
static pwr_sNode *np = 0;
......@@ -56,6 +58,7 @@ static pwr_sNode *np = 0;
void
pwrs_Node_Exec (
void (* handler_event_cb)(int, int)
)
{
int i;
......@@ -75,6 +78,9 @@ pwrs_Node_Exec (
1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1};
static int reboot_done = 0;
static int old_EmergeBreakTrue = 0;
static int old_SystemStatus = 1;
static int init_cnt = 0;
if ( !np) {
pwr_tOid oid;
......@@ -89,9 +95,39 @@ pwrs_Node_Exec (
if ( !np)
return;
if ( np->EmergBreakTrue && !old_EmergeBreakTrue && handler_event_cb) {
switch ( np->EmergBreakSelect) {
case pwr_eEmergBreakSelectEnum_Reboot:
(handler_event_cb)(pwr_eSystemEventTypeEnum_EmergBreakReboot, 1);
break;
case pwr_eEmergBreakSelectEnum_FixedOutputValues:
(handler_event_cb)(pwr_eSystemEventTypeEnum_EmergBreakFixedOutput, 1);
break;
case pwr_eEmergBreakSelectEnum_StopIO:
(handler_event_cb)(pwr_eSystemEventTypeEnum_EmergBreakStopIO, 1);
break;
default: ;
}
}
else if ( !np->EmergBreakTrue && old_EmergeBreakTrue && handler_event_cb) {
switch ( np->EmergBreakSelect) {
case pwr_eEmergBreakSelectEnum_Reboot:
(handler_event_cb)(pwr_eSystemEventTypeEnum_EmergBreakReboot, 0);
break;
case pwr_eEmergBreakSelectEnum_FixedOutputValues:
(handler_event_cb)(pwr_eSystemEventTypeEnum_EmergBreakFixedOutput, 0);
break;
case pwr_eEmergBreakSelectEnum_StopIO:
(handler_event_cb)(pwr_eSystemEventTypeEnum_EmergBreakStopIO, 0);
break;
default: ;
}
}
if ( np->EmergBreakTrue) {
switch ( np->EmergBreakSelect) {
case 1: {
case pwr_eEmergBreakSelectEnum_Reboot: {
/* Reboot */
int sts;
......@@ -105,11 +141,14 @@ pwrs_Node_Exec (
break;
}
default: ;
}
}
}
else
reboot_done = 0;
old_EmergeBreakTrue = np->EmergBreakTrue;
/* Calculate plc status */
new_idx = -1;
plc_severity = errh_Severity( np->ProcStatus[errh_eAnix_plc-1]);
......@@ -157,6 +196,24 @@ pwrs_Node_Exec (
np->SystemStatus = np->ProcStatus[new_idx];
else if ( EVEN(np->SystemStatus))
np->SystemStatus = PWR__RUNNING;
if ( init_cnt > 30) {
if ( old_SystemStatus != np->SystemStatus) {
if ( (errh_SeverityError(np->SystemStatus) || errh_SeverityFatal(np->SystemStatus)) &&
!(errh_SeverityError(old_SystemStatus) || errh_SeverityFatal(old_SystemStatus)))
(handler_event_cb)(pwr_eSystemEventTypeEnum_SystemStatusError, 1);
else if ( !(errh_SeverityError(np->SystemStatus) || errh_SeverityFatal(np->SystemStatus)) &&
(errh_SeverityError(old_SystemStatus) || errh_SeverityFatal(old_SystemStatus)))
(handler_event_cb)(pwr_eSystemEventTypeEnum_SystemStatusError, 0);
if ( errh_SeverityWarning(np->SystemStatus) && !errh_SeverityWarning(old_SystemStatus))
(handler_event_cb)(pwr_eSystemEventTypeEnum_SystemStatusWarning, 1);
else if ( !errh_SeverityWarning(np->SystemStatus) && errh_SeverityWarning(old_SystemStatus))
(handler_event_cb)(pwr_eSystemEventTypeEnum_SystemStatusWarning, 0);
old_SystemStatus = np->SystemStatus;
}
}
else
init_cnt++;
}
......
......@@ -42,6 +42,7 @@
void
pwrs_Node_Exec (
void (* handlerEvent_bc)(int, int)
);
void
......
This diff is collapsed.
......@@ -123,6 +123,46 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Error soft limit reached on any card.
!*/
Object CardErrorSoftLimit $Attribute 19
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
EndBody
EndObject
!/**
! Error hard limit reached on any card.
!*/
Object CardErrorHardLimit $Attribute 20
Body SysBody
Attr TypeRef = "pwrs:Type-$Boolean"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
EndBody
EndObject
!/**
! Object that has reached error soft limit.
!*/
Object ErrorSoftLimitObject $Attribute 21
Body SysBody
Attr TypeRef = "pwrs:Type-$AttrRef"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
EndBody
EndObject
!/**
! Object that has reached error hard limit.
!*/
Object ErrorHardLimitObject $Attribute 22
Body SysBody
Attr TypeRef = "pwrs:Type-$AttrRef"
Attr Flags |= PWR_MASK_STATE
Attr Flags |= PWR_MASK_NOEDIT
EndBody
EndObject
!/**
! Number of configured Di objects in the node.
!*/
Object DiCount $Attribute 5
......
......@@ -110,6 +110,16 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
!/**
! Specifies the maximum number of contemporary system alarms.
! The attribute is used to limit alarm allocation when
! system alarms are not acknowledged.
!*/
Object MaxSystemAlarms $Attribute 23
Body SysBody
Attr TypeRef = "pwrs:Type-$UInt32"
EndBody
EndObject
Object DetectTimer $Intern 6
Body SysBody
Attr TypeRef = "pwrs:Type-$Float32"
......@@ -222,14 +232,135 @@ SObject pwrb:Class
Attr TypeRef = "pwrs:Type-$Boolean"
EndBody
EndObject
Object SystemEvents $Attribute 22
Body SysBody
Attr TypeRef = "pwrb:Class-SystemSup"
Attr Flags |= PWR_MASK_ARRAY
Attr Flags |= PWR_MASK_CLASS
Attr Elements = 14
EndBody
EndObject
EndObject
Object Template MessageHandler
Body RtBody
Attr EventListSize = 100
Attr MaxApplAlarms = 50
Attr MaxSystemAlarms = 50
Attr DetectTimer = 1.0
Attr MessageTimer = 1.0
Attr ScanCycleSup = 1
Attr SystemEvents[0].SystemEvent = 0
Attr SystemEvents[0].Description = "Link down event"
Attr SystemEvents[0].DetectOn = 1
Attr SystemEvents[0].DetectText = "Link down to node"
Attr SystemEvents[0].ReturnText = "Link up to node"
Attr SystemEvents[0].EventType = 256
Attr SystemEvents[0].EventPriority = 67
Attr SystemEvents[0].EventFlags = 15
Attr SystemEvents[1].SystemEvent = 1
Attr SystemEvents[1].Description = "Node up event"
Attr SystemEvents[1].DetectOn = 1
Attr SystemEvents[1].DetectText = "Node up"
Attr SystemEvents[1].ReturnText = ""
Attr SystemEvents[1].EventType = 32
Attr SystemEvents[1].EventPriority = 67
Attr SystemEvents[1].EventFlags = 63
Attr SystemEvents[2].SystemEvent = 2
Attr SystemEvents[2].Description = "Node restart event"
Attr SystemEvents[2].DetectOn = 1
Attr SystemEvents[2].DetectText = "Node restart initiated, node"
Attr SystemEvents[2].ReturnText = "Node restart completion, node"
Attr SystemEvents[2].EventType = 256
Attr SystemEvents[2].EventPriority = 67
Attr SystemEvents[2].EventFlags = 15
Attr SystemEvents[3].SystemEvent = 3
Attr SystemEvents[3].Description = "Outunit restart event"
Attr SystemEvents[3].DetectOn = 1
Attr SystemEvents[3].DetectText = "Outunit restarted, node"
Attr SystemEvents[3].ReturnText = ""
Attr SystemEvents[3].EventType = 32
Attr SystemEvents[3].EventPriority = 67
Attr SystemEvents[3].EventFlags = 63
Attr SystemEvents[4].SystemEvent = 4
Attr SystemEvents[4].Description = "Emergency break with reboot event"
Attr SystemEvents[4].DetectOn = 1
Attr SystemEvents[4].DetectText = "Emergency break reboot, node"
Attr SystemEvents[4].ReturnText = ""
Attr SystemEvents[4].EventType = 256
Attr SystemEvents[4].EventPriority = 67
Attr SystemEvents[4].EventFlags = 15
Attr SystemEvents[5].SystemEvent = 5
Attr SystemEvents[5].Description = "Emergency break with fixed output values event"
Attr SystemEvents[5].DetectOn = 1
Attr SystemEvents[5].DetectText = "Emergency break, fixed output values, node"
Attr SystemEvents[5].ReturnText = ""
Attr SystemEvents[5].EventType = 256
Attr SystemEvents[5].EventPriority = 67
Attr SystemEvents[5].EventFlags = 15
Attr SystemEvents[6].SystemEvent = 6
Attr SystemEvents[6].Description = "Emergency break with stop I/O"
Attr SystemEvents[6].DetectOn = 1
Attr SystemEvents[6].DetectText = "Emergency break, I/O stopped, node"
Attr SystemEvents[6].ReturnText = ""
Attr SystemEvents[6].EventType = 256
Attr SystemEvents[6].EventPriority = 67
Attr SystemEvents[6].EventFlags = 15
Attr SystemEvents[7].SystemEvent = 7
Attr SystemEvents[7].Description = "Simulate load event"
Attr SystemEvents[7].DetectOn = 1
Attr SystemEvents[7].DetectText = "Simulate load started, node"
Attr SystemEvents[7].ReturnText = "Simulate load completion, node"
Attr SystemEvents[7].EventType = 256
Attr SystemEvents[7].EventPriority = 67
Attr SystemEvents[7].EventFlags = 15
Attr SystemEvents[8].SystemEvent = 8
Attr SystemEvents[8].Description = "System status error event"
Attr SystemEvents[8].DetectOn = 1
Attr SystemEvents[8].DetectText = "System status error, node"
Attr SystemEvents[8].ReturnText = ""
Attr SystemEvents[8].EventType = 256
Attr SystemEvents[8].EventPriority = 67
Attr SystemEvents[8].EventFlags = 15
Attr SystemEvents[9].SystemEvent = 9
Attr SystemEvents[9].Description = "System status warning event"
Attr SystemEvents[9].DetectOn = 1
Attr SystemEvents[9].DetectText = "System status warning, node"
Attr SystemEvents[9].ReturnText = ""
Attr SystemEvents[9].EventType = 256
Attr SystemEvents[9].EventPriority = 66
Attr SystemEvents[9].EventFlags = 15
Attr SystemEvents[10].SystemEvent = 10
Attr SystemEvents[10].Description = "IO Soft error limit reached event"
Attr SystemEvents[10].DetectOn = 1
Attr SystemEvents[10].DetectText = "IO Soft error limit reached, node"
Attr SystemEvents[10].ReturnText = ""
Attr SystemEvents[10].EventType = 256
Attr SystemEvents[10].EventPriority = 66
Attr SystemEvents[10].EventFlags = 15
Attr SystemEvents[11].SystemEvent = 11
Attr SystemEvents[11].Description = "IO Hard error limit reached event"
Attr SystemEvents[11].DetectOn = 1
Attr SystemEvents[11].DetectText = "IO Hard error limit reached, node"
Attr SystemEvents[11].ReturnText = ""
Attr SystemEvents[11].EventType = 256
Attr SystemEvents[11].EventPriority = 67
Attr SystemEvents[11].EventFlags = 15
Attr SystemEvents[12].SystemEvent = 12
Attr SystemEvents[12].Description = "Application alarm quota exceeded event, node"
Attr SystemEvents[12].DetectOn = 1
Attr SystemEvents[12].DetectText = "Application alarm quota exceeded, node"
Attr SystemEvents[12].ReturnText = ""
Attr SystemEvents[12].EventType = 32
Attr SystemEvents[12].EventPriority = 67
Attr SystemEvents[12].EventFlags = 63
Attr SystemEvents[13].SystemEvent = 13
Attr SystemEvents[13].Description = "System alarm quota exceeded event"
Attr SystemEvents[13].DetectOn = 1
Attr SystemEvents[13].DetectText = "System alarm quota exceeded, node"
Attr SystemEvents[13].ReturnText = ""
Attr SystemEvents[13].EventType = 32
Attr SystemEvents[13].EventPriority = 67
Attr SystemEvents[13].EventFlags = 63
EndBody
EndObject
EndObject
......
!
! Proview Open Source Process Control.
! Copyright (C) 2005-2014 SSAB EMEA AB.
!
! This file is part of Proview.
!
! This program is free software; you can redistribute it and/or
! modify it under the terms of the GNU General Public License as
! published by the Free Software Foundation, either version 2 of
! the License, or (at your option) any later version.
!
! This program is distributed in the hope that it will be useful
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU General Public License for more details.
!
! You should have received a copy of the GNU General Public License
! along with Proview. If not, see <http://www.gnu.org/licenses/>
!
! Linking Proview statically or dynamically with other modules is
! making a combined work based on Proview. Thus, the terms and
! conditions of the GNU General Public License cover the whole
! combination.
!
! In addition, as a special exception, the copyright holders of
! Proview give you permission to, from the build function in the
! Proview Configurator, combine Proview with modules generated by the
! Proview PLC Editor to a PLC program, regardless of the license
! terms of these modules. You may copy and distribute the resulting
! combined work under the terms of your choice, provided that every
! copy of the combined work is accompanied by a complete copy of
! the source code of Proview (the version used to produce the
! combined work), being distributed under the terms of the GNU
! General Public License plus this exception.
!
! pwrb_systemeventtypeenum.wb_load -- Defines the enum type SystemEventTypeEnum
!
SObject pwrb:Type
!/**
! @Version 1.0
! @Group Types
! System event type.
!
! @b See also
! @classlink SystemSup pwrb_systemsup.html
!*/
Object SystemEventTypeEnum $TypeDef 80
Body SysBody
Attr TypeRef = "pwrs:Type-$Enum"
Attr PgmName = "SystemEventTypeEnum"
EndBody
!/**
! Link down
!*/
Object LinkDown $Value
Body SysBody
Attr PgmName = "LinkDown"
Attr Text = "LinkDown"
Attr Value = 0
EndBody
EndObject
!/**
! Node up
!*/
Object NodeUp $Value
Body SysBody
Attr PgmName = "NodeUp"
Attr Text = "NodeUp"
Attr Value = 1
EndBody
EndObject
!/**
! NodeRestart
!*/
Object NodeRestart $Value
Body SysBody
Attr PgmName = "NodeRestart"
Attr Text = "NodeRestart"
Attr Value = 2
EndBody
EndObject
!/**
! OutunitRestart
!*/
Object OutunitRestart $Value
Body SysBody
Attr PgmName = "OutunitRestart"
Attr Text = "OutunitRestart"
Attr Value = 3
EndBody
EndObject
!/**
! Emergency break reboot.
!*/
Object EmergBreakReboot $Value
Body SysBody
Attr PgmName = "EmergBreakReboot"
Attr Text = "EmergBreakReboot"
Attr Value = 4
EndBody
EndObject
!/**
! Emergency break fixed output values.
!*/
Object EmergBreakFixedOutput $Value
Body SysBody
Attr PgmName = "EmergBreakFixedOutput"
Attr Text = "EmergBreakFixedOutput"
Attr Value = 5
EndBody
EndObject
!/**
! Emergency break stop I/O.
!*/
Object EmergBreakStopIO $Value
Body SysBody
Attr PgmName = "EmergBreakStopIO"
Attr Text = "EmergBreakStopIO"
Attr Value = 6
EndBody
EndObject
!/**
! Simulate load.
!*/
Object SimulateLoad $Value
Body SysBody
Attr PgmName = "SimulateLoad"
Attr Text = "SimulateLoad"
Attr Value = 7
EndBody
EndObject
!/**
! System status error.
!*/
Object SystemStatusError $Value
Body SysBody
Attr PgmName = "SystemStatusError"
Attr Text = "SystemStatusError"
Attr Value = 8
EndBody
EndObject
!/**
! System status warning.
!*/
Object SystemStatusWarning $Value
Body SysBody
Attr PgmName = "SystemStatusWarning"
Attr Text = "SystemStatusWarning"
Attr Value = 9
EndBody
EndObject
!/**
! IO Soft error limit reached.
!*/
Object IOErrorSoftLimit $Value
Body SysBody
Attr PgmName = "IOErrorSoftLimit"
Attr Text = "IOErrorSoftLimit"
Attr Value = 10
EndBody
EndObject
!/**
! IO Hard error limit reached.
!*/
Object IOErrorHardLimit $Value
Body SysBody
Attr PgmName = "IOErrorHardLimit"
Attr Text = "IOErrorHardLimit"
Attr Value = 11
EndBody
EndObject
!/**
! Application alarm quota exceeded.
!*/
Object ApplAlarmQuota $Value
Body SysBody
Attr PgmName = "ApplAlarmQuota"
Attr Text = "ApplAlarmQuota"
Attr Value = 12
EndBody
EndObject
!/**
! System alarm quota exceeded.
!*/
Object SystemAlarmQuota $Value
Body SysBody
Attr PgmName = "SystemAlarmQuota"
Attr Text = "SystemAlarmQuota"
Attr Value = 13
EndBody
EndObject
EndObject
EndSObject
......@@ -246,10 +246,16 @@ static pwr_tStatus IoCardRead (
if (bfb_error == 0) {
op->ErrorCount++;
bfb_error = 1;
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
if ( op->ErrorCount == op->ErrorHardLimit)
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount == op->ErrorHardLimit) {
errh_Error( "IO Error hard limit reached on card '%s', stall action %d", cp->Name, rrp->StallAction);
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit && rrp->StallAction == pwr_eSsabStallAction_ResetInputs )
{
data = 0;
......@@ -295,12 +301,16 @@ static pwr_tStatus IoCardRead (
op->ErrorCount++;
local->ErrTime = now;
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
if ( op->ErrorCount >= op->ErrorHardLimit)
{
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit) {
errh_Error( "IO Error hard limit reached on card '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
chanp++;
......
......@@ -272,12 +272,17 @@ static pwr_tStatus IoCardRead (
op->ErrorCount++;
local->ErrTime = now;
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit)
{
errh_Error( "IO Error hard limit reached on card '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
chanp++;
......
......@@ -298,12 +298,17 @@ static pwr_tStatus IoCardWrite (
op->ErrorCount++;
local->ErrTime = now;
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit)
{
errh_Error( "IO Error hard limit reached on card '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
chanp++;
......
......@@ -47,6 +47,7 @@
#include "pwr.h"
#include "co_time.h"
#include "co_cdh.h"
#include "rt_errh.h"
#include "pwr_baseclasses.h"
#include "pwr_basecomponentclasses.h"
......@@ -356,12 +357,17 @@ static pwr_tStatus IoCardRead (
op->ErrorCount++;
local->ErrTime = now;
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit)
{
errh_Error( "IO Error hard limit reached on card '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
continue;
......
......@@ -47,6 +47,7 @@
#include "pwr.h"
#include "co_time.h"
#include "co_cdh.h"
#include "rt_errh.h"
#include "pwr_baseclasses.h"
#include "pwr_basecomponentclasses.h"
......@@ -209,8 +210,11 @@ static pwr_tStatus IoCardRead (
bfb_error = 1;
if ( op->ErrorCount == op->ErrorSoftLimit)
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
if ( op->ErrorCount == op->ErrorHardLimit)
if ( op->ErrorCount == op->ErrorHardLimit) {
errh_Error( "IO Error hard limit reached on card '%s', stall action %d", cp->Name, rrp->StallAction);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit && rrp->StallAction == pwr_eSsabStallAction_ResetInputs )
{
data = 0;
......@@ -219,6 +223,8 @@ static pwr_tStatus IoCardRead (
if ( op->ErrorCount >= op->ErrorHardLimit && rrp->StallAction == pwr_eSsabStallAction_EmergencyBreak )
{
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
}
......
......@@ -47,6 +47,7 @@
#include "pwr.h"
#include "co_time.h"
#include "co_cdh.h"
#include "rt_errh.h"
#include "pwr_baseclasses.h"
#include "pwr_basecomponentclasses.h"
......@@ -256,12 +257,17 @@ static pwr_tStatus IoCardWrite (
op->ErrorCount++;
local->ErrTime = now;
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit)
{
errh_Error( "IO Error hard limit reached on card '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
continue;
......
......@@ -241,10 +241,16 @@ static pwr_tStatus IoCardRead (
if (bfb_error == 0) {
op->ErrorCount++;
bfb_error = 1;
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
if ( op->ErrorCount == op->ErrorHardLimit)
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount == op->ErrorHardLimit) {
errh_Error( "IO Error hard limit reached on card '%s', stall action %d", cp->Name, rrp->StallAction);
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit && rrp->StallAction == pwr_eSsabStallAction_ResetInputs )
{
data = 0;
......@@ -291,12 +297,17 @@ static pwr_tStatus IoCardRead (
op->ErrorCount++;
local->ErrTime = now;
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit)
{
errh_Error( "IO Error hard limit reached on card '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
chanp++;
......
......@@ -251,10 +251,16 @@ static pwr_tStatus IoCardWrite (
if (bfb_error == 0) {
op->ErrorCount++;
bfb_error = 1;
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
if ( op->ErrorCount == op->ErrorHardLimit)
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount == op->ErrorHardLimit) {
errh_Error( "IO Error hard limit reached on card '%s', stall action %d", cp->Name, rrp->StallAction);
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit &&
rrp->StallAction == pwr_eSsabStallAction_ResetInputs ) {
sts = 1;
......@@ -344,12 +350,17 @@ static pwr_tStatus IoCardWrite (
op->ErrorCount++;
local->ErrTime = now;
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit)
{
errh_Error( "IO Error hard limit reached on card '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
chanp++;
......
......@@ -45,6 +45,7 @@
#include "pwr.h"
#include "co_time.h"
#include "co_cdh.h"
#include "rt_errh.h"
#include "pwr_baseclasses.h"
#include "pwr_basecomponentclasses.h"
......@@ -344,12 +345,17 @@ static pwr_tStatus IoCardRead (
op->ErrorCount++;
local->ErrTime = now;
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit)
{
errh_Error( "IO Error hard limit reached on card '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
continue;
......
......@@ -47,6 +47,7 @@
#include "pwr.h"
#include "co_time.h"
#include "co_cdh.h"
#include "rt_errh.h"
#include "pwr_baseclasses.h"
#include "pwr_basecomponentclasses.h"
......@@ -203,10 +204,16 @@ static pwr_tStatus IoCardRead (
if (bfb_error == 0) {
op->ErrorCount++;
bfb_error = 1;
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
if ( op->ErrorCount == op->ErrorHardLimit)
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount == op->ErrorHardLimit) {
errh_Error( "IO Error hard limit reached on card '%s', stall action %d", cp->Name, rrp->StallAction);
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit && rrp->StallAction == pwr_eSsabStallAction_ResetInputs )
{
data = 0;
......@@ -240,12 +247,17 @@ static pwr_tStatus IoCardRead (
op->ErrorCount++;
local->ErrTime = now;
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit)
{
errh_Error( "IO Error hard limit reached on card '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
continue;
......
......@@ -47,6 +47,7 @@
#include "pwr.h"
#include "co_time.h"
#include "co_cdh.h"
#include "rt_errh.h"
#include "pwr_baseclasses.h"
#include "pwr_basecomponentclasses.h"
......@@ -243,10 +244,16 @@ static pwr_tStatus IoCardWrite (
if (bfb_error == 0) {
op->ErrorCount++;
bfb_error = 1;
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit) {
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
if ( op->ErrorCount == op->ErrorHardLimit)
}
if ( op->ErrorCount == op->ErrorHardLimit) {
errh_Error( "IO Error hard limit reached on card '%s', stall action %d", cp->Name, rrp->StallAction);
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit && rrp->StallAction == pwr_eSsabStallAction_ResetInputs ) {
sts = 1;
}
......@@ -279,12 +286,17 @@ static pwr_tStatus IoCardWrite (
local->ErrTime = now;
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit)
{
errh_Error( "IO Error hard limit reached on card '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
continue;
......
......@@ -370,10 +370,16 @@ static pwr_tStatus IoCardRead (
if (bfb_error == 0) {
op->ErrorCount++;
bfb_error = 1;
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
if ( op->ErrorCount == op->ErrorHardLimit)
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount == op->ErrorHardLimit) {
errh_Error( "IO Error hard limit reached on card '%s', stall action %d", cp->Name, rrp->StallAction);
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit && rrp->StallAction == pwr_eSsabStallAction_ResetInputs )
{
data = 0;
......@@ -410,12 +416,17 @@ static pwr_tStatus IoCardRead (
op->ErrorCount++;
local->ErrTime = now;
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit)
{
errh_Error( "IO Error hard limit reached on card '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
chanp++;
......@@ -563,12 +574,17 @@ static pwr_tStatus IoCardWrite (
op->ErrorCount++;
local->ErrTime = now;
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit)
{
errh_Error( "IO Error hard limit reached on card '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
chanp++;
......@@ -638,11 +654,16 @@ static pwr_tStatus IoCardWrite (
local->ErrTime = now;
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
if ( op->ErrorCount >= op->ErrorHardLimit) {
errh_Error( "IO Error hard limit reached on card '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
}
......
......@@ -328,9 +328,11 @@ static pwr_tStatus IoCardRead (
op->ErrorCount++;
local->ErrTime = now;
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
continue;
}
}
......@@ -354,6 +356,8 @@ static pwr_tStatus IoCardRead (
{
errh_Error( "IO Error hard limit reached on card '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
......@@ -533,9 +537,11 @@ static pwr_tStatus IoCardWrite (
op->ErrorCount++;
local->ErrTime = now;
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
continue;
}
}
......@@ -582,9 +588,11 @@ static pwr_tStatus IoCardWrite (
op->ErrorCount++;
local->ErrTime = now;
if ( op->ErrorCount == op->ErrorSoftLimit)
if ( op->ErrorCount == op->ErrorSoftLimit) {
errh_Error( "IO Error soft limit reached on card '%s'", cp->Name);
ctx->IOHandler->CardErrorSoftLimit = 1;
ctx->IOHandler->ErrorSoftLimitObject = cdh_ObjidToAref( cp->Objid);
}
continue;
}
}
......@@ -613,6 +621,8 @@ static pwr_tStatus IoCardWrite (
{
errh_Error( "IO Error hard limit reached on card '%s', IO stopped", cp->Name);
ctx->Node->EmergBreakTrue = 1;
ctx->IOHandler->CardErrorHardLimit = 1;
ctx->IOHandler->ErrorHardLimitObject = cdh_ObjidToAref( cp->Objid);
return IO__ERRDEVICE;
}
......
This diff is collapsed.
......@@ -131,8 +131,8 @@ class HistGtk : public Hist {
public:
HistGtk( void *hist_parent_ctx,
GtkWidget *hist_parent_wid,
char *hist_name, pwr_tObjid objid,
pwr_tStatus *status) : Hist(hist_parent_ctx,hist_name,objid,status) {}
char *hist_name, pwr_tAttrRef *arp,
pwr_tStatus *status) : Hist(hist_parent_ctx,hist_name,arp,status) {}
~HistGtk() {}
};
......
......@@ -127,6 +127,7 @@ XNavGtk::XNavGtk( void *xn_parent_ctx,
wow = new CoWowGtk( parent_wid);
trace_timerid = wow->timer_new();
autoack_timerid = wow->timer_new();
*status = 1;
}
......@@ -137,6 +138,9 @@ XNavGtk::~XNavGtk()
{
closing_down = 1;
delete autoack_timerid;
delete trace_timerid;
if ( mcp) {
free( mcp);
mcp = 0;
......
......@@ -696,6 +696,10 @@ pwr_tStatus Ev::mh_clear_alarmlist_bc( pwr_tNodeIndex nix)
ev->ala->event_clear_alarmlist( nix);
for ( int i = 0; i < ev->sala_cnt; i++)
ev->sala[i]->mh_clear_alarmlist( nix);
if ( ev->update_info_cb)
ev->update_info_cb( ev->parent_ctx);
ev->ala->fill_alarm_tables();
return 1;
}
......
......@@ -162,7 +162,7 @@ class Hist {
class Hist {
public:
Hist( void *hist_parent_ctx,
char *hist_name, pwr_tObjid objid,
char *hist_name, pwr_tAttrRef *arp,
pwr_tStatus *status) : parent_ctx(hist_parent_ctx) {}
void *parent_ctx;
void (*close_cb)( void *);
......
......@@ -4380,3 +4380,14 @@ void XNav::appl_startup()
}
}
void XNav::autoack_scan( void *data)
{
XNav *xnav = (XNav *)data;
int time = int( xnav->autoack_scantime * 1000);
if ( xnav->ev)
xnav->ev->ack_all();
xnav->autoack_timerid->add( time, autoack_scan, xnav);
}
......@@ -291,6 +291,8 @@ class XNav {
void *root_item;
t_trace_node *TraceList;
CoWowTimer *trace_timerid;
CoWowTimer *autoack_timerid;
float autoack_scantime;
int trace_started;
void (*message_cb)( void *, char, const char *);
void (*close_cb)( void *, int);
......@@ -467,8 +469,8 @@ class XNav {
int sound( pwr_tAttrRef *arp);
int sound_attached();
int eventlog_enabled();
void appl_startup();
void appl_startup();
static int init_brow_base_cb( FlowCtx *fctx, void *client_data);
static int get_trace_attr( pwr_sAttrRef *arp, char *attr);
......@@ -492,6 +494,7 @@ class XNav {
static int trace_disconnect_bc( brow_tObject object);
static int init_brow_collect_cb( BrowCtx *ctx, void *client_data);
static int init_brow_cb( BrowCtx *ctx, void *client_data);
static void autoack_scan( void *data);
// Command module member functions
int command( char *cmd);
......
......@@ -376,7 +376,7 @@ dcli_tCmdTable xnav_command_table[] = {
{
"EVENTLIST",
&xnav_eventlist_func,
{"dcli_arg1", "/PRIORITY", "/NAME", "/ALL", "",}
{"dcli_arg1", "/PRIORITY", "/NAME", "/ALL", "/AUTOACKNOWLEDGE", "",}
},
{
"TEST",
......@@ -2634,6 +2634,7 @@ static int xnav_eventlist_func( void *client_data,
{
// Command is "EVENTLIST ACKNOWLEDGE"
char prio_str[80];
char autoack_str[80];
mh_sEventId *id;
int all;
......@@ -2644,6 +2645,22 @@ static int xnav_eventlist_func( void *client_data,
return XNAV__SUCCESS;
}
if ( ODD( dcli_get_qualifier( "/AUTOACKNOWLEDGE", autoack_str, sizeof(autoack_str)))) {
float ftime;
int nr = sscanf( autoack_str, "%f", &ftime);
if ( nr != 1) {
xnav->message('E', "Syntax error in time");
return XNAV__HOLDCOMMAND;
}
xnav->autoack_scantime = ftime;
int time = int( xnav->autoack_scantime * 1000);
if ( time == 0)
xnav->autoack_timerid->remove();
else
xnav->autoack_timerid->add( time, XNav::autoack_scan, xnav);
return XNAV__SUCCESS;
}
if ( xnav->ev) {
if ( ODD( dcli_get_qualifier( "/PRIORITY", prio_str, sizeof(prio_str)))) {
cdh_ToUpper( prio_str, prio_str);
......
#
# System events
C 0.0.1 "Link down to node"
C 0.0.2 "Link up to node"
C 0.0.3 "Node up"
C 0.0.4 "Node restart initiated, node"
C 0.0.5 "Node restart completion, node"
C 0.0.6 "Outunit restarted, node"
C 0.0.7 "Emergency break reboot, node"
C 0.0.8 "Emergency break, fixed output values, node"
C 0.0.9 "Emergency break, I/O stopped, node"
C 0.0.10 "Simulate load started, node"
C 0.0.11 "Simulate load completion, node"
C 0.0.12 "System status error, node"
C 0.0.13 "System status warning, node"
C 0.0.14 "IO Soft error limit reached, node"
C 0.0.15 "IO Hard error limit reached, node"
C 0.0.16 "Application alarm quota exceeded, node"
C 0.0.17 "System alarm quota exceeded, node"
#
# General
E 1.0.1 "Error"
E 1.0.2 "Warning"
......
#
# System events
C 0.0.1 "Lnken nere till nod"
C 0.0.2 "Lnken uppe till nod"
C 0.0.3 "Nod uppe"
C 0.0.4 "Nod omstart pbrjad, nod"
C 0.0.5 "Nod omstart slutfrd, nod"
C 0.0.6 "Utenhet omstartad, nod"
C 0.0.7 "Ndstopp, omstart, nod"
C 0.0.8 "Ndstopp, fixa utgngsvrden, nod"
C 0.0.9 "Ndstopp, I/O stoppat, nod"
C 0.0.10 "Simulering, ladding startad, nod"
C 0.0.11 "Simulering, ladding slutfrd, nod"
C 0.0.12 "System status fel, nod"
C 0.0.13 "System status varning, nod"
C 0.0.14 "IO Mjuk felgrns uppndd, nod"
C 0.0.15 "IO Hrd felgrns uppndd, nod"
C 0.0.16 "Kvota fr applikationslarm verskriden, nod"
C 0.0.17 "Kvota fr systemlarm verskriden, nod"
#
# General
E 1.0.1 "Fel"
E 1.0.2 "Varning"
......@@ -423,6 +443,18 @@ E 1.17.3 "Zooma ut"
E 1.17.4 "terstll zoom"
E 1.17.5 "Operatrsfnster"
#
# Help window
E 1.18.1 "_Hem"
E 1.18.2 "_Bakt"
E 1.18.3 "_Nsta mne"
E 1.18.4 "_Fregende mne"
E 1.18.5 "Sk _Nsta"
E 1.18.6 "Sk _Fregende"
E 1.18.7 "G till startsidan"
E 1.18.8 "G tillbaka"
E 1.18.9 "Fregende mne"
E 1.18.10 "Nsta mne"
#
# Postscript printing
E 2.1.1 "Innehll"
E 2.1.2 "sidan"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment