|
@@ -910,7 +910,17 @@ func (c *CheckAreaMgr) CheckIedFcda() error {
|
|
|
}
|
|
|
//获取该间隔下该类型的装置
|
|
|
s1 := []orm.Params{}
|
|
|
- _, err = db.Raw("select ied_name,ied_no from t_data_check_area_ied where area_id=?", area_id).Values(&s1)
|
|
|
+ _, err = db.Raw("select ied_name,ied_no,'' ied_desc from t_data_check_area_ied where area_id=?", area_id).Values(&s1)
|
|
|
+ for pos, sr := range s1 {
|
|
|
+ iedname := tools.IsEmpty(sr["ied_name"])
|
|
|
+ iedObj := scdNodeMgr.GetIed(scdXmlObj, scdidStr, iedname)
|
|
|
+ iedObjDesc := ""
|
|
|
+ if iedObj != nil {
|
|
|
+ iedObjDesc = iedObj.Desc
|
|
|
+ }
|
|
|
+ s1[pos]["ied_desc"] = iedObjDesc
|
|
|
+ }
|
|
|
+ iedExtrefIsExistMap := map[string]int{} //确认已存在的装置端子
|
|
|
typeMappingMgr := new(SysCheckModelIedtypeMappingMgr)
|
|
|
pmCode := c.getIedTypeCode(modelid, "PM")
|
|
|
//循环处理关联关系
|
|
@@ -926,6 +936,28 @@ func (c *CheckAreaMgr) CheckIedFcda() error {
|
|
|
ied_type, vol := getIedTypeAndVolCode(ied_type)
|
|
|
isReceivePm := strings.HasPrefix(ied_type, pmCode) //接收装置是Pm装置
|
|
|
iedlst := filterAreaIeds(ied_type, vol, s1, abCode, isReceivePm)
|
|
|
+ if strings.Index(ts[0], "#0") > 0 {
|
|
|
+ //本体装置
|
|
|
+ btIed := []orm.Params{}
|
|
|
+ for _, r := range iedlst {
|
|
|
+ ieddesc := tools.IsEmpty(r["ied_desc"])
|
|
|
+ if strings.Contains(ieddesc, "本休") {
|
|
|
+ btIed = append(btIed, r)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ iedlst = btIed
|
|
|
+ }
|
|
|
+ if strings.Index(ts[0], "#C") > 0 {
|
|
|
+ //差动装置
|
|
|
+ btIed := []orm.Params{}
|
|
|
+ for _, r := range iedlst {
|
|
|
+ ieddesc := tools.IsEmpty(r["ied_desc"])
|
|
|
+ if strings.Contains(ieddesc, "差动") {
|
|
|
+ btIed = append(btIed, r)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ iedlst = btIed
|
|
|
+ }
|
|
|
logger.Logger.Debug(fmt.Sprintf("装置类型%s#%s与%s的装置(%+v)端子关系", ied_type, vol, ts[1], iedlst))
|
|
|
//从间隔中获取当前信号输出装置
|
|
|
outiedlist := map[string]orm.Params{}
|
|
@@ -939,7 +971,16 @@ func (c *CheckAreaMgr) CheckIedFcda() error {
|
|
|
outiedlist2 := filterAreaIeds(from_ied_type, vol2, s1, fromAbCode, isOutPm)
|
|
|
for _, iedrow := range outiedlist2 {
|
|
|
iedname := tools.IsEmpty(iedrow["ied_name"])
|
|
|
- outiedlist[iedname] = iedrow
|
|
|
+ desc := tools.IsEmpty(iedrow["ied_desc"])
|
|
|
+ if strings.Index(fromiedcode, "#0") > 0 && strings.Contains(desc, "本休") {
|
|
|
+ //本体装置
|
|
|
+ outiedlist[iedname] = iedrow
|
|
|
+ } else if strings.Index(fromiedcode, "#C") > 0 && strings.Contains(desc, "差动") {
|
|
|
+ //差动装置
|
|
|
+ outiedlist[iedname] = iedrow
|
|
|
+ } else {
|
|
|
+ outiedlist[iedname] = iedrow
|
|
|
+ }
|
|
|
}
|
|
|
if len(outiedlist) == 0 {
|
|
|
logger.Logger.Debug(fmt.Sprintf("装置类型%s#%s%s未从类型%s%s的任何电压等级%s装置接收信号", ied_type, vol, abCode, from_ied_type, fromAbCode, vol2))
|
|
@@ -950,10 +991,8 @@ func (c *CheckAreaMgr) CheckIedFcda() error {
|
|
|
for _, ied := range iedlst {
|
|
|
iedname := tools.IsEmpty(ied["ied_name"])
|
|
|
iedObj := scdNodeMgr.GetIed(scdXmlObj, scdidStr, iedname)
|
|
|
- iedObjDesc := ""
|
|
|
- if iedObj != nil {
|
|
|
- iedObjDesc = iedObj.Desc
|
|
|
- } else {
|
|
|
+ iedObjDesc := tools.IsEmpty(ied["ied_desc"])
|
|
|
+ if iedObjDesc == "" {
|
|
|
logger.Logger.Error(fmt.Sprintf("信号接收装置%s未找到!", iedname))
|
|
|
continue
|
|
|
}
|
|
@@ -978,6 +1017,13 @@ func (c *CheckAreaMgr) CheckIedFcda() error {
|
|
|
if iedname == outiedname {
|
|
|
continue
|
|
|
}
|
|
|
+ //从装置所有的输入端子中过滤出当前输入装置的部分端子
|
|
|
+ extreflist2 := map[string]*node_attr.NExtRef{}
|
|
|
+ for desc, item := range extreflist {
|
|
|
+ if item.IedName == outiedname {
|
|
|
+ extreflist2[desc] = item
|
|
|
+ }
|
|
|
+ }
|
|
|
logger.Logger.Debug(fmt.Sprintf("正在匹配装置%s与%s的端子关联关系", iedname, outiedname))
|
|
|
outIedObj := scdNodeMgr.GetIed(scdXmlObj, scdidStr, outiedname)
|
|
|
outIedObjDesc := ""
|
|
@@ -990,11 +1036,6 @@ func (c *CheckAreaMgr) CheckIedFcda() error {
|
|
|
continue
|
|
|
}
|
|
|
//outiedFcdaList := getIedFcdas(outiedname) //输入装置的信号输出端子
|
|
|
- //是否设置的端子编号
|
|
|
- noText := tools.IsEmpty(ied["ied_no"])
|
|
|
- if noText == "" {
|
|
|
- noText = tools.IsEmpty(outied["ied_no"])
|
|
|
- }
|
|
|
//检查是否有错误和缺失的端子
|
|
|
for _, r := range refrow {
|
|
|
extref_name := tools.IsEmpty(r["to_fcda_name"])
|
|
@@ -1004,17 +1045,17 @@ func (c *CheckAreaMgr) CheckIedFcda() error {
|
|
|
funcName := tools.IsEmpty(r["to_func_name"])
|
|
|
//端子编号处理
|
|
|
if strings.Index(extref_name_exp, "{no}") > -1 {
|
|
|
- extref_name_exp = strings.ReplaceAll(extref_name_exp, "{no}", noText)
|
|
|
+ extref_name_exp = strings.ReplaceAll(extref_name_exp, "{no}", tools.IsEmpty(ied["ied_no"]))
|
|
|
}
|
|
|
if strings.Index(fcda_name_exp, "{no}") > -1 {
|
|
|
- fcda_name_exp = strings.ReplaceAll(fcda_name_exp, "{no}", noText)
|
|
|
+ fcda_name_exp = strings.ReplaceAll(fcda_name_exp, "{no}", tools.IsEmpty(outied["ied_no"]))
|
|
|
}
|
|
|
|
|
|
funcExist := false //判断接收端设计的端子是否存在
|
|
|
extrefObj := new(node_attr.NExtRef)
|
|
|
fcda2Exist := false
|
|
|
isYx := false
|
|
|
- for desc, item := range extreflist {
|
|
|
+ for desc, item := range extreflist2 {
|
|
|
if item.IedName != outiedname {
|
|
|
continue
|
|
|
}
|
|
@@ -1092,7 +1133,7 @@ func (c *CheckAreaMgr) CheckIedFcda() error {
|
|
|
}
|
|
|
macthResult, _ := tools.RexGroupTestMatch(fcda_name_exp, fcda_name)
|
|
|
if !macthResult {
|
|
|
- parse_result := fmt.Sprintf("间隔%s的装置%s端子%s与装置%s端子%s关联错误", area_name, iedname, extref_name, outiedname, fcda_name)
|
|
|
+ parse_result := fmt.Sprintf("间隔%s的装置%s端子%s与装置%s端子%s关联错误.匹配模式:%s", area_name, iedname, extref_name, outiedname, fcda_name, fcda_name_exp)
|
|
|
re := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result,
|
|
|
"ied_name": iedname,
|
|
|
"ied_desc": iedObj.Desc,
|
|
@@ -1110,12 +1151,12 @@ func (c *CheckAreaMgr) CheckIedFcda() error {
|
|
|
}
|
|
|
}
|
|
|
if !funcExist {
|
|
|
- parse_result := fmt.Sprintf("间隔%s的装置%s缺失端子%s", area_name, iedname, extref_name)
|
|
|
+ parse_result := fmt.Sprintf("间隔%s的装置%s缺失与装置%s的端子%s定义.匹配模式:%s", area_name, iedname, outiedname, extref_name, extref_name_exp)
|
|
|
re := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result,
|
|
|
"ied_name": iedname,
|
|
|
"ied_desc": iedObjDesc,
|
|
|
- "out_ied_name": "",
|
|
|
- "out_ied_desc": "",
|
|
|
+ "out_ied_name": outiedname,
|
|
|
+ "out_ied_desc": outIedObjDesc,
|
|
|
"fcda_desc": extref_name,
|
|
|
"fcda_addr": "",
|
|
|
"out_fcda_desc": "",
|
|
@@ -1126,7 +1167,7 @@ func (c *CheckAreaMgr) CheckIedFcda() error {
|
|
|
scdNodeRule.AppendFcdaCheckResult(re)
|
|
|
} else if !fcda2Exist {
|
|
|
//fcda2Exist为false表示实际的端子from ied不是当前设计的ied
|
|
|
- parse_result := fmt.Sprintf("间隔%s下%s的输入装置%s缺失端子%s", area_name, iedname, outiedname, fcda_name)
|
|
|
+ parse_result := fmt.Sprintf("间隔%s下%s的输入装置%s缺失端子%s.匹配模式:%s", area_name, iedname, outiedname, fcda_name, fcda_name_exp)
|
|
|
re := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result,
|
|
|
"ied_name": iedname,
|
|
|
"ied_desc": iedObjDesc,
|
|
@@ -1143,24 +1184,35 @@ func (c *CheckAreaMgr) CheckIedFcda() error {
|
|
|
}
|
|
|
}
|
|
|
//检查是否有多余(SCD中有不存在于设计中)的端子
|
|
|
- for extrefdesc, r := range extreflist { //scd中的端子关系
|
|
|
+ for extrefdesc, r := range extreflist2 { //scd中的端子关系
|
|
|
//判断是否是当前输入装置和遥信端子
|
|
|
if r.IedName != outiedname || yxAddrMap[fmt.Sprintf("%s%s%s%s%s%s%s", r.IedName, r.IntAddr, r.LdInst, r.Prefix, r.LnClass, r.LnInst, r.DoName)] == 1 {
|
|
|
continue
|
|
|
}
|
|
|
+ key := fmt.Sprintf("%s%s", iedname, extrefdesc)
|
|
|
+ if iedExtrefIsExistMap[key] == 1 {
|
|
|
+ continue
|
|
|
+ }
|
|
|
extref_name := ""
|
|
|
fcda_name := ""
|
|
|
isHave := false
|
|
|
for _, r1 := range refrow { //设计的端子关系
|
|
|
extref_name_exp := tools.IsEmpty(r1["to_fcda_match_exp"])
|
|
|
+ if extrefdesc == extref_name_exp {
|
|
|
+ //端子存在
|
|
|
+ isHave = true
|
|
|
+ iedExtrefIsExistMap[key] = 1
|
|
|
+ break
|
|
|
+ }
|
|
|
//端子编号处理
|
|
|
if strings.Index(extref_name_exp, "{no}") > -1 {
|
|
|
- extref_name_exp = strings.ReplaceAll(extref_name_exp, "{no}", noText)
|
|
|
+ extref_name_exp = strings.ReplaceAll(extref_name_exp, "{no}", tools.IsEmpty(ied["ied_no"]))
|
|
|
}
|
|
|
macthResult, _ := tools.RexGroupTestMatch(extref_name_exp, extrefdesc)
|
|
|
- if extrefdesc == extref_name_exp || macthResult {
|
|
|
+ if macthResult {
|
|
|
//端子存在
|
|
|
isHave = true
|
|
|
+ iedExtrefIsExistMap[key] = 1
|
|
|
break
|
|
|
}
|
|
|
}
|