Commit 2679958e authored by Claes Sjofors's avatar Claes Sjofors

Redundance communication 5

parent d863a8e8
......@@ -2463,39 +2463,46 @@ 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.config->FailoverReason & pwr_mFailoverReasonMask_EmergencyBreak &&
l.nodep->EmergBreakTrue && !l.sup.emergbreaktrue_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 if ( l.config->FailoverReason & pwr_mFailoverReasonMask_SystemStatus &&
(errh_SeverityError(l.nodep->SystemStatus) || errh_SeverityFatal(l.nodep->SystemStatus)) &&
!(errh_SeverityError(l.sup.systemstatus_old) || errh_SeverityFatal(l.sup.systemstatus_old))) {
l.config->SetPassive = 1;
timelog( 1, "Even SystemStatus, set passive");
}
}
else {
/* State if passive, check for overtaking */
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");
}
if ( l.config->FailoverReason & pwr_mFailoverReasonMask_ActiveTimeout) {
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 &&
!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, &current, &lp->receive_time);
ftime = time_DToFloat( 0, &dt);
if ( ftime > timeout) {
timelog( 1, "Link timeout, set active");
l.config->SetActive = 1;
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 &&
!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, &current, &lp->receive_time);
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;
}
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;
}
}
}
......
......@@ -91,15 +91,20 @@
[ $appid != "pwr_fast" ] &&
[ $appid != "pwr_remh" ] &&
[ $appid != "pwr_remlog" ] &&
[ $appid != "pwr_elog" ] &&
[ $appid != "pwr_sysmon" ] &&
[ $appid != "pwr_webmon" ] &&
[ $appid != "pwr_webmonmh" ] &&
[ $appid != "pwr_webmonelog" ] &&
[ $appid != "pwr_opc_server" ] &&
[ $appid != "pwr_statussrv" ] &&
[ $appid != "pwr_post" ] &&
[ $appid != "pwr_report" ] &&
[ $appid != "pwr_sevhistmon" ] &&
[ $appid != "pwr_sev_server" ] &&
[ $appid != "pwr_powerlink" ] &&
[ $appid != "pwr_videomgm" ] &&
[ $appid != "pwr_redcom" ] &&
[ $appid != "pwr_sim" ] &&
[ $appid != "pwr_plc" ] &&
[ "$appfile" != "rt_io_comm" ] &&
......
......@@ -74,6 +74,9 @@ create_killer()
[ $appid != "pwr_fast" ] &&
[ $appid != "pwr_remh" ] &&
[ $appid != "pwr_remlog" ] &&
[ $appid != "pwr_remlog" ] &&
[ $appid != "pwr_elog" ] &&
[ $appid != "pwr_sysmon" ] &&
[ $appid != "pwr_webmon" ] &&
[ $appid != "pwr_webmonmh" ] &&
[ $appid != "pwr_webmonelog" ] &&
......@@ -84,6 +87,8 @@ create_killer()
[ $appid != "pwr_sev_server" ] &&
[ $appid != "pwr_powerlink" ] &&
[ $appid != "pwr_sim" ] &&
[ $appid != "pwr_videomgm" ] &&
[ $appid != "pwr_redcom" ] &&
[ $appid != "pwr_plc" ] &&
[ "$appfile" != "rt_io_comm" ] &&
[ ${appid:0:8} != "pwr_plc_" ]; then
......
......@@ -1124,6 +1124,18 @@ dissect_qcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
strcpy( info, "Ack");
break;
}
case eEvent_connectPassive: {
strcpy( info, "ConnectPassive");
break;
}
case eEvent_redcomActive: {
strcpy( info, "RedcomActive");
break;
}
case eEvent_redcomPassive: {
strcpy( info, "RedcomPassive");
break;
}
}
is_net = 0;
......
......@@ -7,6 +7,9 @@ typedef enum {
eEvent_down,
eEvent_user,
eEvent_ack,
eEvent_connectPassive,
eEvent_redcomActive,
eEvent_redcomPassive,
eEvent_
} eEvent;
......
......@@ -80,14 +80,18 @@ static gint hf_redcom_info_flags = -1;
static gint hf_redu_msgheader = -1;
static gint hf_redu_msgheader_type = -1;
static gint hf_redu_msgheader_size = -1;
static gint hf_redu_msgheader_time = -1;
static gint hf_redu_msgheader_version = -1;
static gint hf_redu_tablemsgheader = -1;
static gint hf_redu_tablemsgheader_type = -1;
static gint hf_redu_tablemsgheader_size = -1;
static gint hf_redu_tablemsgheader_attributes = -1;
static gint hf_redu_tablemsgheader_time = -1;
static gint hf_redu_tablemsgheader_version = -1;
static gint hf_redu_tablereqmsgheader = -1;
static gint hf_redu_tablereqmsgheader_type = -1;
static gint hf_redu_tableversionreqmsgheader = -1;
static gint hf_redu_tableversionreqmsgheader_type = -1;
static gint hf_redu_tableversionmsgheader = -1;
static gint hf_redu_tableversionmsgheader_type = -1;
/* These are the ids of the subtrees that we may be creating */
static gint ett_redcom = -1;
......@@ -119,14 +123,18 @@ static gint ett_redcom_info_flags = -1;
static gint ett_redu_msgheader = -1;
static gint ett_redu_msgheader_type = -1;
static gint ett_redu_msgheader_size = -1;
static gint ett_redu_msgheader_time = -1;
static gint ett_redu_msgheader_version = -1;
static gint ett_redu_tablemsgheader = -1;
static gint ett_redu_tablemsgheader_type = -1;
static gint ett_redu_tablemsgheader_size = -1;
static gint ett_redu_tablemsgheader_attributes = -1;
static gint ett_redu_tablemsgheader_time = -1;
static gint ett_redu_tablemsgheader_version = -1;
static gint ett_redu_tablereqmsgheader = -1;
static gint ett_redu_tablereqmsgheader_type = -1;
static gint ett_redu_tableversionreqmsgheader = -1;
static gint ett_redu_tableversionreqmsgheader_type = -1;
static gint ett_redu_tableversionmsgheader = -1;
static gint ett_redu_tableversionmsgheader_type = -1;
void
......@@ -205,8 +213,8 @@ proto_register_redcom(void)
{ "Type", "redcom.msgheader.type", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
{ &hf_redu_msgheader_size,
{ "Size", "redcom.msgheader.size", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
{ &hf_redu_msgheader_time,
{ "Time", "redcom.msgheader.time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL }},
{ &hf_redu_msgheader_version,
{ "Version", "redcom.msgheader.version", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL }},
/* Redu TableMsgHeader */
{ &hf_redu_tablemsgheader,
......@@ -217,8 +225,8 @@ proto_register_redcom(void)
{ "Size", "redcom.redu.tablemsgheader.size", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
{ &hf_redu_tablemsgheader_attributes,
{ "Attributes", "redcom.redu.tablemsgheader.attributes", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }},
{ &hf_redu_tablemsgheader_time,
{ "Time", "redcom.redu.tablemsgheader.time", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL }},
{ &hf_redu_tablemsgheader_version,
{ "Version", "redcom.redu.tablemsgheader.version", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0x0, NULL, HFILL }},
/* Redu TableReqMsgHeader */
{ &hf_redu_tablereqmsgheader,
......@@ -226,6 +234,18 @@ proto_register_redcom(void)
{ &hf_redu_tablereqmsgheader_type,
{ "Type", "redcom.tablereqmsgheader.type", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
/* Redu TableVersionReqMsgHeader */
{ &hf_redu_tableversionreqmsgheader,
{ "MsgTableVersionReqHeader", "redcom.tableversionreqmsgheader", FT_NONE, BASE_NONE, NULL, 0x0,"Redcom TableVersionReqeustMsg Header", HFILL }},
{ &hf_redu_tableversionreqmsgheader_type,
{ "Type", "redcom.tableversionreqmsgheader.type", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
/* Redu TableVersionMsgHeader */
{ &hf_redu_tableversionmsgheader,
{ "MsgTableVersionHeader", "redcom.tableversionmsgheader", FT_NONE, BASE_NONE, NULL, 0x0,"Redcom TableVersionMsg Header", HFILL }},
{ &hf_redu_tableversionmsgheader_type,
{ "Type", "redcom.tableversionmsgheader.type", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }},
};
static gint *ett[] = {
......@@ -258,14 +278,18 @@ proto_register_redcom(void)
&ett_redu_msgheader,
&ett_redu_msgheader_type,
&ett_redu_msgheader_size,
&ett_redu_msgheader_time,
&ett_redu_msgheader_version,
&ett_redu_tablemsgheader,
&ett_redu_tablemsgheader_type,
&ett_redu_tablemsgheader_size,
&ett_redu_tablemsgheader_attributes,
&ett_redu_tablemsgheader_time,
&ett_redu_tablemsgheader_version,
&ett_redu_tablereqmsgheader,
&ett_redu_tablereqmsgheader_type,
&ett_redu_tableversionreqmsgheader,
&ett_redu_tableversionreqmsgheader_type,
&ett_redu_tableversionmsgheader,
&ett_redu_tableversionmsgheader_type,
};
......@@ -287,10 +311,14 @@ dissect_redcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree *redcom_redu_cyclic_tree = NULL;
proto_tree *redcom_redu_table_tree = NULL;
proto_tree *redcom_redu_tablerequest_tree = NULL;
proto_tree *redcom_redu_tableversionrequest_tree = NULL;
proto_tree *redcom_redu_tableversion_tree = NULL;
int is_user;
int is_reducyclic;
int is_redutable;
int is_redutablerequest;
int is_redutableversionrequest;
int is_redutableversion;
guint32 msg_flags;
gint32 redu_type;
gchar *protostrp;
......@@ -318,6 +346,8 @@ dissect_redcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
is_reducyclic = 0;
is_redutable = 0;
is_redutablerequest = 0;
is_redutableversionrequest = 0;
is_redutableversion = 0;
switch ( msg_flags >> 24) {
case eEvent_connect: {
strcpy( info, "Connect");
......@@ -353,13 +383,15 @@ dissect_redcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
is_reducyclic = 0;
is_redutable = 0;
is_redutablerequest = 0;
is_redutableversionrequest = 0;
is_redutableversion = 0;
if ( is_user) {
prio = tvb_get_ntohl( tvb, 28);
if ( msg_flags & mSeg_middle && !(msg_flags & mSeg_first))
sprintf( info, "P%02d Middle segment", prio);
else if ( msg_flags & mSeg_last && !(msg_flags & mSeg_first))
strcpy( info, "P%02d Last segment");
sprintf( info, "P%02d Last segment", prio);
else {
redu_type = tvb_get_letohl( tvb, header_size + info_size);
......@@ -376,6 +408,14 @@ dissect_redcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
sprintf( info, "P%02d TableRequest", prio);
is_redutablerequest = 1;
break;
case redu_eMsgType_TableVersionRequest:
sprintf( info, "P%02d TableVersionRequest", prio);
is_redutableversionrequest = 1;
break;
case redu_eMsgType_TableVersion:
sprintf( info, "P%02d TableVersion", prio);
is_redutableversion = 1;
break;
default:
strcpy( info, "Unknown redu_eMsgType");
}
......@@ -519,7 +559,7 @@ dissect_redcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
redcom_sub_item = proto_tree_add_item( redcom_redu_cyclic_tree, hf_redu_msgheader_size,
tvb, offset, 4, local_endian );
offset += 4;
redcom_sub_item = proto_tree_add_item( redcom_redu_cyclic_tree, hf_redu_msgheader_time,
redcom_sub_item = proto_tree_add_item( redcom_redu_cyclic_tree, hf_redu_msgheader_version,
tvb, offset, 8, local_endian );
offset += 8;
}
......@@ -539,7 +579,7 @@ dissect_redcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
redcom_sub_item = proto_tree_add_item( redcom_redu_table_tree, hf_redu_tablemsgheader_attributes,
tvb, offset, 4, local_endian );
offset += 4;
redcom_sub_item = proto_tree_add_item( redcom_redu_table_tree, hf_redu_tablemsgheader_time,
redcom_sub_item = proto_tree_add_item( redcom_redu_table_tree, hf_redu_tablemsgheader_version,
tvb, offset, 8, local_endian );
offset += 8;
}
......@@ -554,6 +594,28 @@ dissect_redcom(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
tvb, offset, 4, local_endian );
offset += 4;
}
else if ( is_redutableversionrequest) {
/* redu table request message map */
redcom_sub_item = proto_tree_add_item( redcom_tree, hf_redu_tableversionreqmsgheader,
tvb, offset, redutable_size, FALSE );
redcom_redu_tableversionrequest_tree = proto_item_add_subtree(redcom_sub_item, ett_redcom);
redcom_sub_item = proto_tree_add_item( redcom_redu_tableversionrequest_tree, hf_redu_tableversionreqmsgheader_type,
tvb, offset, 4, local_endian );
offset += 4;
}
else if ( is_redutableversion) {
/* redu table request message map */
redcom_sub_item = proto_tree_add_item( redcom_tree, hf_redu_tableversionmsgheader,
tvb, offset, redutable_size, FALSE );
redcom_redu_tableversion_tree = proto_item_add_subtree(redcom_sub_item, ett_redcom);
redcom_sub_item = proto_tree_add_item( redcom_redu_tableversion_tree, hf_redu_tableversionmsgheader_type,
tvb, offset, 4, local_endian );
offset += 4;
}
}
#if 0
guint32 offset = 0;
......
......@@ -79,7 +79,9 @@ typedef enum {
typedef enum {
redu_eMsgType_Table,
redu_eMsgType_Cyclic,
redu_eMsgType_TableRequest
redu_eMsgType_TableRequest,
redu_eMsgType_TableVersionRequest,
redu_eMsgType_TableVersion
} redu_eMsgType;
typedef enum {
......
......@@ -128,14 +128,22 @@ SObject pwrb:Class
EndBody
EndObject
!/**
! Failover reason.
!*/
Object FailoverReason $Attribute 9
Body SysBody
Attr TypeRef = "pwrb:Type-FailoverReasonMask"
EndBody
EndObject
!/**
! Link state.
!*/
Object Link $Attribute 9
Object Link $Attribute 10
Body SysBody
Attr Flags |= PWR_MASK_ARRAY
Attr Flags |= PWR_MASK_CLASS
Attr Elements = 2
Attr Flags |= PWR_MASK_ARRAY
Attr TypeRef = "pwrb:Class-RedcomLink"
Attr Elements = 2
EndBody
EndObject
EndObject
......@@ -144,6 +152,7 @@ SObject pwrb:Class
Attr CycleTime = 0.005
Attr LinkTimeout = 0.200
Attr StartupTimeout = 5.0
Attr FailoverReason = 15
EndBody
EndObject
EndObject
......
!
! 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.
!
! pwrb_xttopmethodsmask.wb_load -- Defines the mask type XttOpMethodsMask
!
SObject pwrb:Type
!/**
! @Version 1.0
! @Group Types
! Mask for operator Xtt methods.
!
! @b See also
! @classlink XttMethodsMask pwrb_xttmethodsmask.html
!*/
Object FailoverReasonMask $TypeDef 86
Body SysBody
Attr TypeRef = "pwrs:Type-$Mask"
Attr PgmName = "FailoverReasonMask"
EndBody
!/**
! Allow manual control.
!*/
Object Manual $Bit
Body SysBody
Attr PgmName = "Manual"
Attr Text = "Manual"
Attr Value = 1
EndBody
EndObject
!/**
! Timeout from active when in passive mode.
!*/
Object ActiveTimout $Bit
Body SysBody
Attr PgmName = "ActiveTimeout"
Attr Text = "ActiveTimeout"
Attr Value = 2
EndBody
EndObject
!/**
! Emergency break detected.
!*/
Object EmergencyBreak $Bit
Body SysBody
Attr PgmName = "EmergencyBreak"
Attr Text = "EmergencyBreak"
Attr Value = 4
EndBody
EndObject
!/**
! System status has fatal or error severity.
!*/
Object SystemStatus $Bit
Body SysBody
Attr PgmName = "SystemStatus"
Attr Text = "SystemStatus"
Attr Value = 8
EndBody
EndObject
EndObject
EndSObject
......@@ -2531,6 +2531,25 @@ pwr_tStatus lfu_SaveDirectoryVolume(
}
fprintf( optfile, "%s", str);
fclose( optfile);
if ( secondary_nodename_ptr != null_nodename) {
if ( os == pwr_mOpSys_CustomBuild)
sprintf( dir, "$pwrp_root/bld/%s/exe/", cdh_OpSysToStr( (pwr_mOpSys)custom_os));
else
sprintf( dir, "$pwrp_root/bld/%s/exe/", cdh_OpSysToStr( (pwr_mOpSys)os));
cdh_ToLower( nodename, secondary_nodename_ptr);
sprintf( fname, pwr_cNameOpt, dir, nodename, *bus_number_ptr, cdh_Low(plcproc));
dcli_translate_filename( fname, fname);
optfile = fopen( fname, "w");
if ( optfile == 0) {
char msg[200];
sprintf( msg, "Error, Unable to open file %s", fname);
MsgWindow::message( 'E', msg, msgw_ePop_Default);
return LFU__NOFILE;
}
fprintf( optfile, "%s", str);
fclose( optfile);
}
}
break;
}
......@@ -3805,7 +3824,9 @@ pwr_tStatus lfu_check_appl_file( ldh_tSesContext ldhses,
"#pwr_post, , noload, norun, , 5, debug, \"\"" << endl <<
"#pwr_sevhistmon, , noload, norun, , 5, debug, \"\"" << endl <<
"#pwr_sev_server, , noload, norun, , 5, debug, \"\"" << endl <<
"#rt_powerlink, , noload, norun, , 5, debug, \"\"" << endl;
"#pwr_powerlink, , noload, norun, , 5, debug, \"\"" << endl <<
"#pwr_videomgm, , noload, norun, , 5, debug, \"\"" << endl <<
"#pwr_redcom, , noload, norun, , 5, debug, \"\"" << endl;
fp.close();
return LFU__SUCCESS;
......
......@@ -6977,12 +6977,18 @@ pwr_exe:
2730 0
2721
1
100 1
100 129
105 0
101 1
106 0
102 4
103 0
9
900 !$object.FailoverReason##Bit[0]
901 1
902 1
903 1
99
51
5100 $object.SetPassive##Boolean
5101 1
......@@ -7113,12 +7119,18 @@ pwr_exe:
2730 0
2721
1
100 1
100 129
105 0
101 1
106 0
102 4
103 0
9
900 !$object.FailoverReason##Bit[0]
901 1
902 1
903 1
99
51
5100 $object.SetActive##Boolean
5101 1
......@@ -7249,12 +7261,18 @@ pwr_exe:
2730 0
2721
1
100 1
100 129
105 0
101 1
106 0
102 4
103 0
9
900 !$object.FailoverReason##Bit[0]
901 1
902 1
903 1
99
51
5100 $object.SetOff##Boolean
5101 1
......
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