diff --git a/src/exe/rt_emon/src/rt_emon.c b/src/exe/rt_emon/src/rt_emon.c index fd9c6e1f9eb4dd12ae8fe16512135fe2c69a52b2..936978387810d2cd025000233ca496a0c50d453b 100644 --- a/src/exe/rt_emon/src/rt_emon.c +++ b/src/exe/rt_emon/src/rt_emon.c @@ -5547,9 +5547,14 @@ static pwr_tStatus emon_redu_receive() l.redu->packetp->UnpackTime = l.redu->msg_time; } + break; + case redu_eMsgType_TableVersionRequest: + sts = redu_send_table_version( l.redu); + break; + case redu_eMsgType_TableVersion: break; default: - printf( "Redu: Unknown message type\n"); + printf( "Redu: Unknown message type %d\n", ((redu_sHeader *)msg)->type); } qcom_Free( &sts, msg); return MH__SUCCESS; diff --git a/src/exe/rt_ini/src/ini.c b/src/exe/rt_ini/src/ini.c index ff87d873b78f067226347ddd8dae470b26ff51fb..060e40e51dee31d6f6573c01bba8030396c6d8a4 100644 --- a/src/exe/rt_ini/src/ini.c +++ b/src/exe/rt_ini/src/ini.c @@ -141,6 +141,7 @@ # define cPrio_remotelogg (cPrio_base + 5) # define cPrio_sim (cPrio_base + 5) # define cPrio_videomgm (cPrio_base + 5) +# define cPrio_redcom (cPrio_base + 17) #endif static pwr_tBoolean checkSect (pwr_tStatus*, ini_sContext*, int, int); @@ -2135,6 +2136,9 @@ ini_ProcTable ( pp = ini_ProcInsert(sts, cp, "pwr_videomgm", "pwr_videomgm_%d", 0, 1, "rt_videomgm", cPrio_videomgm, 0, pwr_cClass_VideoMgmServer, "", 0); pp->proc.flags.b.system = 1; + pp = ini_ProcInsert(sts, cp, "pwr_redcom", "pwr_redcom_%d", 0, 1, "rt_redcom", cPrio_redcom, 0, pwr_cClass_RedcomConfig, "", 0); + pp->proc.flags.b.system = 1; + pp = ini_ProcInsert(sts, cp, "pwr_sim", "pwr_sim_%d", 0, 1, "rt_sim", cPrio_sim, 0, pwr_cClass_SimulateConfig, "", 0); pp->proc.flags.b.system = 1; #endif diff --git a/src/exe/rt_ini/src/rt_ini.c b/src/exe/rt_ini/src/rt_ini.c index 09bee54040f58f47039cb4c2eb3319caba6ab979..a028ffcea31c7eae1147f6935e4aef0337eb9611 100644 --- a/src/exe/rt_ini/src/rt_ini.c +++ b/src/exe/rt_ini/src/rt_ini.c @@ -210,10 +210,6 @@ start ( ini_SetSystemStatus( cp, PWR__STARTUP); errh_SetStatus( PWR__STARTUP); - sts = redu_get_initial_state( cp->nodename, cp->busid, &state); - if ( ODD(sts)) - cp->np->RedundancyState = state; - sts = ini_RcReadAndSet(cp->dir, cp->nodename, cp->busid); if (EVEN(sts)) errh_LogError(&cp->log, "ini_RcReadAndSet, %m", sts); @@ -224,6 +220,12 @@ start ( qini_BuildDb(&sts, cp->nid_t, cp->me, NULL, cp->busid); + sts = redu_get_initial_state( cp->nodename, cp->busid, &state); + if ( ODD(sts)) { + cp->np->RedundancyState = state; + qcom_SetRedundancyState( state); + } + io_init_signals(); load_backup(); diff --git a/src/exe/rt_neth/src/rt_neth.c b/src/exe/rt_neth/src/rt_neth.c index cfef14b92d4649bad1f3b096ae8160cdb48cfa00..60c9cf6ca23b069e3b6e1bf6c2ea81063f27e4d9 100644 --- a/src/exe/rt_neth/src/rt_neth.c +++ b/src/exe/rt_neth/src/rt_neth.c @@ -69,6 +69,7 @@ #include "rt_cvolcm.h" #include "rt_cbuf.h" #include "rt_pwr_msg.h" +#include "co_timelog.h" /* Declare routines used by main. */ @@ -490,8 +491,7 @@ id ( errh_Info("Received '%s' from nid %s", cMsg[get->type.s], cdh_NodeIdToString(NULL, mp->hdr.nid, 0, 0)); } - printf("Id Received '%s' from nid %s\n", - cMsg[get->type.s], cdh_NodeIdToString(NULL, mp->hdr.nid, 0, 0)); + timelog_ss( 1, "Neth Id received from nid", cdh_NodeIdToString(NULL, mp->hdr.nid, 0, 0)); if (get->sender.nid == gdbroot->my_qid.nid && mp->hdr.nid == gdbroot->db->nid) { errh_Error("New node using nid %s, conflicts with local node, '%s' ignored", @@ -936,8 +936,7 @@ sendId ( errh_Info("Sending 'id' to %s (%s)", np->name, cdh_NodeIdToString(NULL, np->nid, 0, 0)); } - printf("Sending 'id' to %s (%s)\n", - np->name, cdh_NodeIdToString(NULL, np->nid, 0, 0)); + timelog_ss( 1, "Neth sending 'id' to", np->name); if ( np->handler.nid) tgt = np->handler; diff --git a/src/exe/rt_qmon/src/rt_qmon.c b/src/exe/rt_qmon/src/rt_qmon.c index bafdc23dc6b699007c71e425c166d1af333df38a..a8290b32831e4f39635b0a2509f4c2ff3c803455 100644 --- a/src/exe/rt_qmon/src/rt_qmon.c +++ b/src/exe/rt_qmon/src/rt_qmon.c @@ -83,6 +83,7 @@ #include "rt_pwr_msg.h" #include "rt_ini_event.h" #include "rt_qmon.h" +#include "co_timelog.h" #if 1 # define MAX_SEGSIZE (8192 - sizeof(sHead)) @@ -671,12 +672,16 @@ create_connect ( { sEseg *sp; - printf( "Create connect %d\n", qdb->my_node->redundancy_state); sp = eseg_alloc(&l.eseg.mutex); - if ( qdb->my_node->redundancy_state == pwr_eRedundancyState_Passive) + if ( qdb->my_node->redundancy_state == pwr_eRedundancyState_Passive || + qdb->my_node->redundancy_state == pwr_eRedundancyState_Init) { sp->head.flags.b.event = eEvent_connectPassive; - else + timelog( 1, "qmon sending connect Passive"); + } + else { sp->head.flags.b.event = eEvent_connect; + timelog( 1, "qmon sending connect"); + } sp->lp = lp; sp->c.action = eAction_export; @@ -1386,14 +1391,14 @@ link_connect ( if ( sp->head.flags.b.event == eEvent_connect) lp->np->clx = lp->lix; - else if ( sp->head.flags.b.event == eEvent_connectPassive && - lp->np->clx == lp->lix) { - if ( lp->lix == 1) - lp->np->clx = 0; - else if ( lp->lix == 0 && lp->np->link_cnt > 1) - lp->np->clx = 1; + else if ( sp->head.flags.b.event == eEvent_connectPassive) { + if ( lp->np->clx == lp->lix) { + if ( lp->lix == 1) + lp->np->clx = 0; + else if ( lp->lix == 0 && lp->np->link_cnt > 1) + lp->np->clx = 1; + } } - lp->np->link[lp->lix].flags.b.active = 1; if (lp->np->link[lp->lix].flags.b.connected) @@ -1408,7 +1413,7 @@ link_connect ( lp->np->link[lp->lix].qflags.b.connected = 1; lp->np->link[lp->lix].qflags.b.active = 1; set_link_info(lp, (qdb_sLinkInfo *)sp->buff); - if ( lp->np->clx == lp->lix) + if ( lp->np->clx == lp->lix && sp->head.flags.b.event == eEvent_connect) qdb_NetEvent(&sts, lp->np, qcom_eStype_linkConnect); } qdb_ScopeUnlock; @@ -1590,8 +1595,13 @@ link_import ( ) { - //if ( IS_SECONDARY_NID(lp->nid)) - // printf( "link_import %d\n", lp->nid); +#if 0 + if ( IS_SECONDARY_NID(lp->nid)) { + char msg[80]; + sprintf( msg, "From secondary %s %d", cdh_NodeIdToString(NULL, lp->np->nid, 0, 0), sp->head.flags.b.event); + timelog( 1, msg); + } +#endif if (!lp->np->link[lp->lix].flags.b.active && lp->np->link[lp->lix].birth == sp->head.birth) link_active(lp); @@ -1622,6 +1632,7 @@ link_import ( break; case eEvent_connect: case eEvent_connectPassive: + timelog_ss( 1, "Qmon connect received from", lp->np->link[lp->lix].name); link_connect(lp, sp); lack(lp, sp); set_rack(lp, sp); @@ -1631,13 +1642,13 @@ link_import ( lack(lp, sp); set_rack(lp, sp); link_redcom_active(lp, sp); - printf( "Active from %s\n", lp->np->link[lp->lix].name); + timelog_ss( 1, "Active received from", lp->np->link[lp->lix].name); break; case eEvent_redcomPassive: lack(lp, sp); set_rack(lp, sp); link_redcom_passive(lp, sp); - printf( "Passive from %s\n", lp->np->link[lp->lix].name); + timelog_ss( 1, "Passive received from", lp->np->link[lp->lix].name); break; default: break; @@ -2393,8 +2404,6 @@ action_thread () switch ( get.type.s) { case qmon_eMsgTypeAction_NodeActive: case qmon_eMsgTypeAction_NodePassive: - printf( "Node active\n"); - for (lp = tree_Minimum(&sts, l.links.table); lp != NULL; lp = tree_Successor(&sts, l.links.table, lp)) send_action( lp, get.type.s); @@ -2423,9 +2432,11 @@ send_action ( sp = eseg_alloc(&l.eseg.mutex); switch ( action) { case qmon_eMsgTypeAction_NodeActive: + timelog( 1, "qmon send NodeActive"); sp->head.flags.b.event = eEvent_redcomActive; break; case qmon_eMsgTypeAction_NodePassive: + timelog( 1, "qmon send NodePassive"); sp->head.flags.b.event = eEvent_redcomPassive; break; } diff --git a/src/exe/rt_redcom/src/rt_redcom.c b/src/exe/rt_redcom/src/rt_redcom.c index 41dc396301280a8c195ce8c94b77b9ea284fb788..41af4fe531364e69f2aa158a9652270c01539688 100644 --- a/src/exe/rt_redcom/src/rt_redcom.c +++ b/src/exe/rt_redcom/src/rt_redcom.c @@ -34,7 +34,7 @@ * General Public License plus this exception. */ -/* rt_redumon.c -- Redundance communication monitor. */ +/* rt_redcom.c -- Redundance communication monitor. */ #include <stdlib.h> #include <string.h> @@ -75,6 +75,9 @@ #include "rt_ini_event.h" #include "pwr_baseclasses.h" #include "rt_redu.h" +#include "rt_aproc.h" +#include "rt_redu_msg.h" +#include "co_timelog.h" #define redu_qix_import ((1<<31) | 5) @@ -88,6 +91,7 @@ #define RACK_TMO 1 #define EXPORT_BUF_WARN_LEVEL 300000 #define EXPORT_BUF_QUOTA 600000 +#define K_FILTER 0.99 #define max(Dragon,Eagle) ((Dragon) > (Eagle) ? (Dragon) : (Eagle)) @@ -237,6 +241,7 @@ struct sLink { sIseg tmo; thread_sMutex eseg_mutex; pwr_tTime receive_time; + int passive_timeout; }; @@ -312,7 +317,13 @@ struct { pwr_tBoolean emergbreaktrue_old; pwr_eUpDownEnum linkstate_old; pwr_tStatus systemstatus_old; + pwr_tTime startup_time; + int startup_timeout; } sup; + int pending_set_active; + pwr_tTime pending_set_active_time; + pwr_tTime last_switch_time; + pwr_eRedundancyState default_redundancy_state; } l; static pwr_tStatus redu_sts = PWR__SRVSTARTUP; @@ -385,7 +396,7 @@ main (int argc, char *argv[]) qcom_sQid my_q = qcom_cNQid; pwr_tOid oid; - errh_Init("pwr_redumon", errh_eAnix_appl1); + errh_Init("pwr_redcom", errh_eAnix_redcom); errh_SetStatus( PWR__SRVSTARTUP); if (!qcom_Init(&sts, NULL, "pwr_redcom")) { @@ -427,6 +438,7 @@ main (int argc, char *argv[]) errh_SetStatus( sts); exit(sts); } + aproc_RegisterObject( oid); l.nid = ntohl(qdb->my_node->sa.sin_addr.s_addr); @@ -479,6 +491,14 @@ main (int argc, char *argv[]) } while (0); + if ( l.nodep->RedundancyState == pwr_eRedundancyState_Init || + l.nodep->RedundancyState == pwr_eRedundancyState_Passive) { + l.pending_set_active = 1; + time_GetTimeMonotonic( &l.pending_set_active_time); + l.sup.startup_timeout = 1; + l.sup.startup_time = l.pending_set_active_time; + } + check_link_status(); set_status( PWR__SRUN); @@ -493,7 +513,7 @@ main (int argc, char *argv[]) qcom_Exit(&sts); errh_Info("Exiting"); - exit(QCOM__SUCCESS); + exit( REDU__SUCCESS); } static pwr_tStatus redu_node_init( ) { @@ -548,8 +568,8 @@ static pwr_tStatus redu_node_init( ) if ( l.port == 0) l.port = redu_cPort; redu_segment_size = atoi(s_seg_size); - l.nodep->RedundancyState = atoi(s_state); - qdb->my_node->redundancy_state = l.nodep->RedundancyState; + // l.nodep->RedundancyState = atoi(s_state); + l.default_redundancy_state = atoi(s_state); l.min_resend_time = atoi(s_min_resend_time); l.max_resend_time = atoi(s_max_resend_time); l.export_buf_quota = atoi(s_export_buf_quota); @@ -571,7 +591,6 @@ static pwr_tStatus redu_node_init( ) np->port = atoi(s_port); if ( np->port == 0) np->port = redu_cPort; - np->redundancy_state = atoi(s_state); np->min_resend_time = atoi(s_min_resend_time); np->max_resend_time = atoi(s_max_resend_time); np->export_buf_quota = atoi(s_export_buf_quota); @@ -614,8 +633,8 @@ static pwr_tStatus redu_node_init( ) static int export_alloc_check( sLink *lp) { - if ( lp->np->link.export_alloc_cnt > EXPORT_BUF_WARN_LEVEL && redu_sts != QCOM__BUFFHIGH) - set_status(QCOM__BUFFHIGH); + if ( lp->np->link.export_alloc_cnt > EXPORT_BUF_WARN_LEVEL && redu_sts != REDU__BUFFHIGH) + set_status(REDU__BUFFHIGH); if ( lp->np->link.export_alloc_cnt > lp->exp_buf_quota) { link_purge(lp); return 1; @@ -631,7 +650,7 @@ static void export_alloc_sub( sEseg *sp) sp->lp->np->link.export_alloc_cnt -= sp->size; if ( sp->lp->np->link.export_alloc_cnt < 0) sp->lp->np->link.export_alloc_cnt = 0; - if ( redu_sts == QCOM__BUFFHIGH && sp->lp->np->link.export_alloc_cnt < EXPORT_BUF_WARN_LEVEL ) + if ( redu_sts == REDU__BUFFHIGH && sp->lp->np->link.export_alloc_cnt < EXPORT_BUF_WARN_LEVEL ) set_status(PWR__SRUN); l.config->Link[sp->lp->idx].ExportAlloc = sp->lp->np->link.export_alloc_cnt; } @@ -798,9 +817,10 @@ create_connect ( /* Init receive timeout */ if ( l.nodep->RedundancyState == pwr_eRedundancyState_Init || - l.nodep->RedundancyState == pwr_eRedundancyState_Passive) + l.nodep->RedundancyState == pwr_eRedundancyState_Passive) { time_GetTimeMonotonic( &lp->receive_time); - + lp->passive_timeout = 0; + } return sp; } @@ -1487,6 +1507,10 @@ link_connect ( sIseg *sp ) { + if ( l.pending_set_active) { + l.pending_set_active = 0; + timelog( 1, "Pending set active reset"); + } lp->np->link.flags.b.active = 1; l.config->Link[lp->idx].State = pwr_eUpDownEnum_Up; @@ -1622,12 +1646,21 @@ link_purge ( static void check_state( sLink *lp, sIseg *sp) { + pwr_tDeltaTime dt; + pwr_tFloat32 ft; + + time_Adiff( &dt, &lp->receive_time, &l.last_switch_time); + time_DToFloat( &ft, &dt); + if ( ft < l.config->LinkTimeout) + return; + switch ( sp->head.state) { case pwr_eRedundancyState_Active: switch ( l.nodep->RedundancyState) { case pwr_eRedundancyState_Init: case pwr_eRedundancyState_Active: state_change_request( lp, sp, pwr_eRedundancyState_Passive); + timelog( 1, "redcom state to Passive, remote is Active"); break; } break; @@ -1636,13 +1669,18 @@ static void check_state( sLink *lp, sIseg *sp) case pwr_eRedundancyState_Init: case pwr_eRedundancyState_Passive: state_change_request( lp, sp, pwr_eRedundancyState_Active); + timelog( 1, "redcom state to Active, remote is Passive"); break; } break; case pwr_eRedundancyState_Init: switch ( l.nodep->RedundancyState) { case pwr_eRedundancyState_Init: - state_change_request( lp, sp, pwr_eRedundancyState_Active); + if ( l.default_redundancy_state == pwr_eRedundancyState_Active) + state_change_request( lp, sp, pwr_eRedundancyState_Active); + else + state_change_request( lp, sp, pwr_eRedundancyState_Passive); + timelog( 1, "redcom state to Active, remote is Init"); break; } break; @@ -1667,6 +1705,11 @@ link_import ( else if (lp->np->birth != sp->head.birth && !lp->np->link.flags.b.connected) link_redisconnect(lp); + if ( l.pending_set_active) { + l.pending_set_active = 0; + timelog( 1, "Pending set active reset"); + } + switch (sp->head.flags.b.event) { case eEvent_user: check_state(lp, sp); @@ -1689,11 +1732,14 @@ link_import ( set_rack(lp, sp); break; case eEvent_set_active: + timelog( 1, "redcom Active received"); state_change_request(lp, sp, pwr_eRedundancyState_Active); + lack(lp, sp); set_rack(lp, sp); break; case eEvent_set_passive: + timelog( 1, "redcom Passive received"); state_change_request(lp, sp, pwr_eRedundancyState_Passive); lack(lp, sp); set_rack(lp, sp); @@ -1725,12 +1771,13 @@ link_redisconnect ( lp->np->link.rack_tmo = pwr_cNTime; sp = lst_Succ(NULL, &lp->lh_win, NULL); - if (sp == NULL) + if (sp == NULL) { sp = lst_Succ(NULL, &lp->lh_send, NULL); - pwr_Assert(sp != NULL); - pwr_Assert(sp->head.flags.b.event == eEvent_connect); + sp->tmo = pwr_cNTime; + } + // pwr_Assert(sp != NULL); + // pwr_Assert(sp->head.flags.b.event == eEvent_connect); - sp->tmo = pwr_cNTime; } @@ -2106,6 +2153,7 @@ seg_send ( sp->head.nid = l.head.nid; sp->head.birth = l.head.birth; sp->head.rack = sp->lp->np->link.rack; + sp->head.state = l.nodep->RedundancyState; thread_MutexLock(&l.send_mutex); @@ -2277,7 +2325,7 @@ check_link_status( for (lp = tree_Minimum(&sts, l.links.table); lp != NULL; lp = tree_Successor(&sts, l.links.table, lp)) { if ( !lp->np->link.flags.b.active) - linksts = QCOM__DOWN; + linksts = REDU__DOWN; } if ( linksts != l.sts) { if ( errh_Severity(linksts) >= errh_Severity(redu_sts)) @@ -2322,15 +2370,37 @@ state_change_request ( pwr_eRedundancyState state ) { - switch ( state) { - case pwr_eRedundancyState_Active: - case pwr_eRedundancyState_Passive: - case pwr_eRedundancyState_Off: - case pwr_eRedundancyState_Init: - l.nodep->RedundancyState = state; - qdb->my_node->redundancy_state = l.nodep->RedundancyState; - - break; + if ( l.pending_set_active) { + l.pending_set_active = 0; + timelog( 1, "Pending set active reset"); + } + + if ( state != l.nodep->RedundancyState) { + + switch ( state) { + case pwr_eRedundancyState_Active: + case pwr_eRedundancyState_Passive: + case pwr_eRedundancyState_Off: + case pwr_eRedundancyState_Init: + l.nodep->RedundancyState = state; + qdb->my_node->redundancy_state = l.nodep->RedundancyState; + + break; + } + + switch ( state) { + case pwr_eRedundancyState_Passive: + time_GetTimeMonotonic( &lp->receive_time); + time_GetTimeMonotonic( &l.last_switch_time); + lp->passive_timeout = 1; + send_state_change(); + break; + case pwr_eRedundancyState_Active: + time_GetTimeMonotonic( &l.last_switch_time); + send_state_change(); + break; + default: ; + } } } @@ -2374,7 +2444,17 @@ static void failover_detection() time_GetTimeMonotonic( ¤t); - + if (l.sup.startup_timeout) { + /* Disable timeout for a while after startup */ + pwr_tDeltaTime dt; + float ftime; + float timeout = l.config->StartupTimeout; + + time_Adiff( &dt, ¤t, &l.sup.startup_time); + ftime = time_DToFloat( 0, &dt); + if ( ftime > timeout) + l.sup.startup_timeout = 0; + } /* When force is removed, initialize again */ if ( !l.config->Force && l.sup.force_old) @@ -2383,23 +2463,39 @@ static void failover_detection() if ( !l.config->Force && l.sup.initialized) { if ( l.nodep->RedundancyState == pwr_eRedundancyState_Active) { /* State is active */ - if ( l.nodep->EmergBreakTrue && !l.sup.emergbreaktrue_old) + if ( l.nodep->EmergBreakTrue && !l.sup.emergbreaktrue_old) { l.config->SetPassive = 1; - //else if ( EVEN(l.nodep->SystemStatus) && ODD(l.sup.systemstatus_old)) - //l.config->SetPassive = 1; + timelog( 1, "Emergency break, set passive"); + } + // else if ( EVEN(l.nodep->SystemStatus) && ODD(l.sup.systemstatus_old)) + // l.config->SetPassive = 1; } else { /* State if passive, check for overtaking */ - if ( l.config->Link[0].State == pwr_eUpDownEnum_Down && l.sup.linkstate_old == pwr_eUpDownEnum_Up) + if ( l.config->Link[0].State == pwr_eUpDownEnum_Down && l.sup.linkstate_old == pwr_eUpDownEnum_Up) { l.config->SetActive = 1; + timelog( 1, "Link down, set active"); + } for (lp = tree_Minimum(&sts, l.links.table); lp != NULL; lp = tree_Successor(&sts, l.links.table, lp)) { - if ( l.config->Link[lp->idx].State == pwr_eUpDownEnum_Up && l.config->LinkTimeout > 0) { + if ( l.config->Link[lp->idx].State == pwr_eUpDownEnum_Up && l.config->LinkTimeout > 0 && + !l.sup.startup_timeout) { pwr_tDeltaTime dt; + float ftime; + float timeout = l.config->LinkTimeout; + if ( lp->passive_timeout) + timeout = 2.0 * timeout; + time_Adiff( &dt, ¤t, &lp->receive_time); - if ( time_DToFloat( 0, &dt) > l.config->LinkTimeout) + ftime = time_DToFloat( 0, &dt); + if ( ftime > timeout) { + timelog( 1, "Link timeout, set active"); l.config->SetActive = 1; + } + l.config->Link[lp->idx].TimeMean = K_FILTER * l.config->Link[lp->idx].TimeMean + ( 1.0 - K_FILTER) * ftime; + if ( ftime > l.config->Link[lp->idx].TimeMax) + l.config->Link[lp->idx].TimeMax = ftime; } } } @@ -2419,6 +2515,8 @@ cyclic_thread () pwr_tStatus sts; struct timespec ts; pwr_tDeltaTime dt; + pwr_tTime current; + pwr_tFloat32 ftime; time_FloatToD( &dt, l.config->CycleTime); @@ -2427,9 +2525,36 @@ cyclic_thread () for (;;) { + aproc_TimeStamp( l.config->CycleTime, 5.0); + + if ( l.nodep->RedundancyState == pwr_eRedundancyState_Init || + l.nodep->RedundancyState == pwr_eRedundancyState_Passive) { + if ( l.pending_set_active) { + time_GetTimeMonotonic( ¤t); + time_Adiff( &dt, ¤t, &l.pending_set_active_time); + ftime = time_DToFloat( 0, &dt); + if ( ftime > 5) { + l.config->SetActive = 1; + l.pending_set_active = 0; + timelog( 1, "Pending set active timed out"); + } + } + } + else { + if ( l.pending_set_active) { + timelog( 1, "Pending set active reset"); + l.pending_set_active = 0; + } + } + + failover_detection(); if ( l.config->SetActive) { + timelog( 1, "redcom SetActive"); + + if ( l.nodep->RedundancyState != pwr_eRedundancyState_Active) + time_GetTimeMonotonic( &l.last_switch_time); for (lp = tree_Minimum(&sts, l.links.table); lp != NULL; lp = tree_Successor(&sts, l.links.table, lp)) request_state_change( lp, pwr_eRedundancyState_Passive); @@ -2439,15 +2564,23 @@ cyclic_thread () send_state_change(); } if ( l.config->SetPassive) { + timelog( 1, "redcom SetPassive"); - for (lp = tree_Minimum(&sts, l.links.table); lp != NULL; lp = tree_Successor(&sts, l.links.table, lp)) + if ( l.nodep->RedundancyState != pwr_eRedundancyState_Passive) + time_GetTimeMonotonic( &l.last_switch_time); + + for (lp = tree_Minimum(&sts, l.links.table); lp != NULL; lp = tree_Successor(&sts, l.links.table, lp)) { request_state_change( lp, pwr_eRedundancyState_Active); + time_GetTimeMonotonic( &lp->receive_time); + lp->passive_timeout = 1; + } l.config->SetPassive = 0; + l.pending_set_active = 0; l.nodep->RedundancyState = pwr_eRedundancyState_Passive; qdb->my_node->redundancy_state = l.nodep->RedundancyState; send_state_change(); } - if ( l.config->SetOff) { + if ( l.config->SetOff) { for (lp = tree_Minimum(&sts, l.links.table); lp != NULL; lp = tree_Successor(&sts, l.links.table, lp)) request_state_change( lp, pwr_eRedundancyState_Off); @@ -2471,9 +2604,11 @@ void send_state_change() switch ( l.nodep->RedundancyState) { case pwr_eRedundancyState_Active: put.type.s = (qcom_eStype) qmon_eMsgTypeAction_NodeActive; + timelog( 1, "redcom to qmon NodeActive"); break; case pwr_eRedundancyState_Passive: put.type.s = (qcom_eStype) qmon_eMsgTypeAction_NodePassive; + timelog( 1, "redcom to qmon NodePassive"); break; } put.size = 4; diff --git a/src/lib/co/src/co_timelog.c b/src/lib/co/src/co_timelog.c new file mode 100644 index 0000000000000000000000000000000000000000..5b4873abd6012055367a58c8e3e94ffa9ebdc015 --- /dev/null +++ b/src/lib/co/src/co_timelog.c @@ -0,0 +1,87 @@ +/* + * Proview Open Source Process Control. + * Copyright (C) 2005-2016 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. + */ + +#include <stdio.h> +#include <string.h> +#include <stdlib.h> +#include "co_timelog.h" +#include "co_time.h" + +/* 1 redcom connect */ +/* 2 redcom tables */ +/* 4 alarms and events */ +unsigned int tmlog = 1; + +void tm_log( unsigned int level, const char *func, const char *str) +{ + char logstr[200]; + int i; + time_AtoAscii( NULL, time_eFormat_DateAndTime, logstr, sizeof(logstr)); + strcat( logstr, " "); + strcat( logstr, func); + for ( i = strlen(func); i < 25; i++) + strcat( logstr, " "); + strcat( logstr, str); + printf( "%s\n", logstr); +} + +void tm_log_ss( unsigned int level, const char *func, const char *str1, const char *str2) +{ + char logstr[200]; + int i; + time_AtoAscii( NULL, time_eFormat_DateAndTime, logstr, sizeof(logstr)); + strcat( logstr, " "); + strcat( logstr, func); + for ( i = strlen(func); i < 25; i++) + strcat( logstr, " "); + strcat( logstr, str1); + strcat( logstr, " "); + strcat( logstr, str2); + printf( "%s\n", logstr); +} + +void tm_log_sii( unsigned int level, const char *func, const char *str, int i1, int i2) +{ + char logstr[200]; + int i; + time_AtoAscii( NULL, time_eFormat_DateAndTime, logstr, sizeof(logstr)); + strcat( logstr, " "); + strcat( logstr, func); + for ( i = strlen(func); i < 25; i++) + strcat( logstr, " "); + strcat( logstr, str); + printf( "%s %d %d\n", logstr, i1, i2); +} diff --git a/src/lib/co/src/co_timelog.h b/src/lib/co/src/co_timelog.h new file mode 100644 index 0000000000000000000000000000000000000000..36f8fa0cb279f004c623baa3087a81f036da1ad8 --- /dev/null +++ b/src/lib/co/src/co_timelog.h @@ -0,0 +1,58 @@ +/* + * Proview Open Source Process Control. + * Copyright (C) 2005-2016 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. + */ + +#ifndef co_timelog_h +#define co_timelog_h + +#if defined __cplusplus +extern "C" { +#endif + +extern unsigned int tmlog; + +#define timelog( level, str) if (tmlog & level) tm_log( level, __func__, str); +#define timelog_ss( level, str1, str2) if (tmlog & level) tm_log_ss( level, __func__, str1, str2); +#define timelog_sii( level, str, i1, i2) if (tmlog & level) tm_log_sii( level, __func__, str, i1, i2); + +void tm_log( unsigned int level, const char *func, const char *str); +void tm_log_ss( unsigned int level, const char *func, const char *str1, const char *str2); +void tm_log_sii( unsigned int level, const char *func, const char *str, int i1, int i2); + +#if defined __cplusplus +} +#endif +#endif + diff --git a/src/lib/rt/src/rt_c_node.c b/src/lib/rt/src/rt_c_node.c index 0492b62526c2f1b7d127b90f9bf9b2c4e199d8e1..7e3c849c670aadcfce13a16c99dfd9296c45ef56 100644 --- a/src/lib/rt/src/rt_c_node.c +++ b/src/lib/rt/src/rt_c_node.c @@ -71,7 +71,7 @@ pwrs_Node_Exec ( static int supervise[110] = { 0,0,0,0,1,1,1,0,1,1, 1,1,1,0,0,1,0,1,1,1, - 1,1,1,0,0,1,0,0,0,0, + 1,1,1,0,0,1,1,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, diff --git a/src/lib/rt/src/rt_errh.h b/src/lib/rt/src/rt_errh.h index 62024f7d3a145775a4870114f9704981fe8a08cf..9d7efc62cb2eff43589c5972993e8b72e9b98bf1 100644 --- a/src/lib/rt/src/rt_errh.h +++ b/src/lib/rt/src/rt_errh.h @@ -126,6 +126,7 @@ typedef enum { errh_eAnix_sim = 24, errh_eAnix_powerlink = 25, errh_eAnix_videomgm = 26, + errh_eAnix_redcom = 27, errh_eAnix_plc1 = 41, errh_eAnix_plc2 = 42, errh_eAnix_plc3 = 43, diff --git a/src/lib/rt/src/rt_plc.h b/src/lib/rt/src/rt_plc.h index aea3be8faff6072041b9b266889bfc159f57c69f..1e6f98b248a68a2a12e0bb9303862051b2a8e8d1 100644 --- a/src/lib/rt/src/rt_plc.h +++ b/src/lib/rt/src/rt_plc.h @@ -193,6 +193,7 @@ struct plc_sThread { unsigned int sim_halted; unsigned int sim_singlestep; pwr_tRedundancyStateEnum redu_state_old; + int redu_table_version_req_sent; redu_tCtx redu; }; diff --git a/src/lib/rt/src/rt_plc_thread.c b/src/lib/rt/src/rt_plc_thread.c index 73c1b80ef1b23295fdb309393922d87df808a48a..5b12b7bad8e6a8e82d8159510c3dfdb396ac8fd3 100644 --- a/src/lib/rt/src/rt_plc_thread.c +++ b/src/lib/rt/src/rt_plc_thread.c @@ -95,6 +95,7 @@ #define USE_RT_TIMER 0 static void scan (plc_sThread*); +static pwr_tStatus plc_redu_send_table( plc_sThread *tp); static pwr_tStatus plc_redu_init( plc_sThread *tp) { @@ -119,12 +120,11 @@ static pwr_tStatus plc_redu_init( plc_sThread *tp) return PLC__REDUCONFIG; } -static pwr_tStatus plc_redu_receive( plc_sThread *tp) +static pwr_tStatus plc_redu_receive( plc_sThread *tp, unsigned int timeout) { pwr_tStatus sts; void *msg; int size; - unsigned int timeout = tp->i_scan_time; sts = redu_receive( tp->redu, timeout, &size, &msg); if ( sts == QCOM__TMO) @@ -138,42 +138,60 @@ static pwr_tStatus plc_redu_receive( plc_sThread *tp) redu_free_table( tp->redu); sts = redu_receive_table( tp->redu, msg); - if ( tp->redu->packetp) + if ( tp->redu->packetp) { tp->redu->packetp->TableStatus = sts; - if ( EVEN(sts)) return sts; - + tp->redu->packetp->TableVersion = tp->redu->table_version; + } + if ( EVEN(sts)) { + qcom_Free( &sts, msg); + return sts; + } tp->redu->table_sent = 1; break; case redu_eMsgType_Cyclic: if ( tp->redu->packetp) tp->redu->packetp->PacketSize = size; sts = redu_unpack_message( tp->redu, msg); - if ( EVEN(sts)) return sts; - + if ( EVEN(sts)) { + qcom_Free( &sts, msg); + return sts; + } break; case redu_eMsgType_TableRequest: { - void *table_msg; + sts = plc_redu_send_table( tp); + if ( ODD(sts)) + tp->redu->table_sent = 1; + break; + } + case redu_eMsgType_TableVersionRequest: { + sts = redu_send_table_version( tp->redu); + break; + } + case redu_eMsgType_TableVersion: { + int tsts; + pwr_tTime table_version; - if ( !tp->redu->table_sent) { - sts = redu_create_table( tp->redu); - if ( tp->redu->packetp) - tp->redu->packetp->TableStatus = sts; - if ( EVEN(sts)) return sts; + tp->redu_table_version_req_sent = 0; + if ( tp->redu->table_version.tv_sec == 0) + table_version = tp->redu->nodep->CurrentVersion; + else + table_version = tp->redu->table_version; + + tsts = time_Acomp_NE( &table_version, &((redu_sMsgTableVersion *)msg)->version); + if ( tsts == 0) + sts = redu_send_table_request( tp->redu); + else { + sts = plc_redu_send_table( tp); + if ( EVEN(sts)) { + qcom_Free( &sts, msg); + return sts; + } + tp->redu->table_sent = 1; } - sts = redu_send_table( tp->redu, &table_msg); - if ( tp->redu->packetp) - tp->redu->packetp->TableStatus = sts; - if ( EVEN(sts)) return sts; - - sts = redu_send( tp->redu, table_msg, - ((redu_sTableMsgHeader *)table_msg)->size + sizeof( redu_sTableMsgHeader), - tp->redu->msgid_table); - if ( EVEN(sts)) return sts; - tp->redu->table_sent = 1; break; } default: - printf( "Redu: Unknown message type\n"); + printf( "Redu: Unknown message type %d\n", ((redu_sHeader *)msg)->type); } qcom_Free( &sts, msg); return PLC__SUCCESS; @@ -190,30 +208,52 @@ static pwr_tStatus plc_redu_receive_active( plc_sThread *tp) switch ( ((redu_sHeader *)msg)->type) { break; - case redu_eMsgType_TableRequest: { - void *table_msg; - - if ( !tp->redu->table_sent) { - sts = redu_create_table( tp->redu); - if ( tp->redu->packetp) - tp->redu->packetp->TableStatus = sts; - if ( EVEN(sts)) return sts; - } - sts = redu_send_table( tp->redu, &table_msg); - if ( tp->redu->packetp) + case redu_eMsgType_Table: + if ( tp->redu->t) + redu_free_table( tp->redu); + + sts = redu_receive_table( tp->redu, msg); + if ( tp->redu->packetp) { tp->redu->packetp->TableStatus = sts; - if ( EVEN(sts)) return sts; - - sts = redu_send( tp->redu, table_msg, - ((redu_sTableMsgHeader *)table_msg)->size + sizeof( redu_sTableMsgHeader), - tp->redu->msgid_table); + tp->redu->packetp->TableVersion = tp->redu->table_version; + } + if ( EVEN(sts)) { + qcom_Free( &sts, msg); + return sts; + } + tp->redu->table_sent = 1; + break; + case redu_eMsgType_Cyclic: + break; + case redu_eMsgType_TableRequest: { + sts = plc_redu_send_table( tp); if ( EVEN(sts)) return sts; tp->redu->table_sent = 1; break; } - case redu_eMsgType_Table: - case redu_eMsgType_Cyclic: + case redu_eMsgType_TableVersionRequest: { + sts = redu_send_table_version( tp->redu); break; + } + case redu_eMsgType_TableVersion: { + int tsts; + pwr_tTime table_version; + + if ( tp->redu->table_version.tv_sec == 0) + table_version = tp->redu->nodep->CurrentVersion; + else + table_version = tp->redu->table_version; + + tsts = time_Acomp_NE( &table_version, &((redu_sMsgTableVersion *)msg)->version); + if ( tsts == 0) + sts = redu_send_table_request( tp->redu); + else { + sts = plc_redu_send_table( tp); + if ( ODD(sts)) + tp->redu->table_sent = 1; + } + break; + } default: printf( "Redu: Unknown message type\n"); } @@ -221,27 +261,41 @@ static pwr_tStatus plc_redu_receive_active( plc_sThread *tp) return PLC__SUCCESS; } -static pwr_tStatus plc_redu_send( plc_sThread *tp) +static pwr_tStatus plc_redu_send_table( plc_sThread *tp) { + void *table_msg; pwr_tStatus sts; - void *msg; - - if ( !tp->redu->table_sent) { - void *table_msg; + if ( !tp->redu->table_created) { sts = redu_create_table( tp->redu); - if ( tp->redu->packetp) + if ( tp->redu->packetp) { tp->redu->packetp->TableStatus = sts; + tp->redu->packetp->TableVersion = tp->redu->table_version; + } if ( EVEN(sts)) return sts; + tp->redu->table_created = 1; + } - sts = redu_send_table( tp->redu, &table_msg); - if ( tp->redu->packetp) - tp->redu->packetp->TableStatus = sts; - if ( EVEN(sts)) return sts; + sts = redu_send_table( tp->redu, &table_msg); + if ( tp->redu->packetp) + tp->redu->packetp->TableStatus = sts; + if ( EVEN(sts)) return sts; + + sts = redu_send( tp->redu, table_msg, + ((redu_sTableMsgHeader *)table_msg)->size + sizeof( redu_sTableMsgHeader), + tp->redu->msgid_table); + free( table_msg); + return sts; +} - sts = redu_send( tp->redu, table_msg, - ((redu_sTableMsgHeader *)table_msg)->size + sizeof( redu_sTableMsgHeader), - tp->redu->msgid_table); +static pwr_tStatus plc_redu_send( plc_sThread *tp) +{ + pwr_tStatus sts; + void *msg; + + if ( !tp->redu->table_sent) { + + sts = plc_redu_send_table( tp); if ( EVEN(sts)) return sts; tp->redu->table_sent = 1; } @@ -260,21 +314,6 @@ static pwr_tStatus plc_redu_send( plc_sThread *tp) return sts; } -static pwr_tStatus plc_redu_send_table_request( plc_sThread *tp) -{ - pwr_tStatus sts; - void *msg; - - sts = redu_create_table_request_message( tp->redu, &msg); - if ( EVEN(sts)) return sts; - - sts = redu_send( tp->redu, msg, sizeof(redu_sHeader), 0); - - free( msg); - - return sts; -} - void plc_thread ( @@ -565,13 +604,17 @@ scan ( if ( tp->redu && tp->pp->Node->RedundancyState == pwr_eRedundancyState_Passive) { if ( tp->redu_state_old == pwr_eRedundancyState_Off || tp->redu_state_old == pwr_eRedundancyState_Init) { - /* Send table request */ - sts = plc_redu_send_table_request( tp); + /* Send table version request to see if table should be requested or sent */ + if ( !tp->redu_table_version_req_sent) { + sts = redu_send_table_version_request( tp->redu); + if ( ODD(sts)) + tp->redu_table_version_req_sent = 1; + } } time_GetTimeMonotonic(&tp->before_scan); time_GetTime(&tp->before_scan_abs); - sts = plc_redu_receive( tp); + sts = plc_redu_receive( tp, tp->i_scan_time); if ( EVEN(sts)) return; time_Aadd(NULL, &tp->sync_time, &tp->scan_time); @@ -594,6 +637,9 @@ scan ( if ( !tp->redu || (tp->pp->Node->RedundancyState != pwr_eRedundancyState_Passive)) { + if ( tp->redu_state_old == pwr_eRedundancyState_Passive && tp->redu) + sts = plc_redu_receive( tp, 0); + if (pp->IOHandler->IOReadWriteFlag) { if ( tp->redu_state_old == pwr_eRedundancyState_Passive) tp->plc_io_ctx->read_reset = 1; @@ -607,8 +653,8 @@ scan ( errh_Error("IO read, %m", sts); errh_SetStatus( PLC__IOREAD); } - tp->redu_state_old = tp->pp->Node->RedundancyState; } + tp->redu_state_old = tp->pp->Node->RedundancyState; if ( pp->Node->EmergBreakTrue && !tp->emergency_break_old) io_swap(tp->plc_io_ctx, io_eEvent_EmergencyBreak); diff --git a/src/lib/rt/src/rt_qcom.c b/src/lib/rt/src/rt_qcom.c index a5d6908b8841c12beb5adea65f2918ba53c6a865..e90c3f0a8c4243d44a7f06d7020c851551f169fe 100644 --- a/src/lib/rt/src/rt_qcom.c +++ b/src/lib/rt/src/rt_qcom.c @@ -414,7 +414,7 @@ qcom_Get ( if (gp != NULL && gp->data != NULL) { br = pool_InPool(&lsts, &qdb->pool, gp->data, gp->size); - if (br != pool_cNRef) return NULL; + if (br != pool_cNRef) break; } qp = qdb_Que(sts, qid, NULL); @@ -1360,6 +1360,14 @@ qcom_EventMask ( return result; } +void +qcom_SetRedundancyState ( + pwr_eRedundancyState state +) +{ + qdb->my_node->redundancy_state = state; +} + /* diff --git a/src/lib/rt/src/rt_qcom.h b/src/lib/rt/src/rt_qcom.h index 102bb1cd4e76e67b69831a09f06bae936d20799e..9c1e3b413d2a5d227a1f3bee70798ffaa0a4fd3d 100644 --- a/src/lib/rt/src/rt_qcom.h +++ b/src/lib/rt/src/rt_qcom.h @@ -48,6 +48,10 @@ # include "pwr.h" #endif +#ifndef pwr_class_h +# include "pwr_class.h" +#endif + #ifndef co_platform_h # include "co_platform.h" #endif @@ -460,6 +464,10 @@ pwr_tBoolean qcom_Unbind ( const qcom_sQid *fromQ ); +void +qcom_SetRedundancyState ( + pwr_eRedundancyState state +); diff --git a/src/lib/rt/src/rt_redu.c b/src/lib/rt/src/rt_redu.c index cd3c032c17291265db7775ae67ce353382dab8a7..d55006e0480da184560e27787271179aaad13dd1 100644 --- a/src/lib/rt/src/rt_redu.c +++ b/src/lib/rt/src/rt_redu.c @@ -49,6 +49,7 @@ #include "rt_qcom_msg.h" #include "rt_redu.h" #include "rt_redu_msg.h" +#include "co_timelog.h" static pwr_tStatus add_table_object( redu_tCtx ctx, pwr_tAttrRef *o); static pwr_tStatus add_table_attr( redu_tCtx ctx, pwr_tAttrRef *aref, gdh_sAttrDef *bd); @@ -81,6 +82,8 @@ pwr_tStatus redu_create_table( redu_tCtx ctx) } #endif + ctx->table_version = ctx->nodep->CurrentVersion; + return REDU__TABLECREATED; } @@ -105,6 +108,7 @@ void redu_free_table( redu_tCtx ctx) ctx->t_last = 0; ctx->attr_cnt = 0; ctx->current_offset = 0; + ctx->table_version = pwr_cNTime; } static pwr_tStatus add_table_object( redu_tCtx ctx, pwr_tAttrRef *o) @@ -257,13 +261,6 @@ static pwr_tStatus add_table_attr( redu_tCtx ctx, pwr_tAttrRef *aref, gdh_sAttrD return REDU__SUCCESS; } -pwr_tStatus redu_create_table_request_message( redu_tCtx ctx, void **msg) -{ - *msg = malloc( sizeof(redu_sHeader)); - ((redu_sHeader *)(*msg))->type = redu_eMsgType_TableRequest; - return REDU__SUCCESS; -} - pwr_tStatus redu_create_message( redu_tCtx ctx, void **msg) { char *buf; @@ -278,6 +275,7 @@ pwr_tStatus redu_create_message( redu_tCtx ctx, void **msg) ((redu_sMsgHeader *)buf)->h.type = redu_eMsgType_Cyclic; ((redu_sMsgHeader *)buf)->size = ctx->current_offset; + ((redu_sMsgHeader *)buf)->version = ctx->table_version; time_GetTime( &start_time); bufp = buf + sizeof(redu_sMsgHeader); @@ -305,6 +303,16 @@ pwr_tStatus redu_unpack_message( redu_tCtx ctx, void *msg) pwr_tTime start_time; pwr_tTime end_time; pwr_tDeltaTime dtime; + int tsts; + + tsts = time_Acomp_NE( &ctx->table_version, &((redu_sMsgHeader *)msg)->version); + if ( tsts != 0) { + if ( tsts == -2) + return 0; + else + // Request new table... + return 0; + } time_GetTime( &start_time); bufp = msg + sizeof(redu_sMsgHeader); @@ -336,6 +344,7 @@ pwr_tStatus redu_send_table( redu_tCtx ctx, void **table_msg) ((redu_sTableMsgHeader *)msg)->h.type = redu_eMsgType_Table; ((redu_sTableMsgHeader *)msg)->attributes = ctx->attr_cnt; ((redu_sTableMsgHeader *)msg)->size = size; + ((redu_sTableMsgHeader *)msg)->version = ctx->table_version; msgp = msg + sizeof(redu_sTableMsgHeader); for ( e = ctx->t; e; e = e->next) { @@ -360,14 +369,23 @@ pwr_tStatus redu_receive_table( redu_tCtx ctx, void *table_msg) int i; redu_sTable *e; pwr_tStatus sts; + int tsts; void *p; - // Test msg = table_msg; if ( ctx->t) redu_free_table( ctx); + timelog( 2, "Table received"); + tsts = time_Acomp_NE( &ctx->nodep->CurrentVersion, &((redu_sTableMsgHeader *)msg)->version); + if ( tsts != 0) { + if ( tsts == -2) + return 0; + else + errh_Warning( "Table version differs from current load version"); + } + attributes = ((redu_sTableMsgHeader *)msg)->attributes; msgp = msg + sizeof(redu_sTableMsgHeader); @@ -396,6 +414,9 @@ pwr_tStatus redu_receive_table( redu_tCtx ctx, void *table_msg) ctx->attr_cnt++; msgp += sizeof(redu_sTableMsgElement); } + + ctx->table_version = ((redu_sTableMsgHeader *)msg)->version; + return REDU__TABLERECEIVED; } @@ -414,7 +435,7 @@ void redu_print_table( redu_tCtx ctx) } } -int redu_send( redu_tCtx ctx, void *msg, int size, unsigned int msg_id) +pwr_tStatus redu_send( redu_tCtx ctx, void *msg, int size, unsigned int msg_id) { pwr_tStatus sts; qcom_sPut put; @@ -433,7 +454,7 @@ int redu_send( redu_tCtx ctx, void *msg, int size, unsigned int msg_id) return sts; } -int redu_init( redu_tCtx *ctx, pwr_sNode *nodep, pwr_sClass_RedcomPacket *packetp) +pwr_tStatus redu_init( redu_tCtx *ctx, pwr_sNode *nodep, pwr_sClass_RedcomPacket *packetp) { qcom_sQattr qattr; pwr_tStatus sts; @@ -496,7 +517,7 @@ int redu_init( redu_tCtx *ctx, pwr_sNode *nodep, pwr_sClass_RedcomPacket *packet return REDU__SUCCESS; } -int redu_receive( redu_tCtx ctx, unsigned int timeout, int *size, void **msg) +pwr_tStatus redu_receive( redu_tCtx ctx, unsigned int timeout, int *size, void **msg) { pwr_tStatus sts; qcom_sGet get; @@ -561,3 +582,130 @@ pwr_tStatus redu_get_initial_state( char *nodename, int busid, int *state) return REDU__SUCCESS; } +pwr_tStatus redu_send_table_request( redu_tCtx ctx) +{ + redu_sHeader *msg; + pwr_tStatus sts; + + timelog( 2, "Redu seding table request"); + + msg = (redu_sHeader *)malloc( sizeof(redu_sHeader)); + msg->type = redu_eMsgType_TableRequest; + + sts = redu_send( ctx, msg, sizeof(redu_sHeader), 0); + + free( msg); + + return sts; +} + +pwr_tStatus redu_send_table_version( redu_tCtx ctx) +{ + redu_sMsgTableVersion *msg; + pwr_tStatus sts; + + timelog( 2, "Redu seding table version"); + + msg = (redu_sMsgTableVersion *)malloc( sizeof(redu_sMsgTableVersion)); + + msg->h.type = redu_eMsgType_TableVersion; + msg->version = ctx->table_version; + + sts = redu_send( ctx, msg, sizeof(redu_sMsgTableVersion), 0); + + free( msg); + + return sts; +} + +pwr_tStatus redu_send_table_version_request( redu_tCtx ctx) +{ + redu_sHeader *msg; + pwr_tStatus sts; + + timelog( 1, ""); + + msg = (redu_sHeader *)malloc( sizeof(redu_sHeader)); + msg->type = redu_eMsgType_TableVersionRequest; + + sts = redu_send( ctx, msg, sizeof(redu_sHeader), 0); + + free( msg); + + return sts; +} + +pwr_tStatus redu_set_state( pwr_eRedundancyState state) +{ + pwr_tStatus sts; + pwr_tOid oid; + pwr_sClass_RedcomConfig *p; + + sts = gdh_GetClassList( pwr_cClass_RedcomConfig, &oid); + if ( EVEN(sts)) return sts; + + sts = gdh_ObjidToPointer( oid, (void **)&p); + if ( EVEN(sts)) return sts; + + switch ( state) { + case pwr_eRedundancyState_Active: + p->SetActive = 1; + break; + case pwr_eRedundancyState_Passive: + p->SetPassive = 1; + break; + case pwr_eRedundancyState_Off: + p->SetOff = 1; + break; + default: ; + } + return REDU__SUCCESS; +} + +pwr_tStatus redu_appl_init( redu_tCtx *ctx, pwr_sClass_RedcomPacket *packetp) +{ + pwr_sNode *nodep; + pwr_tOid noid; + pwr_tStatus sts; + + sts = gdh_GetNodeObject( pwr_cNNid, &noid); + if ( EVEN(sts)) return sts; + + sts = gdh_ObjidToPointer( noid, (void **)&nodep); + if ( EVEN(sts)) return sts; + + return redu_init( ctx, nodep, packetp); +} + +pwr_tStatus redu_appl_send( redu_tCtx ctx, void *msg, int size, pwr_tTime version, unsigned int msg_id) +{ + pwr_tStatus sts; + + ((redu_sMsgHeader *)msg)->h.type = redu_eMsgType_Cyclic; + ((redu_sMsgHeader *)msg)->size = size; + ((redu_sMsgHeader *)msg)->version = version; + + sts = redu_send( ctx, msg, size, msg_id); + if ( ODD(sts) && ctx->packetp) { + ctx->packetp->TransmitCnt++; + ctx->packetp->PacketSize = size; + } + return sts; +} + +pwr_tStatus redu_appl_receive( redu_tCtx ctx, unsigned int timeout, void **msg, int *size) +{ + pwr_tStatus sts; + + sts = redu_receive( ctx, timeout, size, msg); + if ( EVEN(sts) && sts != QCOM__TMO) { + // Wait to avoid looping + struct timespec ts = {timeout/1000, (timeout * 1000000) % 1000000000}; + nanosleep(&ts, NULL); + } + if ( ODD(sts) && ctx->packetp) { + ctx->packetp->ReceiveCnt++; + ctx->packetp->PacketSize = *size; + } + return sts; +} diff --git a/src/lib/rt/src/rt_redu.h b/src/lib/rt/src/rt_redu.h index e9f2c618f65e894dd727dde2cfa1c184b2627655..a5a804741097fc03e2d95bf5d3ca704c107e8989 100644 --- a/src/lib/rt/src/rt_redu.h +++ b/src/lib/rt/src/rt_redu.h @@ -67,7 +67,9 @@ extern "C" { typedef enum { redu_eMsgType_Table, redu_eMsgType_Cyclic, - redu_eMsgType_TableRequest + redu_eMsgType_TableRequest, + redu_eMsgType_TableVersionRequest, + redu_eMsgType_TableVersion } redu_eMsgType; typedef enum { @@ -107,6 +109,8 @@ typedef struct { redu_sTable *t_last; float msg_time; int table_sent; + int table_created; + pwr_tTime table_version; } redu_sCtx, *redu_tCtx; typedef struct { @@ -116,14 +120,14 @@ typedef struct { typedef struct { redu_sHeader h; pwr_tUInt32 size; - pwr_tTime time; + pwr_tTime version; } redu_sMsgHeader; typedef struct { redu_sHeader h; pwr_tUInt32 size; pwr_tUInt32 attributes; - pwr_tTime time; + pwr_tTime version; } redu_sTableMsgHeader; typedef struct { @@ -131,6 +135,11 @@ typedef struct { pwr_tUInt32 size; } redu_sTableMsgElement; +typedef struct { + redu_sHeader h; + pwr_tTime version; +} redu_sMsgTableVersion; + pwr_tStatus redu_create_table( redu_tCtx ctx); void redu_free( redu_tCtx ctx); void redu_free_table( redu_tCtx ctx); @@ -138,12 +147,19 @@ pwr_tStatus redu_create_message( redu_tCtx ctx, void **msg); pwr_tStatus redu_unpack_message( redu_tCtx ctx, void *msg); pwr_tStatus redu_receive_table( redu_tCtx ctx, void *table_msg); pwr_tStatus redu_send_table( redu_tCtx ctx, void **table_msg); -pwr_tStatus redu_create_table_request_message( redu_tCtx ctx, void **msg); -int redu_init( redu_tCtx *ctx, pwr_sNode *nodep, pwr_sClass_RedcomPacket *packetp); -int redu_send( redu_tCtx ctx, void *msg, int size, unsigned int msg_id); -int redu_receive( redu_tCtx ctx, unsigned int timeout, int *size, void **msg); +pwr_tStatus redu_send_table_request( redu_tCtx ctx); +pwr_tStatus redu_send_table_version( redu_tCtx ctx); +pwr_tStatus redu_send_table_version_request( redu_tCtx ctx); +pwr_tStatus redu_init( redu_tCtx *ctx, pwr_sNode *nodep, pwr_sClass_RedcomPacket *packetp); +pwr_tStatus redu_send( redu_tCtx ctx, void *msg, int size, unsigned int msg_id); +pwr_tStatus redu_receive( redu_tCtx ctx, unsigned int timeout, int *size, void **msg); void redu_print( redu_tCtx ctx); pwr_tStatus redu_get_initial_state( char *nodename, int busid, int *state); +pwr_tStatus redu_set_state( pwr_eRedundancyState state); + +pwr_tStatus redu_appl_init( redu_tCtx *ctx, pwr_sClass_RedcomPacket *packetp); +pwr_tStatus redu_appl_send( redu_tCtx ctx, void *msg, int size, pwr_tTime version, unsigned int msg_id); +pwr_tStatus redu_appl_receive( redu_tCtx ctx, unsigned int timeout, void **msg, int *size); #if defined __cplusplus } diff --git a/src/msg/rt/src/rt_gdb_msg.msg b/src/msg/rt/src/rt_gdb_msg.msg index 1abb8da1b5d88439ed19969dffda6e1bec5dea06..1b0064dd46be03e024141c966f0197913722a9cd 100644 --- a/src/msg/rt/src/rt_gdb_msg.msg +++ b/src/msg/rt/src/rt_gdb_msg.msg @@ -38,7 +38,7 @@ .facility GDB,15 /prefix = GDB__ ! Global database success <successful completion> /succ -lockcheck <database locking bugckeck> /fatal +lockcheck <database locking bugcheck> /fatal mutexinit <failed to init mutex> /error dupladd <item is already added> /error alradd <item is already added> /info diff --git a/src/msg/rt/src/rt_gdh_msg.msg b/src/msg/rt/src/rt_gdh_msg.msg index 447ac456b5c305ba8e8b6f6ad272714c0db9f675..a68d0c51fa7c2f44ff17c967678d1a5ed7349894 100644 --- a/src/msg/rt/src/rt_gdh_msg.msg +++ b/src/msg/rt/src/rt_gdh_msg.msg @@ -102,6 +102,7 @@ convert <Unable to convert value> /error readonly <Object or attribute is read only> /error remotemount <Remotly mounted object> /error dblock <Unable to map db lock> /error +connlost <Connection lost> /error .end diff --git a/src/msg/rt/src/rt_redu_msg.msg b/src/msg/rt/src/rt_redu_msg.msg index 0535ea55c76116e6fb75b04d5bb3307857636a77..72a74811ec92c4ef7ea801b96e6864313f55b130 100644 --- a/src/msg/rt/src/rt_redu_msg.msg +++ b/src/msg/rt/src/rt_redu_msg.msg @@ -43,6 +43,9 @@ tablecreated <Table successfully created> /succ tablesent <Table sent> /succ redcomfile <Unable to open redcom file> /error localnode <Local node not found> /error +down <Link down> /warning +buffhigh <High buffer level> /warning + .end diff --git a/src/wbl/pwrb/src/pwrb_c_a_redcomlink.wb_load b/src/wbl/pwrb/src/pwrb_c_a_redcomlink.wb_load index 5b2663629040051d88bd0c1a94ad3a8a3e8584f4..3570172580b02babdba717ba2bc17c9acae9b667 100644 --- a/src/wbl/pwrb/src/pwrb_c_a_redcomlink.wb_load +++ b/src/wbl/pwrb/src/pwrb_c_a_redcomlink.wb_load @@ -182,9 +182,29 @@ SObject pwrb:Class EndBody EndObject !/** + ! Maximum time between two received transactions. + !*/ + Object TimeMax $Attribute 14 + Body SysBody + Attr Flags |= PWR_MASK_STATE + Attr Flags |= PWR_MASK_NOEDIT + Attr TypeRef = "pwrs:Type-$Float32" + EndBody + EndObject + !/** + ! Mean time between received transactions. + !*/ + Object TimeMean $Attribute 15 + Body SysBody + Attr Flags |= PWR_MASK_STATE + Attr Flags |= PWR_MASK_NOEDIT + Attr TypeRef = "pwrs:Type-$Float32" + EndBody + EndObject + !/** ! Disable. !*/ - Object Disable $Attribute 15 + Object Disable $Attribute 16 Body SysBody Attr TypeRef = "pwrs:Type-$Boolean" EndBody diff --git a/src/wbl/pwrb/src/pwrb_c_redcomconfig.wb_load b/src/wbl/pwrb/src/pwrb_c_redcomconfig.wb_load index 7a24d50a302f35c9754871b9d2193b9ecae04a50..6abe7524449dbe382b0274a82144c0b9629fb5cb 100644 --- a/src/wbl/pwrb/src/pwrb_c_redcomconfig.wb_load +++ b/src/wbl/pwrb/src/pwrb_c_redcomconfig.wb_load @@ -78,12 +78,21 @@ SObject pwrb:Class EndBody EndObject !/** + ! Startup timeout time. + ! Increased timeout time at startup. + !*/ + Object StartupTimeout $Attribute 4 + Body SysBody + Attr TypeRef = "pwrs:Type-$Float32" + EndBody + EndObject + !/** ! Force state. ! State can only be changed from Active/Passive buttons in - ! object graph. I will not automatically be changed by system + ! object graph. It will not automatically be changed by system ! events or errors. !*/ - Object Force $Attribute 4 + Object Force $Attribute 5 Body SysBody Attr TypeRef = "pwrs:Type-$Boolean" EndBody @@ -91,7 +100,7 @@ SObject pwrb:Class !/** ! Set redundancy state Active. !*/ - Object SetActive $Attribute 5 + Object SetActive $Attribute 6 Body SysBody Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_NOEDIT @@ -101,7 +110,7 @@ SObject pwrb:Class !/** ! Set redundancy state Passive. !*/ - Object SetPassive $Attribute 6 + Object SetPassive $Attribute 7 Body SysBody Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_NOEDIT @@ -111,7 +120,7 @@ SObject pwrb:Class !/** ! Set redundancy state Off. !*/ - Object SetOff $Attribute 7 + Object SetOff $Attribute 8 Body SysBody Attr Flags |= PWR_MASK_STATE Attr Flags |= PWR_MASK_NOEDIT @@ -121,7 +130,7 @@ SObject pwrb:Class !/** ! Link state. !*/ - Object Link $Attribute 8 + Object Link $Attribute 9 Body SysBody Attr Flags |= PWR_MASK_ARRAY Attr Flags |= PWR_MASK_CLASS @@ -134,6 +143,7 @@ SObject pwrb:Class Body RtBody Attr CycleTime = 0.005 Attr LinkTimeout = 0.200 + Attr StartupTimeout = 5.0 EndBody EndObject EndObject diff --git a/src/wbl/pwrb/src/pwrb_c_redcompacket.wb_load b/src/wbl/pwrb/src/pwrb_c_redcompacket.wb_load index 8479f1aba6f822509e58e7f782bc0f26d90c8812..cc73ccfebe915b18f880c2f1b0b44ccddf32ac22 100644 --- a/src/wbl/pwrb/src/pwrb_c_redcompacket.wb_load +++ b/src/wbl/pwrb/src/pwrb_c_redcompacket.wb_load @@ -128,6 +128,16 @@ SObject pwrb:Class EndBody EndObject !/** + ! Table status. + !*/ + Object TableVersion $Attribute 13 + Body SysBody + Attr Flags |= PWR_MASK_NOEDIT + Attr Flags |= PWR_MASK_STATE + Attr TypeRef = "pwrs:Type-$Time" + EndBody + EndObject + !/** ! Number of attributes. !*/ Object Attributes $Attribute 8 diff --git a/xtt/exp/ge/src/pwr_c_node.pwg b/xtt/exp/ge/src/pwr_c_node.pwg index efe19863bf427fbfbd54b06871484e8580530f1a..9a1dcc4210ce2c12acddddecee11f41151cd3b1b 100644 --- a/xtt/exp/ge/src/pwr_c_node.pwg +++ b/xtt/exp/ge/src/pwr_c_node.pwg @@ -29,21 +29,21 @@ 100 20 135 20 101 20 -102 -86 -103 15 -104 2.37945 -136 2.37945 +102 399 +103 -1 +104 2.37629 +136 2.37629 105 100 -106 -10 +106 -4 107 0 108 51.5 109 -2 110 47.5032 111 0.01322 -116 0 -117 1 -118 119 -119 81 +116 51 +117 0 +118 138 +119 72 120 1 121 Claes context 122 0 @@ -63,7 +63,7 @@ 134 22 2200 0 -2201 517 +2201 518 2202 pwr_c_node 2203 310 2205 0 @@ -486,6 +486,290 @@ pwr_exe: 123 2 3 +300 pwrct_valueinputmediumcenterbg +301 +2 +26 +2604 O0 +2600 3.15 +2601 -0.15 +2602 1.15 +2603 -0.15 +2605 +25 +2500 0 +2501 1 +2503 1 +2504 0 +2502 +2 +7 +700 -0.15 +701 1.15 +99 +7 +700 3.15 +701 1.15 +99 +7 +700 3.15 +701 -0.15 +99 +7 +700 3 +701 0 +99 +7 +700 3 +701 1 +99 +7 +700 0 +701 1 +99 +7 +700 -0.15 +701 1.15 +99 +99 +99 +2608 0 +2609 310 +2629 10000 +2610 310 +2611 0 +2616 0 +2614 5 +2617 2 +2615 0 +2618 1 +2607 0 +2606 +2612 +28 +2800 1 +2801 0 +2802 0 +2803 0 +2804 1 +2805 0 +2806 0 +99 +2613 0 +2619 0 +2620 0 +2626 1 +2627 0 +2621 0 +2622 0 +2623 0 +2624 4 +2625 1 +2628 0 +99 +26 +2604 O1 +2600 3.15 +2601 -0.15 +2602 1.15 +2603 -0.15 +2605 +25 +2500 0 +2501 1 +2503 1 +2504 0 +2502 +2 +7 +700 3 +701 0 +99 +7 +700 3.15 +701 -0.15 +99 +7 +700 -0.15 +701 -0.15 +99 +7 +700 -0.15 +701 1.15 +99 +7 +700 0 +701 1 +99 +7 +700 0 +701 0 +99 +7 +700 3 +701 0 +99 +99 +99 +2608 0 +2609 310 +2629 10000 +2610 310 +2611 0 +2616 0 +2614 5 +2617 2 +2615 0 +2618 1 +2607 0 +2606 +2612 +28 +2800 1 +2801 0 +2802 0 +2803 0 +2804 1 +2805 0 +2806 0 +99 +2613 0 +2619 0 +2620 0 +2626 0 +2627 1 +2621 0 +2622 0 +2623 0 +2624 4 +2625 1 +2628 0 +99 +19 +1904 O2 +1900 3 +1901 0 +1902 1 +1903 0 +1908 334 +1909 330 +1910 330 +1911 1 +1915 0 +1913 10 +1916 2 +1914 0 +1918 0 +1919 0 +1920 0 +1917 1 +1921 0 +1922 2 +1923 0 +1924 0 +1925 10000 +1926 0 +1907 0 +1906 +1905 +5 +500 334 +501 1 +504 1 +505 1 +502 +7 +700 0 +701 0 +99 +503 +7 +700 3 +701 1 +99 +99 +1912 +28 +2800 1 +2801 0 +2802 0 +2803 0 +2804 1 +2805 0 +2806 0 +99 +99 +29 +2907 +13 +1300 1 +1301 303 +1306 338 +1302 3 +1305 1 +1303 +7 +700 1 +701 1.35 +99 +1304 0 +1307 4 +1308 0 +99 +2908 +28 +2800 1 +2801 0 +2802 0.521458 +2803 0 +2804 1 +2805 -0.55 +2806 0 +99 +2901 0 +99 +99 +302 0 +304 0 +303 +305 0 +306 +307 +308 1024 +330 0 +321 4096 +331 0 +309 0 +313 0 +322 0 +323 0 +324 0 +325 0 +326 0 +327 0 +310 0 +311 0 +312 +314 +315 1 +316 1 +317 0 +318 0 +319 0 +320 0 +328 0 +332 0 +329 +1 +100 1 +105 0 +101 1 +106 0 +102 65532 +103 0 +99 +99 +3 300 pwr_indsquare 301 2 @@ -1824,6 +2108,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -3082,6 +3368,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -3253,6 +3541,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -3390,6 +3680,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -3527,6 +3819,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -3664,6 +3958,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -3801,6 +4097,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -3938,6 +4236,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -4089,5 +4389,168 @@ pwr_exe: 103 0 99 99 +27 +2703 10000 +2704 10000 +2731 10000 +2722 10000 +2705 10000 +2723 10000 +2706 10000 +2732 10000 +2708 0 +2709 0 +2710 0 +2711 0 +2712 0 +2713 0 +2714 0 +2715 0 +2720 0 +2725 0 +2726 0 +2702 0 +2701 +2700 +10 +1000 pwrct_valueinputmediumcenterbg +1002 O517 +1005 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +1006 49.45 +1007 42.85 +1008 3.75 +1009 1.95 +1013 49.45 +1014 42.85 +1015 3.75 +1016 1.95 +1003 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +1004 +1001 +7 +700 8.9 +701 8.95 +99 +1010 +1011 +1018 +1019 +1020 +1021 +1022 +1023 +1024 +1025 +1012 0 +1017 9999 +1027 9999 +1026 35454972 +1028 0 +1029 +99 +2707 +28 +2800 2 +2801 0 +2802 43.15 +2803 0 +2804 1.38462 +2805 2.15769 +2806 0 +99 +2716 0 +2718 +2717 +2719 0 +2724 0 +2727 0 +2728 303 +2729 4 +2730 0 +2721 +1 +100 2177 +105 0 +101 0 +106 0 +102 35454972 +103 0 +9 +900 !$object.RedundancyState##Boolean +901 0 +902 1 +903 1 +99 +61 +6100 +6101 3 +6102 4 +6103 470 +6104 2 +6105 1 +6106 0 +99 +61 +6100 $object.RedundancyState##Int32 +6101 2 +6102 4 +6103 410 +6104 1 +6105 3 +6106 0 +99 +12 +1200 $object.RedundancyState##Enum +1201 %s +1202 1 +1203 1 +1204 0 +1205 +1206 0 +99 +99 +99 99 99 diff --git a/xtt/exp/ge/src/pwr_c_node_servers.pwg b/xtt/exp/ge/src/pwr_c_node_servers.pwg index 95100fc519efd8dc541ce6c3f0574b547c109ea8..6733ef07321b8faa7f8dee5225bba9c69ddd0494 100644 --- a/xtt/exp/ge/src/pwr_c_node_servers.pwg +++ b/xtt/exp/ge/src/pwr_c_node_servers.pwg @@ -1,5 +1,5 @@ 0! DefaultWidth 990 -0! DefaultHeight 490 +0! DefaultHeight 515 199 !/** ! TempSwitch @@ -38,13 +38,13 @@ 107 0 108 51.5 109 -2 -110 24.8552 +110 26.0048 111 0.01322 116 0 117 11 118 120 119 113 -120 1 +120 0 121 Claes context 122 0 126 0.5 @@ -63,7 +63,7 @@ 134 22 2200 0 -2201 527 +2201 548 2202 pwr_c_node_servers 2203 310 2205 0 @@ -74,7 +74,7 @@ 2209 0 2210 0 2211 49.5 -2212 24.5 +2212 25.75 2213 4 2214 pwrp_pop: @@ -969,6 +969,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -1241,6 +1243,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -1513,6 +1517,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -1785,6 +1791,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -2057,6 +2065,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -2329,6 +2339,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -2601,6 +2613,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -2873,6 +2887,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -3145,6 +3161,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -3417,6 +3435,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -3689,6 +3709,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -3961,6 +3983,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -4233,6 +4257,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -4505,6 +4531,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -4642,6 +4670,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -4914,6 +4944,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -5321,6 +5353,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -5593,6 +5627,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -5865,6 +5901,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -6137,6 +6175,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -6409,6 +6449,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -6681,6 +6723,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -6953,6 +6997,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -7225,6 +7271,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -7497,6 +7545,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -7769,6 +7819,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -8041,6 +8093,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -8313,6 +8367,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -8585,6 +8641,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -8857,6 +8915,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -8994,6 +9054,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -9266,6 +9328,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -9673,6 +9737,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -9945,6 +10011,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -10217,6 +10285,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -10489,6 +10559,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -10761,6 +10833,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -11033,6 +11107,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -11305,6 +11381,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -11577,6 +11655,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -11849,6 +11929,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -12121,6 +12203,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -12393,6 +12477,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -12665,6 +12751,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -12937,6 +13025,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -13209,6 +13299,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -13481,6 +13573,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -13753,6 +13847,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -13760,7 +13856,7 @@ pwr_exe: 1904 O433 1900 0 1901 -2 -1902 24.8552 +1902 26.0048 1903 0.01322 1908 0 1909 318 @@ -13805,8 +13901,8 @@ pwr_exe: 2801 0 2802 0 2803 0 -2804 0.522989 -2805 -0.509769 +2804 0.547192 +2805 -0.533972 2806 0 99 99 @@ -13814,7 +13910,7 @@ pwr_exe: 1904 O434 1900 51.5 1901 49.5 -1902 24.8552 +1902 26.0048 1903 0.01322 1908 0 1909 318 @@ -13859,8 +13955,8 @@ pwr_exe: 2801 0 2802 51.5 2803 0 -2804 0.522989 -2805 -0.509769 +2804 0.547192 +2805 -0.533972 2806 0 99 99 @@ -14980,13 +15076,13 @@ pwr_exe: 0 0 1006 7.25453 -1007 1.0158 -1008 23.4086 -1009 22.4953 +1007 1.01579 +1008 23.4085 +1009 22.4952 1013 7.25453 -1014 1.0158 -1015 23.4086 -1016 22.4953 +1014 1.01579 +1015 23.4085 +1016 22.4952 1003 0 0 @@ -19993,6 +20089,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -20265,6 +20363,8 @@ pwr_exe: 1202 1 1203 1 1204 0 +1205 +1206 0 99 99 99 @@ -20569,5 +20669,854 @@ pwr_exe: 99 99 99 +27 +2703 370 +2704 410 +2731 10000 +2722 10000 +2705 410 +2723 10000 +2706 370 +2732 10000 +2708 0 +2709 0 +2710 0 +2711 0 +2712 0 +2713 0 +2714 0 +2715 0 +2720 0 +2725 0 +2726 0 +2702 0 +2701 +2700 +10 +1000 pwr_indsquare +1002 O541 +1005 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +1006 8.32213 +1007 7.5915 +1008 25.3477 +1009 24.5562 +1013 8.32213 +1014 7.5915 +1015 25.3477 +1016 24.5562 +1003 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +1004 +1001 +7 +700 5.95 +701 8.95 +99 +1010 +1011 +1018 +1019 +1020 +1021 +1022 +1023 +1024 +1025 +1012 0 +1017 9999 +1027 9999 +1026 65532 +1028 0 +1029 +99 +2707 +28 +2800 1.21772 +2801 0 +2802 7.40884 +2803 0 +2804 1.21772 +2805 24.4344 +2806 0 +99 +2716 0 +2718 +2717 +2719 0 +2724 0 +2727 0 +2728 303 +2729 4 +2730 0 +2721 +1 +100 33554432 +105 0 +101 0 +106 0 +102 65532 +103 0 +31 +3100 $object.ProcStatus[26]##status +3101 374 +3102 1 +99 +99 +99 +27 +2703 310 +2704 310 +2731 10000 +2722 326 +2705 310 +2723 326 +2706 310 +2732 10000 +2708 0 +2709 0 +2710 0 +2711 0 +2712 0 +2713 0 +2714 0 +2715 0 +2720 0 +2725 0 +2726 0 +2702 0 +2701 +2700 +10 +1000 pwr_valuelong +1002 O542 +1005 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +1006 25.8189 +1007 8.56567 +1008 25.3477 +1009 24.4953 +1013 25.8189 +1014 8.56567 +1015 25.3477 +1016 24.4953 +1003 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +1004 +1001 +7 +700 6.75 +701 5.6 +99 +1010 +1011 +1018 +1019 +1020 +1021 +1022 +1023 +1024 +1025 +1012 0 +1017 9999 +1027 9999 +1026 65532 +1028 0 +1029 +99 +2707 +28 +2800 0.648618 +2801 0 +2802 8.56567 +2803 0 +2804 1.21772 +2805 24.4953 +2806 0 +99 +2716 0 +2718 +2717 +2719 0 +2724 0 +2727 0 +2728 303 +2729 4 +2730 0 +2721 +1 +100 1 +105 0 +101 1 +106 0 +102 65532 +103 0 +12 +1200 $object.ProcStatus[26]##status +1201 %1m +1202 1 +1203 1 +1204 0 +1205 +1206 0 +99 +99 +99 +27 +2703 370 +2704 410 +2731 10000 +2722 10000 +2705 410 +2723 10000 +2706 370 +2732 10000 +2708 0 +2709 0 +2710 0 +2711 0 +2712 0 +2713 0 +2714 0 +2715 0 +2720 0 +2725 0 +2726 0 +2702 0 +2701 +2700 +10 +1000 pwr_indsquare +1002 O543 +1005 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +1006 27.4404 +1007 26.7098 +1008 25.3477 +1009 24.5562 +1013 27.4404 +1014 26.7098 +1015 25.3477 +1016 24.5562 +1003 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +1004 +1001 +7 +700 5.95 +701 8.95 +99 +1010 +1011 +1018 +1019 +1020 +1021 +1022 +1023 +1024 +1025 +1012 0 +1017 9999 +1027 9999 +1026 65532 +1028 0 +1029 +99 +2707 +28 +2800 1.21772 +2801 0 +2802 26.5271 +2803 0 +2804 1.21772 +2805 24.4344 +2806 0 +99 +2716 0 +2718 +2717 +2719 0 +2724 0 +2727 0 +2728 303 +2729 4 +2730 0 +2721 +1 +100 33554432 +105 0 +101 0 +106 0 +102 65532 +103 0 +31 +3100 $object.ProcMsgSeverity[26]##status +3101 374 +3102 1 +99 +99 +99 +27 +2703 310 +2704 310 +2731 10000 +2722 326 +2705 310 +2723 326 +2706 310 +2732 10000 +2708 0 +2709 0 +2710 0 +2711 0 +2712 0 +2713 0 +2714 0 +2715 0 +2720 0 +2725 0 +2726 0 +2702 0 +2701 +2700 +10 +1000 pwr_valuelong +1002 O544 +1005 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +1006 48.6406 +1007 27.623 +1008 25.3477 +1009 24.4953 +1013 48.6406 +1014 27.623 +1015 25.3477 +1016 24.4953 +1003 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +1004 +1001 +7 +700 6.75 +701 5.6 +99 +1010 +1011 +1018 +1019 +1020 +1021 +1022 +1023 +1024 +1025 +1012 0 +1017 9999 +1027 9999 +1026 65532 +1028 0 +1029 +99 +2707 +28 +2800 0.790134 +2801 0 +2802 27.623 +2803 0 +2804 1.21772 +2805 24.4953 +2806 0 +99 +2716 0 +2718 +2717 +2719 0 +2724 0 +2727 0 +2728 303 +2729 4 +2730 0 +2721 +1 +100 1 +105 0 +101 1 +106 0 +102 65532 +103 0 +12 +1200 $object.ProcMessage[26]##string80 +1201 %s +1202 1 +1203 1 +1204 0 +1205 +1206 0 +99 +99 +99 +20 +2004 O545 +2000 49.5 +2001 0 +2002 25.4272 +2003 25.4272 +2009 322 +2010 0 +2005 +6 +600 322 +601 1 +602 +7 +700 49.5 +701 13 +99 +603 +7 +700 0 +701 13 +99 +99 +2008 +28 +2800 1 +2801 0 +2802 0 +2803 0 +2804 1 +2805 12.4272 +2806 0 +99 +99 +35 +3500 +27 +2703 10000 +2704 10000 +2731 10000 +2722 10000 +2705 10000 +2723 10000 +2706 10000 +2732 10000 +2708 0 +2709 0 +2710 0 +2711 0 +2712 0 +2713 0 +2714 0 +2715 0 +2720 0 +2725 0 +2726 0 +2702 0 +2701 +2700 +10 +1000 Grp547_ +1002 Grp547_ +1005 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +1006 7.25453 +1007 1.01579 +1008 25.4085 +1009 24.4952 +1013 7.25453 +1014 1.01579 +1015 25.4085 +1016 24.4952 +1003 +0 +0 +0 +0 +0 +0 +0 +0 +0 +0 +1004 +1001 +7 +700 0 +701 0 +99 +1010 +1011 +1018 +1019 +1020 +1021 +1022 +1023 +1024 +1025 +1012 0 +1017 9999 +1027 9999 +1026 35454972 +1028 0 +1029 +99 +2707 +28 +2800 1 +2801 0 +2802 0 +2803 0 +2804 1 +2805 0 +2806 0 +99 +2716 0 +2718 +2717 +2719 0 +2724 0 +2727 0 +2728 303 +2729 9999 +2730 0 +2721 +1 +100 0 +105 0 +101 66 +106 0 +102 65535 +103 0 +50 +5000 &$object.ProcObject[26] +99 +55 +5500 open graph/classgraph/instance=&$object.ProcObject[26] +99 +99 +99 +3501 +36 +3600 +3 +300 Grp547_ +301 +2 +19 +1904 O387 +1900 7.25453 +1901 1.01579 +1902 25.4085 +1903 24.4952 +1908 0 +1909 30 +1910 30 +1911 1 +1915 1 +1913 16 +1916 2 +1914 0 +1918 0 +1919 0 +1920 0 +1917 0 +1921 0 +1922 4 +1923 0 +1924 0 +1925 10000 +1926 0 +1907 0 +1906 +1905 +5 +500 0 +501 1 +504 1 +505 1 +502 +7 +700 0.95 +701 10.6 +99 +503 +7 +700 4.5 +701 11.35 +99 +99 +1912 +28 +2800 1.75739 +2801 0 +2802 -0.653727 +2803 0 +2804 1.21772 +2805 11.5874 +2806 0 +99 +99 +30 +3004 O388 +3000 5.13088 +3001 1.63088 +3002 25.3887 +3003 24.5887 +3008 103 +3010 4 +3011 2 +3007 0 +3006 +3005 +9 +900 2 +901 303 +904 0 +902 rt_redcom +903 +7 +700 1.1 +701 2.5 +99 +99 +3009 +28 +2800 1.75739 +2801 0 +2802 -0.302248 +2803 0 +2804 1.21772 +2805 22.1944 +2806 0 +99 +99 +99 +302 0 +304 0 +303 +305 0 +306 +307 +308 0 +330 0 +321 0 +331 0 +309 0 +313 0 +322 0 +323 0 +324 0 +325 0 +326 0 +327 0 +310 0 +311 0 +312 +314 +315 1 +316 1 +317 0 +318 0 +319 0 +320 0 +328 0 +332 0 +99 +99 +99 99 99 diff --git a/xtt/exp/ge/src/pwr_c_redcomconfig.pwg b/xtt/exp/ge/src/pwr_c_redcomconfig.pwg index ca38e929998ac2e989996c3369775a2efdee8532..3d5ccb3293db41732be8e19dc184ea53be25828f 100644 --- a/xtt/exp/ge/src/pwr_c_redcomconfig.pwg +++ b/xtt/exp/ge/src/pwr_c_redcomconfig.pwg @@ -5461,11 +5461,11 @@ pwr_exe: 0 1006 40.4414 1007 12.55 -1008 12.8815 +1008 12.8816 1009 11.9519 1013 40.4414 1014 12.55 -1015 12.8815 +1015 12.8816 1016 11.9519 1003 0 @@ -5529,7 +5529,7 @@ pwr_exe: 102 65532 103 0 12 -1200 $node.ProcStatus[20]##Status +1200 $node.ProcStatus[26]##Status 1201 %1m 1202 1 1203 1 @@ -6024,11 +6024,11 @@ pwr_exe: 0 1006 40.4414 1007 12.55 -1008 14.2597 +1008 14.2598 1009 13.3301 1013 40.4414 1014 12.55 -1015 14.2597 +1015 14.2598 1016 13.3301 1003 0 @@ -6092,7 +6092,7 @@ pwr_exe: 102 65532 103 0 12 -1200 $node.ProcMessage[20]##String80 +1200 $node.ProcMessage[26]##String80 1201 %s 1202 1 1203 1 @@ -6503,7 +6503,7 @@ pwr_exe: 102 65532 103 0 31 -3100 $node.ProcStatus[20]##status +3100 $node.ProcStatus[26]##status 3101 374 3102 1 99 @@ -6814,7 +6814,7 @@ pwr_exe: 102 65532 103 0 31 -3100 $node.ProcMsgSeverity[20]##status +3100 $node.ProcMsgSeverity[26]##status 3101 374 3102 1 99 @@ -7386,7 +7386,7 @@ pwr_exe: 1 100 2049 105 0 -101 1 +101 0 106 0 102 35454972 103 0 @@ -7417,17 +7417,6 @@ pwr_exe: 1205 1206 0 99 -13 -1302 0 -1303 0 -1304 0 -1305 0 -1306 0 -1307 -1308 -1309 0 -1310 0 -99 99 99 99 diff --git a/xtt/lib/xtt/src/xtt_evlist.cpp b/xtt/lib/xtt/src/xtt_evlist.cpp index 00013601cc7c0e2e5d04a0a78f1c49726703ebb6..ce03c188c93b753b2a1433ca72d3bfce759b69d3 100644 --- a/xtt/lib/xtt/src/xtt_evlist.cpp +++ b/xtt/lib/xtt/src/xtt_evlist.cpp @@ -46,6 +46,7 @@ #include "cow_wow.h" #include "co_lng.h" #include "co_time.h" +#include "co_timelog.h" #include "rt_gdh.h" #include "flow.h" #include "flow_browctx.h" @@ -942,8 +943,8 @@ void EvList::event_alarm( mh_sMessage *msg) if ( id_to_item( &event->Info.Id, (void **)&item)) return; - if ( type != ev_eType_EventList ) - printf( "New ala %d,%d\n", event->Info.Id.Nix, event->Info.Id.Idx); + if ( type != ev_eType_EventList ) + timelog_sii( 4, "Ev, New alarm", event->Info.Id.Nix, event->Info.Id.Idx); sts = get_destination( net_NetTimeToTime( &event->Info.EventTime), (void **)&dest); if ( EVEN(sts)) { @@ -1146,7 +1147,7 @@ void EvList::event_ack( mh_sAck *msg) // Check that this id not already inserted if ( id_to_item( &event->Info.Id, (void **)&item)) return; - printf( "New ack %d,%d\n", event->Info.Id.Nix, event->Info.Id.Idx); + timelog_sii( 3, "Ev, new ack", event->Info.Id.Nix, event->Info.Id.Idx); sts = get_destination( net_NetTimeToTime( &event->Info.EventTime), (void **)&dest); if ( EVEN(sts)) { @@ -1240,7 +1241,7 @@ void EvList::event_return( mh_sReturn *msg) // Check that this id not already inserted if ( id_to_item( &event->Info.Id, (void **)&item)) return; - printf( "New ret %d,%d\n", event->Info.Id.Nix, event->Info.Id.Idx); + timelog_sii( 4, "Ev, New return", event->Info.Id.Nix, event->Info.Id.Idx); sts = get_destination( net_NetTimeToTime( &event->Info.EventTime), (void **)&dest); if ( EVEN(sts)) {