namespace IStation
|
{
|
/// <summary>
|
/// 全局辅助类
|
/// </summary>
|
public class GlobalHelper
|
{
|
#region 默认配置
|
|
#region 泵标志
|
|
public readonly static int FlagJD1 = 1;
|
public readonly static int FlagJD2 = 2;
|
public readonly static int FlagJD3 = 3;
|
public readonly static int FlagDN2400 = 2400;
|
public readonly static int FlagDN2700 = 2700;
|
|
public readonly static List<int> Station1PipeFlagList = new List<int>() { FlagJD1, FlagJD2, FlagJD3 };
|
public readonly static List<int> Station2PipeFlagList = new List<int>() { FlagDN2400, FlagDN2700 };
|
|
|
#region 一输
|
|
public readonly static int Flag11 = 11;
|
public readonly static int Flag12 = 12;
|
public readonly static int Flag13 = 13;
|
public readonly static int Flag14 = 14;
|
public readonly static int Flag15 = 15;
|
public readonly static int Flag16 = 16;
|
public readonly static int Flag17 = 17;
|
public readonly static int Flag18 = 18;
|
|
public readonly static List<int> Station1FlagList = new List<int>() { Flag11, Flag12, Flag13, Flag14, Flag15, Flag16, Flag17, Flag18 };
|
public readonly static List<int> Station1SameTypeFlagGroupFirst = new List<int>() { Flag11, Flag12, Flag13, Flag14, Flag16, Flag17, Flag18 };
|
public readonly static List<int> Station1SameTypeFlagGroupSecond = new List<int>() { Flag15 };
|
|
#endregion
|
|
#region 二输
|
|
public readonly static int Flag21 = 21;
|
public readonly static int Flag22 = 22;
|
public readonly static int Flag23 = 23;
|
public readonly static int Flag24 = 24;
|
public readonly static int Flag25 = 25;
|
public readonly static int Flag26 = 26;
|
public readonly static int Flag27 = 27;
|
|
|
|
public readonly static List<int> Station2FlagList = new List<int>() { Flag21, Flag22, Flag23, Flag24, Flag25, Flag26, Flag27 };
|
public readonly static List<int> Station2SameTypeFlagGroupFirst = new List<int>() { Flag22, Flag23, Flag24, Flag25, Flag26 };
|
public readonly static List<int> Station2SameTypeFlagGroupSecond = new List<int>() { Flag21, Flag27 };
|
|
#endregion
|
|
/// <summary>
|
/// 是否变频
|
/// </summary>
|
/// <param name="flag"></param>
|
/// <returns></returns>
|
public static bool IsFrequency(int flag)
|
{
|
if (flag == Flag15 || flag == Flag16)
|
{
|
return false;
|
}
|
return true;
|
}
|
|
/// <summary>
|
/// 是否是1输水
|
/// </summary>
|
/// <param name="flags"></param>
|
/// <returns></returns>
|
public static bool IsStation1(IEnumerable<int> flags)
|
{
|
if (flags == null || !flags.Any())
|
{
|
return false;
|
}
|
var flag = flags.FirstOrDefault();
|
if (!Station1FlagList.Contains(flag))
|
{
|
return false;
|
}
|
return true;
|
}
|
|
/// <summary>
|
/// 是否是2输水
|
/// </summary>
|
/// <param name="flags"></param>
|
/// <returns></returns>
|
public static bool IsStation2(IEnumerable<int> flags)
|
{
|
if (flags == null || !flags.Any())
|
{
|
return false;
|
}
|
var flag = flags.FirstOrDefault();
|
if (!Station2FlagList.Contains(flag))
|
{
|
return false;
|
}
|
return true;
|
}
|
|
#endregion
|
|
#region 监测对接标签
|
|
#region 二取
|
public readonly static string 长江水位 = "10001";
|
public readonly static string 二取前池液位 = "10002";
|
public readonly static string 陈行水库水位 = "10003";
|
|
public readonly static string 二取1泵_有功功率 = "10090";
|
public readonly static string 二取2泵_有功功率 = "10091";
|
public readonly static string 二取3泵_有功功率 = "10092";
|
public readonly static string 二取4泵_有功功率 = "10093";
|
public readonly static string 二取5泵_有功功率 = "10094";
|
|
public readonly static string 二取1泵_出口压力 = "10014";
|
public readonly static string 二取2泵_出口压力 = "10015";
|
public readonly static string 二取3泵_出口压力 = "10016";
|
public readonly static string 二取4泵_出口压力 = "10017";
|
public readonly static string 二取5泵_出口压力 = "10018";
|
|
public readonly static string 二取1泵_水泵_运行状态 = "10072";
|
public readonly static string 二取2泵_水泵_运行状态 = "10073";
|
public readonly static string 二取3泵_水泵_运行状态 = "10074";
|
public readonly static string 二取4泵_水泵_运行状态 = "10075";
|
public readonly static string 二取5泵_水泵_运行状态 = "10076";
|
|
public readonly static string 二取1泵_有功电能 = "10109";
|
public readonly static string 二取2泵_有功电能 = "10110";
|
public readonly static string 二取3泵_有功电能 = "10111";
|
public readonly static string 二取4泵_有功电能 = "10112";
|
public readonly static string 二取5泵_有功电能 = "10113";
|
|
public readonly static string 二取1泵_累计流量 = "10054";
|
public readonly static string 二取2泵_累计流量 = "10055";
|
public readonly static string 二取3泵_累计流量 = "10056";
|
public readonly static string 二取4泵_累计流量 = "10057";
|
public readonly static string 二取5泵_累计流量 = "10058";
|
|
public readonly static string 二取1泵_瞬时流量 = "10034";
|
public readonly static string 二取2泵_瞬时流量 = "10035";
|
public readonly static string 二取3泵_瞬时流量 = "10036";
|
public readonly static string 二取4泵_瞬时流量 = "10037";
|
public readonly static string 二取5泵_瞬时流量 = "10038";
|
|
public readonly static string 二取1泵_累计运行时间 = "10167";
|
public readonly static string 二取2泵_累计运行时间 = "10168";
|
public readonly static string 二取3泵_累计运行时间 = "10169";
|
public readonly static string 二取4泵_累计运行时间 = "10170";
|
public readonly static string 二取5泵_累计运行时间 = "10171";
|
|
public readonly static string 二取1泵_检修状态 = "10191";
|
public readonly static string 二取2泵_检修状态 = "10192";
|
public readonly static string 二取3泵_检修状态 = "10193";
|
public readonly static string 二取4泵_检修状态 = "10194";
|
public readonly static string 二取5泵_检修状态 = "10195";
|
|
public readonly static string 二取1泵_累计运行时间_历史 = "二取水1号主水泵.累计运行时间";
|
public readonly static string 二取2泵_累计运行时间_历史 = "二取水2号主水泵.累计运行时间";
|
public readonly static string 二取3泵_累计运行时间_历史 = "二取水3号主水泵.累计运行时间";
|
public readonly static string 二取4泵_累计运行时间_历史 = "二取水4号主水泵.累计运行时间";
|
public readonly static string 二取5泵_累计运行时间_历史 = "二取水5号主水泵.累计运行时间";
|
|
|
#endregion
|
|
#region 一输
|
|
public readonly static string 嘉定1线_瞬时流量 = "10138";
|
public readonly static string 嘉定2线_瞬时流量 = "10139";
|
public readonly static string 嘉定3线_瞬时流量 = "10140";
|
|
public readonly static string 嘉定1线_瞬时流量_长江管网图 = "10159";
|
public readonly static string 嘉定2线_瞬时流量_长江管网图 = "10160";
|
public readonly static string 嘉定3线_瞬时流量_长江管网图 = "10161";
|
|
public readonly static string 嘉定1线_表头累计 = "10143";
|
public readonly static string 嘉定2线_表头累计 = "10144";
|
public readonly static string 嘉定3线_表头累计 = "10145";
|
|
public readonly static string 嘉定1线_累计流量_长江管网图 = "10164";
|
public readonly static string 嘉定2线_累计流量_长江管网图 = "10165";
|
public readonly static string 嘉定3线_累计流量_长江管网图 = "10166";
|
|
public readonly static string 嘉定1线_压力 = "10128";
|
public readonly static string 嘉定2线_压力 = "10129";
|
public readonly static string 嘉定3线_压力 = "10130";
|
|
public readonly static string 嘉定1线_压力_长江管网图 = "10154";
|
public readonly static string 嘉定2线_压力_长江管网图 = "10155";
|
public readonly static string 嘉定3线_压力_长江管网图 = "10156";
|
|
public readonly static string 一输_老前池南侧液位 = "10011";
|
public readonly static string 一输_老前池北侧液位 = "10012";
|
public readonly static string 一输_新前池液位 = "10013";
|
|
public readonly static string 一输11泵_出口压力 = "10026";
|
public readonly static string 一输12泵_出口压力 = "10027";
|
public readonly static string 一输13泵_出口压力 = "10028";
|
public readonly static string 一输14泵_出口压力 = "10029";
|
public readonly static string 一输15泵_出口压力 = "10030";
|
public readonly static string 一输16泵_出口压力 = "10031";
|
public readonly static string 一输17泵_出口压力 = "10032";
|
public readonly static string 一输18泵_出口压力 = "10033";
|
|
public readonly static string 一输11泵_转速 = "10084";
|
public readonly static string 一输12泵_转速 = "10085";
|
public readonly static string 一输13泵_转速 = "10086";
|
public readonly static string 一输14泵_转速 = "10087";
|
public readonly static string 一输17泵_转速 = "10088";
|
public readonly static string 一输18泵_转速 = "10089";
|
|
public readonly static string 一输11泵_频率 = "10066";
|
public readonly static string 一输12泵_频率 = "10067";
|
public readonly static string 一输13泵_频率 = "10068";
|
public readonly static string 一输14泵_频率 = "10069";
|
public readonly static string 一输17泵_频率 = "10070";
|
public readonly static string 一输18泵_频率 = "10071";
|
|
public readonly static string 一输11泵_运行状态 = "10046";
|
public readonly static string 一输12泵_运行状态 = "10047"; // 10150 is null
|
public readonly static string 一输13泵_运行状态 = "10048";
|
public readonly static string 一输14泵_运行状态 = "10049";
|
public readonly static string 一输15泵_运行状态 = "10050";
|
public readonly static string 一输16泵_运行状态 = "10051";
|
public readonly static string 一输17泵_运行状态 = "10052";
|
public readonly static string 一输18泵_运行状态 = "10053";
|
|
public readonly static string 一输11泵_运行时间 = "10172";
|
public readonly static string 一输12泵_运行时间 = "10173";
|
public readonly static string 一输13泵_运行时间 = "10174";
|
public readonly static string 一输14泵_运行时间 = "10175";
|
|
public readonly static string 一输11泵_累计运行时间 = "10187";
|
public readonly static string 一输12泵_累计运行时间 = "10188";
|
public readonly static string 一输13泵_累计运行时间 = "10189";
|
public readonly static string 一输14泵_累计运行时间 = "10190";
|
public readonly static string 一输15泵_累计运行时间 = "10176";
|
public readonly static string 一输16泵_累计运行时间 = "10177";
|
public readonly static string 一输17泵_累计运行时间 = "10178";
|
public readonly static string 一输18泵_累计运行时间 = "10179";
|
|
public readonly static string 一输11泵_有功功率 = "10101";
|
public readonly static string 一输12泵_有功功率 = "10102";
|
public readonly static string 一输13泵_有功功率 = "10103";
|
public readonly static string 一输14泵_有功功率 = "10104";
|
public readonly static string 一输15泵_有功功率 = "10105";
|
public readonly static string 一输16泵_有功功率 = "10106";
|
public readonly static string 一输17泵_有功功率 = "10107";
|
public readonly static string 一输18泵_有功功率 = "10108";
|
|
public readonly static string 一输11泵_累计运行时间_历史 = "一输水泵11号变频单泵.水泵累计运行时间";
|
public readonly static string 一输12泵_累计运行时间_历史 = "一输水泵12号变频单泵1.水泵运行时间";
|
public readonly static string 一输13泵_累计运行时间_历史 = "一输水泵13号变频单泵.水泵累计运行时间";
|
public readonly static string 一输14泵_累计运行时间_历史 = "一输水泵14号变频单泵.水泵累计运行时间";
|
public readonly static string 一输15泵_累计运行时间_历史 = "HF一输水15号工频控制图.水泵累计运行时间";
|
public readonly static string 一输16泵_累计运行时间_历史 = "HF一输水16号工频控制图.水泵累计运行时间";
|
public readonly static string 一输17泵_累计运行时间_历史 = "一输水泵17号变频单泵.水泵累计运行时间";
|
public readonly static string 一输18泵_累计运行时间_历史 = "一输水泵18号变频单泵.水泵累计运行时间";
|
|
|
//20250213新增
|
//10210 一输水11号辅助设备.三档位切换
|
//10211 一输水12号辅助设备.三档位切换
|
//10212 一输水13号辅助设备.三档位切换
|
//10213 一输水14号辅助设备.三档位切换
|
//10214 一输水15号辅助设备图.三档位切换
|
//10215 一输水16号辅助设备图.三档位切换
|
//10216 一输水17号辅助设备.三档位切换
|
//10217 一输水18号辅助设备.三档位切换
|
public readonly static string 一输11泵_状态 = "10210";
|
public readonly static string 一输12泵_状态 = "10211";
|
public readonly static string 一输13泵_状态 = "10212";
|
public readonly static string 一输14泵_状态 = "10213";
|
public readonly static string 一输15泵_状态 = "10214";
|
public readonly static string 一输16泵_状态 = "10215";
|
public readonly static string 一输17泵_状态 = "10216";
|
public readonly static string 一输18泵_状态 = "10217";
|
|
#endregion
|
|
#region 二输
|
|
public readonly static string DN2400_出厂压力 = "10141";
|
public readonly static string DN2700_出厂压力 = "10142";
|
|
public readonly static string DN2400_出厂压力_长江管网图 = "10152";
|
public readonly static string DN2700_出厂压力_长江管网图 = "10153";
|
|
public readonly static string DN2400总管_瞬时流量 = "10146";
|
public readonly static string DN2700总管_瞬时流量 = "10147";
|
|
public readonly static string DN2400总管_瞬时流量_长江管网图 = "10157";
|
public readonly static string DN2700总管_瞬时流量_长江管网图 = "10158";
|
|
public readonly static string DN2400总管_实际累计流量 = "10148";
|
public readonly static string DN2700总管_实际累计流量 = "10149";
|
|
public readonly static string DN2400总管_累计流量_长江管网图 = "10162";
|
public readonly static string DN2700总管_累计流量_长江管网图 = "10163";
|
|
public readonly static string 二输21泵_泵井液位 = "10004";
|
public readonly static string 二输22泵_泵井液位 = "10005";
|
public readonly static string 二输23泵_泵井液位 = "10006";
|
public readonly static string 二输24泵_泵井液位 = "10007";
|
public readonly static string 二输25泵_泵井液位 = "10008";
|
public readonly static string 二输26泵_泵井液位 = "10009";
|
public readonly static string 二输27泵_泵井液位 = "10010";
|
|
public readonly static string 二输21泵_出水压力 = "10019";
|
public readonly static string 二输22泵_出水压力 = "10020";
|
public readonly static string 二输23泵_出水压力 = "10021";
|
public readonly static string 二输24泵_出水压力 = "10022";
|
public readonly static string 二输25泵_出水压力 = "10023";
|
public readonly static string 二输26泵_出水压力 = "10024";
|
public readonly static string 二输27泵_出水压力 = "10025";
|
|
public readonly static string 二输21泵_瞬时流量 = "10039";
|
public readonly static string 二输22泵_瞬时流量 = "10040";
|
public readonly static string 二输23泵_瞬时流量 = "10041";
|
public readonly static string 二输24泵_瞬时流量 = "10042";
|
public readonly static string 二输25泵_瞬时流量 = "10043";
|
public readonly static string 二输26泵_瞬时流量 = "10044";
|
public readonly static string 二输27泵_瞬时流量 = "10045";
|
|
public readonly static string 二输21泵_累计流量 = "10059";
|
public readonly static string 二输22泵_累计流量 = "10060";
|
public readonly static string 二输23泵_累计流量 = "10061";
|
public readonly static string 二输24泵_累计流量 = "10062";
|
public readonly static string 二输25泵_累计流量 = "10063";
|
public readonly static string 二输26泵_累计流量 = "10064";
|
public readonly static string 二输27泵_累计流量 = "10065";
|
|
public readonly static string 二输21泵_有功电能 = "10131";
|
public readonly static string 二输22泵_有功电能 = "10132";
|
public readonly static string 二输23泵_有功电能 = "10133";
|
public readonly static string 二输24泵_有功电能 = "10134";
|
public readonly static string 二输25泵_有功电能 = "10135";
|
public readonly static string 二输26泵_有功电能 = "10136";
|
public readonly static string 二输27泵_有功电能 = "10137";
|
|
public readonly static string 二输22泵_频率 = "10095";
|
public readonly static string 二输23泵_频率 = "10096";
|
public readonly static string 二输24泵_频率 = "10097";
|
public readonly static string 二输25泵_频率 = "10098";
|
public readonly static string 二输26泵_频率 = "10099";
|
public readonly static string 二输27泵_频率 = "10100";
|
|
public readonly static string 二输21泵_转速 = "10114";
|
public readonly static string 二输22泵_转速 = "10115";
|
public readonly static string 二输23泵_转速 = "10116";
|
public readonly static string 二输24泵_转速 = "10117";
|
public readonly static string 二输25泵_转速 = "10118";
|
public readonly static string 二输26泵_转速 = "10119";
|
public readonly static string 二输27泵_转速 = "10120";
|
|
public readonly static string 二输21泵_有功功率 = "10121";
|
public readonly static string 二输22泵_有功功率 = "10122";
|
public readonly static string 二输23泵_有功功率 = "10123";
|
public readonly static string 二输24泵_有功功率 = "10124";
|
public readonly static string 二输25泵_有功功率 = "10125";
|
public readonly static string 二输26泵_有功功率 = "10126"; // "10151"; is null
|
public readonly static string 二输27泵_有功功率 = "10127";
|
|
public readonly static string 二输21泵_运行状态 = "10077";
|
public readonly static string 二输22泵_运行状态 = "10078";
|
public readonly static string 二输23泵_运行状态 = "10079";
|
public readonly static string 二输24泵_运行状态 = "10080";
|
public readonly static string 二输25泵_运行状态 = "10081";
|
public readonly static string 二输26泵_运行状态 = "10082";
|
public readonly static string 二输27泵_运行状态 = "10083";
|
|
public readonly static string 二输21泵_运行时间 = "10180";
|
public readonly static string 二输22泵_运行时间 = "10181";
|
public readonly static string 二输23泵_运行时间 = "10182";
|
public readonly static string 二输24泵_运行时间 = "10183";
|
public readonly static string 二输25泵_运行时间 = "10184";
|
public readonly static string 二输26泵_运行时间 = "10185";
|
public readonly static string 二输27泵_运行时间 = "10186";
|
|
//public readonly static string 二输21泵_状态 = "10196";
|
//public readonly static string 二输22泵_状态 = "10197";
|
//public readonly static string 二输23泵_状态 = "10198";
|
//public readonly static string 二输24泵_状态 = "10199";
|
//public readonly static string 二输25泵_状态 = "10200";
|
//public readonly static string 二输26泵_状态 = "10201";
|
//public readonly static string 二输27泵_状态 = "10202";
|
//历史版本,20250213变更
|
|
public readonly static string 二输21泵_状态 = "10203";
|
public readonly static string 二输22泵_状态 = "10204";
|
public readonly static string 二输23泵_状态 = "10205";
|
public readonly static string 二输24泵_状态 = "10206";
|
public readonly static string 二输25泵_状态 = "10207";
|
public readonly static string 二输26泵_状态 = "10208";
|
public readonly static string 二输27泵_状态 = "10209";
|
|
public readonly static string 二输21泵_累计运行时间_历史 = "二输水21号水泵运行参数.运行时间";
|
public readonly static string 二输22泵_累计运行时间_历史 = "二输水22号水泵运行参数.运行时间";
|
public readonly static string 二输23泵_累计运行时间_历史 = "二输水23号水泵运行参数.运行时间";
|
public readonly static string 二输24泵_累计运行时间_历史 = "二输水24号水泵运行参数.运行时间";
|
public readonly static string 二输25泵_累计运行时间_历史 = "二输水25号水泵运行参数.运行时间";
|
public readonly static string 二输26泵_累计运行时间_历史 = "二输水26号水泵运行参数.运行时间";
|
public readonly static string 二输27泵_累计运行时间_历史 = "二输水27号水泵运行参数.运行时间";
|
|
#endregion
|
|
#endregion
|
|
#region 泵标志 和 监测对接标签 映射
|
|
/// <summary>
|
/// 泵标志运行状态映射字典 1输水
|
/// </summary>
|
public readonly static Dictionary<int, string> FlagRunStatusMappingDict1 = new() {
|
{Flag11, 一输11泵_运行状态},
|
{Flag12, 一输12泵_运行状态},
|
{Flag13, 一输13泵_运行状态},
|
{Flag14, 一输14泵_运行状态},
|
{Flag15, 一输15泵_运行状态},
|
{Flag16, 一输16泵_运行状态},
|
{Flag17, 一输17泵_运行状态},
|
{Flag18, 一输18泵_运行状态}
|
};
|
|
/// <summary>
|
/// 泵标志运行状态映射字典 2输水
|
/// </summary>
|
public readonly static Dictionary<int, string> FlagRunStatusMappingDict2 = new() {
|
{Flag21, 二输21泵_运行状态},
|
{Flag22, 二输22泵_运行状态},
|
{Flag23, 二输23泵_运行状态},
|
{Flag24, 二输24泵_运行状态},
|
{Flag25, 二输25泵_运行状态},
|
{Flag26, 二输26泵_运行状态},
|
{Flag27, 二输27泵_运行状态}
|
};
|
|
/// <summary>
|
/// 泵标志进口水位映射字典 1输水
|
/// </summary>
|
public readonly static Dictionary<int, string> FlagInletWaterLevelMappingDict1 = new() {
|
{Flag11, 一输_老前池南侧液位},
|
{Flag12, 一输_老前池南侧液位},
|
{Flag13, 一输_老前池南侧液位},
|
{Flag14, 一输_老前池北侧液位},
|
{Flag15, 一输_老前池北侧液位},
|
{Flag16, 一输_新前池液位},
|
{Flag17, 一输_新前池液位},
|
{Flag18, 一输_新前池液位}
|
};
|
|
/// <summary>
|
/// 泵标志进口水位映射字典 2输水
|
/// </summary>
|
public readonly static Dictionary<int, string> FlagInletWaterLevelMappingDict2 = new() {
|
{Flag21, 二输21泵_泵井液位},
|
{Flag22, 二输22泵_泵井液位},
|
{Flag23, 二输23泵_泵井液位},
|
{Flag24, 二输24泵_泵井液位},
|
{Flag25, 二输25泵_泵井液位},
|
{Flag26, 二输26泵_泵井液位},
|
{Flag27, 二输27泵_泵井液位}
|
};
|
|
/// <summary>
|
/// 泵标志出口压力映射字典 1输水
|
/// </summary>
|
public readonly static Dictionary<int, string> FlagOutletPressureMappingDict1 = new() {
|
{Flag11, 一输11泵_出口压力},
|
{Flag12, 一输12泵_出口压力},
|
{Flag13, 一输13泵_出口压力},
|
{Flag14, 一输14泵_出口压力},
|
{Flag15, 一输15泵_出口压力},
|
{Flag16, 一输16泵_出口压力},
|
{Flag17, 一输17泵_出口压力},
|
{Flag18, 一输18泵_出口压力}
|
};
|
|
/// <summary>
|
/// 泵标志出口压力映射字典 2输水
|
/// </summary>
|
public readonly static Dictionary<int, string> FlagOutletPressureMappingDict2 = new() {
|
{Flag21, 二输21泵_出水压力},
|
{Flag22, 二输22泵_出水压力},
|
{Flag23, 二输23泵_出水压力},
|
{Flag24, 二输24泵_出水压力},
|
{Flag25, 二输25泵_出水压力},
|
{Flag26, 二输26泵_出水压力},
|
{Flag27, 二输27泵_出水压力}
|
};
|
|
/// <summary>
|
/// 泵标志出口压力映射字典 2输水
|
/// </summary>
|
public readonly static Dictionary<int, string> FlagOutletFlowMappingDict2 = new() {
|
{Flag21, 二输21泵_瞬时流量},
|
{Flag22, 二输22泵_瞬时流量},
|
{Flag23, 二输23泵_瞬时流量},
|
{Flag24, 二输24泵_瞬时流量},
|
{Flag25, 二输25泵_瞬时流量},
|
{Flag26, 二输26泵_瞬时流量},
|
{Flag27, 二输27泵_瞬时流量}
|
};
|
|
/// <summary>
|
/// 泵标志转速映射字典 1输水
|
/// </summary>
|
public readonly static Dictionary<int, string> FlagNrMappingDict1 = new() {
|
{Flag11, 一输11泵_转速},
|
{Flag12, 一输12泵_转速},
|
{Flag13, 一输13泵_转速},
|
{Flag14, 一输14泵_转速},
|
{Flag15, 一输15泵_运行状态},
|
{Flag16, 一输16泵_运行状态},
|
{Flag17, 一输17泵_转速},
|
{Flag18, 一输18泵_转速}
|
};
|
|
/// <summary>
|
/// 泵标志转速映射字典 2输水
|
/// </summary>
|
public readonly static Dictionary<int, string> FlagNrMappingDict2 = new() {
|
{Flag21, 二输21泵_转速},
|
{Flag22, 二输22泵_转速},
|
{Flag23, 二输23泵_转速},
|
{Flag24, 二输24泵_转速},
|
{Flag25, 二输25泵_转速},
|
{Flag26, 二输26泵_转速},
|
{Flag27, 二输27泵_转速}
|
};
|
|
/// <summary>
|
/// 泵标志状态映射字典 1输水
|
/// </summary>
|
public readonly static Dictionary<int, string> FlagStateMappingDict1 = new() {
|
{Flag11, 一输11泵_状态},
|
{Flag12, 一输12泵_状态},
|
{Flag13, 一输13泵_状态},
|
{Flag14, 一输14泵_状态},
|
{Flag15, 一输15泵_状态},
|
{Flag16, 一输16泵_状态},
|
{Flag17, 一输17泵_状态},
|
{Flag18, 一输18泵_状态}
|
};
|
|
/// <summary>
|
/// 泵标志状态映射字典 2输水
|
/// </summary>
|
public readonly static Dictionary<int, string> FlagStateMappingDict2 = new() {
|
{Flag21, 二输21泵_状态},
|
{Flag22, 二输22泵_状态},
|
{Flag23, 二输23泵_状态},
|
{Flag24, 二输24泵_状态},
|
{Flag25, 二输25泵_状态},
|
{Flag26, 二输26泵_状态},
|
{Flag27, 二输27泵_状态}
|
};
|
|
/// <summary>
|
/// 泵标志累计时间映射字典 1输水 (分钟单位)
|
/// </summary>
|
public readonly static Dictionary<string, int> FlagCumulativeRuntimeMappingDict1 = new() {
|
{一输11泵_累计运行时间_历史,Flag11},
|
{一输12泵_累计运行时间_历史,Flag12},
|
{一输13泵_累计运行时间_历史,Flag13},
|
{一输14泵_累计运行时间_历史,Flag14},
|
{一输15泵_累计运行时间_历史,Flag15},
|
{一输16泵_累计运行时间_历史,Flag16},
|
{一输17泵_累计运行时间_历史,Flag17},
|
{一输18泵_累计运行时间_历史,Flag18}
|
};
|
|
/// <summary>
|
/// 泵标志累计时间映射字典 2输水 (小时单位)
|
/// </summary>
|
public readonly static Dictionary<string, int> FlagCumulativeRuntimeMappingDict2 = new() {
|
{二输21泵_累计运行时间_历史,Flag21},
|
{二输22泵_累计运行时间_历史,Flag22},
|
{二输23泵_累计运行时间_历史,Flag23},
|
{二输24泵_累计运行时间_历史,Flag24},
|
{二输25泵_累计运行时间_历史,Flag25},
|
{二输26泵_累计运行时间_历史,Flag26},
|
{二输27泵_累计运行时间_历史,Flag27}
|
};
|
|
#endregion
|
|
#region 模型映射
|
|
/// <summary>
|
/// 模型流量点映射字典
|
/// </summary>
|
public readonly static Dictionary<string, string> ModelFlowIdMappingDict = new(){
|
{ "Pjd1", 嘉定1线_瞬时流量_长江管网图},
|
{ "Pjd2", 嘉定2线_瞬时流量_长江管网图},
|
{ "Pjd3", 嘉定3线_瞬时流量_长江管网图},
|
{ "Pdn2400", DN2400总管_瞬时流量_长江管网图},
|
{ "Pdn2700", DN2700总管_瞬时流量_长江管网图},
|
{ "Ppump21", 二输21泵_瞬时流量},
|
{ "Ppump22", 二输22泵_瞬时流量},
|
{ "Ppump23", 二输23泵_瞬时流量},
|
{ "Ppump24", 二输24泵_瞬时流量},
|
{ "Ppump25", 二输25泵_瞬时流量},
|
{ "Ppump26", 二输26泵_瞬时流量},
|
{ "Ppump27", 二输27泵_瞬时流量}
|
};
|
|
/// <summary>
|
/// 模型压力点映射字典
|
/// </summary>
|
public readonly static Dictionary<string, string> ModelPressureIdMappingDict = new() {
|
{ "Jjd1", 嘉定1线_压力_长江管网图},
|
{ "Jjd2", 嘉定2线_压力_长江管网图},
|
{ "Jjd3", 嘉定3线_压力_长江管网图},
|
{ "Jpump11", 一输11泵_出口压力},
|
{ "Jpump12", 一输12泵_出口压力},
|
{ "Jpump13", 一输13泵_出口压力},
|
{ "Jpump14", 一输14泵_出口压力},
|
{ "Jpump15", 一输15泵_出口压力},
|
{ "Jpump16", 一输16泵_出口压力},
|
{ "Jpump17", 一输17泵_出口压力},
|
{ "Jpump18", 一输18泵_出口压力},
|
{ "Jdn2400", DN2400_出厂压力_长江管网图},
|
{ "Jdn2700", DN2700_出厂压力_长江管网图},
|
{ "Jpump21", 二输21泵_出水压力},
|
{ "Jpump22", 二输22泵_出水压力},
|
{ "Jpump23", 二输23泵_出水压力},
|
{ "Jpump24", 二输24泵_出水压力},
|
{ "Jpump25", 二输25泵_出水压力},
|
{ "Jpump26", 二输26泵_出水压力},
|
{ "Jpump27", 二输27泵_出水压力}
|
};
|
|
/// <summary>
|
/// 模型模式点映射字典
|
/// </summary>
|
public readonly static Dictionary<string, string> ModelPatternIdMappingDict = new() {
|
{"Pump11", 一输11泵_转速},
|
{"Pump12", 一输12泵_转速},
|
{"Pump13", 一输13泵_转速},
|
{"Pump14", 一输14泵_转速},
|
{"Pump15", 一输15泵_运行状态},
|
{"Pump16", 一输16泵_运行状态},
|
{"Pump17", 一输17泵_转速},
|
{"Pump18", 一输18泵_转速},
|
{"R3", 一输_老前池南侧液位},
|
{"R2", 一输_老前池北侧液位 },
|
{"R1", 一输_新前池液位},
|
{"SFJD1", 嘉定1线_瞬时流量_长江管网图},
|
{"SFJD2", 嘉定2线_瞬时流量_长江管网图},
|
{"SFJD3", 嘉定3线_瞬时流量_长江管网图},
|
{"RPump21", 二输21泵_泵井液位},
|
{"RPump22", 二输22泵_泵井液位},
|
{"RPump23", 二输23泵_泵井液位},
|
{"RPump24", 二输24泵_泵井液位},
|
{"RPump25", 二输25泵_泵井液位},
|
{"RPump26", 二输26泵_泵井液位},
|
{"RPump27", 二输27泵_泵井液位},
|
{"SFPump21", 二输21泵_瞬时流量},
|
{"SFPump22", 二输22泵_瞬时流量},
|
{"SFPump23", 二输23泵_瞬时流量},
|
{"SFPump24", 二输24泵_瞬时流量},
|
{"SFPump25", 二输25泵_瞬时流量},
|
{"SFPump26", 二输26泵_瞬时流量},
|
{"SFPump27", 二输27泵_瞬时流量},
|
{"Pump21", 二输21泵_转速},
|
{"Pump22", 二输22泵_转速},
|
{"Pump23", 二输23泵_转速},
|
{"Pump24", 二输24泵_转速},
|
{"Pump25", 二输25泵_转速},
|
{"Pump26", 二输26泵_转速},
|
{"Pump27", 二输27泵_转速},
|
{"SFDN2400", DN2400总管_瞬时流量_长江管网图},
|
{"SFDN2700", DN2700总管_瞬时流量_长江管网图}
|
};
|
|
/// <summary>
|
/// 模型压力点(kPa)列表
|
/// </summary>
|
public readonly static List<string> ModelPressureIdkPaList = new()
|
{
|
嘉定1线_压力,
|
嘉定2线_压力,
|
嘉定3线_压力,
|
嘉定1线_压力_长江管网图,
|
嘉定2线_压力_长江管网图,
|
嘉定3线_压力_长江管网图,
|
一输11泵_出口压力,
|
一输12泵_出口压力,
|
一输13泵_出口压力,
|
一输14泵_出口压力,
|
一输15泵_出口压力,
|
一输16泵_出口压力,
|
一输17泵_出口压力,
|
一输18泵_出口压力
|
};
|
|
/// <summary>
|
/// 模型泵转速字典
|
/// </summary>
|
public static readonly Dictionary<string, double> ModelPumpNrDict = new() {
|
{ "Pump11",590},
|
{ "Pump12",590},
|
{ "Pump13",590},
|
{ "Pump14",590},
|
{ "Pump15",590},
|
{ "Pump16",590},
|
{ "Pump17",590},
|
{ "Pump18",590},
|
{ "Pump21",740},
|
{ "Pump22",495},
|
{ "Pump23",495},
|
{ "Pump24",495},
|
{ "Pump25",495},
|
{ "Pump26",495},
|
{ "Pump27",740}
|
};
|
|
/// <summary>
|
/// 模型泵标识映射字典
|
/// </summary>
|
public static readonly Dictionary<int, string> ModelPumpIdMappingDict = new() {
|
{ Flag11,"Pump11"},
|
{ Flag12,"Pump12"},
|
{ Flag13,"Pump13"},
|
{ Flag14,"Pump14"},
|
{ Flag15,"Pump15"},
|
{ Flag16,"Pump16"},
|
{ Flag17,"Pump17"},
|
{ Flag18,"Pump18"},
|
|
{ Flag21,"Pump21"},
|
{ Flag22,"Pump22"},
|
{ Flag23,"Pump23"},
|
{ Flag24,"Pump24"},
|
{ Flag25,"Pump25"},
|
{ Flag26,"Pump26"},
|
{ Flag27,"Pump27"}
|
};
|
|
|
/// <summary>
|
/// 模型泵标识列表
|
/// </summary>
|
public static readonly List<string> ModelPumpIdList = new() {
|
"Pump11" ,
|
"Pump12" ,
|
"Pump13" ,
|
"Pump14" ,
|
"Pump15" ,
|
"Pump16" ,
|
"Pump17" ,
|
"Pump18" ,
|
"Pump21" ,
|
"Pump22" ,
|
"Pump23" ,
|
"Pump24" ,
|
"Pump25" ,
|
"Pump26" ,
|
"Pump27"
|
};
|
|
/// <summary>
|
/// 模型模式标识列表
|
/// </summary>
|
public static readonly List<string> ModelPatternIdList=new()
|
{
|
"Pump11",
|
"Pump12",
|
"Pump13",
|
"Pump14",
|
"Pump15",
|
"Pump16",
|
"Pump17",
|
"Pump18",
|
"R3",
|
"R2",
|
"R1",
|
"SFJD1",
|
"SFJD2",
|
"SFJD3",
|
"RPump21",
|
"RPump22",
|
"RPump23",
|
"RPump24",
|
"RPump25",
|
"RPump26",
|
"RPump27",
|
"SFPump21",
|
"SFPump22",
|
"SFPump23",
|
"SFPump24",
|
"SFPump25",
|
"SFPump26",
|
"SFPump27",
|
"Pump21",
|
"Pump22",
|
"Pump23",
|
"Pump24",
|
"Pump25",
|
"Pump26",
|
"Pump27",
|
"SFDN2400",
|
"SFDN2700",
|
};
|
|
#endregion
|
|
#endregion
|
|
#region 获取 配置字典
|
|
/// <summary>
|
/// 获取 泵标志运行状态映射字典
|
/// </summary>
|
public static Dictionary<int, string> GetFlagRunStatusMappingDict()
|
{
|
var flag_run_status_mapping_dict = new Dictionary<int, string>();
|
foreach (var item in FlagRunStatusMappingDict1)
|
{
|
flag_run_status_mapping_dict.Add(item.Key, item.Value);
|
}
|
foreach (var item in FlagRunStatusMappingDict2)
|
{
|
flag_run_status_mapping_dict.Add(item.Key, item.Value);
|
}
|
|
return flag_run_status_mapping_dict;
|
}
|
|
/// <summary>
|
/// 获取 泵标志转速映射字典
|
/// </summary>
|
public static Dictionary<int, string> GetFlagNrMappingDict()
|
{
|
var flag_nr_mapping_dict = new Dictionary<int, string>();
|
foreach (var item in FlagNrMappingDict1)
|
{
|
flag_nr_mapping_dict.Add(item.Key, item.Value);
|
}
|
foreach (var item in FlagNrMappingDict2)
|
{
|
flag_nr_mapping_dict.Add(item.Key, item.Value);
|
}
|
|
return flag_nr_mapping_dict;
|
}
|
|
#endregion
|
|
#region 获取实时Scada
|
|
/// <summary>
|
/// 众毅实时数据
|
/// </summary>
|
public class ZyRealTimeDataDto
|
{
|
|
/// <summary>
|
///
|
/// </summary>
|
public string msg { get; set; }
|
|
/// <summary>
|
///
|
/// </summary>
|
public Dictionary<string, Dictionary<string, string>> data { get; set; }
|
|
/// <summary>
|
///
|
/// </summary>
|
public int status { get; set; }
|
}
|
|
/// <summary>
|
/// 获取监测数据列表
|
/// </summary>
|
public static string GetMonitorRecordList(DateTime receipt_time, out List<Model.MonitorRecord> monitor_record_list, bool use_debug = false)
|
{
|
var now= DateTime.Now;
|
monitor_record_list = new List<Model.MonitorRecord>();
|
if (!Settings.ParasHelper.ZyDocking.Enable)
|
{
|
if (use_debug)
|
{
|
var debug_monitor_record_file = Settings.ParasHelper.LocalFile.DataFolderDirectory + "\\" + "monitor_record_debug.txt";
|
if (File.Exists(debug_monitor_record_file))
|
{
|
var debug_monitor_record_json = File.ReadAllText(debug_monitor_record_file);
|
var dto = JsonHelper.Json2Object<ZyRealTimeDataDto>(debug_monitor_record_json);
|
if (dto == null)
|
{
|
monitor_record_list = JsonHelper.Json2Object<List<Model.MonitorRecord>>(debug_monitor_record_json);
|
}
|
else
|
{
|
monitor_record_list = ConvertMonitorRecordList(receipt_time,dto?.data);
|
}
|
}
|
}
|
return "ZyDocking 未启用";
|
}
|
|
var url = Settings.ParasHelper.ZyDocking.RealTimeScadaHttpUrl;
|
if (string.IsNullOrEmpty(url))
|
{
|
return "RealTimeScadaHttpUrl 为空";
|
}
|
|
try
|
{
|
var response_text = Yw.Untity.HttpRequestHelper.Get(url);
|
var dto = JsonHelper.Json2Object<ZyRealTimeDataDto>(response_text);
|
var data = dto?.data;
|
if (dto.data == null || !dto.data.Any())
|
{
|
return "response_text 解析失败!";
|
}
|
monitor_record_list = ConvertMonitorRecordList(receipt_time,dto.data);
|
}
|
catch (System.Exception ex)
|
{
|
return ex.Message;
|
}
|
if (!monitor_record_list.Any())
|
{
|
return "monitor_record_list 无数据";
|
}
|
|
return string.Empty;
|
}
|
|
|
|
/// <summary>
|
/// 转换实时监测数据列表
|
/// </summary>
|
/// <param name="receipt_time"></param>
|
/// <param name="data"></param>
|
/// <returns></returns>
|
private static List<Model.MonitorRecord> ConvertMonitorRecordList(DateTime receipt_time, Dictionary<string, Dictionary<string, string>> data)
|
{
|
if (data == null || !data.Any())
|
return default;
|
var monitor_record_list = new List<Model.MonitorRecord>();
|
foreach (var item in data)
|
{
|
var monitor_record = new Model.MonitorRecord();
|
monitor_record.DataCode = item.Key;
|
if (DateTime.TryParse(item.Value["time"], out DateTime t))
|
monitor_record.DataTime = t;
|
if (double.TryParse(item.Value["vals"], out double v))
|
monitor_record.DataValue = v;
|
monitor_record.ReceiptTime = receipt_time;
|
monitor_record_list.Add(monitor_record);
|
}
|
return monitor_record_list;
|
}
|
|
|
#endregion
|
|
#region 获取历史Scada
|
|
/// <summary>
|
/// 众毅历史数据
|
/// </summary>
|
public class ZyHistoryDataDto
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public string msg { get; set; }
|
|
/// <summary>
|
///
|
/// </summary>
|
public List<ZyDataDto> data { get; set; }
|
|
/// <summary>
|
///
|
/// </summary>
|
public string status { get; set; }
|
}
|
|
/// <summary>
|
/// 众毅历史数据 data
|
/// </summary>
|
public class ZyDataDto
|
{
|
/// <summary>
|
///
|
/// </summary>
|
public string dataMsg { get; set; }
|
|
/// <summary>
|
///
|
/// </summary>
|
public List<string[]> vals { get; set; }
|
|
/// <summary>
|
///
|
/// </summary>
|
public string tagName { get; set; }
|
}
|
|
/// <summary>
|
/// 获取泵累计运行时间(小时)字典
|
/// </summary>
|
/// <param name="receipt_time">接收时间</param>
|
/// <param name="station1_flag_cumulative_run_time_dict"></param>
|
/// <param name="station2_flag_cumulative_run_time_dict"></param>
|
/// <param name="date_interval">统计日期间隔(天)</param>
|
/// <param name="frequency">数据步长 1h(s:秒 m:分 h:小时 d:天)</param>
|
/// <param name="type">数据值类型 first:每个间隔的第一个值 mean:每个间隔的平均值</param>
|
/// <returns></returns>
|
public static string GetFlagCumulativeRuntimeDict(DateTime receipt_time, out Dictionary<int, double> station1_flag_cumulative_run_time_dict, out Dictionary<int, double> station2_flag_cumulative_run_time_dict, int date_interval = 30, string frequency = "1h", string type = "first")
|
{
|
station1_flag_cumulative_run_time_dict = new Dictionary<int, double>();
|
foreach (var flag in Station1FlagList)
|
{
|
station1_flag_cumulative_run_time_dict.Add(flag, 0);
|
}
|
station2_flag_cumulative_run_time_dict = new Dictionary<int, double>();
|
foreach (var flag in Station2FlagList)
|
{
|
station2_flag_cumulative_run_time_dict.Add(flag, 0);
|
}
|
|
if (!Settings.ParasHelper.ZyDocking.Enable)
|
{
|
return "ZyDocking 未启用";
|
}
|
|
var url_prefix = Settings.ParasHelper.ZyDocking.HistoryScadaHttpUrl;
|
if (string.IsNullOrEmpty(url_prefix))
|
{
|
return "HistoryScadaHttpUrl 为空";
|
}
|
|
var enter_time_format = "yyyy-MM-dd HH:mm:ss";
|
var travel_time_format = new System.Globalization.DateTimeFormatInfo()
|
{
|
ShortDatePattern = "yyyy-MM-dd'T'HH:mm:ss.SSS Z"
|
};
|
|
var now_dt = DateTime.Now;
|
var start_dt = now_dt.AddDays(-date_interval);
|
var end_dt = now_dt;
|
|
var start_time = start_dt.ToString(enter_time_format);
|
var end_time = end_dt.ToString(enter_time_format);
|
|
var tag_list = new List<string>();
|
tag_list.AddRange(FlagCumulativeRuntimeMappingDict1.Keys);
|
tag_list.AddRange(FlagCumulativeRuntimeMappingDict2.Keys);
|
|
var measurement_max_count = 5;
|
var measurements_list = new List<string>();
|
for (int i = 0; i < tag_list.Count; i += measurement_max_count)
|
{
|
var tag_list_temp = tag_list.Skip(i).Take(measurement_max_count).ToList();
|
var measurements = Yw.Untity.StringListHelper.ToString(tag_list_temp);
|
measurements_list.Add(measurements);
|
}
|
|
var log_str_builder = new StringBuilder();
|
var monitor_record_list_dict = new Dictionary<string, List<Model.MonitorRecord>>();
|
try
|
{
|
foreach (var measurements in measurements_list)
|
{
|
var url = $"{url_prefix}?" +
|
$"startTime={start_time}&" +
|
$"endTime={end_time}&" +
|
$"type={type}&" +
|
$"frequency={frequency}&" +
|
$"measurements={measurements}";
|
|
log_str_builder.AppendLine($"历史数据请求:{url}");
|
var response_text = Yw.Untity.HttpRequestHelper.Get(url);
|
var dto = JsonHelper.Json2Object<ZyHistoryDataDto>(response_text);
|
var zy_dada_dto_list = dto?.data;
|
if (zy_dada_dto_list == null || !zy_dada_dto_list.Any())
|
{
|
log_str_builder.AppendLine("无数据");
|
continue;
|
}
|
|
Yw.LogHelper.Debug(log_str_builder.ToString());
|
Yw.LogHelper.Debug(response_text);
|
|
foreach (var zy_dada_dto in zy_dada_dto_list)
|
{
|
var tag = zy_dada_dto.tagName;
|
var vlus = zy_dada_dto.vals;
|
|
var monitor_record_list = new List<Model.MonitorRecord>();
|
foreach (var vlu in vlus)
|
{
|
var time_str = vlu[0];
|
var value_str = vlu[1];
|
if (!double.TryParse(value_str, out double value))
|
continue;
|
var time = Convert.ToDateTime(time_str, travel_time_format).AddHours(-8);
|
var monitor_record = new Model.MonitorRecord();
|
monitor_record.DataTime = time;
|
monitor_record.DataCode = tag;
|
monitor_record.DataValue = value;
|
monitor_record.ReceiptTime = receipt_time;
|
monitor_record_list.Add(monitor_record);
|
}
|
monitor_record_list_dict.Add(tag, monitor_record_list);
|
}
|
}
|
}
|
catch (System.Exception ex)
|
{
|
log_str_builder.AppendLine(ex.Message);
|
}
|
|
foreach (var item in monitor_record_list_dict)
|
{
|
var tag = item.Key;
|
var monitor_record_list = item.Value;
|
if (monitor_record_list == null || !monitor_record_list.Any())
|
{
|
continue;
|
}
|
var min_time = monitor_record_list.Min(x => x.DataValue);
|
var max_time = monitor_record_list.Max(x => x.DataValue);
|
var run_time = max_time - min_time ?? 0;
|
if (FlagCumulativeRuntimeMappingDict1.ContainsKey(tag))
|
{
|
var flag = FlagCumulativeRuntimeMappingDict1[tag];
|
var time = Math.Round(run_time / 60, 1);
|
|
station1_flag_cumulative_run_time_dict[flag] = time;
|
}
|
else if (FlagCumulativeRuntimeMappingDict2.ContainsKey(tag))
|
{
|
var flag = FlagCumulativeRuntimeMappingDict2[tag];
|
var time = Math.Round(run_time, 1);
|
|
station2_flag_cumulative_run_time_dict[flag] = time;
|
}
|
}
|
|
return log_str_builder.ToString();
|
}
|
|
#endregion
|
|
#region 获取调度算法入参
|
|
/// <summary>
|
/// 获取泵站运行标志列表
|
/// </summary>
|
/// <param name="monitor_record_list">监测列表</param>
|
/// <param name="station1_open_flag_list">运行标志列表 1输水</param>
|
/// <param name="station2_open_flag_list">运行标志列表 2输水</param>
|
public static void GetStationOpenFlagList(List<Model.MonitorRecord> monitor_record_list, out List<int> station1_open_flag_list, out List<int> station2_open_flag_list)
|
{
|
station1_open_flag_list = new List<int>();
|
station2_open_flag_list = new List<int>();
|
if (monitor_record_list == null || !monitor_record_list.Any())
|
return;
|
foreach (var mapping in FlagRunStatusMappingDict1)
|
{
|
var flag = mapping.Key;
|
var code = mapping.Value;
|
var monitor_record = monitor_record_list.Find(x => x.DataCode == code);
|
if (monitor_record != null && monitor_record.DataValue == 1)
|
{
|
station1_open_flag_list.Add(flag);
|
}
|
}
|
|
foreach (var mapping in FlagRunStatusMappingDict2)
|
{
|
var flag = mapping.Key;
|
var code = mapping.Value;
|
var monitor_record = monitor_record_list.Find(x => x.DataCode == code);
|
if (monitor_record != null && monitor_record.DataValue == 1)
|
{
|
station2_open_flag_list.Add(flag);
|
}
|
}
|
|
}
|
|
/// <summary>
|
/// 获取泵进口水位字典
|
/// </summary>
|
/// <param name="monitor_record_list">监测列表</param>
|
/// <param name="station1_flag_inlet_water_level_dict">泵进口水位字典 1输水</param>
|
/// <param name="station2_flag_inlet_water_level_dict">泵进口水位字典 2输水</param>
|
public static void GetFlagInletWaterLevelDict(List<Model.MonitorRecord> monitor_record_list, out Dictionary<int, double> station1_flag_inlet_water_level_dict, out Dictionary<int, double> station2_flag_inlet_water_level_dict)
|
{
|
station1_flag_inlet_water_level_dict = new Dictionary<int, double>();
|
station2_flag_inlet_water_level_dict = new Dictionary<int, double>();
|
|
foreach (var mapping in FlagInletWaterLevelMappingDict1)
|
{
|
var flag = mapping.Key;
|
var code = mapping.Value;
|
var water_level = 0d;
|
|
var water_level_monitor_record = monitor_record_list?.Find(x => x.DataCode == code);
|
if (water_level_monitor_record != null)
|
{
|
water_level = water_level_monitor_record.DataValue ?? 0;
|
}
|
|
station1_flag_inlet_water_level_dict.Add(flag, water_level);
|
}
|
|
foreach (var mapping in FlagInletWaterLevelMappingDict2)
|
{
|
var flag = mapping.Key;
|
var code = mapping.Value;
|
var water_level = 0d;
|
|
var water_level_monitor_record = monitor_record_list?.Find(x => x.DataCode == code);
|
if (water_level_monitor_record != null)
|
{
|
water_level = water_level_monitor_record.DataValue ?? 0;
|
}
|
|
station2_flag_inlet_water_level_dict.Add(flag, water_level);
|
}
|
}
|
|
/// <summary>
|
/// 获取泵流量和压力
|
/// </summary>
|
/// <param name="monitor_record_list"></param>
|
/// <param name="station1_flag_rpm_pressure_dict"></param>
|
/// <param name="station2_flag_rpm_flow_pressure_dict"></param>
|
public static void GetFlagRpmAndFlowAndPressureDict(
|
List<Model.MonitorRecord> monitor_record_list,
|
out Dictionary<int, Tuple<double?, double?>> station1_flag_rpm_pressure_dict,
|
out Dictionary<int, Tuple<double?, double?, double?>> station2_flag_rpm_flow_pressure_dict)
|
{
|
station1_flag_rpm_pressure_dict = new Dictionary<int, Tuple<double?, double?>>();
|
station2_flag_rpm_flow_pressure_dict = new Dictionary<int, Tuple<double?, double?, double?>>();
|
|
if (monitor_record_list == null || !monitor_record_list.Any())
|
{
|
return;
|
}
|
|
var record_dict = monitor_record_list.ToDictionary(x => x.DataCode, y => y.DataValue);
|
|
#region 1
|
|
var pump11_run_status = record_dict[GlobalHelper.一输11泵_运行状态];
|
var pump12_run_status = record_dict[GlobalHelper.一输12泵_运行状态];
|
var pump13_run_status = record_dict[GlobalHelper.一输13泵_运行状态];
|
var pump14_run_status = record_dict[GlobalHelper.一输14泵_运行状态];
|
var pump15_run_status = record_dict[GlobalHelper.一输15泵_运行状态];
|
var pump16_run_status = record_dict[GlobalHelper.一输16泵_运行状态];
|
var pump17_run_status = record_dict[GlobalHelper.一输17泵_运行状态];
|
var pump18_run_status = record_dict[GlobalHelper.一输18泵_运行状态];
|
|
var pump11_wl = record_dict[GlobalHelper.一输_老前池南侧液位];
|
var pump12_wl = record_dict[GlobalHelper.一输_老前池南侧液位];
|
var pump13_wl = record_dict[GlobalHelper.一输_老前池南侧液位];
|
var pump14_wl = record_dict[GlobalHelper.一输_老前池北侧液位];
|
var pump15_wl = record_dict[GlobalHelper.一输_老前池北侧液位];
|
var pump16_wl = record_dict[GlobalHelper.一输_新前池液位];
|
var pump17_wl = record_dict[GlobalHelper.一输_新前池液位];
|
var pump18_wl = record_dict[GlobalHelper.一输_新前池液位];
|
|
|
var pump11_pressure = record_dict[GlobalHelper.一输11泵_出口压力] / 1000;
|
var pump12_pressure = record_dict[GlobalHelper.一输12泵_出口压力] / 1000;
|
var pump13_pressure = record_dict[GlobalHelper.一输13泵_出口压力] / 1000;
|
var pump14_pressure = record_dict[GlobalHelper.一输14泵_出口压力] / 1000;
|
var pump15_pressure = record_dict[GlobalHelper.一输15泵_出口压力] / 1000;
|
var pump16_pressure = record_dict[GlobalHelper.一输16泵_出口压力] / 1000;
|
var pump17_pressure = record_dict[GlobalHelper.一输17泵_出口压力] / 1000;
|
var pump18_pressure = record_dict[GlobalHelper.一输18泵_出口压力] / 1000;
|
|
var pump11_rpm = record_dict[GlobalHelper.一输11泵_转速];
|
var pump12_rpm = record_dict[GlobalHelper.一输12泵_转速];
|
var pump13_rpm = record_dict[GlobalHelper.一输13泵_转速];
|
var pump14_rpm = record_dict[GlobalHelper.一输14泵_转速];
|
var pump15_rpm = pump15_run_status == 1 ? 590 : 0;
|
var pump16_rpm = pump16_run_status == 1 ? 590 : 0;
|
var pump17_rpm = record_dict[GlobalHelper.一输17泵_转速];
|
var pump18_rpm = record_dict[GlobalHelper.一输18泵_转速];
|
|
var pump11_power = record_dict[GlobalHelper.一输11泵_有功功率];
|
var pump12_power = record_dict[GlobalHelper.一输12泵_有功功率];
|
var pump13_power = record_dict[GlobalHelper.一输13泵_有功功率];
|
var pump14_power = record_dict[GlobalHelper.一输14泵_有功功率];
|
var pump15_power = record_dict[GlobalHelper.一输15泵_有功功率];
|
var pump16_power = record_dict[GlobalHelper.一输16泵_有功功率];
|
var pump17_power = record_dict[GlobalHelper.一输17泵_有功功率];
|
var pump18_power = record_dict[GlobalHelper.一输18泵_有功功率];
|
|
pump11_pressure.Mpa2M();
|
pump12_pressure.Mpa2M();
|
pump13_pressure.Mpa2M();
|
pump14_pressure.Mpa2M();
|
pump15_pressure.Mpa2M();
|
pump16_pressure.Mpa2M();
|
pump17_pressure.Mpa2M();
|
pump18_pressure.Mpa2M();
|
|
pump11_pressure.Round(1);
|
pump12_pressure.Round(1);
|
pump13_pressure.Round(1);
|
pump14_pressure.Round(1);
|
pump15_pressure.Round(1);
|
pump16_pressure.Round(1);
|
pump17_pressure.Round(1);
|
pump18_pressure.Round(1);
|
|
|
#endregion
|
|
#region 2
|
|
var pump21_run_status = record_dict[GlobalHelper.二输21泵_运行状态];
|
var pump22_run_status = record_dict[GlobalHelper.二输22泵_运行状态];
|
var pump23_run_status = record_dict[GlobalHelper.二输23泵_运行状态];
|
var pump24_run_status = record_dict[GlobalHelper.二输24泵_运行状态];
|
var pump25_run_status = record_dict[GlobalHelper.二输25泵_运行状态];
|
var pump26_run_status = record_dict[GlobalHelper.二输26泵_运行状态];
|
var pump27_run_status = record_dict[GlobalHelper.二输27泵_运行状态];
|
|
|
var pump21_wl = record_dict[GlobalHelper.二输21泵_泵井液位];
|
var pump22_wl = record_dict[GlobalHelper.二输22泵_泵井液位];
|
var pump23_wl = record_dict[GlobalHelper.二输23泵_泵井液位];
|
var pump24_wl = record_dict[GlobalHelper.二输24泵_泵井液位];
|
var pump25_wl = record_dict[GlobalHelper.二输25泵_泵井液位];
|
var pump26_wl = record_dict[GlobalHelper.二输26泵_泵井液位];
|
var pump27_wl = record_dict[GlobalHelper.二输27泵_泵井液位];
|
|
|
var pump21_pressure = record_dict[GlobalHelper.二输21泵_出水压力];
|
var pump22_pressure = record_dict[GlobalHelper.二输22泵_出水压力];
|
var pump23_pressure = record_dict[GlobalHelper.二输23泵_出水压力];
|
var pump24_pressure = record_dict[GlobalHelper.二输24泵_出水压力];
|
var pump25_pressure = record_dict[GlobalHelper.二输25泵_出水压力];
|
var pump26_pressure = record_dict[GlobalHelper.二输26泵_出水压力];
|
var pump27_pressure = record_dict[GlobalHelper.二输27泵_出水压力];
|
|
|
var pump21_rpm = record_dict[GlobalHelper.二输21泵_转速];
|
var pump22_rpm = record_dict[GlobalHelper.二输22泵_转速];
|
var pump23_rpm = record_dict[GlobalHelper.二输23泵_转速];
|
var pump24_rpm = record_dict[GlobalHelper.二输24泵_转速];
|
var pump25_rpm = record_dict[GlobalHelper.二输25泵_转速];
|
var pump26_rpm = record_dict[GlobalHelper.二输26泵_转速];
|
var pump27_rpm = record_dict[GlobalHelper.二输27泵_转速];
|
|
|
|
var pump21_flow = record_dict[GlobalHelper.二输21泵_瞬时流量];
|
var pump22_flow = record_dict[GlobalHelper.二输22泵_瞬时流量];
|
var pump23_flow = record_dict[GlobalHelper.二输23泵_瞬时流量];
|
var pump24_flow = record_dict[GlobalHelper.二输24泵_瞬时流量];
|
var pump25_flow = record_dict[GlobalHelper.二输25泵_瞬时流量];
|
var pump26_flow = record_dict[GlobalHelper.二输26泵_瞬时流量];
|
var pump27_flow = record_dict[GlobalHelper.二输27泵_瞬时流量];
|
|
var pump21_power = record_dict[GlobalHelper.二输21泵_有功功率];
|
var pump22_power = record_dict[GlobalHelper.二输22泵_有功功率];
|
var pump23_power = record_dict[GlobalHelper.二输23泵_有功功率];
|
var pump24_power = record_dict[GlobalHelper.二输24泵_有功功率];
|
var pump25_power = record_dict[GlobalHelper.二输25泵_有功功率];
|
var pump26_power = record_dict[GlobalHelper.二输26泵_有功功率];
|
var pump27_power = record_dict[GlobalHelper.二输27泵_有功功率];
|
|
|
var pump21_maintenance_status = record_dict[GlobalHelper.二输21泵_状态];
|
var pump22_maintenance_status = record_dict[GlobalHelper.二输22泵_状态];
|
var pump23_maintenance_status = record_dict[GlobalHelper.二输23泵_状态];
|
var pump24_maintenance_status = record_dict[GlobalHelper.二输24泵_状态];
|
var pump25_maintenance_status = record_dict[GlobalHelper.二输25泵_状态];
|
var pump26_maintenance_status = record_dict[GlobalHelper.二输26泵_状态];
|
var pump27_maintenance_status = record_dict[GlobalHelper.二输27泵_状态];
|
|
|
|
pump21_pressure.Mpa2M();
|
pump22_pressure.Mpa2M();
|
pump23_pressure.Mpa2M();
|
pump24_pressure.Mpa2M();
|
pump25_pressure.Mpa2M();
|
pump26_pressure.Mpa2M();
|
pump27_pressure.Mpa2M();
|
|
pump21_flow.Round(1);
|
pump22_flow.Round(1);
|
pump23_flow.Round(1);
|
pump24_flow.Round(1);
|
pump25_flow.Round(1);
|
pump26_flow.Round(1);
|
pump27_flow.Round(1);
|
|
pump21_pressure.Round(1);
|
pump22_pressure.Round(1);
|
pump23_pressure.Round(1);
|
pump24_pressure.Round(1);
|
pump25_pressure.Round(1);
|
pump26_pressure.Round(1);
|
pump27_pressure.Round(1);
|
|
#endregion
|
|
|
station1_flag_rpm_pressure_dict.Add(Flag11, new Tuple<double?, double?>(pump11_rpm, pump11_pressure));
|
station1_flag_rpm_pressure_dict.Add(Flag12, new Tuple<double?, double?>(pump12_rpm, pump12_pressure));
|
station1_flag_rpm_pressure_dict.Add(Flag13, new Tuple<double?, double?>(pump13_rpm, pump13_pressure));
|
station1_flag_rpm_pressure_dict.Add(Flag14, new Tuple<double?, double?>(pump14_rpm, pump14_pressure));
|
station1_flag_rpm_pressure_dict.Add(Flag15, new Tuple<double?, double?>(pump15_rpm, pump15_pressure));
|
station1_flag_rpm_pressure_dict.Add(Flag16, new Tuple<double?, double?>(pump16_rpm, pump16_pressure));
|
station1_flag_rpm_pressure_dict.Add(Flag17, new Tuple<double?, double?>(pump17_rpm, pump17_pressure));
|
station1_flag_rpm_pressure_dict.Add(Flag18, new Tuple<double?, double?>(pump18_rpm, pump18_pressure));
|
|
station2_flag_rpm_flow_pressure_dict.Add(Flag21, new Tuple<double?, double?, double?>(pump21_rpm, pump21_flow, pump21_pressure));
|
station2_flag_rpm_flow_pressure_dict.Add(Flag22, new Tuple<double?, double?, double?>(pump22_rpm, pump22_flow, pump22_pressure));
|
station2_flag_rpm_flow_pressure_dict.Add(Flag23, new Tuple<double?, double?, double?>(pump23_rpm, pump23_flow, pump23_pressure));
|
station2_flag_rpm_flow_pressure_dict.Add(Flag24, new Tuple<double?, double?, double?>(pump24_rpm, pump24_flow, pump24_pressure));
|
station2_flag_rpm_flow_pressure_dict.Add(Flag25, new Tuple<double?, double?, double?>(pump25_rpm, pump25_flow, pump25_pressure));
|
station2_flag_rpm_flow_pressure_dict.Add(Flag26, new Tuple<double?, double?, double?>(pump26_rpm, pump26_flow, pump26_pressure));
|
station2_flag_rpm_flow_pressure_dict.Add(Flag27, new Tuple<double?, double?, double?>(pump27_rpm, pump27_flow, pump27_pressure));
|
|
}
|
|
|
|
/// <summary>
|
/// 获取总管流量和压力
|
/// </summary>
|
/// <param name="monitor_record_list"></param>
|
/// <param name="station1_pipe_flag_flow_pressure_dict"></param>
|
/// <param name="station2_pipe_flag_flow_pressure_dict"></param>
|
public static void GetPipeFlagFlowAndPressureDict(List<Model.MonitorRecord> monitor_record_list, out Dictionary<int, Tuple<double?, double?>> station1_pipe_flag_flow_pressure_dict, out Dictionary<int, Tuple<double?, double?>> station2_pipe_flag_flow_pressure_dict)
|
{
|
station1_pipe_flag_flow_pressure_dict = new Dictionary<int, Tuple<double?, double?>>();
|
station2_pipe_flag_flow_pressure_dict = new Dictionary<int, Tuple<double?, double?>>();
|
|
if (monitor_record_list == null || !monitor_record_list.Any())
|
{
|
return;
|
}
|
|
var record_dict = monitor_record_list.ToDictionary(x => x.DataCode, y => y.DataValue);
|
var jd1_flow = record_dict[嘉定1线_瞬时流量_长江管网图];
|
var jd2_flow = record_dict[嘉定2线_瞬时流量_长江管网图];
|
var jd3_flow = record_dict[嘉定3线_瞬时流量_长江管网图];
|
|
var jd1_pressure = record_dict[嘉定1线_压力_长江管网图] / 1000;
|
var jd2_pressure = record_dict[嘉定2线_压力_长江管网图] / 1000;
|
var jd3_pressure = record_dict[嘉定3线_压力_长江管网图] / 1000;
|
|
|
var dn2400_flow = record_dict[DN2400总管_瞬时流量_长江管网图];
|
var dn2700_flow = record_dict[DN2700总管_瞬时流量_长江管网图];
|
|
var dn2400_pressure = record_dict[DN2400_出厂压力_长江管网图];
|
var dn2700_pressure = record_dict[DN2700_出厂压力_长江管网图];
|
|
jd1_pressure.Mpa2M();
|
jd2_pressure.Mpa2M();
|
jd3_pressure.Mpa2M();
|
|
dn2400_pressure.Mpa2M();
|
dn2700_pressure.Mpa2M();
|
|
jd1_flow.Round(1);
|
jd2_flow.Round(1);
|
jd3_flow.Round(1);
|
|
jd1_pressure.Round(1);
|
jd2_pressure.Round(1);
|
jd3_pressure.Round(1);
|
|
dn2400_flow.Round(1);
|
dn2700_flow.Round(1);
|
|
dn2400_pressure.Round(1);
|
dn2700_pressure.Round(1);
|
|
|
station1_pipe_flag_flow_pressure_dict.Add(FlagJD1, new Tuple<double?, double?>(jd1_flow, jd1_pressure));
|
station1_pipe_flag_flow_pressure_dict.Add(FlagJD2, new Tuple<double?, double?>(jd2_flow, jd2_pressure));
|
station1_pipe_flag_flow_pressure_dict.Add(FlagJD3, new Tuple<double?, double?>(jd3_flow, jd3_pressure));
|
|
station2_pipe_flag_flow_pressure_dict.Add(FlagDN2400, new Tuple<double?, double?>(dn2400_flow, dn2400_pressure));
|
station2_pipe_flag_flow_pressure_dict.Add(FlagDN2700, new Tuple<double?, double?>(dn2700_flow, dn2700_pressure));
|
|
}
|
|
|
/// <summary>
|
/// 获取泵站检修标志列表(0:正常,1:检修,2:优先)
|
/// </summary>
|
/// <param name="monitor_record_list">监测列表</param>
|
/// <param name="station1_maintenance_flag_list">检修标志列表 1输水</param>
|
/// <param name="station2_maintenance_flag_list">检修标志列表 2输水</param>
|
/// <param name="station1_priority_flag_list">优先标志列表 1输水</param>
|
/// <param name="station2_priority_flag_list">优先标志列表 2输水</param>
|
public static void GetStationFlagStateList
|
(List<Model.MonitorRecord> monitor_record_list,
|
out List<int> station1_maintenance_flag_list,
|
out List<int> station2_maintenance_flag_list,
|
out List<int> station1_priority_flag_list,
|
out List<int> station2_priority_flag_list
|
)
|
{
|
station1_maintenance_flag_list = new List<int>();
|
station2_maintenance_flag_list = new List<int>();
|
station1_priority_flag_list=new List<int>();
|
station2_priority_flag_list=new List<int>();
|
if (monitor_record_list == null || !monitor_record_list.Any())
|
return;
|
|
//1输水待补充 ,20250213更新
|
foreach (var mapping in FlagStateMappingDict1)
|
{
|
var flag = mapping.Key;
|
var code = mapping.Value;
|
var monitor_record = monitor_record_list.Find(x => x.DataCode == code);
|
if (monitor_record == null)
|
continue;
|
if (monitor_record.DataValue == 1)
|
{
|
station1_maintenance_flag_list.Add(flag);
|
}
|
else if (monitor_record.DataValue == 2)
|
{
|
station1_priority_flag_list.Add(flag);
|
}
|
}
|
|
foreach (var mapping in FlagStateMappingDict2)
|
{
|
var flag = mapping.Key;
|
var code = mapping.Value;
|
var monitor_record = monitor_record_list.Find(x => x.DataCode == code);
|
if (monitor_record == null)
|
continue;
|
if (monitor_record.DataValue==1)
|
{
|
station2_maintenance_flag_list.Add(flag);
|
}
|
else if (monitor_record.DataValue == 2)
|
{
|
station2_priority_flag_list.Add(flag);
|
}
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
}
|
|
}
|