diff --git a/NengLiang/.vs/NengLiang/FileContentIndex/0db82c5e-7820-42f7-b1d7-71466095d20a.vsidx b/NengLiang/.vs/NengLiang/FileContentIndex/0db82c5e-7820-42f7-b1d7-71466095d20a.vsidx
new file mode 100644
index 0000000..962922f
Binary files /dev/null and b/NengLiang/.vs/NengLiang/FileContentIndex/0db82c5e-7820-42f7-b1d7-71466095d20a.vsidx differ
diff --git a/NengLiang/.vs/NengLiang/FileContentIndex/52831988-186e-44c6-b11b-df3240283bd2.vsidx b/NengLiang/.vs/NengLiang/FileContentIndex/52831988-186e-44c6-b11b-df3240283bd2.vsidx
new file mode 100644
index 0000000..7a5a8d4
Binary files /dev/null and b/NengLiang/.vs/NengLiang/FileContentIndex/52831988-186e-44c6-b11b-df3240283bd2.vsidx differ
diff --git a/NengLiang/.vs/NengLiang/FileContentIndex/6592445c-a0e2-4a53-a304-0771e6289d56.vsidx b/NengLiang/.vs/NengLiang/FileContentIndex/5b4caea7-e323-4182-acf9-8b72215045b0.vsidx
similarity index 100%
rename from NengLiang/.vs/NengLiang/FileContentIndex/6592445c-a0e2-4a53-a304-0771e6289d56.vsidx
rename to NengLiang/.vs/NengLiang/FileContentIndex/5b4caea7-e323-4182-acf9-8b72215045b0.vsidx
diff --git a/NengLiang/.vs/NengLiang/v17/.suo b/NengLiang/.vs/NengLiang/v17/.suo
index 2769fcc..93b6140 100644
Binary files a/NengLiang/.vs/NengLiang/v17/.suo and b/NengLiang/.vs/NengLiang/v17/.suo differ
diff --git a/NengLiang/Models/energy_data.cs b/NengLiang/Models/energy_data.cs
new file mode 100644
index 0000000..f370c37
--- /dev/null
+++ b/NengLiang/Models/energy_data.cs
@@ -0,0 +1,543 @@
+/** 版本信息模板在安装目录下,可自行修改。
+* energy_data.cs
+*
+* 功 能: N/A
+* 类 名: energy_data
+*
+* Ver 变更日期 负责人 变更内容
+* ───────────────────────────────────
+* V0.01 2023/2/26 19:05:08 N/A 初版
+*
+* Copyright (c) 2012 Maticsoft Corporation. All rights reserved.
+*┌──────────────────────────────────┐
+*│ 此技术信息为本公司机密信息,未经本公司书面同意禁止向第三方披露. │
+*│ 版权所有:动软卓越(北京)科技有限公司 │
+*└──────────────────────────────────┘
+*/
+using System;
+namespace DataService.Model
+{
+ ///
+ /// energy_data:实体类(属性说明自动提取数据库字段的描述信息)
+ ///
+ [Serializable]
+ public partial class energy_data
+ {
+ public energy_data()
+ {}
+ #region Model
+ private string _energy_id;
+ private string _device_id;
+ private decimal? _supply_water_temperature;
+ private decimal? _return_water_temperature;
+ private decimal? _instantaneous_delivery;
+ private decimal? _sampling_value;
+ private decimal? _cumulative_traffic;
+ private decimal? _positive_total_flow;
+ private decimal? _negative_total_flow;
+ private decimal? _instant_heat;
+ private string _revised_version_number;
+ private string _lang;
+ private string _table_address;
+ private int? _meter_communication_speed;
+ private decimal? _modified_caliber;
+ private string _flow_unit;
+ private string _flow_integration_unit;
+ private decimal? _zero_sample_value;
+ private decimal? _meter_factor;
+ private decimal? _heat_coefficient;
+ private decimal? _supply_water_temperature_coefficient;
+ private decimal? _return_temperature_coefficient;
+ private decimal? _small_signal_cut_off_point;
+ private decimal? _modify_pulse_unit;
+ private string _allow_cutout_display;
+ private string _reverseoutputallows;
+ private string _current_output_type;
+ private string _pulse_output_mode;
+ private string _frequency_output_range;
+ private string _empty_traffic_alarm_allowed;
+ private decimal? _empty_traffic_alarm_threshold;
+ private string _high_limit_alarm_allows;
+ private decimal? _upper_alarm_value;
+ private string _lower_limit_alarm_allowed;
+ private decimal? _lower_limit_alarm_value;
+ private string _excitation_alarm_allows;
+ private decimal? _sensor_coefficient;
+ private decimal? _empty_pipe_sampling_value;
+ private string _alarm_information;
+ private decimal? _current_zero_correction;
+ private decimal? _current_full_scale_correction;
+ private string _meter_range_setting;
+ private string _measure_damping_time;
+ private string _flow_direction_option;
+ private decimal? _cumulative_heat;
+ private decimal? _cumulative_cooling_capacity;
+ private DateTime? _input_date;
+ private DateTime? _create_time;
+ private string _r1;
+ private string _r2;
+ private string _r3;
+ ///
+ /// 主键
+ ///
+ public string energy_id
+ {
+ set{ _energy_id=value;}
+ get{return _energy_id;}
+ }
+ ///
+ /// 设备外键
+ ///
+ public string device_id
+ {
+ set{ _device_id=value;}
+ get{return _device_id;}
+ }
+ ///
+ /// 供水温度
+ ///
+ public decimal? supply_water_temperature
+ {
+ set{ _supply_water_temperature=value;}
+ get{return _supply_water_temperature;}
+ }
+ ///
+ /// 回水温度
+ ///
+ public decimal? return_water_temperature
+ {
+ set{ _return_water_temperature=value;}
+ get{return _return_water_temperature;}
+ }
+ ///
+ /// 瞬时流量
+ ///
+ public decimal? instantaneous_delivery
+ {
+ set{ _instantaneous_delivery=value;}
+ get{return _instantaneous_delivery;}
+ }
+ ///
+ /// 采样值
+ ///
+ public decimal? sampling_value
+ {
+ set{ _sampling_value=value;}
+ get{return _sampling_value;}
+ }
+ ///
+ /// 累计流量
+ ///
+ public decimal? cumulative_traffic
+ {
+ set{ _cumulative_traffic=value;}
+ get{return _cumulative_traffic;}
+ }
+ ///
+ /// 正累计流量
+ ///
+ public decimal? positive_total_flow
+ {
+ set{ _positive_total_flow=value;}
+ get{return _positive_total_flow;}
+ }
+ ///
+ /// 负累计流量
+ ///
+ public decimal? negative_total_flow
+ {
+ set{ _negative_total_flow=value;}
+ get{return _negative_total_flow;}
+ }
+ ///
+ /// 瞬时热量
+ ///
+ public decimal? instant_heat
+ {
+ set{ _instant_heat=value;}
+ get{return _instant_heat;}
+ }
+ ///
+ /// 修改版本号
+ ///
+ public string revised_version_number
+ {
+ set{ _revised_version_number=value;}
+ get{return _revised_version_number;}
+ }
+ ///
+ /// 语言
+ ///
+ public string lang
+ {
+ set{ _lang=value;}
+ get{return _lang;}
+ }
+ ///
+ /// 表地址
+ ///
+ public string table_address
+ {
+ set{ _table_address=value;}
+ get{return _table_address;}
+ }
+ ///
+ /// 仪表通讯速度
+ ///
+ public int? meter_communication_speed
+ {
+ set{ _meter_communication_speed=value;}
+ get{return _meter_communication_speed;}
+ }
+ ///
+ /// 修改口径
+ ///
+ public decimal? modified_caliber
+ {
+ set{ _modified_caliber=value;}
+ get{return _modified_caliber;}
+ }
+ ///
+ /// 流量单位
+ ///
+ public string flow_unit
+ {
+ set{ _flow_unit=value;}
+ get{return _flow_unit;}
+ }
+ ///
+ /// 流量积算单位
+ ///
+ public string flow_integration_unit
+ {
+ set{ _flow_integration_unit=value;}
+ get{return _flow_integration_unit;}
+ }
+ ///
+ /// 零点采样值
+ ///
+ public decimal? zero_sample_value
+ {
+ set{ _zero_sample_value=value;}
+ get{return _zero_sample_value;}
+ }
+ ///
+ /// 仪表系数
+ ///
+ public decimal? meter_factor
+ {
+ set{ _meter_factor=value;}
+ get{return _meter_factor;}
+ }
+ ///
+ /// 热量系数
+ ///
+ public decimal? heat_coefficient
+ {
+ set{ _heat_coefficient=value;}
+ get{return _heat_coefficient;}
+ }
+ ///
+ /// 供水温度系数
+ ///
+ public decimal? supply_water_temperature_coefficient
+ {
+ set{ _supply_water_temperature_coefficient=value;}
+ get{return _supply_water_temperature_coefficient;}
+ }
+ ///
+ /// 回水温度系数
+ ///
+ public decimal? return_temperature_coefficient
+ {
+ set{ _return_temperature_coefficient=value;}
+ get{return _return_temperature_coefficient;}
+ }
+ ///
+ /// 小信号切除点
+ ///
+ public decimal? small_signal_cut_off_point
+ {
+ set{ _small_signal_cut_off_point=value;}
+ get{return _small_signal_cut_off_point;}
+ }
+ ///
+ /// 修改脉冲单位
+ ///
+ public decimal? modify_pulse_unit
+ {
+ set{ _modify_pulse_unit=value;}
+ get{return _modify_pulse_unit;}
+ }
+ ///
+ /// 允许切除显示
+ ///
+ public string allow_cutout_display
+ {
+ set{ _allow_cutout_display=value;}
+ get{return _allow_cutout_display;}
+ }
+ ///
+ /// 反向输出允许
+ ///
+ public string ReverseOutputAllows
+ {
+ set{ _reverseoutputallows=value;}
+ get{return _reverseoutputallows;}
+ }
+ ///
+ /// 电流输出类型
+ ///
+ public string current_output_type
+ {
+ set{ _current_output_type=value;}
+ get{return _current_output_type;}
+ }
+ ///
+ /// 脉冲输出方式
+ ///
+ public string pulse_output_mode
+ {
+ set{ _pulse_output_mode=value;}
+ get{return _pulse_output_mode;}
+ }
+ ///
+ /// 频率输出范围
+ ///
+ public string frequency_output_range
+ {
+ set{ _frequency_output_range=value;}
+ get{return _frequency_output_range;}
+ }
+ ///
+ /// 空管报警允许
+ ///
+ public string empty_traffic_alarm_allowed
+ {
+ set{ _empty_traffic_alarm_allowed=value;}
+ get{return _empty_traffic_alarm_allowed;}
+ }
+ ///
+ /// 空管报警阈值
+ ///
+ public decimal? empty_traffic_alarm_threshold
+ {
+ set{ _empty_traffic_alarm_threshold=value;}
+ get{return _empty_traffic_alarm_threshold;}
+ }
+ ///
+ /// 上限报警允许
+ ///
+ public string high_limit_alarm_allows
+ {
+ set{ _high_limit_alarm_allows=value;}
+ get{return _high_limit_alarm_allows;}
+ }
+ ///
+ /// 上限报警数值
+ ///
+ public decimal? upper_alarm_value
+ {
+ set{ _upper_alarm_value=value;}
+ get{return _upper_alarm_value;}
+ }
+ ///
+ /// 下限报警允许
+ ///
+ public string lower_limit_alarm_allowed
+ {
+ set{ _lower_limit_alarm_allowed=value;}
+ get{return _lower_limit_alarm_allowed;}
+ }
+ ///
+ /// 下限报警数值
+ ///
+ public decimal? lower_limit_alarm_value
+ {
+ set{ _lower_limit_alarm_value=value;}
+ get{return _lower_limit_alarm_value;}
+ }
+ ///
+ /// 励磁报警允许
+ ///
+ public string excitation_alarm_allows
+ {
+ set{ _excitation_alarm_allows=value;}
+ get{return _excitation_alarm_allows;}
+ }
+ ///
+ /// 传感器系数
+ ///
+ public decimal? sensor_coefficient
+ {
+ set{ _sensor_coefficient=value;}
+ get{return _sensor_coefficient;}
+ }
+ ///
+ /// 空管采样值
+ ///
+ public decimal? empty_pipe_sampling_value
+ {
+ set{ _empty_pipe_sampling_value=value;}
+ get{return _empty_pipe_sampling_value;}
+ }
+ ///
+ /// 报警信息
+ ///
+ public string alarm_information
+ {
+ set{ _alarm_information=value;}
+ get{return _alarm_information;}
+ }
+ ///
+ /// 电流零点修正
+ ///
+ public decimal? current_zero_correction
+ {
+ set{ _current_zero_correction=value;}
+ get{return _current_zero_correction;}
+ }
+ ///
+ /// 电流满度修正
+ ///
+ public decimal? current_full_scale_correction
+ {
+ set{ _current_full_scale_correction=value;}
+ get{return _current_full_scale_correction;}
+ }
+ ///
+ /// 仪表量程设置
+ ///
+ public string meter_range_setting
+ {
+ set{ _meter_range_setting=value;}
+ get{return _meter_range_setting;}
+ }
+ ///
+ /// 测量阻尼时间
+ ///
+ public string measure_damping_time
+ {
+ set{ _measure_damping_time=value;}
+ get{return _measure_damping_time;}
+ }
+ ///
+ /// 流量方向选择项
+ ///
+ public string flow_direction_option
+ {
+ set{ _flow_direction_option=value;}
+ get{return _flow_direction_option;}
+ }
+ ///
+ /// 累计热量
+ ///
+ public decimal? cumulative_heat
+ {
+ set{ _cumulative_heat=value;}
+ get{return _cumulative_heat;}
+ }
+ ///
+ /// 累计冷量
+ ///
+ public decimal? cumulative_cooling_capacity
+ {
+ set{ _cumulative_cooling_capacity=value;}
+ get{return _cumulative_cooling_capacity;}
+ }
+ ///
+ /// 录入日期
+ ///
+ public DateTime? input_date
+ {
+ set{ _input_date=value;}
+ get{return _input_date;}
+ }
+ ///
+ /// 创建时间
+ ///
+ public DateTime? create_time
+ {
+ set{ _create_time=value;}
+ get{return _create_time;}
+ }
+ ///
+ /// 备用1
+ ///
+ public string r1
+ {
+ set{ _r1=value;}
+ get{return _r1;}
+ }
+ ///
+ /// 备用2
+ ///
+ public string r2
+ {
+ set{ _r2=value;}
+ get{return _r2;}
+ }
+ ///
+ /// 备用3
+ ///
+ public string r3
+ {
+ set{ _r3=value;}
+ get{return _r3;}
+ }
+ #endregion Model
+
+
+
+
+ ///
+ /// 正累计流量整数
+ ///
+ public string positive_total_flowA { get { return positive_total_flowA; } set { positive_total_flowA = value; } }
+ ///
+ /// 正累计流量小数
+ ///
+ public string positive_total_flowB { get { return positive_total_flowB; } set { positive_total_flowB = value; } }
+
+
+ ///
+ /// 累计流量整数
+ ///
+ public string cumulative_trafficA { get { return cumulative_trafficA; } set { cumulative_trafficA = value} }
+ ///
+ /// 累计流量小数
+ ///
+ public string cumulative_trafficB { get { return cumulative_trafficB; } set { cumulative_trafficB=value} }
+
+
+ ///
+ /// 负累计流量整数
+ ///
+ public string negative_total_flowA { get { return negative_total_flowA; } set { negative_total_flowA = value; } }
+ ///
+ /// 负累计流量小数
+ ///
+ public string negative_total_flowB { get { return negative_total_flowB; } set { negative_total_flowB = value; } }
+
+
+ ///
+ /// 累计热量整数
+ ///
+ public string cumulative_heatA { get { return cumulative_heatA; } set { cumulative_heatA = value; } }
+ ///
+ /// 累计热量小数
+ ///
+ public string cumulative_heatB { get { return cumulative_heatB; } set { cumulative_heatB = value; } }
+
+
+ ///
+ /// 累计冷量整数
+ ///
+ public string cumulative_cooling_capacityA { get { return cumulative_cooling_capacityA; } set { cumulative_cooling_capacityA = value; } }
+ ///
+ /// 累计冷量小数
+ ///
+ public string cumulative_cooling_capacityB { get { return cumulative_cooling_capacityB; } set { cumulative_cooling_capacityB = value; } }
+ }
+}
+
diff --git a/NengLiang/NengLiang.cs b/NengLiang/NengLiang.cs
index e4e7b68..e643ef3 100644
--- a/NengLiang/NengLiang.cs
+++ b/NengLiang/NengLiang.cs
@@ -1,13 +1,17 @@
using CRClib;
+using DataService.Model;
using System;
using System.Collections.Generic;
using System.Net;
using System.Net.Sockets;
+using System.Reflection;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
+using System.Xml.Linq;
using ToolKitlib;
+
namespace NengLiang
{
internal class NengLiang
@@ -38,7 +42,7 @@ namespace NengLiang
///
/// 当前请求数据类型
///
- public static ushort index_id ;
+ public static ushort index_id;
///
/// 报文发送间隔时间
///
@@ -136,22 +140,26 @@ namespace NengLiang
Console.WriteLine("发送报文time " + T + " 毫秒,loop间隔 " + loopTime + " 秒");
byte devAdd = 0x01;
byte code = 0x03;
- byte[] bytes;// 发送字节
+ ushort start = (ushort)0;
+ ushort length = ushort.Parse("0033");
+ //byte[] bytes;// 发送字节
foreach (var v in OnLineDic.Values)
{
- foreach (var item in RegisterType.Keys)
- {
- if (T >= 0) { Thread.Sleep(T); }
- else continue;
- ushort start = (ushort)item;
- ushort length = ushort.Parse(RegisterType[item][3].ToString());
- bytes = ReadKsepRsgistecs(devAdd, code, start, length);
- log.Info("发送至" + v.RemoteEndPoint + ": " + ToolKit.byteArrayToHexString(bytes));
- //Console.WriteLine(ToolKit.byteArrayToHexString(bytes));
- v.Send(bytes);
- index_id = start;//记录当前请求数据 地址码
- }
+ Thread.Sleep(T);
+ ReadKsepRsgistecs(devAdd, code, start, length);
+ //foreach (var item in RegisterType.Keys)
+ //{
+ // if (T >= 0) { Thread.Sleep(T); }
+ // else continue;
+ // ushort start = (ushort)item;
+ // ushort length = ushort.Parse(RegisterType[item][3].ToString());
+ // bytes = ReadKsepRsgistecs(devAdd, code, start, length);
+ // log.Info("发送至" + v.RemoteEndPoint + ": " + ToolKit.byteArrayToHexString(bytes));
+ // //Console.WriteLine(ToolKit.byteArrayToHexString(bytes));
+ // v.Send(bytes);
+ // index_id = start;//记录当前请求数据 地址码
+ //}
}
}
}
@@ -309,7 +317,7 @@ namespace NengLiang
{
//执行解析
log.Info("接收到" + clientSocket.RemoteEndPoint + ": " + _message);
- JudgmentFunction(message);
+ JudgmentFunction(bytes);
}
}
}
@@ -352,21 +360,18 @@ namespace NengLiang
/// 判断功能类型
///
///
- public static void JudgmentFunction(string message)
+ public static void JudgmentFunction(/*string message*/byte[] message)
{
try
{
- string order = message[2].ToString() + message[3].ToString();//命令
+ //tring order = message[2].ToString() + message[3].ToString();//命令
+ var order = message[1];//命令
- var key = (int)index_id;//获取 地址码
- if (order == "03")//读取命令
+ //var key = (int)index_id;//获取 地址码
+ if (order == 0x03)//读取命令
{
- if (!RegisterType.ContainsKey(key) || RegisterType[key][2][1] == 'n') return;
- readData(message, key);
- }
- else if (order == "10") //修改命令
- {
- if (!RegisterType.ContainsKey(key) || RegisterType[key][2][0] == 'n') return;
+ //if (!RegisterType.ContainsKey(key) || RegisterType[key][2][1] == 'n') return;
+ readData(message);
}
}
catch (Exception e)
@@ -417,29 +422,37 @@ namespace NengLiang
///
///
/// 地址码
- public static void readData(string message, int key)
+ public static void readData(byte[] message)
{
+ energy_data energy_Data = new energy_data();
try
{
- string _readSum = message[4].ToString() + message[5].ToString();
- int readSum = int.Parse(ToolKit.hexStr2Str(_readSum));//变量总字节数
- StringBuilder builder = new StringBuilder("");
- for (int i = 6; i < 6 + readSum * 2; i++)
+ int a = 3; //message[3]开始
+ List by = new List();
+ var _readSum = message[2];
+ int readSum = (int)message[2];//变量总字节数
+ foreach (var item in RegisterType.Keys)
{
- builder.Append(message[i]);
- }
- var num = Convert.ToInt64(builder.ToString().Trim(), 16);//获取值
- var aa = RegisterType[key][1].ToLower();
- if (aa == "ulong")
- {
- var number = (ulong)num;
- analysisUnit(RegisterType[key][0], number);
- }
- else
- {
- var number = (uint)num;
- analysisUnit(RegisterType[key][0], number);
+ for (int i = a; i < a + int.Parse(RegisterType[item][3]); i++)
+ {
+ by.Add(message[i]);
+ }
+ a += by.Count;
+ var data = ToolKit.listToBytes(by);//每组数值
+ var num = Convert.ToInt64(ToolKit.byteArrayToString(data, encoding), 16);//获取值
+ var aa = RegisterType[item][1].ToLower();
+ if (aa == "ulong")
+ {
+ var number = (ulong)num;
+ analysisUlong(RegisterType[item][0], number, energy_Data);
+ }
+ else
+ {
+ var number = (uint)num;
+ analysisUnit(RegisterType[item][0], number, energy_Data);
+ }
}
+ //energy_data对象取值完毕
}
catch (Exception e)
{
@@ -448,178 +461,320 @@ namespace NengLiang
}
}
+
///
/// unit值类型解析
///
/// 变量名
///
- public static void analysisUnit(string name, uint number)
+ public static void analysisUnit(string name, uint number, energy_data ed)
{
if (name == "供水温度")
{
number /= 100;
Console.WriteLine(name + ":" + number + "℃");
+ ed.supply_water_temperature = number;
}
else if (name == "回水温度")
{
number /= 100;
Console.WriteLine(name + ":" + number + "℃");
+ ed.return_water_temperature = number;
}
else if (name == "采样值")
{
Console.WriteLine(name + ":" + number);
+ ed.sampling_value = number;
}
else if (name == "累计流量小数")
{
Console.WriteLine(name + ":0." + number);
+ ed.cumulative_trafficB = number.ToString();
}
else if (name == "正累计流量小数")
{
Console.WriteLine(name + ":0." + number);
+ ed.positive_total_flowB = number.ToString();
}
else if (name == "负累计流量小数")
{
Console.WriteLine(name + ":0." + number);
+ ed.negative_total_flowB = number.ToString();
}
else if (name == "修改版本号")
{
Console.WriteLine(name + ":" + number);
+ ed.revised_version_number = number.ToString();
}
else if (name == "语言")
{
- if (number == 0) Console.WriteLine(name + ":中文");
- else if (number == 1) Console.WriteLine(name + ":英文");
+ if (number == 0) { Console.WriteLine(name + ":中文"); ed.lang = "中文"; }
+ else if (number == 1) { Console.WriteLine(name + ":英文"); ed.lang = "英文"; }
}
else if (name == "表地址")
{
Console.WriteLine(name + ":" + number);
+ ed.table_address = number.ToString();
}
else if (name == "仪表通讯速度")
{
//float TRAS;//3.5字符周期周期时间(单位ms)
- if (number == 0) { Console.WriteLine(name + ":300"); /*TRAS = 1000 / 300 * 12.5f;*/ TRAS = 3.5f * 9 / 0.3f; }
- else if (number == 1) { Console.WriteLine(name + ":2400"); /*TRAS = 1000 / 2400 * 12.5f;*/ TRAS = 3.5f * 9 / 2.4f; }
- else if (number == 2) { Console.WriteLine(name + ":14400"); /*TRAS = 1000 / 14400 * 12.5f; */TRAS = 3.5f * 9 / 14.4f; }
- else if (number == 3) { Console.WriteLine(name + ":600"); /*TRAS = 1000 / 600 * 12.5f; */TRAS = 3.5f * 9 / 0.6f; }
- else if (number == 4) { Console.WriteLine(name + ":4800");/* TRAS = 1000 / 4800 * 12.5f;*/ TRAS = 3.5f * 9 / 4.8f; }
- else if (number == 5) { Console.WriteLine(name + ":19200"); /*TRAS = 1000 / 19200 * 12.5f;*/ TRAS = 3.5f * 9 / 19.2f; }
- else if (number == 6) { Console.WriteLine(name + ":1200"); /*TRAS = 1000 / 1200 * 12.5f; */TRAS = 3.5f * 9 / 1.2f; }
- else if (number == 7) { Console.WriteLine(name + ":9600"); /*TRAS = 1000 / 9600 * 12.5f;*/ TRAS = 3.5f * 9 / 9.6f; }
- else if (number == 8) { Console.WriteLine(name + ":38400"); /*TRAS = 1000 / 38400 * 12.5f;*/ TRAS = 3.5f * 9 / 38.4f; }
+ if (number == 0) { Console.WriteLine(name + ":300"); ed.meter_communication_speed = 300;/*TRAS = 1000 / 300 * 12.5f;*/ TRAS = 3.5f * 9 / 0.3f; }
+ else if (number == 1) { Console.WriteLine(name + ":2400"); ed.meter_communication_speed = 2400;/*TRAS = 1000 / 2400 * 12.5f;*/ TRAS = 3.5f * 9 / 2.4f; }
+ else if (number == 2) { Console.WriteLine(name + ":14400"); ed.meter_communication_speed = 14400; /*TRAS = 1000 / 14400 * 12.5f; */TRAS = 3.5f * 9 / 14.4f; }
+ else if (number == 3) { Console.WriteLine(name + ":600"); ed.meter_communication_speed = 600; /*TRAS = 1000 / 600 * 12.5f; */TRAS = 3.5f * 9 / 0.6f; }
+ else if (number == 4) { Console.WriteLine(name + ":4800"); ed.meter_communication_speed = 4800;/* TRAS = 1000 / 4800 * 12.5f;*/ TRAS = 3.5f * 9 / 4.8f; }
+ else if (number == 5) { Console.WriteLine(name + ":19200"); ed.meter_communication_speed = 19200;/*TRAS = 1000 / 19200 * 12.5f;*/ TRAS = 3.5f * 9 / 19.2f; }
+ else if (number == 6) { Console.WriteLine(name + ":1200"); ed.meter_communication_speed = 1200;/*TRAS = 1000 / 1200 * 12.5f; */TRAS = 3.5f * 9 / 1.2f; }
+ else if (number == 7) { Console.WriteLine(name + ":9600"); ed.meter_communication_speed = 9600;/*TRAS = 1000 / 9600 * 12.5f;*/ TRAS = 3.5f * 9 / 9.6f; }
+ else if (number == 8) { Console.WriteLine(name + ":38400"); ed.meter_communication_speed = 38400;/*TRAS = 1000 / 38400 * 12.5f;*/ TRAS = 3.5f * 9 / 38.4f; }
}
else if (name == "修改口径")
{
Console.WriteLine(name + ":" + number);
+ ed.modified_caliber = number;
}
else if (name == "流量单位")
{
- if (number == 0) Console.WriteLine(name + ":L/H");
- else if (number == 1) Console.WriteLine(name + ":L/M");
- else if (number == 2) Console.WriteLine(name + ":L/S");
- else if (number == 3) Console.WriteLine(name + ":M³/H");
- else if (number == 4) Console.WriteLine(name + ":M³/M");
- else if (number == 5) Console.WriteLine(name + ":M³/S");
+ if (number == 0)
+ {
+ Console.WriteLine(name + ":L/H");
+ ed.flow_unit = "L/H";
+ }
+ else if (number == 1)
+ {
+ Console.WriteLine(name + ":L/M");
+ ed.flow_unit = "L/M";
+ }
+ else if (number == 2)
+ {
+ Console.WriteLine(name + ":L/S");
+ ed.flow_unit = "L/S";
+ }
+ else if (number == 3)
+ {
+ Console.WriteLine(name + ":M³/H");
+ ed.flow_unit = "M³/H";
+ }
+ else if (number == 4)
+ {
+ Console.WriteLine(name + ":M³/M");
+ ed.flow_unit = "M³/M";
+ }
+ else if (number == 5)
+ {
+ Console.WriteLine(name + ":M³/S");
+ ed.flow_unit = "M³/S";
+ }
}
else if (name == "流量积算单位")
{
- if (number == 0) Console.WriteLine(name + ":0.001L");
- else if (number == 1) Console.WriteLine(name + ":0.001M³");
- else if (number == 2) Console.WriteLine(name + ":0.01L");
- else if (number == 3) Console.WriteLine(name + ":0.1L");
- else if (number == 4) Console.WriteLine(name + ":1L");
- else if (number == 5) Console.WriteLine(name + ":0.01M³");
- else if (number == 6) Console.WriteLine(name + ":0.1M³");
- else if (number == 7) Console.WriteLine(name + ":1M³");
+ if (number == 0)
+ {
+ Console.WriteLine(name + ":0.001L");
+ ed.flow_integration_unit = "0.001L";
+ }
+ else if (number == 1)
+ {
+ Console.WriteLine(name + ":0.001M³");
+ ed.flow_integration_unit = "0.001M³";
+ }
+ else if (number == 2)
+ {
+ Console.WriteLine(name + ":0.01L");
+ ed.flow_integration_unit = "0.01L";
+ }
+ else if (number == 3)
+ {
+ Console.WriteLine(name + ":0.1L");
+ ed.flow_integration_unit = "0.1L";
+ }
+ else if (number == 4)
+ {
+ Console.WriteLine(name + ":1L");
+ ed.flow_integration_unit = "1L";
+ }
+ else if (number == 5)
+ {
+ Console.WriteLine(name + ":0.01M³");
+ ed.flow_integration_unit = "0.01M³";
+ }
+ else if (number == 6)
+ {
+ Console.WriteLine(name + ":0.1M³");
+ ed.flow_integration_unit = "0.1M³";
+ }
+ else if (number == 7)
+ {
+ Console.WriteLine(name + ":1M³");
+ ed.flow_integration_unit = "1M³";
+ }
}
else if (name == "零点采样值")
{
Console.WriteLine(name + ":" + number);
+ ed.zero_sample_value = number;
}
else if (name == "仪表系数")
{
Console.WriteLine(name + ":" + number);
+ ed.meter_factor = number;
}
else if (name == "热量系数")
{
Console.WriteLine(name + ":" + number);
+ ed.heat_coefficient = number;
}
else if (name == "供水温度系数")
{
Console.WriteLine(name + ":" + number);
+ ed.supply_water_temperature_coefficient = number;
}
else if (name == "回水温度系数")
{
Console.WriteLine(name + ":" + number);
+ ed.return_temperature_coefficient = number;
}
else if (name == "小信号切除点")
{
Console.WriteLine(name + ":" + number);
+ ed.small_signal_cut_off_point = number;
}
else if (name == "修改脉冲单位")
{
Console.WriteLine(name + ":" + number);
+ ed.modify_pulse_unit = number;
}
else if (name == "允许切除显示")
{
- if (number == 0) Console.WriteLine(name + ":允许");
- else if (number == 1) Console.WriteLine(name + ":禁止");
+ if (number == 0)
+ {
+ Console.WriteLine(name + ":允许");
+ ed.allow_cutout_display = "允许";
+ }
+ else if (number == 1)
+ {
+ Console.WriteLine(name + ":禁止");
+ ed.allow_cutout_display = "禁止";
+ }
}
else if (name == "反向输出允许")
{
- if (number == 0) Console.WriteLine(name + ":允许");
- else if (number == 1) Console.WriteLine(name + ":禁止");
+ if (number == 0)
+ {
+ Console.WriteLine(name + ":允许");
+ ed.ReverseOutputAllows = "允许";
+ }
+ else if (number == 1)
+ {
+ Console.WriteLine(name + ":禁止");
+ ed.ReverseOutputAllows = "禁止";
+ }
}
else if (name == "电流输出类型")
{
- if (number == 0) Console.WriteLine(name + ":0~10mA");
- else if (number == 1) Console.WriteLine(name + ":4~20mA");
+ if (number == 0)
+ {
+ Console.WriteLine(name + ":0~10mA");
+ ed.current_output_type = "0~10mA";
+ }
+ else if (number == 1)
+ {
+ Console.WriteLine(name + ":4~20mA");
+ ed.current_output_type = "4~20mA";
+ }
}
else if (name == "脉冲输出方式")
{
- if (number == 0) Console.WriteLine(name + ":频率");
- else if (number == 1) Console.WriteLine(name + ":脉冲");
+ if (number == 0)
+ {
+ Console.WriteLine(name + ":频率");
+ ed.pulse_output_mode = "频率";
+ }
+ else if (number == 1)
+ {
+ Console.WriteLine(name + ":脉冲");
+ ed.pulse_output_mode = "脉冲";
+ }
}
else if (name == "频率输出范围")
{
Console.WriteLine(name + ":" + number);
+ ed.frequency_output_range = number.ToString();
}
else if (name == "空管报警允许")
{
- if (number == 0) Console.WriteLine(name + ":允许");
- else if (number == 1) Console.WriteLine(name + ":禁止");
+ if (number == 0)
+ {
+ Console.WriteLine(name + ":允许");
+ ed.empty_traffic_alarm_allowed = "允许";
+ }
+ else if (number == 1)
+ {
+ Console.WriteLine(name + ":禁止");
+ ed.empty_traffic_alarm_allowed = "禁止";
+ }
}
else if (name == "空管报警阈值")
{
Console.WriteLine(name + ":" + number);
+ ed.empty_traffic_alarm_threshold = number;
}
else if (name == "上限报警允许")
{
- if (number == 0) Console.WriteLine(name + ":允许");
- else if (number == 1) Console.WriteLine(name + ":禁止");
+ if (number == 0)
+ {
+ Console.WriteLine(name + ":允许");
+ ed.high_limit_alarm_allows = "允许";
+ }
+ else if (number == 1)
+ {
+ Console.WriteLine(name + ":禁止");
+ ed.high_limit_alarm_allows = "禁止";
+ }
}
else if (name == "上限报警数值")
{
Console.WriteLine(name + ":" + number);
+ ed.upper_alarm_value= number;
}
else if (name == "下限报警允许")
{
- if (number == 0) Console.WriteLine(name + ":允许");
- else if (number == 1) Console.WriteLine(name + ":禁止");
+ if (number == 0)
+ {
+ Console.WriteLine(name + ":允许");
+ ed.lower_limit_alarm_allowed = "允许";
+ }
+ else if (number == 1)
+ {
+ Console.WriteLine(name + ":禁止");
+ ed.lower_limit_alarm_allowed = "禁止";
+ }
}
else if (name == "下限报警数值")
{
Console.WriteLine(name + ":" + number);
+ ed.lower_limit_alarm_value = number;
}
else if (name == "励磁报警允许")
{
- if (number == 0) Console.WriteLine(name + ":允许");
- else if (number == 1) Console.WriteLine(name + ":禁止");
+ if (number == 0)
+ {
+ Console.WriteLine(name + ":允许");
+ ed.excitation_alarm_allows = "允许";
+ }
+ else if (number == 1)
+ {
+ Console.WriteLine(name + ":禁止");
+ ed.excitation_alarm_allows = "禁止";
+ }
}
else if (name == "传感器系数")
{
Console.WriteLine(name + ":" + number);
+ ed.sensor_coefficient= number;
}
else if (name == "预留")
{
@@ -628,41 +783,65 @@ namespace NengLiang
else if (name == "空管采样值")
{
Console.WriteLine(name + ":" + number);
+ ed.empty_pipe_sampling_value = number;
}
else if (name == "报警信息")
{
- if (number == 1) Console.WriteLine(name + ":瞬时流量单位选择错误");
- else if (number == 2) Console.WriteLine(name + ":空管");
- else if (number == 4) Console.WriteLine(name + ":下限报警");
- else if (number == 8) Console.WriteLine(name + ":上限报警");
+ if (number == 1)
+ {
+ Console.WriteLine(name + ":瞬时流量单位选择错误");
+ ed.alarm_information = "瞬时流量单位选择错误";
+ }
+ else if (number == 2)
+ {
+ Console.WriteLine(name + ":空管");
+ ed.alarm_information = "空管";
+ }
+ else if (number == 4)
+ {
+ Console.WriteLine(name + ":下限报警");
+ ed.alarm_information = "下限报警";
+ }
+ else if (number == 8)
+ {
+ Console.WriteLine(name + ":上限报警");
+ ed.alarm_information = "上限报警";
+ }
}
else if (name == "电流零点修正")
{
Console.WriteLine(name + ":" + number);
+ ed.current_zero_correction= number;
}
else if (name == "电流满度修正")
{
Console.WriteLine(name + ":" + number);
+ ed.current_full_scale_correction= number;
}
else if (name == "仪表量程设置")
{
Console.WriteLine(name + ":" + number);
+ ed.meter_range_setting= number.ToString();
}
else if (name == "测量阻尼时间")
{
Console.WriteLine(name + ":" + number);
+ ed.measure_damping_time= number.ToString();
}
else if (name == "流量方向选择项")
{
Console.WriteLine(name + ":" + number);
+ ed.flow_direction_option= number.ToString();
}
else if (name == "累计热量小数")
{
Console.WriteLine(name + ":0." + number);
+ ed.cumulative_heatB = number.ToString();
}
else if (name == "累计冷量小数")
{
Console.WriteLine(name + ":0." + number);
+ ed.cumulative_cooling_capacityB= number.ToString();
}
}
@@ -672,36 +851,43 @@ namespace NengLiang
///
/// 变量名
///
- public static void analysisUnit(string name, ulong number)
+ public static void analysisUlong(string name, ulong number, energy_data ed)
{
if (name == "瞬时流量")
{
number /= 1000;//此值单位为升 / 小时,需要除以 1000 得到立方米 / 小时
Console.WriteLine(name + ":" + number + "m³/h");
+ ed.instantaneous_delivery = number;
}
else if (name == "累计流量整数")
{
Console.WriteLine(name + ":" + number);
+ ed.cumulative_trafficA = number.ToString();
}
else if (name == "正累计流量整数")
{
Console.WriteLine(name + ":" + number);
+ ed.positive_total_flowA = number.ToString();
}
else if (name == "负累计流量整数")
{
Console.WriteLine(name + ":" + number);
+ ed.negative_total_flowA = number.ToString();
}
else if (name == "瞬时热量")//单位为 KJ/h(千焦每小时),若想得到 MJ/h 则需要除以 1000;换算成 KWh/h 需要除以 3600,
{
Console.WriteLine(name + ":" + number + "KJ/h");
+ ed.instant_heat = number;
}
else if (name == "累计热量整数")
{
Console.WriteLine(name + ":" + number);
+ ed.cumulative_heatA= number.ToString();
}
else if (name == "累计冷量整数")
{
Console.WriteLine(name + ":" + number);
+ ed.cumulative_cooling_capacityA= number.ToString();
}
}
diff --git a/NengLiang/NengLiang.csproj b/NengLiang/NengLiang.csproj
index f9bda20..f6a2159 100644
--- a/NengLiang/NengLiang.csproj
+++ b/NengLiang/NengLiang.csproj
@@ -59,6 +59,7 @@
+
diff --git a/NengLiang/NengLiang.csproj.user b/NengLiang/NengLiang.csproj.user
new file mode 100644
index 0000000..9b86104
--- /dev/null
+++ b/NengLiang/NengLiang.csproj.user
@@ -0,0 +1,6 @@
+
+
+
+ ShowAllFiles
+
+
\ No newline at end of file
diff --git a/NengLiang/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/NengLiang/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
index a423998..5c782ae 100644
Binary files a/NengLiang/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/NengLiang/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ
diff --git a/NengLiang/obj/Debug/NengLiang.csproj.AssemblyReference.cache b/NengLiang/obj/Debug/NengLiang.csproj.AssemblyReference.cache
index 2672051..404a997 100644
Binary files a/NengLiang/obj/Debug/NengLiang.csproj.AssemblyReference.cache and b/NengLiang/obj/Debug/NengLiang.csproj.AssemblyReference.cache differ