整表汇总

This commit is contained in:
高国正 2023-02-27 10:28:14 +08:00
parent 3344266ef5
commit c1e5e8a60e
10 changed files with 826 additions and 90 deletions

Binary file not shown.

View File

@ -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
{
/// <summary>
/// energy_data:实体类(属性说明自动提取数据库字段的描述信息)
/// </summary>
[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;
/// <summary>
/// 主键
/// </summary>
public string energy_id
{
set{ _energy_id=value;}
get{return _energy_id;}
}
/// <summary>
/// 设备外键
/// </summary>
public string device_id
{
set{ _device_id=value;}
get{return _device_id;}
}
/// <summary>
/// 供水温度
/// </summary>
public decimal? supply_water_temperature
{
set{ _supply_water_temperature=value;}
get{return _supply_water_temperature;}
}
/// <summary>
/// 回水温度
/// </summary>
public decimal? return_water_temperature
{
set{ _return_water_temperature=value;}
get{return _return_water_temperature;}
}
/// <summary>
/// 瞬时流量
/// </summary>
public decimal? instantaneous_delivery
{
set{ _instantaneous_delivery=value;}
get{return _instantaneous_delivery;}
}
/// <summary>
/// 采样值
/// </summary>
public decimal? sampling_value
{
set{ _sampling_value=value;}
get{return _sampling_value;}
}
/// <summary>
/// 累计流量
/// </summary>
public decimal? cumulative_traffic
{
set{ _cumulative_traffic=value;}
get{return _cumulative_traffic;}
}
/// <summary>
/// 正累计流量
/// </summary>
public decimal? positive_total_flow
{
set{ _positive_total_flow=value;}
get{return _positive_total_flow;}
}
/// <summary>
/// 负累计流量
/// </summary>
public decimal? negative_total_flow
{
set{ _negative_total_flow=value;}
get{return _negative_total_flow;}
}
/// <summary>
/// 瞬时热量
/// </summary>
public decimal? instant_heat
{
set{ _instant_heat=value;}
get{return _instant_heat;}
}
/// <summary>
/// 修改版本号
/// </summary>
public string revised_version_number
{
set{ _revised_version_number=value;}
get{return _revised_version_number;}
}
/// <summary>
/// 语言
/// </summary>
public string lang
{
set{ _lang=value;}
get{return _lang;}
}
/// <summary>
/// 表地址
/// </summary>
public string table_address
{
set{ _table_address=value;}
get{return _table_address;}
}
/// <summary>
/// 仪表通讯速度
/// </summary>
public int? meter_communication_speed
{
set{ _meter_communication_speed=value;}
get{return _meter_communication_speed;}
}
/// <summary>
/// 修改口径
/// </summary>
public decimal? modified_caliber
{
set{ _modified_caliber=value;}
get{return _modified_caliber;}
}
/// <summary>
/// 流量单位
/// </summary>
public string flow_unit
{
set{ _flow_unit=value;}
get{return _flow_unit;}
}
/// <summary>
/// 流量积算单位
/// </summary>
public string flow_integration_unit
{
set{ _flow_integration_unit=value;}
get{return _flow_integration_unit;}
}
/// <summary>
/// 零点采样值
/// </summary>
public decimal? zero_sample_value
{
set{ _zero_sample_value=value;}
get{return _zero_sample_value;}
}
/// <summary>
/// 仪表系数
/// </summary>
public decimal? meter_factor
{
set{ _meter_factor=value;}
get{return _meter_factor;}
}
/// <summary>
/// 热量系数
/// </summary>
public decimal? heat_coefficient
{
set{ _heat_coefficient=value;}
get{return _heat_coefficient;}
}
/// <summary>
/// 供水温度系数
/// </summary>
public decimal? supply_water_temperature_coefficient
{
set{ _supply_water_temperature_coefficient=value;}
get{return _supply_water_temperature_coefficient;}
}
/// <summary>
/// 回水温度系数
/// </summary>
public decimal? return_temperature_coefficient
{
set{ _return_temperature_coefficient=value;}
get{return _return_temperature_coefficient;}
}
/// <summary>
/// 小信号切除点
/// </summary>
public decimal? small_signal_cut_off_point
{
set{ _small_signal_cut_off_point=value;}
get{return _small_signal_cut_off_point;}
}
/// <summary>
/// 修改脉冲单位
/// </summary>
public decimal? modify_pulse_unit
{
set{ _modify_pulse_unit=value;}
get{return _modify_pulse_unit;}
}
/// <summary>
/// 允许切除显示
/// </summary>
public string allow_cutout_display
{
set{ _allow_cutout_display=value;}
get{return _allow_cutout_display;}
}
/// <summary>
/// 反向输出允许
/// </summary>
public string ReverseOutputAllows
{
set{ _reverseoutputallows=value;}
get{return _reverseoutputallows;}
}
/// <summary>
/// 电流输出类型
/// </summary>
public string current_output_type
{
set{ _current_output_type=value;}
get{return _current_output_type;}
}
/// <summary>
/// 脉冲输出方式
/// </summary>
public string pulse_output_mode
{
set{ _pulse_output_mode=value;}
get{return _pulse_output_mode;}
}
/// <summary>
/// 频率输出范围
/// </summary>
public string frequency_output_range
{
set{ _frequency_output_range=value;}
get{return _frequency_output_range;}
}
/// <summary>
/// 空管报警允许
/// </summary>
public string empty_traffic_alarm_allowed
{
set{ _empty_traffic_alarm_allowed=value;}
get{return _empty_traffic_alarm_allowed;}
}
/// <summary>
/// 空管报警阈值
/// </summary>
public decimal? empty_traffic_alarm_threshold
{
set{ _empty_traffic_alarm_threshold=value;}
get{return _empty_traffic_alarm_threshold;}
}
/// <summary>
/// 上限报警允许
/// </summary>
public string high_limit_alarm_allows
{
set{ _high_limit_alarm_allows=value;}
get{return _high_limit_alarm_allows;}
}
/// <summary>
/// 上限报警数值
/// </summary>
public decimal? upper_alarm_value
{
set{ _upper_alarm_value=value;}
get{return _upper_alarm_value;}
}
/// <summary>
/// 下限报警允许
/// </summary>
public string lower_limit_alarm_allowed
{
set{ _lower_limit_alarm_allowed=value;}
get{return _lower_limit_alarm_allowed;}
}
/// <summary>
/// 下限报警数值
/// </summary>
public decimal? lower_limit_alarm_value
{
set{ _lower_limit_alarm_value=value;}
get{return _lower_limit_alarm_value;}
}
/// <summary>
/// 励磁报警允许
/// </summary>
public string excitation_alarm_allows
{
set{ _excitation_alarm_allows=value;}
get{return _excitation_alarm_allows;}
}
/// <summary>
/// 传感器系数
/// </summary>
public decimal? sensor_coefficient
{
set{ _sensor_coefficient=value;}
get{return _sensor_coefficient;}
}
/// <summary>
/// 空管采样值
/// </summary>
public decimal? empty_pipe_sampling_value
{
set{ _empty_pipe_sampling_value=value;}
get{return _empty_pipe_sampling_value;}
}
/// <summary>
/// 报警信息
/// </summary>
public string alarm_information
{
set{ _alarm_information=value;}
get{return _alarm_information;}
}
/// <summary>
/// 电流零点修正
/// </summary>
public decimal? current_zero_correction
{
set{ _current_zero_correction=value;}
get{return _current_zero_correction;}
}
/// <summary>
/// 电流满度修正
/// </summary>
public decimal? current_full_scale_correction
{
set{ _current_full_scale_correction=value;}
get{return _current_full_scale_correction;}
}
/// <summary>
/// 仪表量程设置
/// </summary>
public string meter_range_setting
{
set{ _meter_range_setting=value;}
get{return _meter_range_setting;}
}
/// <summary>
/// 测量阻尼时间
/// </summary>
public string measure_damping_time
{
set{ _measure_damping_time=value;}
get{return _measure_damping_time;}
}
/// <summary>
/// 流量方向选择项
/// </summary>
public string flow_direction_option
{
set{ _flow_direction_option=value;}
get{return _flow_direction_option;}
}
/// <summary>
/// 累计热量
/// </summary>
public decimal? cumulative_heat
{
set{ _cumulative_heat=value;}
get{return _cumulative_heat;}
}
/// <summary>
/// 累计冷量
/// </summary>
public decimal? cumulative_cooling_capacity
{
set{ _cumulative_cooling_capacity=value;}
get{return _cumulative_cooling_capacity;}
}
/// <summary>
/// 录入日期
/// </summary>
public DateTime? input_date
{
set{ _input_date=value;}
get{return _input_date;}
}
/// <summary>
/// 创建时间
/// </summary>
public DateTime? create_time
{
set{ _create_time=value;}
get{return _create_time;}
}
/// <summary>
/// 备用1
/// </summary>
public string r1
{
set{ _r1=value;}
get{return _r1;}
}
/// <summary>
/// 备用2
/// </summary>
public string r2
{
set{ _r2=value;}
get{return _r2;}
}
/// <summary>
/// 备用3
/// </summary>
public string r3
{
set{ _r3=value;}
get{return _r3;}
}
#endregion Model
/// <summary>
/// 正累计流量整数
/// </summary>
public string positive_total_flowA { get { return positive_total_flowA; } set { positive_total_flowA = value; } }
/// <summary>
/// 正累计流量小数
/// </summary>
public string positive_total_flowB { get { return positive_total_flowB; } set { positive_total_flowB = value; } }
/// <summary>
/// 累计流量整数
/// </summary>
public string cumulative_trafficA { get { return cumulative_trafficA; } set { cumulative_trafficA = value} }
/// <summary>
/// 累计流量小数
/// </summary>
public string cumulative_trafficB { get { return cumulative_trafficB; } set { cumulative_trafficB=value} }
/// <summary>
/// 负累计流量整数
/// </summary>
public string negative_total_flowA { get { return negative_total_flowA; } set { negative_total_flowA = value; } }
/// <summary>
/// 负累计流量小数
/// </summary>
public string negative_total_flowB { get { return negative_total_flowB; } set { negative_total_flowB = value; } }
/// <summary>
/// 累计热量整数
/// </summary>
public string cumulative_heatA { get { return cumulative_heatA; } set { cumulative_heatA = value; } }
/// <summary>
/// 累计热量小数
/// </summary>
public string cumulative_heatB { get { return cumulative_heatB; } set { cumulative_heatB = value; } }
/// <summary>
/// 累计冷量整数
/// </summary>
public string cumulative_cooling_capacityA { get { return cumulative_cooling_capacityA; } set { cumulative_cooling_capacityA = value; } }
/// <summary>
/// 累计冷量小数
/// </summary>
public string cumulative_cooling_capacityB { get { return cumulative_cooling_capacityB; } set { cumulative_cooling_capacityB = value; } }
}
}

View File

@ -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
/// <summary>
/// 当前请求数据类型
/// </summary>
public static ushort index_id ;
public static ushort index_id;
/// <summary>
/// 报文发送间隔时间
/// </summary>
@ -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
/// 判断功能类型
/// </summary>
/// <param name="message"></param>
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
/// </summary>
/// <param name="message"></param>
/// <param name="key">地址码</param>
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<byte> by = new List<byte>();
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
}
}
/// <summary>
/// unit值类型解析
/// </summary>
/// <param name="name">变量名</param>
/// <param name="number"></param>
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
/// </summary>
/// <param name="name">变量名</param>
/// <param name="number"></param>
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();
}
}

View File

@ -59,6 +59,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="CRC.cs" />
<Compile Include="Models\energy_data.cs" />
<Compile Include="NengLiang.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ToolKit.cs" />

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectView>ShowAllFiles</ProjectView>
</PropertyGroup>
</Project>