|
@@ -3,7 +3,6 @@ package bo
|
|
|
import (
|
|
|
"errors"
|
|
|
"fmt"
|
|
|
- "regexp"
|
|
|
"scd_check_tools/logger"
|
|
|
"scd_check_tools/models/enum"
|
|
|
"scd_check_tools/models/node_attr"
|
|
@@ -483,11 +482,13 @@ func (c *CheckAreaMgr) CheckIedFcda() error {
|
|
|
volMap["low"] = volRows[len(volRows)-1]["vol"].(string) //低压电压等级
|
|
|
}
|
|
|
scdNodeRule := new(ScdNodeRule)
|
|
|
+ scdNodeRule.SetScdXmlObject(scdXmlObj)
|
|
|
scdNodeMgr := new(ScdNode)
|
|
|
//当前装置的所有信号接收端子列表
|
|
|
var getIedExtRefs = func(iedname string) map[string]*node_attr.NExtRef {
|
|
|
iedObj := scdNodeMgr.GetIed(scdXmlObj, tools.IsEmpty(c.ScdId), iedname)
|
|
|
if iedObj == nil {
|
|
|
+ logger.Logger.Debug(fmt.Sprintf("在scd:%d中未发现装置%s", c.ScdId, iedname))
|
|
|
return nil
|
|
|
}
|
|
|
fcdaObjList := map[string]*node_attr.NExtRef{}
|
|
@@ -589,50 +590,67 @@ func (c *CheckAreaMgr) CheckIedFcda() error {
|
|
|
}
|
|
|
return iedlst
|
|
|
}
|
|
|
-
|
|
|
//iedRelationMgr := new(SysCheckModelIedRelationMgr)
|
|
|
+ modelFcda := sync.Map{}
|
|
|
for _, row := range arealist {
|
|
|
//获取间隔标准装置及关系
|
|
|
modelid, _ := strconv.Atoi(tools.IsEmpty(row["model_id"]))
|
|
|
area_name := tools.IsEmpty(row["area_name"])
|
|
|
//area_type := tools.IsEmpty(row["area_type"]) //间隔模型类型
|
|
|
area_id := tools.IsEmpty(row["id"])
|
|
|
+ logger.Logger.Debug(fmt.Sprintf("开始检查模型%d的间隔%s", modelid, area_name))
|
|
|
+ //获取装置分组信息
|
|
|
+ bgm := new(SysCheckModelIedtypeGroupMgr)
|
|
|
+ bgm.Model = T_data_model_iedtype_group{ModelId: modelid}
|
|
|
+ groupList := bgm.List()
|
|
|
//获取该间隔模型配置的所有端子关系列表
|
|
|
tmpMgr := new(SysCheckModelFcdaRalationMgr)
|
|
|
tmpMgr.Model.ModelId = modelid
|
|
|
- funclist, _ := tmpMgr.GetModelAllFcdaRef()
|
|
|
- if funclist == nil {
|
|
|
- continue
|
|
|
- }
|
|
|
- if len(funclist) == 0 {
|
|
|
- logger.Logger.Error(errors.New(fmt.Sprintf("模型%d还未配置装置关系", modelid)))
|
|
|
- continue
|
|
|
+ funclist := map[string][]orm.Params{}
|
|
|
+ key := fmt.Sprintf("%d-%d", modelid, area_id)
|
|
|
+ v, h := modelFcda.Load(key)
|
|
|
+ if h {
|
|
|
+ funclist = v.(map[string][]orm.Params)
|
|
|
+ } else {
|
|
|
+ funclist, _ = tmpMgr.GetModelAllFcdaRef()
|
|
|
+ if funclist == nil || len(funclist) == 0 {
|
|
|
+ logger.Logger.Error(errors.New(fmt.Sprintf("模型%d下的间隔%s还未配置装置端子关联关系", modelid, area_name)))
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ modelFcda.Store(key, funclist)
|
|
|
}
|
|
|
//获取该间隔下该类型的装置
|
|
|
s1 := []orm.Params{}
|
|
|
_, err = db.Raw("select ied_name from t_data_check_area_ied where area_id=?", area_id).Values(&s1)
|
|
|
//循环处理关联关系
|
|
|
- for ied_type2, fromrowlist := range funclist {
|
|
|
- ied_type := c.getIedTypeCode(modelid, ied_type2)
|
|
|
- //找出信号输出装置
|
|
|
- outiedlist := map[string][]orm.Params{}
|
|
|
- for _, r := range fromrowlist {
|
|
|
- fromiedcode := c.getIedTypeCode(modelid, tools.IsEmpty(r["from_ied_code"]))
|
|
|
- ied_type, vol := getIedTypeAndVolCode(fromiedcode)
|
|
|
- outiedlist2 := filterAreaIeds(ied_type, vol, s1)
|
|
|
- for _, iedrow := range outiedlist2 {
|
|
|
- iedname := tools.IsEmpty(iedrow["ied_name"])
|
|
|
- if outiedlist[iedname] == nil {
|
|
|
- outiedlist[iedname] = []orm.Params{}
|
|
|
- }
|
|
|
- outiedlist[iedname] = append(outiedlist[iedname], r)
|
|
|
- }
|
|
|
+ for to_ied_type2, refrow := range funclist {
|
|
|
+ ts := strings.Split(to_ied_type2, ",")
|
|
|
+ //从间隔中获取当前同类型的信号接收装置
|
|
|
+ ied_type := c.getIedTypeCode(modelid, ts[0])
|
|
|
+ if v, h := groupList[ied_type]; h {
|
|
|
+ ied_type = v
|
|
|
+ }
|
|
|
+ ied_type, vol := getIedTypeAndVolCode(ied_type)
|
|
|
+ iedlst := filterAreaIeds(ied_type, vol, s1)
|
|
|
+ logger.Logger.Debug(fmt.Sprintf("正在检查装置类型:%s的装置(%+v)端子关系", ied_type, iedlst))
|
|
|
+ //从间隔中获取当前信号输出装置
|
|
|
+ outiedlist := map[string]orm.Params{}
|
|
|
+ fromiedcode := c.getIedTypeCode(modelid, ts[1])
|
|
|
+ if v, h := groupList[fromiedcode]; h {
|
|
|
+ fromiedcode = v
|
|
|
+ }
|
|
|
+ from_ied_type, vol2 := getIedTypeAndVolCode(fromiedcode)
|
|
|
+ outiedlist2 := filterAreaIeds(from_ied_type, vol2, s1)
|
|
|
+ for _, iedrow := range outiedlist2 {
|
|
|
+ iedname := tools.IsEmpty(iedrow["ied_name"])
|
|
|
+ outiedlist[iedname] = iedrow
|
|
|
}
|
|
|
if len(outiedlist) == 0 {
|
|
|
+ logger.Logger.Debug(fmt.Sprintf("装置类型%s未发现输出任何装置", ied_type))
|
|
|
continue
|
|
|
}
|
|
|
- ied_type, vol := getIedTypeAndVolCode(ied_type)
|
|
|
- iedlst := filterAreaIeds(ied_type, vol, s1)
|
|
|
+ logger.Logger.Debug(fmt.Sprintf("当前装置类型:%s的装置(%+v)存在以下信号输出装置:%+v", ied_type, iedlst, outiedlist))
|
|
|
+ //logger.Logger.Debug(fmt.Sprintf("设计端子关联关系:%+v", refrow))
|
|
|
for _, ied := range iedlst {
|
|
|
iedname := tools.IsEmpty(ied["ied_name"])
|
|
|
iedObj := scdNodeMgr.GetIed(scdXmlObj, fmt.Sprintf("%d", c.ScdId), iedname)
|
|
@@ -641,9 +659,14 @@ func (c *CheckAreaMgr) CheckIedFcda() error {
|
|
|
iedObjDesc = iedObj.Desc
|
|
|
} else {
|
|
|
logger.Logger.Error(fmt.Sprintf("信号接收装置%s未找到!", iedname))
|
|
|
+ continue
|
|
|
}
|
|
|
extreflist := getIedExtRefs(iedname)
|
|
|
- for outiedname, refrow := range outiedlist {
|
|
|
+ for outiedname, _ := range outiedlist {
|
|
|
+ if iedname == outiedname {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ logger.Logger.Debug(fmt.Sprintf("正在匹配装置%s与%s的端子关联关系", iedname, outiedname))
|
|
|
outIedObj := scdNodeMgr.GetIed(scdXmlObj, fmt.Sprintf("%d", c.ScdId), outiedname)
|
|
|
outIedObjDesc := ""
|
|
|
if outIedObj == nil {
|
|
@@ -667,57 +690,73 @@ func (c *CheckAreaMgr) CheckIedFcda() error {
|
|
|
fcda_name := tools.IsEmpty(r["from_fcda_name"])
|
|
|
extref_name_exp := tools.IsEmpty(r["to_fcda_match_exp"])
|
|
|
fcda_name_exp := tools.IsEmpty(r["from_fcda_match_exp"])
|
|
|
- funcExist := false //设计的功能是否存在
|
|
|
+ funcExist := false //判断接收端设计的端子是否存在
|
|
|
extrefObj := new(node_attr.NExtRef)
|
|
|
+ fcda2Exist := false
|
|
|
+ fcdaObj := new(node_attr.NFCDA)
|
|
|
for desc, item := range extreflist {
|
|
|
- rex, err := regexp.Compile(extref_name_exp)
|
|
|
- if err != nil {
|
|
|
- logger.Logger.Error(err, "无效的正则表达式:"+extref_name_exp)
|
|
|
- return err
|
|
|
- }
|
|
|
- if rex.MatchString(desc) {
|
|
|
+ //logger.Logger.Debug(fmt.Sprintf("接收装置%s的设计端子%s匹配SCD ExtRef DO端子%s", iedname, extref_name_exp, desc))
|
|
|
+ if tools.RexGroupTestMatch(extref_name_exp, desc) {
|
|
|
funcExist = true
|
|
|
extrefObj = item
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
- if !funcExist {
|
|
|
- parse_result := fmt.Sprintf("间隔%s的装置%s缺失端子%s", area_name, iedname, extref_name)
|
|
|
- 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": outiedname,
|
|
|
- "out_ied_desc": outIedObjDesc,
|
|
|
- "fcda_desc": extref_name,
|
|
|
- "fcda_addr": "",
|
|
|
- "out_fcda_desc": fcda_name,
|
|
|
- "out_fcda_addr": "",
|
|
|
- "error_type": "3",
|
|
|
- }
|
|
|
- //检查未通过
|
|
|
- scdNodeRule.AppendFcdaCheckResult(re)
|
|
|
- } else {
|
|
|
- //检查端子是否关联正确
|
|
|
- fcda2Exist := false
|
|
|
- fcdaObj := new(node_attr.NFCDA)
|
|
|
+ if funcExist {
|
|
|
+ //判断输出端端子是否存在
|
|
|
for desc, item := range outiedFcdaList {
|
|
|
- rex, err := regexp.Compile(fcda_name_exp)
|
|
|
- if err != nil {
|
|
|
- logger.Logger.Error(err, "无效的正则表达式:"+fcda_name_exp)
|
|
|
- return err
|
|
|
- }
|
|
|
- if rex.MatchString(desc) {
|
|
|
+ //logger.Logger.Debug(fmt.Sprintf("输出装置%s的设计端子%s匹配SCD FCDA DO端子%s", outiedname, fcda_name_exp, desc))
|
|
|
+ if tools.RexGroupTestMatch(fcda_name_exp, desc) {
|
|
|
fcda2Exist = true
|
|
|
fcdaObj = item
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+ if !funcExist || !fcda2Exist {
|
|
|
+ if !funcExist {
|
|
|
+ parse_result := fmt.Sprintf("间隔%s的装置%s缺失端子%s", area_name, iedname, extref_name)
|
|
|
+ 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": "",
|
|
|
+ "fcda_desc": extref_name,
|
|
|
+ "fcda_addr": "",
|
|
|
+ "out_fcda_desc": "",
|
|
|
+ "out_fcda_addr": "",
|
|
|
+ "error_type": "3",
|
|
|
+ }
|
|
|
+ //检查未通过
|
|
|
+ scdNodeRule.AppendFcdaCheckResult(re)
|
|
|
+ }
|
|
|
+ if !fcda2Exist {
|
|
|
+ parse_result := fmt.Sprintf("间隔%s的装置%s缺失端子%s", area_name, outiedname, fcda_name)
|
|
|
+ re := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result,
|
|
|
+ "ied_name": "",
|
|
|
+ "ied_desc": "",
|
|
|
+ "out_ied_name": outiedname,
|
|
|
+ "out_ied_desc": outIedObjDesc,
|
|
|
+ "fcda_desc": "",
|
|
|
+ "fcda_addr": "",
|
|
|
+ "out_fcda_desc": fcda_name,
|
|
|
+ "out_fcda_addr": "",
|
|
|
+ "error_type": "3",
|
|
|
+ }
|
|
|
+ //检查未通过
|
|
|
+ scdNodeRule.AppendFcdaCheckResult(re)
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ //检查端子是否关联正确
|
|
|
if fcda2Exist && (extrefObj.LdInst != fcdaObj.LdInst ||
|
|
|
extrefObj.LnInst != fcdaObj.LnInst ||
|
|
|
extrefObj.LnClass != fcdaObj.LnClass ||
|
|
|
extrefObj.Prefix != fcdaObj.Prefix ||
|
|
|
extrefObj.DoName != fcdaObj.DoName) {
|
|
|
//不正确
|
|
|
+ logger.Logger.Debug(fmt.Sprintf("extref_name:%s extref_name_exp:%s extrefObj:%+v", extref_name, extref_name_exp, extrefObj))
|
|
|
+ logger.Logger.Debug(fmt.Sprintf("fcda_name:%s fcda_name_exp:%s fcdaObj:%+v", fcda_name, fcda_name_exp, fcdaObj))
|
|
|
iedObj := scdNodeMgr.GetIed(scdXmlObj, fmt.Sprintf("%d", c.ScdId), iedname)
|
|
|
outIedObj := scdNodeMgr.GetIed(scdXmlObj, fmt.Sprintf("%d", c.ScdId), outiedname)
|
|
|
parse_result := fmt.Sprintf("间隔%s的装置%s端子%s与装置%s端子%s关联错误", area_name, iedname, extref_name, outiedname, fcda_name)
|
|
@@ -751,19 +790,13 @@ func (c *CheckAreaMgr) CheckIedFcda() error {
|
|
|
hasYaoXinFunc = true
|
|
|
}
|
|
|
extref_name_exp := tools.IsEmpty(r1["to_fcda_match_exp"])
|
|
|
- rex, err := regexp.Compile(extref_name_exp)
|
|
|
- if err != nil {
|
|
|
- logger.Logger.Error(err)
|
|
|
- return err
|
|
|
- }
|
|
|
- if rex.MatchString(extrefdesc) {
|
|
|
+ if extrefdesc == extref_name_exp || tools.RexGroupTestMatch(extref_name_exp, extrefdesc) {
|
|
|
//端子存在
|
|
|
isHave = true
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
if !isHave {
|
|
|
- parse_result := fmt.Sprintf("间隔%s的装置%s端子%s在设计中不存在", area_name, iedname, extref_name)
|
|
|
daname := ""
|
|
|
if r.DaName != "" {
|
|
|
daname = "." + r.DaName
|
|
@@ -776,6 +809,7 @@ func (c *CheckAreaMgr) CheckIedFcda() error {
|
|
|
if doi != nil {
|
|
|
fcda_name = doi.(*node_attr.NDOI).Desc
|
|
|
}
|
|
|
+ parse_result := fmt.Sprintf("间隔%s下装置(%s)的端子%s在设计中不存在", area_name, iedname, extref_name)
|
|
|
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,
|
|
@@ -974,7 +1008,10 @@ func (c *CheckAreaMgr) pT(modelid int, iedtypes string, ieds map[string]orm.Para
|
|
|
scdParseMgr := new(ScdParse)
|
|
|
scdNodeMgr := new(ScdNode)
|
|
|
db := orm.NewOrm()
|
|
|
-
|
|
|
+ //获取装置分组信息
|
|
|
+ bgm := new(SysCheckModelIedtypeGroupMgr)
|
|
|
+ bgm.Model = T_data_model_iedtype_group{ModelId: modelid}
|
|
|
+ groupList := bgm.List()
|
|
|
scdXmlObj, _ := scdParseMgr.GetScdXmlObjectBySCDID(tools.IsEmpty(c.ScdId))
|
|
|
//获取当前站的各电压等级
|
|
|
volRows := []orm.Params{}
|
|
@@ -1032,6 +1069,10 @@ func (c *CheckAreaMgr) pT(modelid int, iedtypes string, ieds map[string]orm.Para
|
|
|
if tools.IsEmpty(row["ied_type"]) != ptCode[0:1] || tools.IsEmpty(row["p_type"]) != ptCode[1:] {
|
|
|
continue
|
|
|
}
|
|
|
+ if _, h := groupList[ptCode]; h {
|
|
|
+ //装置如果是分组成员装置,则不用检测
|
|
|
+ continue
|
|
|
+ }
|
|
|
//判断主变保护是否是按电压等级分开配置的模型
|
|
|
/*
|
|
|
if strings.Contains(iedtypes, "PT#H") || strings.Contains(iedtypes, "PT#M") || strings.Contains(iedtypes, "PT#L") {
|
|
@@ -1295,7 +1336,10 @@ func (c *CheckAreaMgr) pL(modelid int, vol, iedtypes string, ieds map[string]orm
|
|
|
scdParseMgr := new(ScdParse)
|
|
|
scdNodeMgr := new(ScdNode)
|
|
|
db := orm.NewOrm()
|
|
|
-
|
|
|
+ //获取装置分组信息
|
|
|
+ bgm := new(SysCheckModelIedtypeGroupMgr)
|
|
|
+ bgm.Model = T_data_model_iedtype_group{ModelId: modelid}
|
|
|
+ groupList := bgm.List()
|
|
|
scdXmlObj, _ := scdParseMgr.GetScdXmlObjectBySCDID(tools.IsEmpty(c.ScdId))
|
|
|
iedCode := c.getIedTypeCode(modelid, "PL")
|
|
|
for _, row := range ieds {
|
|
@@ -1305,6 +1349,10 @@ func (c *CheckAreaMgr) pL(modelid int, vol, iedtypes string, ieds map[string]orm
|
|
|
pmIedName := ""
|
|
|
mmIedName := ""
|
|
|
pl_iedname := tools.IsEmpty(row["ied_name"])
|
|
|
+ if _, h := groupList[pl_iedname]; h {
|
|
|
+ //装置如果是分组成员装置,则不用检测
|
|
|
+ continue
|
|
|
+ }
|
|
|
iednameParts := scdParseMgr.ParseIedName(pl_iedname)
|
|
|
areadesc := tools.IsEmpty(row["ied_desc"])
|
|
|
if areadesc == "" {
|
|
@@ -1335,7 +1383,15 @@ func (c *CheckAreaMgr) pL(modelid int, vol, iedtypes string, ieds map[string]orm
|
|
|
clCode := c.getIedTypeCode(modelid, "CL")
|
|
|
for _, ty := range strings.Split(iedtypes, ",") {
|
|
|
inAreaIedName := ""
|
|
|
+ if _, h := groupList[ty]; h {
|
|
|
+ //装置如果是分组成员装置,则不用检测
|
|
|
+ continue
|
|
|
+ }
|
|
|
tyCode := c.getIedTypeCode(modelid, ty)
|
|
|
+ if _, h := groupList[tyCode]; h {
|
|
|
+ //装置如果是分组成员装置,则不用检测
|
|
|
+ continue
|
|
|
+ }
|
|
|
if tyCode == pmCode {
|
|
|
//母线保护和母线合并单元装置编号跟随变压器
|
|
|
//查找变压器编号
|
|
@@ -1588,7 +1644,15 @@ func (c *CheckAreaMgr) cJ(modelid string, scdXmlObj *node_attr.SCL, scdNodeMgr *
|
|
|
//线路间隔装置关系检查
|
|
|
func (c *CheckAreaMgr) cL(modelid string, scdXmlObj *node_attr.SCL, scdNodeMgr *ScdNode, scdNodeRule *ScdNodeRule, area_name string, ied_refs []orm.Params, area_ieds []orm.Params, area_ruleid string) {
|
|
|
modelidInt, _ := strconv.Atoi(modelid)
|
|
|
+ //获取装置分组信息
|
|
|
+ bgm := new(SysCheckModelIedtypeGroupMgr)
|
|
|
+ bgm.Model = T_data_model_iedtype_group{ModelId: modelidInt}
|
|
|
+ groupList := bgm.List()
|
|
|
plIed := c.getIedTypeCode(modelidInt, "PL")
|
|
|
+ if v, h := groupList[plIed]; h {
|
|
|
+ //装置如果是分组成员装置
|
|
|
+ plIed = v
|
|
|
+ }
|
|
|
masterIed := new(node_attr.NIED)
|
|
|
findIedName := ""
|
|
|
for _, row2 := range area_ieds {
|
|
@@ -1601,6 +1665,7 @@ func (c *CheckAreaMgr) cL(modelid string, scdXmlObj *node_attr.SCL, scdNodeMgr *
|
|
|
if masterIed == nil {
|
|
|
return
|
|
|
}
|
|
|
+ logger.Logger.Debug(fmt.Sprintf("开始分析模型%d的线路间隔关系", modelidInt))
|
|
|
dealFromIed := map[string]int{}
|
|
|
for _, row := range ied_refs {
|
|
|
fromiedtype := c.getIedTypeCode(modelidInt, tools.IsEmpty(row["from_ied_code"]))
|
|
@@ -1617,7 +1682,17 @@ func (c *CheckAreaMgr) cL(modelid string, scdXmlObj *node_attr.SCL, scdNodeMgr *
|
|
|
} else {
|
|
|
if dealFromIed[findIedName] == 0 {
|
|
|
parse_result := fmt.Sprintf("间隔%s的装置%s缺失", area_name, findIedName)
|
|
|
- r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
|
|
|
+ r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result,
|
|
|
+ "ied_name": findIedName,
|
|
|
+ "ied_desc": "",
|
|
|
+ "out_ied_name": "",
|
|
|
+ "out_ied_desc": "",
|
|
|
+ "fcda_desc": "",
|
|
|
+ "fcda_addr": "",
|
|
|
+ "out_fcda_desc": "",
|
|
|
+ "out_fcda_addr": "",
|
|
|
+ "error_type": "9",
|
|
|
+ }
|
|
|
//检查未通过
|
|
|
scdNodeRule.AppendFcdaCheckResult(r)
|
|
|
}
|
|
@@ -1650,7 +1725,7 @@ func (c *CheckAreaMgr) cL(modelid string, scdXmlObj *node_attr.SCL, scdNodeMgr *
|
|
|
hasToIed = true
|
|
|
// 获取该ied的输出(ref_type为0)装置,并从中检测是否存在toiedtype类型的装置
|
|
|
inout, _ := scdNodeMgr.GetIedRelations(map[string]interface{}{"scd_id": c.ScdId, "ied_name": findIedName})
|
|
|
- logger.Logger.Debug(fmt.Sprintf("ied:%s refs:%+v", findIedName, inout))
|
|
|
+ //logger.Logger.Debug(fmt.Sprintf("ied:%s refs:%+v", findIedName, inout))
|
|
|
if inout != nil {
|
|
|
outiedlist := inout[findIedName].(orm.Params)["list"].([]orm.Params)
|
|
|
for _, ieditem := range outiedlist {
|
|
@@ -1663,7 +1738,17 @@ func (c *CheckAreaMgr) cL(modelid string, scdXmlObj *node_attr.SCL, scdNodeMgr *
|
|
|
}
|
|
|
if !hasToIedRef {
|
|
|
parse_result := fmt.Sprintf("间隔%s的装置%s缺失与装置%s的%s信号关联", area_name, findIedName, toIedname, reftype)
|
|
|
- r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
|
|
|
+ r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result,
|
|
|
+ "ied_name": findIedName,
|
|
|
+ "ied_desc": "",
|
|
|
+ "out_ied_name": toIedname,
|
|
|
+ "out_ied_desc": "",
|
|
|
+ "fcda_desc": "",
|
|
|
+ "fcda_addr": "",
|
|
|
+ "out_fcda_desc": "",
|
|
|
+ "out_fcda_addr": "",
|
|
|
+ "error_type": "9",
|
|
|
+ }
|
|
|
//检查未通过
|
|
|
scdNodeRule.AppendFcdaCheckResult(r)
|
|
|
}
|
|
@@ -1671,7 +1756,17 @@ func (c *CheckAreaMgr) cL(modelid string, scdXmlObj *node_attr.SCL, scdNodeMgr *
|
|
|
}
|
|
|
if !hasToIed {
|
|
|
parse_result := fmt.Sprintf("间隔%s的装置%s缺失关联装置%s", area_name, findIedName, toIedname)
|
|
|
- r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
|
|
|
+ r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result,
|
|
|
+ "ied_name": findIedName,
|
|
|
+ "ied_desc": "",
|
|
|
+ "out_ied_name": toIedname,
|
|
|
+ "out_ied_desc": "",
|
|
|
+ "fcda_desc": "",
|
|
|
+ "fcda_addr": "",
|
|
|
+ "out_fcda_desc": "",
|
|
|
+ "out_fcda_addr": "",
|
|
|
+ "error_type": "9",
|
|
|
+ }
|
|
|
//检查未通过
|
|
|
scdNodeRule.AppendFcdaCheckResult(r)
|
|
|
}
|
|
@@ -1714,7 +1809,17 @@ func (c *CheckAreaMgr) cT(modelid string, scdXmlObj *node_attr.SCL, scdNodeMgr *
|
|
|
} else {
|
|
|
if dealFromIed[findIedName] == 0 {
|
|
|
parse_result := fmt.Sprintf("间隔%s的装置%s缺失", area_name, findIedName)
|
|
|
- r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
|
|
|
+ r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result,
|
|
|
+ "ied_name": findIedName,
|
|
|
+ "ied_desc": "",
|
|
|
+ "out_ied_name": "",
|
|
|
+ "out_ied_desc": "",
|
|
|
+ "fcda_desc": "",
|
|
|
+ "fcda_addr": "",
|
|
|
+ "out_fcda_desc": "",
|
|
|
+ "out_fcda_addr": "",
|
|
|
+ "error_type": "9",
|
|
|
+ }
|
|
|
//检查未通过
|
|
|
scdNodeRule.AppendFcdaCheckResult(r)
|
|
|
}
|
|
@@ -1731,7 +1836,17 @@ func (c *CheckAreaMgr) cT(modelid string, scdXmlObj *node_attr.SCL, scdNodeMgr *
|
|
|
if len(tmpToAreaIeds) == 0 {
|
|
|
logger.Logger.Debug(fmt.Sprintf("缺失类型关联装置 :%+v", row))
|
|
|
parse_result := fmt.Sprintf("间隔%s缺失类型为%s的%s信号装置", area_name, toiedtype, reftype)
|
|
|
- r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
|
|
|
+ r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result,
|
|
|
+ "ied_name": findIedName,
|
|
|
+ "ied_desc": "",
|
|
|
+ "out_ied_name": "",
|
|
|
+ "out_ied_desc": "",
|
|
|
+ "fcda_desc": "",
|
|
|
+ "fcda_addr": "",
|
|
|
+ "out_fcda_desc": "",
|
|
|
+ "out_fcda_addr": "",
|
|
|
+ "error_type": "9",
|
|
|
+ }
|
|
|
//检查未通过
|
|
|
scdNodeRule.AppendFcdaCheckResult(r)
|
|
|
continue
|
|
@@ -1762,7 +1877,7 @@ func (c *CheckAreaMgr) cT(modelid string, scdXmlObj *node_attr.SCL, scdNodeMgr *
|
|
|
hasToIed = true
|
|
|
// 获取该ied的输出(ref_type为0)装置,并从中检测是否存在toiedtype类型的装置
|
|
|
inout, _ := scdNodeMgr.GetIedRelations(map[string]interface{}{"scd_id": c.ScdId, "ied_name": findIedName})
|
|
|
- logger.Logger.Debug(fmt.Sprintf("ied:%s refs:%+v", findIedName, inout))
|
|
|
+ //logger.Logger.Debug(fmt.Sprintf("ied:%s refs:%+v", findIedName, inout))
|
|
|
if inout != nil {
|
|
|
outiedlist := inout[findIedName].(orm.Params)["list"].([]orm.Params)
|
|
|
for _, ieditem := range outiedlist {
|
|
@@ -1775,7 +1890,17 @@ func (c *CheckAreaMgr) cT(modelid string, scdXmlObj *node_attr.SCL, scdNodeMgr *
|
|
|
}
|
|
|
if !hasToIedRef {
|
|
|
parse_result := fmt.Sprintf("间隔%s的装置%s缺失与装置%s的%s信号关联", area_name, findIedName, toIedname, reftype)
|
|
|
- r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
|
|
|
+ r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result,
|
|
|
+ "ied_name": findIedName,
|
|
|
+ "ied_desc": "",
|
|
|
+ "out_ied_name": toIedname,
|
|
|
+ "out_ied_desc": "",
|
|
|
+ "fcda_desc": "",
|
|
|
+ "fcda_addr": "",
|
|
|
+ "out_fcda_desc": "",
|
|
|
+ "out_fcda_addr": "",
|
|
|
+ "error_type": "9",
|
|
|
+ }
|
|
|
//检查未通过
|
|
|
scdNodeRule.AppendFcdaCheckResult(r)
|
|
|
}
|
|
@@ -1787,12 +1912,32 @@ func (c *CheckAreaMgr) cT(modelid string, scdXmlObj *node_attr.SCL, scdNodeMgr *
|
|
|
if toiedtype != ptIed {
|
|
|
if volLevel != "" && !hasSameVolIed {
|
|
|
parse_result := fmt.Sprintf("间隔%s的装置%s缺失同电压等级的关联类型%s装置", area_name, findIedName, toiedtype)
|
|
|
- r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
|
|
|
+ r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result,
|
|
|
+ "ied_name": findIedName,
|
|
|
+ "ied_desc": "",
|
|
|
+ "out_ied_name": "",
|
|
|
+ "out_ied_desc": "",
|
|
|
+ "fcda_desc": "",
|
|
|
+ "fcda_addr": "",
|
|
|
+ "out_fcda_desc": "",
|
|
|
+ "out_fcda_addr": "",
|
|
|
+ "error_type": "9",
|
|
|
+ }
|
|
|
//检查未通过
|
|
|
scdNodeRule.AppendFcdaCheckResult(r)
|
|
|
} else if !hasToIed {
|
|
|
parse_result := fmt.Sprintf("间隔%s的装置%s缺失关联装置%s", area_name, findIedName, toIedname)
|
|
|
- r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result}
|
|
|
+ r := map[string]interface{}{"scdid": c.ScdId, "lineno": 0, "ruleid": area_ruleid, "nodeid": 0, "parse_result": parse_result,
|
|
|
+ "ied_name": findIedName,
|
|
|
+ "ied_desc": "",
|
|
|
+ "out_ied_name": toIedname,
|
|
|
+ "out_ied_desc": "",
|
|
|
+ "fcda_desc": "",
|
|
|
+ "fcda_addr": "",
|
|
|
+ "out_fcda_desc": "",
|
|
|
+ "out_fcda_addr": "",
|
|
|
+ "error_type": "9",
|
|
|
+ }
|
|
|
//检查未通过
|
|
|
scdNodeRule.AppendFcdaCheckResult(r)
|
|
|
}
|
|
@@ -1808,7 +1953,7 @@ func (c *CheckAreaMgr) getPMName(iednameParts []string, ieds map[string]orm.Para
|
|
|
//如果只有一个PM装置,则直接返回该 装置
|
|
|
pmLst := []string{}
|
|
|
for n, _ := range ieds {
|
|
|
- if strings.HasPrefix(n, "PM") {
|
|
|
+ if strings.HasPrefix(n, "PM"+iednameParts[3]+iednameParts[4]) {
|
|
|
pmLst = append(pmLst, n)
|
|
|
}
|
|
|
}
|
|
@@ -1816,12 +1961,9 @@ func (c *CheckAreaMgr) getPMName(iednameParts []string, ieds map[string]orm.Para
|
|
|
return pmLst[0]
|
|
|
}
|
|
|
//暴力匹配
|
|
|
- no := []string{"A", "B", "C", "D", "1", "2", "3", "4"}
|
|
|
- for _, i := range no {
|
|
|
- tmpIedName := "PM" + iednameParts[3] + iednameParts[4] + iednameParts[5] + i + iednameParts[7]
|
|
|
- iedObj := ieds[tmpIedName]
|
|
|
- if iedObj != nil {
|
|
|
- return tmpIedName
|
|
|
+ for _, n := range pmLst {
|
|
|
+ if strings.HasSuffix(n, iednameParts[7]) {
|
|
|
+ return n
|
|
|
}
|
|
|
}
|
|
|
return ""
|
|
@@ -1829,11 +1971,21 @@ func (c *CheckAreaMgr) getPMName(iednameParts []string, ieds map[string]orm.Para
|
|
|
|
|
|
//根据参考ied name找出应该关联MM装置
|
|
|
func (c *CheckAreaMgr) getMMName(iednameParts []string, ieds map[string]orm.Params, ab string) string {
|
|
|
- tmpIedName := "MM" + iednameParts[3] + iednameParts[4] + iednameParts[5] + iednameParts[6] + ab
|
|
|
- if ieds[tmpIedName] == nil {
|
|
|
- tmpIedName = "MM" + iednameParts[3] + iednameParts[4] + iednameParts[5] + iednameParts[6] + iednameParts[7]
|
|
|
+ mmLst := []string{}
|
|
|
+ for n, _ := range ieds {
|
|
|
+ if strings.HasPrefix(n, "MM"+iednameParts[3]+iednameParts[4]) {
|
|
|
+ mmLst = append(mmLst, n)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if len(mmLst) == 1 {
|
|
|
+ return mmLst[0]
|
|
|
}
|
|
|
- return tmpIedName
|
|
|
+ for _, n := range mmLst {
|
|
|
+ if strings.HasSuffix(n, ab) {
|
|
|
+ return n
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return ""
|
|
|
}
|
|
|
|
|
|
//根据当前设备列表,分析出电压等级(高、中、低)的设备列表
|