|
@@ -414,10 +414,10 @@ func (c *CheckAreaMgr) CheckAreaIedRelation() error {
|
|
|
if areaCode == "J" {
|
|
|
HasAreaJ = true
|
|
|
modelid := tools.IsEmpty(row["model_id"])
|
|
|
- c.cJ(scdXmlObj, scdNode, scdNodeRule, area_name, model_refs[modelid], area_ieds[area_id], "PE", area_ruleid)
|
|
|
- c.cJ(scdXmlObj, scdNode, scdNodeRule, area_name, model_refs[modelid], area_ieds[area_id], "PJ", area_ruleid)
|
|
|
- c.cJ(scdXmlObj, scdNode, scdNodeRule, area_name, model_refs[modelid], area_ieds[area_id], "PK", area_ruleid)
|
|
|
- c.cJ(scdXmlObj, scdNode, scdNodeRule, area_name, model_refs[modelid], area_ieds[area_id], "PF", area_ruleid)
|
|
|
+ c.cJ(modelid, scdXmlObj, scdNode, scdNodeRule, area_name, model_refs[modelid], area_ieds[area_id], "PE", area_ruleid)
|
|
|
+ c.cJ(modelid, scdXmlObj, scdNode, scdNodeRule, area_name, model_refs[modelid], area_ieds[area_id], "PJ", area_ruleid)
|
|
|
+ c.cJ(modelid, scdXmlObj, scdNode, scdNodeRule, area_name, model_refs[modelid], area_ieds[area_id], "PK", area_ruleid)
|
|
|
+ c.cJ(modelid, scdXmlObj, scdNode, scdNodeRule, area_name, model_refs[modelid], area_ieds[area_id], "PF", area_ruleid)
|
|
|
}
|
|
|
}
|
|
|
for _, row := range arealist {
|
|
@@ -430,11 +430,11 @@ func (c *CheckAreaMgr) CheckAreaIedRelation() error {
|
|
|
}
|
|
|
if areaCode == "L" {
|
|
|
//线路间隔
|
|
|
- c.cL(scdXmlObj, scdNode, scdNodeRule, area_name, model_refs[modelid], area_ieds[area_id], area_ruleid)
|
|
|
+ c.cL(modelid, scdXmlObj, scdNode, scdNodeRule, area_name, model_refs[modelid], area_ieds[area_id], area_ruleid)
|
|
|
}
|
|
|
if areaCode == "T" {
|
|
|
//变压器齐间隔
|
|
|
- c.cT(scdXmlObj, scdNode, scdNodeRule, area_name, model_refs[modelid], area_ieds[area_id], area_ruleid, HasAreaJ)
|
|
|
+ c.cT(modelid, scdXmlObj, scdNode, scdNodeRule, area_name, model_refs[modelid], area_ieds[area_id], area_ruleid, HasAreaJ)
|
|
|
}
|
|
|
}
|
|
|
scdNodeRule.CheckFinish()
|
|
@@ -612,11 +612,12 @@ func (c *CheckAreaMgr) CheckIedFcda() error {
|
|
|
s1 := []orm.Params{}
|
|
|
_, err = db.Raw("select ied_name from t_data_check_area_ied where area_id=?", area_id).Values(&s1)
|
|
|
//循环处理关联关系
|
|
|
- for ied_type, fromrowlist := range funclist {
|
|
|
+ for ied_type2, fromrowlist := range funclist {
|
|
|
+ ied_type := c.getIedTypeCode(modelid, ied_type2)
|
|
|
//找出信号输出装置
|
|
|
outiedlist := map[string][]orm.Params{}
|
|
|
for _, r := range fromrowlist {
|
|
|
- fromiedcode := tools.IsEmpty(r["from_ied_code"])
|
|
|
+ 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 {
|
|
@@ -879,6 +880,20 @@ func (c *CheckAreaMgr) ParseModelArea() {
|
|
|
modelid, _ := strconv.Atoi(tools.IsEmpty(row["id"]))
|
|
|
//modelname := tools.IsEmpty(row["model_name"])
|
|
|
iedtypes := tools.IsEmpty(row["ied_types"])
|
|
|
+ mapptype := new(SysCheckModelIedtypeMappingMgr)
|
|
|
+ mapptype.Model = T_data_model_iedtype_maping{ModelId: modelid}
|
|
|
+ mappresult := mapptype.List()
|
|
|
+ if len(mappresult) > 0 {
|
|
|
+ tmp := []string{}
|
|
|
+ for _, r := range strings.Split(iedtypes, ",") {
|
|
|
+ if mappresult[r] != "" {
|
|
|
+ tmp = append(tmp, mappresult[r])
|
|
|
+ } else {
|
|
|
+ tmp = append(tmp, r)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ iedtypes = strings.Join(tmp, ",")
|
|
|
+ }
|
|
|
volcode := strings.ReplaceAll(tools.IsEmpty(row["vol_code"]), "v_level_", "")
|
|
|
c.pJ(modelid, volcode, iedtypes, iedMap, "PE")
|
|
|
c.pJ(modelid, volcode, iedtypes, iedMap, "PJ")
|
|
@@ -914,6 +929,21 @@ func (c *CheckAreaMgr) ParseModelArea() {
|
|
|
if areaCode == "J" {
|
|
|
continue
|
|
|
}
|
|
|
+ //获取模型中的自定义装置类型编码
|
|
|
+ mapptype := new(SysCheckModelIedtypeMappingMgr)
|
|
|
+ mapptype.Model = T_data_model_iedtype_maping{ModelId: modelid}
|
|
|
+ mappresult := mapptype.List()
|
|
|
+ if len(mappresult) > 0 {
|
|
|
+ tmp := []string{}
|
|
|
+ for _, r := range strings.Split(iedtypes, ",") {
|
|
|
+ if mappresult[r] != "" {
|
|
|
+ tmp = append(tmp, mappresult[r])
|
|
|
+ } else {
|
|
|
+ tmp = append(tmp, r)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ iedtypes = strings.Join(tmp, ",")
|
|
|
+ }
|
|
|
//获取模型内中装备关系定义
|
|
|
//主变间隔分析:需要查站内该电压等级下的高中低压侧装置或者高低压装置组成一个间隔,以主变保护装置(PT)为起始
|
|
|
if areaCode == "T" {
|
|
@@ -926,6 +956,19 @@ func (c *CheckAreaMgr) ParseModelArea() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+//根据默认装置类型获取其类型编码。如果没有自定义编码,则返回默认编码
|
|
|
+func (c *CheckAreaMgr) getIedTypeCode(modelid int, iedtype string) string {
|
|
|
+ mapptype := new(SysCheckModelIedtypeMappingMgr)
|
|
|
+ mapptype.Model = T_data_model_iedtype_maping{ModelId: modelid}
|
|
|
+ mapptype.Model.IedType = iedtype
|
|
|
+ mappresult := mapptype.List()
|
|
|
+ ptCode := iedtype
|
|
|
+ if len(mappresult) > 0 {
|
|
|
+ ptCode = mappresult[iedtype] //自定义主变保护编码
|
|
|
+ }
|
|
|
+ return ptCode
|
|
|
+}
|
|
|
+
|
|
|
//变压器间隔分析
|
|
|
func (c *CheckAreaMgr) pT(modelid int, iedtypes string, ieds map[string]orm.Params, HasAreaJ bool) {
|
|
|
scdParseMgr := new(ScdParse)
|
|
@@ -981,9 +1024,9 @@ func (c *CheckAreaMgr) pT(modelid int, iedtypes string, ieds map[string]orm.Para
|
|
|
//判断是否将各电压等级的保护装置合并还是分开的间隔
|
|
|
//如果存在高中低压的保护装置,则说明是分开的主变间隔
|
|
|
//isMarge := true // 默认为合并的主变间隔
|
|
|
-
|
|
|
+ ptCode := c.getIedTypeCode(modelid, "PT")
|
|
|
for _, row := range ieds {
|
|
|
- if tools.IsEmpty(row["ied_type"]) != "P" || tools.IsEmpty(row["p_type"]) != "T" {
|
|
|
+ if tools.IsEmpty(row["ied_type"]) != ptCode[0:1] || tools.IsEmpty(row["p_type"]) != ptCode[1:] {
|
|
|
continue
|
|
|
}
|
|
|
//判断主变保护是否是按电压等级分开配置的模型
|
|
@@ -1015,8 +1058,8 @@ func (c *CheckAreaMgr) pT(modelid int, iedtypes string, ieds map[string]orm.Para
|
|
|
inAreaIedName := pl_iedname
|
|
|
insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, "P", "T"))
|
|
|
//判断间隔是否需要包含差动装置
|
|
|
- if strings.Contains(iedtypes, "PT#C") {
|
|
|
- _, iedname := getIedByDesc(ieds, "PT", "差动")
|
|
|
+ if strings.Contains(iedtypes, ptCode+"#C") {
|
|
|
+ _, iedname := getIedByDesc(ieds, ptCode, "差动")
|
|
|
if len(iedname) > 0 {
|
|
|
for _, in := range iedname {
|
|
|
tmpIednameParts := scdParseMgr.ParseIedName(in)
|
|
@@ -1028,8 +1071,8 @@ func (c *CheckAreaMgr) pT(modelid int, iedtypes string, ieds map[string]orm.Para
|
|
|
}
|
|
|
}
|
|
|
//判断间隔是否需要包含本体保护装置
|
|
|
- if strings.Contains(iedtypes, "PT#0") {
|
|
|
- _, iedname := getIedByDesc(ieds, "PT", "本体")
|
|
|
+ if strings.Contains(iedtypes, ptCode+"#0") {
|
|
|
+ _, iedname := getIedByDesc(ieds, ptCode, "本体")
|
|
|
if len(iedname) > 0 {
|
|
|
for _, in := range iedname {
|
|
|
tmpIednameParts := scdParseMgr.ParseIedName(in)
|
|
@@ -1041,7 +1084,8 @@ func (c *CheckAreaMgr) pT(modelid int, iedtypes string, ieds map[string]orm.Para
|
|
|
}
|
|
|
}
|
|
|
//合智一体IMT/MIT,分高中低压
|
|
|
- h, m, l := c.getIedListByVol("IMT", ieds, volMap)
|
|
|
+ imtcode := c.getIedTypeCode(modelid, "IMT")
|
|
|
+ h, m, l := c.getIedListByVol(imtcode, ieds, volMap)
|
|
|
h = append(h, m...)
|
|
|
h = append(h, l...)
|
|
|
for _, r := range h {
|
|
@@ -1051,7 +1095,8 @@ func (c *CheckAreaMgr) pT(modelid int, iedtypes string, ieds map[string]orm.Para
|
|
|
insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, "IM", "T"))
|
|
|
}
|
|
|
}
|
|
|
- h, m, l = c.getIedListByVol("MIT", ieds, volMap)
|
|
|
+ imtcode = c.getIedTypeCode(modelid, "MIT")
|
|
|
+ h, m, l = c.getIedListByVol(imtcode, ieds, volMap)
|
|
|
h = append(h, m...)
|
|
|
h = append(h, l...)
|
|
|
for _, r := range h {
|
|
@@ -1063,7 +1108,8 @@ func (c *CheckAreaMgr) pT(modelid int, iedtypes string, ieds map[string]orm.Para
|
|
|
}
|
|
|
//母联智能终端IE需要分高中压,无低压侧
|
|
|
if HasAreaJ {
|
|
|
- h, m, l = c.getIedListByVol("IE", ieds, volMap)
|
|
|
+ imtcode = c.getIedTypeCode(modelid, "IE")
|
|
|
+ h, m, l = c.getIedListByVol(imtcode, ieds, volMap)
|
|
|
for _, r := range h {
|
|
|
//高压侧,AB套必须与PT装置相同
|
|
|
inAreaIedName = tools.IsEmpty(r["ied_name"])
|
|
@@ -1083,7 +1129,8 @@ func (c *CheckAreaMgr) pT(modelid int, iedtypes string, ieds map[string]orm.Para
|
|
|
}
|
|
|
}
|
|
|
//合并单元MT分高中低压侧;低压侧无关联母线合并单元MM
|
|
|
- h, m, l = c.getIedListByVol("MT", ieds, volMap)
|
|
|
+ imtcode = c.getIedTypeCode(modelid, "MT")
|
|
|
+ h, m, l = c.getIedListByVol(imtcode, ieds, volMap)
|
|
|
h = append(h, m...)
|
|
|
h = append(h, l...)
|
|
|
for _, r := range h {
|
|
@@ -1094,8 +1141,8 @@ func (c *CheckAreaMgr) pT(modelid int, iedtypes string, ieds map[string]orm.Para
|
|
|
}
|
|
|
}
|
|
|
//是否包含本体合并单元
|
|
|
- if strings.Contains(iedtypes, "MT#0") {
|
|
|
- _, iedname := getIedByDesc(ieds, "MT", "本体")
|
|
|
+ if strings.Contains(iedtypes, imtcode+"#0") {
|
|
|
+ _, iedname := getIedByDesc(ieds, imtcode, "本体")
|
|
|
if len(iedname) > 0 {
|
|
|
for _, in := range iedname {
|
|
|
tmpIednameParts := scdParseMgr.ParseIedName(in)
|
|
@@ -1107,7 +1154,8 @@ func (c *CheckAreaMgr) pT(modelid int, iedtypes string, ieds map[string]orm.Para
|
|
|
}
|
|
|
}
|
|
|
//测控装置CT分高中低压侧,且可能是多套合并单元MT共用,既不分AB套
|
|
|
- h, m, l = c.getIedListByVol("CT", ieds, volMap)
|
|
|
+ imtcode = c.getIedTypeCode(modelid, "CT")
|
|
|
+ h, m, l = c.getIedListByVol(imtcode, ieds, volMap)
|
|
|
h = append(h, m...)
|
|
|
h = append(h, l...)
|
|
|
for _, r := range h {
|
|
@@ -1121,8 +1169,8 @@ func (c *CheckAreaMgr) pT(modelid int, iedtypes string, ieds map[string]orm.Para
|
|
|
}
|
|
|
}
|
|
|
//是否包含本体测控装置
|
|
|
- if strings.Contains(iedtypes, "CT#0") {
|
|
|
- _, iedname := getIedByDesc(ieds, "CT", "本体")
|
|
|
+ if strings.Contains(iedtypes, imtcode+"#0") {
|
|
|
+ _, iedname := getIedByDesc(ieds, imtcode, "本体")
|
|
|
if len(iedname) > 0 {
|
|
|
for _, in := range iedname {
|
|
|
tmpIednameParts := scdParseMgr.ParseIedName(in)
|
|
@@ -1134,7 +1182,10 @@ func (c *CheckAreaMgr) pT(modelid int, iedtypes string, ieds map[string]orm.Para
|
|
|
}
|
|
|
}
|
|
|
//智能终端(IB:开关\IT:分支\IF:分段)分高中低压侧
|
|
|
- h, m, l = c.getIedListByVol("IB", ieds, volMap)
|
|
|
+ imtcodeB := c.getIedTypeCode(modelid, "IB")
|
|
|
+ imtcodeT := c.getIedTypeCode(modelid, "IT")
|
|
|
+ imtcodeF := c.getIedTypeCode(modelid, "IF")
|
|
|
+ h, m, l = c.getIedListByVol(imtcodeB, ieds, volMap)
|
|
|
h = append(h, m...)
|
|
|
h = append(h, l...)
|
|
|
for _, r := range h {
|
|
@@ -1148,9 +1199,9 @@ func (c *CheckAreaMgr) pT(modelid int, iedtypes string, ieds map[string]orm.Para
|
|
|
}
|
|
|
}
|
|
|
//是否包含本体测控装置
|
|
|
- if strings.Contains(iedtypes, "IT#0") {
|
|
|
+ if strings.Contains(iedtypes, imtcodeT+"#0") {
|
|
|
for n, row := range ieds {
|
|
|
- if strings.HasPrefix(n, "IT") || strings.HasPrefix(n, "IB") || strings.HasPrefix(n, "IF") {
|
|
|
+ if strings.HasPrefix(n, imtcodeT) || strings.HasPrefix(n, imtcodeB) || strings.HasPrefix(n, imtcodeF) {
|
|
|
ieddesc := tools.IsEmpty(row["ied_desc"])
|
|
|
if strings.Contains(ieddesc, "本体") {
|
|
|
tmpIednameParts := scdParseMgr.ParseIedName(n)
|
|
@@ -1162,7 +1213,7 @@ func (c *CheckAreaMgr) pT(modelid int, iedtypes string, ieds map[string]orm.Para
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- h, m, l = c.getIedListByVol("IT", ieds, volMap)
|
|
|
+ h, m, l = c.getIedListByVol(imtcodeT, ieds, volMap)
|
|
|
h = append(h, m...)
|
|
|
h = append(h, l...)
|
|
|
for _, r := range h {
|
|
@@ -1175,7 +1226,7 @@ func (c *CheckAreaMgr) pT(modelid int, iedtypes string, ieds map[string]orm.Para
|
|
|
insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, "I", "T"))
|
|
|
}
|
|
|
}
|
|
|
- h, m, l = c.getIedListByVol("IF", ieds, volMap)
|
|
|
+ h, m, l = c.getIedListByVol(imtcodeF, ieds, volMap)
|
|
|
h = append(h, m...)
|
|
|
h = append(h, l...)
|
|
|
for _, r := range h {
|
|
@@ -1189,7 +1240,8 @@ func (c *CheckAreaMgr) pT(modelid int, iedtypes string, ieds map[string]orm.Para
|
|
|
}
|
|
|
}
|
|
|
//母线保护PM及母线合并单元MM,可能是多套合并单元MT共用,既不分AB套;低压侧智能终端无关联母线保护
|
|
|
- h, m, l = c.getIedListByVol("PM", ieds, volMap)
|
|
|
+ imtcode = c.getIedTypeCode(modelid, "PM")
|
|
|
+ h, m, l = c.getIedListByVol(imtcode, ieds, volMap)
|
|
|
for _, r := range h {
|
|
|
//高压侧,AB套必须与PT装置相同
|
|
|
inAreaIedName = tools.IsEmpty(r["ied_name"])
|
|
@@ -1232,8 +1284,9 @@ func (c *CheckAreaMgr) pL(modelid int, vol, iedtypes string, ieds map[string]orm
|
|
|
db := orm.NewOrm()
|
|
|
|
|
|
scdXmlObj, _ := scdParseMgr.GetScdXmlObjectBySCDID(tools.IsEmpty(c.ScdId))
|
|
|
+ iedCode := c.getIedTypeCode(modelid, "PL")
|
|
|
for _, row := range ieds {
|
|
|
- if tools.IsEmpty(row["vol"]) != vol || tools.IsEmpty(row["ied_type"]) != "P" || tools.IsEmpty(row["p_type"]) != "L" {
|
|
|
+ if tools.IsEmpty(row["vol"]) != vol || tools.IsEmpty(row["ied_type"]) != iedCode[0:1] || tools.IsEmpty(row["p_type"]) != iedCode[1:] {
|
|
|
continue
|
|
|
}
|
|
|
pmIedName := ""
|
|
@@ -1255,9 +1308,13 @@ func (c *CheckAreaMgr) pL(modelid int, vol, iedtypes string, ieds map[string]orm
|
|
|
}
|
|
|
ins1 := "insert into t_data_check_area_ied(scd_id,area_id,ied_name,ied_type,p_type)values"
|
|
|
insvalues := []string{}
|
|
|
+ pmCode := c.getIedTypeCode(modelid, "PM")
|
|
|
+ mmCode := c.getIedTypeCode(modelid, "MM")
|
|
|
+ clCode := c.getIedTypeCode(modelid, "CL")
|
|
|
for _, ty := range strings.Split(iedtypes, ",") {
|
|
|
inAreaIedName := ""
|
|
|
- if ty == "PM" {
|
|
|
+ tyCode := c.getIedTypeCode(modelid, ty)
|
|
|
+ if tyCode == pmCode {
|
|
|
//母线保护和母线合并单元装置编号跟随变压器
|
|
|
//查找变压器编号
|
|
|
//1号变压器->2号变压器->3号
|
|
@@ -1267,11 +1324,11 @@ func (c *CheckAreaMgr) pL(modelid int, vol, iedtypes string, ieds map[string]orm
|
|
|
insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, ty[0:1], ty[1:2]))
|
|
|
//pmIedNameParts := scdParseMgr.ParseIedName(pmIedName)
|
|
|
//使用PM装置的名称去定义MM的名称
|
|
|
- ty = "MM"
|
|
|
+ tyCode = mmCode
|
|
|
inAreaIedName = c.getMMName(iednameParts, ieds, iednameParts[7])
|
|
|
mmIedName = inAreaIedName
|
|
|
}
|
|
|
- } else if ty == "MM" {
|
|
|
+ } else if tyCode == mmCode {
|
|
|
if pmIedName != "" && mmIedName == "" {
|
|
|
//pmIedNameParts := scdParseMgr.ParseIedName(pmIedName)
|
|
|
//使用PM装置的名称去定义MM的名称
|
|
@@ -1280,7 +1337,7 @@ func (c *CheckAreaMgr) pL(modelid int, vol, iedtypes string, ieds map[string]orm
|
|
|
} else {
|
|
|
continue
|
|
|
}
|
|
|
- } else if ty == "PLC" || ty == "PCL" {
|
|
|
+ } else if tyCode == "PLC" || tyCode == "PCL" {
|
|
|
//判断是否是保测一体的
|
|
|
if strings.Contains(iedtypes, "PLC") || strings.Contains(iedtypes, "PCL") {
|
|
|
no := []string{"PLC", "PCL", "PL"}
|
|
@@ -1293,8 +1350,8 @@ func (c *CheckAreaMgr) pL(modelid int, vol, iedtypes string, ieds map[string]orm
|
|
|
}
|
|
|
}
|
|
|
} else {
|
|
|
- inAreaIedName = ty + iednameParts[3] + iednameParts[4] + iednameParts[5] + iednameParts[6] + iednameParts[7]
|
|
|
- if ty == "IML" {
|
|
|
+ inAreaIedName = tyCode + iednameParts[3] + iednameParts[4] + iednameParts[5] + iednameParts[6] + iednameParts[7]
|
|
|
+ if tyCode == "IML" {
|
|
|
//查找IML装置是否存在,不存在就查找MIL开头装置做中合智一体装置
|
|
|
no := []string{"IML", "MIL"}
|
|
|
for _, n := range no {
|
|
@@ -1307,8 +1364,8 @@ func (c *CheckAreaMgr) pL(modelid int, vol, iedtypes string, ieds map[string]orm
|
|
|
}
|
|
|
if strings.Index("ABCDE", iednameParts[7]) > -1 {
|
|
|
//最后一位是字母则说明是AB套
|
|
|
- switch ty {
|
|
|
- case "CL":
|
|
|
+ switch tyCode {
|
|
|
+ case clCode:
|
|
|
if strings.Contains(iedtypes, "PLC") || strings.Contains(iedtypes, "PCL") {
|
|
|
//不处理CL装置
|
|
|
} else {
|
|
@@ -1325,7 +1382,7 @@ func (c *CheckAreaMgr) pL(modelid int, vol, iedtypes string, ieds map[string]orm
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
- insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, ty[0:1], ty[1:2]))
|
|
|
+ insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, tyCode[0:1], tyCode[1:]))
|
|
|
}
|
|
|
_, err = db.Raw(ins1 + strings.Join(insvalues, ",")).Exec()
|
|
|
if err != nil {
|
|
@@ -1350,9 +1407,10 @@ func (c *CheckAreaMgr) pJ(modelid int, vol, iedtypes string, ieds map[string]orm
|
|
|
scdParseMgr := new(ScdParse)
|
|
|
//scdNodeMgr := new(ScdNode)
|
|
|
db := orm.NewOrm()
|
|
|
+ pjIed = c.getIedTypeCode(modelid, pjIed)
|
|
|
//scdXmlObject, _ := scdParseMgr.GetScdXmlObjectBySCDID(tools.IsEmpty(c.ScdId))
|
|
|
for _, row := range ieds {
|
|
|
- if tools.IsEmpty(row["vol"]) != vol || tools.IsEmpty(row["ied_type"]) != "P" || tools.IsEmpty(row["p_type"]) != pjIed[1:2] {
|
|
|
+ if tools.IsEmpty(row["vol"]) != vol || tools.IsEmpty(row["ied_type"]) != pjIed[0:1] || tools.IsEmpty(row["p_type"]) != pjIed[1:2] {
|
|
|
continue
|
|
|
}
|
|
|
pmIedName := ""
|
|
@@ -1373,23 +1431,26 @@ func (c *CheckAreaMgr) pJ(modelid int, vol, iedtypes string, ieds map[string]orm
|
|
|
}
|
|
|
ins1 := "insert into t_data_check_area_ied(scd_id,area_id,ied_name,ied_type,p_type)values"
|
|
|
insvalues := []string{}
|
|
|
+ pmCode := c.getIedTypeCode(modelid, "PM")
|
|
|
+ mmCode := c.getIedTypeCode(modelid, "MM")
|
|
|
for _, ty := range strings.Split(iedtypes, ",") {
|
|
|
+ tyCode := c.getIedTypeCode(modelid, ty)
|
|
|
inAreaIedName := ""
|
|
|
- if ty == "PM" {
|
|
|
+ if tyCode == pmCode {
|
|
|
//母线保护和母线合并单元装置编号跟随变压器
|
|
|
//查找变压器编号
|
|
|
//1号变压器->2号变压器->3号
|
|
|
inAreaIedName = c.getPMName(iednameParts, ieds)
|
|
|
pmIedName = inAreaIedName
|
|
|
if mmIedName == "" {
|
|
|
- insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, ty[0:1], ty[1:2]))
|
|
|
+ insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, tyCode[0:1], tyCode[1:2]))
|
|
|
pmIedNameParts := scdParseMgr.ParseIedName(pmIedName)
|
|
|
//使用PM装置的名称去定义MM的名称
|
|
|
- ty = "MM"
|
|
|
+ tyCode = "MM"
|
|
|
inAreaIedName = c.getMMName(pmIedNameParts, ieds, iednameParts[7])
|
|
|
mmIedName = inAreaIedName
|
|
|
}
|
|
|
- } else if ty == "MM" {
|
|
|
+ } else if tyCode == mmCode {
|
|
|
if pmIedName != "" && mmIedName == "" {
|
|
|
pmIedNameParts := scdParseMgr.ParseIedName(pmIedName)
|
|
|
//使用PM装置的名称去定义MM的名称
|
|
@@ -1399,15 +1460,15 @@ func (c *CheckAreaMgr) pJ(modelid int, vol, iedtypes string, ieds map[string]orm
|
|
|
continue
|
|
|
}
|
|
|
} else {
|
|
|
- ty = ty[0:1] + pjIed[1:2]
|
|
|
- inAreaIedName = ty + iednameParts[3] + iednameParts[4] + iednameParts[5] + iednameParts[6] + iednameParts[7]
|
|
|
+ tyCode = tyCode[0:1] + pjIed[1:2]
|
|
|
+ inAreaIedName = tyCode + iednameParts[3] + iednameParts[4] + iednameParts[5] + iednameParts[6] + iednameParts[7]
|
|
|
//判断与基准保护装置相同套号的装置是否存在
|
|
|
if ieds[inAreaIedName] == nil {
|
|
|
//尝试去除套号
|
|
|
- inAreaIedName = ty + iednameParts[3] + iednameParts[4] + iednameParts[5] + iednameParts[6]
|
|
|
+ inAreaIedName = tyCode + iednameParts[3] + iednameParts[4] + iednameParts[5] + iednameParts[6]
|
|
|
}
|
|
|
}
|
|
|
- insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, ty[0:1], ty[1:2]))
|
|
|
+ insvalues = append(insvalues, fmt.Sprintf("(%d,%d,'%s','%s','%s')", c.ScdId, newid, inAreaIedName, tyCode[0:1], tyCode[1:2]))
|
|
|
}
|
|
|
_, err = db.Raw(ins1 + strings.Join(insvalues, ",")).Exec()
|
|
|
if err != nil {
|
|
@@ -1420,8 +1481,9 @@ func (c *CheckAreaMgr) pJ(modelid int, vol, iedtypes string, ieds map[string]orm
|
|
|
}
|
|
|
|
|
|
//母联间隔装置关系检查
|
|
|
-func (c *CheckAreaMgr) cJ(scdXmlObj *node_attr.SCL, scdNodeMgr *ScdNode, scdNodeRule *ScdNodeRule, area_name string, ied_refs []orm.Params, area_ieds []orm.Params, pjIed, area_ruleid string) {
|
|
|
-
|
|
|
+func (c *CheckAreaMgr) cJ(modelid string, scdXmlObj *node_attr.SCL, scdNodeMgr *ScdNode, scdNodeRule *ScdNodeRule, area_name string, ied_refs []orm.Params, area_ieds []orm.Params, pjIed, area_ruleid string) {
|
|
|
+ modelidInt, _ := strconv.Atoi(modelid)
|
|
|
+ pjIed = c.getIedTypeCode(modelidInt, pjIed)
|
|
|
masterIed := new(node_attr.NIED)
|
|
|
findIedName := ""
|
|
|
for _, row2 := range area_ieds {
|
|
@@ -1436,8 +1498,8 @@ func (c *CheckAreaMgr) cJ(scdXmlObj *node_attr.SCL, scdNodeMgr *ScdNode, scdNode
|
|
|
}
|
|
|
dealFromIed := map[string]int{}
|
|
|
for _, row := range ied_refs {
|
|
|
- fromiedtype := tools.IsEmpty(row["from_ied_code"])
|
|
|
- toiedtype := tools.IsEmpty(row["to_ied_code"])
|
|
|
+ fromiedtype := c.getIedTypeCode(modelidInt, tools.IsEmpty(row["from_ied_code"]))
|
|
|
+ toiedtype := c.getIedTypeCode(modelidInt, tools.IsEmpty(row["to_ied_code"]))
|
|
|
reftype := tools.IsEmpty(row["in_type"])
|
|
|
tmpFromAreaIeds := []orm.Params{}
|
|
|
tmpToAreaIeds := []orm.Params{}
|
|
@@ -1514,12 +1576,14 @@ func (c *CheckAreaMgr) cJ(scdXmlObj *node_attr.SCL, scdNodeMgr *ScdNode, scdNode
|
|
|
}
|
|
|
|
|
|
//线路间隔装置关系检查
|
|
|
-func (c *CheckAreaMgr) cL(scdXmlObj *node_attr.SCL, scdNodeMgr *ScdNode, scdNodeRule *ScdNodeRule, area_name string, ied_refs []orm.Params, area_ieds []orm.Params, area_ruleid string) {
|
|
|
+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)
|
|
|
+ plIed := c.getIedTypeCode(modelidInt, "PL")
|
|
|
masterIed := new(node_attr.NIED)
|
|
|
findIedName := ""
|
|
|
for _, row2 := range area_ieds {
|
|
|
findIedName = tools.IsEmpty(row2["ied_name"])
|
|
|
- if strings.HasPrefix(findIedName, "PL") {
|
|
|
+ if strings.HasPrefix(findIedName, plIed) {
|
|
|
masterIed = scdNodeMgr.GetIed(scdXmlObj, "", findIedName)
|
|
|
break
|
|
|
}
|
|
@@ -1529,8 +1593,8 @@ func (c *CheckAreaMgr) cL(scdXmlObj *node_attr.SCL, scdNodeMgr *ScdNode, scdNode
|
|
|
}
|
|
|
dealFromIed := map[string]int{}
|
|
|
for _, row := range ied_refs {
|
|
|
- fromiedtype := tools.IsEmpty(row["from_ied_code"])
|
|
|
- toiedtype := tools.IsEmpty(row["to_ied_code"])
|
|
|
+ fromiedtype := c.getIedTypeCode(modelidInt, tools.IsEmpty(row["from_ied_code"]))
|
|
|
+ toiedtype := c.getIedTypeCode(modelidInt, tools.IsEmpty(row["to_ied_code"]))
|
|
|
reftype := tools.IsEmpty(row["in_type"])
|
|
|
tmpFromAreaIeds := []orm.Params{}
|
|
|
tmpToAreaIeds := []orm.Params{}
|
|
@@ -1607,12 +1671,14 @@ func (c *CheckAreaMgr) cL(scdXmlObj *node_attr.SCL, scdNodeMgr *ScdNode, scdNode
|
|
|
}
|
|
|
|
|
|
//变压器间隔装置关系检查
|
|
|
-func (c *CheckAreaMgr) cT(scdXmlObj *node_attr.SCL, scdNodeMgr *ScdNode, scdNodeRule *ScdNodeRule, area_name string, ied_refs []orm.Params, area_ieds []orm.Params, area_ruleid string, HasAreaJ bool) {
|
|
|
+func (c *CheckAreaMgr) cT(modelid string, scdXmlObj *node_attr.SCL, scdNodeMgr *ScdNode, scdNodeRule *ScdNodeRule, area_name string, ied_refs []orm.Params, area_ieds []orm.Params, area_ruleid string, HasAreaJ bool) {
|
|
|
masterIed := new(node_attr.NIED)
|
|
|
findIedName := ""
|
|
|
+ modelidInt, _ := strconv.Atoi(modelid)
|
|
|
+ ptIed := c.getIedTypeCode(modelidInt, "PT")
|
|
|
for _, row2 := range area_ieds {
|
|
|
findIedName = tools.IsEmpty(row2["ied_name"])
|
|
|
- if strings.HasPrefix(findIedName, "PT") {
|
|
|
+ if strings.HasPrefix(findIedName, ptIed) {
|
|
|
masterIed = scdNodeMgr.GetIed(scdXmlObj, "", findIedName)
|
|
|
break
|
|
|
}
|
|
@@ -1623,9 +1689,9 @@ func (c *CheckAreaMgr) cT(scdXmlObj *node_attr.SCL, scdNodeMgr *ScdNode, scdNode
|
|
|
scdParseMgr := new(ScdParse)
|
|
|
dealFromIed := map[string]int{}
|
|
|
for _, row := range ied_refs {
|
|
|
- fromiedtype := tools.IsEmpty(row["from_ied_code"])
|
|
|
- fromiedtype = strings.Split(fromiedtype, "#")[0] //去除后面的电压级别标识
|
|
|
- toiedtype := strings.Split(tools.IsEmpty(row["to_ied_code"]), "#")[0] //去除后面的电压级别标识
|
|
|
+ fromiedtype := c.getIedTypeCode(modelidInt, tools.IsEmpty(row["from_ied_code"]))
|
|
|
+ fromiedtype = strings.Split(fromiedtype, "#")[0] //去除后面的电压级别标识
|
|
|
+ toiedtype := strings.Split(c.getIedTypeCode(modelidInt, tools.IsEmpty(row["to_ied_code"])), "#")[0] //去除后面的电压级别标识
|
|
|
reftype := tools.IsEmpty(row["in_type"])
|
|
|
tmpFromAreaIeds := []orm.Params{}
|
|
|
tmpToAreaIeds := []orm.Params{}
|
|
@@ -1708,7 +1774,7 @@ func (c *CheckAreaMgr) cT(scdXmlObj *node_attr.SCL, scdNodeMgr *ScdNode, scdNode
|
|
|
break
|
|
|
}
|
|
|
}
|
|
|
- if toiedtype != "PT" {
|
|
|
+ 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}
|