Merge remote-tracking branch 'origin/master'

# Conflicts:
#	HybirdFrameworkDriver/ModbusTcpMaster/ModbusDecoder.cs
#	HybirdFrameworkDriver/ModbusTcpMaster/ModbusTcpMaster.cs
#	HybirdFrameworkDriver/TcpServer/SessionMgr.cs
#	HybirdFrameworkRepository/bin/Debug/net6.0/HybirdFrameworkRepository.deps.json
#	HybirdFrameworkRepository/obj/Debug/net6.0/ref/HybirdFrameworkRepository.dll
#	HybirdFrameworkRepository/obj/Debug/net6.0/refint/HybirdFrameworkRepository.dll
#	HybirdFrameworkServices/HybirdFrameworkServices.csproj
#	WinFormStarter/Form2.cs
#	WinFormStarter/WinFormStarter.csproj
master
smartwyy 6 months ago
commit b1d28cc4d4

Binary file not shown.

@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HybirdFrameworkDriver.ModbusTcpMaster
{
/// <summary>
/// PLC地址
/// </summary>
public class PlcDate
{
/// <summary>
/// 写编程使能
/// </summary>
public ModbusProperty<UInt16> ProgrammingEnable { get; set; } = new(40960);
/// <summary>
/// 本机modbus地址
/// </summary>
public ModbusProperty<UInt16> Modbus1Addres { get; set; } = new(40962);
/// <summary>
/// 波特率
/// </summary>
public ModbusProperty<UInt16> BaudRate { get; set; } = new(40964);
/// <summary>
/// 校验位
/// </summary>
public ModbusProperty<UInt16> CheckBit { get; set; } = new(2566);
/// <summary>
/// 秒
/// </summary>
public ModbusProperty<UInt16> Seconds { get; set; } = new(0);
/// <summary>
/// 分
/// </summary>
public ModbusProperty<UInt16> Points { get; set; } = new(2);
/// <summary>
/// 时
/// </summary>
public ModbusProperty<UInt16> When { get; set; } = new(4);
/// <summary>
/// 周
/// </summary>
public ModbusProperty<UInt16> Weeks { get; set; } = new(6);
/// <summary>
/// 日
/// </summary>
public ModbusProperty<UInt16> Day { get; set; } = new(8);
/// <summary>
/// 月
/// </summary>
public ModbusProperty<UInt16> Month { get; set; } = new(10);
/// <summary>
/// 年
/// </summary>
public ModbusProperty<UInt16> Years { get; set; } = new(12);
/// <summary>
/// 本机modbus地址
/// </summary>
public ModbusProperty<UInt16> Modbus1Addres2 { get; set; } = new(14);
/// <summary>
/// 保留
/// </summary>
public ModbusProperty<UInt16> Reserve { get; set; } = new(16);
/// <summary>
/// 电压变比
/// </summary>
public ModbusProperty<UInt16> VoltageRatio { get; set; } = new(18);
/// <summary>
/// 电流变比
/// </summary>
public ModbusProperty<UInt16> CurrentRatio { get; set; } = new(20);
/// <summary>
/// 秒脉冲/无功电能选择
/// </summary>
public ModbusProperty<UInt16> PulsePerSecond { get; set; } = new(42);
/// <summary>
/// 电流接线反向
/// </summary>
public ModbusProperty<UInt16> CurrentReversal { get; set; } = new(48);
/// <summary>
/// 电表清零
/// </summary>
public ModbusProperty<UInt16> MeterReset { get; set; } = new(4576);
}
}

@ -0,0 +1,40 @@
using HybirdFrameworkDriver.ModbusTcpMaster;
using log4net;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HybirdFrameworkDriver.TcpServer
{
public class ModbusSession
{
private readonly ILog Log = LogManager.GetLogger(typeof(ModbusSession));
public ModbusTcpMaster.ModbusTcpMaster ModbusTcpMaster;
private String IpAddr { get; }
public String Key { get; set; }
public ConcurrentDictionary<String, Object> BusinessMap { get; set; }
public ModbusSession(ModbusTcpMaster.ModbusTcpMaster modbusTcpMaster)
{
this.ModbusTcpMaster = modbusTcpMaster;
this.IpAddr = modbusTcpMaster.Ip;
this.Key = modbusTcpMaster.connectId;
}
public bool Write<T>(ModbusProperty<T> property)
{
return ModbusTcpMaster.WriteValue(property);
}
public byte[]? Read(int registerNo, int length)
{
return ModbusTcpMaster.BatchRead(registerNo, length);
}
}
}

@ -0,0 +1,59 @@
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Principal;
using System.Text;
using System.Threading.Tasks;
namespace HybirdFrameworkEntity.DbModel
{
/// <summary>
/// 设备连接参数信息字段类
/// </summary>
[SugarTable("t_bs_net_eqm_param_info")]
public partial class BsNetEqmParamInfo
{
/// <summary>
/// 索引
/// </summary>
[SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnName = "f_id")]
public int Id { get; set; }
/// <summary>
/// 设备类型编号
/// </summary>
[SugarColumn(ColumnName = "f_eqm_type_no")]
public int EqmTypeNo { get; set; }
/// <summary>
/// 设备类型名称
/// </summary>
[SugarColumn(ColumnName = "f_eqm_type_name")]
public string EqmTypeName { get; set; }
/// <summary>
/// 设备编码
/// </summary>
[SugarColumn(ColumnName = "f_eqm_code")]
public string EqmCode { get; set; }
/// <summary>
/// 设备序号
/// </summary>
[SugarColumn(ColumnName = "f_eqm_sn")]
public int EqmSn { get; set; }
/// <summary>
/// 连接地址
/// </summary>
[SugarColumn(ColumnName = "f_net_addr")]
public string NetAddr { get; set; }
/// <summary>
/// 连接端口
/// </summary>
[SugarColumn(ColumnName = "f_net_port")]
public string NetPort { get; set; }
/// <summary>
/// 目的地址
/// </summary>
[SugarColumn(ColumnName = "f_dest_addr")]
public string DestAddr { get; set; }
}
}

@ -0,0 +1,39 @@
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkEntity.DbModel;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HybirdFrameworkRepository.System
{
[Scope("SingleInstance")]
public class BsNetEqmParamInfoRepository : BaseRepository<BsNetEqmParamInfo>
{
private ISqlSugarClient DbBaseClient;
public BsNetEqmParamInfoRepository(ISqlSugarClient sqlSugar) : base(sqlSugar)
{
DbBaseClient = sqlSugar;
}
public List<BsNetEqmParamInfo> QueryListByFEqmTypeNo(List<int> fEqmTypeNo)
{
return DbBaseClient
.Queryable<BsNetEqmParamInfo>()
.In(t => t.EqmTypeNo, fEqmTypeNo)
.ToList();
}
public IEnumerable<IGrouping<int, BsNetEqmParamInfo>> QueryConnectParams(List<int> types)
{
List<BsNetEqmParamInfo> infos = this.QueryListByFEqmTypeNo(types);
return infos.GroupBy(i => i.EqmTypeNo).ToList();
}
}
}

@ -0,0 +1,171 @@
using HslCommunication.ModBus;
using HslCommunication;
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkDriver.ModbusTcpMaster;
using HybirdFrameworkDriver.TcpServer;
using HybirdFrameworkEntity.DbModel;
using HybirdFrameworkRepository.System;
using HybirdFrameworkServices.Init.Entity;
using HybirdFrameworkServices.Plc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HybirdFrameworkServices
{
[Scope("SingleInstance")]
public class EquipmentInit
{
#region
BsNetEqmParamInfoRepository _bsNetEqmParamInfoRepository;
public EquipmentInit(BsNetEqmParamInfoRepository bsNetEqmParamInfoRepository)
{
_bsNetEqmParamInfoRepository = bsNetEqmParamInfoRepository;
}
/// <summary>
/// 连接所有数据
/// </summary>
/// <exception cref="InvalidOperationException"></exception>
public void Connect()
{
BsNetEqmParamInfo bsNetEqmParamInfo = new BsNetEqmParamInfo()
{
EqmTypeNo = 3,
EqmTypeName = "",
EqmCode = "",
EqmSn = 3,
NetAddr = "127.0.0.1",
NetPort = "502",
DestAddr = "1",
};
ConnectPlc(bsNetEqmParamInfo);
}
/// <summary>
/// 连接PLC
/// </summary>
/// <param name="param"></param>
/// <returns></returns>
public int ConnectPlc(/*IGrouping<int, BsNetEqmParamInfo> param*/ BsNetEqmParamInfo p)
{
Thread thread = new Thread(() => ConnectPlcAsync(p));
thread.Start();
return 0;
}
/// <summary>
/// 连接PLC
/// </summary>
/// <param name="p"></param>
private void ConnectPlcAsync(BsNetEqmParamInfo p)
{
bool connected = false;
ModbusTcpMaster master = null;
//PLC连接
while (!connected)
{
master = new ModbusTcpMaster()
{
Ip = "172.0.20.66",
Port = 502,
};
master.ReadAction = BatchReadPlc;//启动线程一直读
master.Duration = 3000;
connected = master.Connect();
if (connected)
{
break;
}
Thread.Sleep(5000);
}
ModbusSession modbusSession = new ModbusSession(master);
master.connectId = master.Ip + master.Port;
SessionMgr.RegisterModbusSession(master.connectId, modbusSession);
SessionMgr.SetAttrModbus(modbusSession, "eqm_sn", p.EqmSn);
PlcInfo waterColdInfo = new PlcInfo(master.connectId, p.EqmSn);
ChargerStaticInfo.PlcInfos.TryAdd(p.EqmSn, waterColdInfo);
}
/**
*
*/
private static void BatchReadPlc(ModbusTcpMaster master)
{
while (true)
{
int sn = 3;//(int)SessionMgr.GetAttrModbus(master.connectId, "eqm_sn");
ChargerStaticInfo.PlcInfos.TryGetValue(sn, out PlcInfo plcInfo);
if (plcInfo != null)
{
var bytes01 = master.BatchRead(1, 115);
if (bytes01 != null)
{
ModbusDecoder.Decode<HostToPlc>(bytes01, plcInfo.hostToPlc);
}
var bytes02 = master.BatchRead(201, 222);
if (bytes02 != null)
{
ModbusDecoder.Decode<PlcToHost>(bytes02, plcInfo.plcToHost);
}
var bytes03 = master.BatchRead(701, 10);
if (bytes03 != null)
{
ModbusDecoder.Decode<PlcFault>(bytes03, plcInfo.plcFault);
}
//OperateResult<byte[]> result2 = ModbusTcpNet.Read("x=3;201", 222);
}
/*
if (plcInfo != null)
{
byte[]? bytes01 = master.BatchRead(0, 22);
if (bytes01 != null)
{
ModbusDecoder.DecodeByT<PlcReadAndWrite2>(bytes01, plcInfo.PlcReadAndWritten2);
}
byte[]? bytes02 = master.BatchRead(256, 170);
if (bytes02 != null)
{
ModbusDecoder.DecodeByT<PlcReadonly>(bytes02, plcInfo.PlcReadonly);
}
byte[]? bytes03 = master.BatchRead(39424, 108);
if (bytes03 != null)
{
ModbusDecoder.DecodeByT<PlcTurnsRatio>(bytes03, plcInfo.PlcTurnsRatio);
}
byte[]? bytes04 = master.BatchRead(40960, 3);//写编程使能。本机modbus地址。波特率
byte[]? bytes05 = master.BatchRead(2566, 1);//校验位
byte[]? bytes06 = master.BatchRead(42, 1);//秒脉冲/无功电能选择
byte[]? bytes07 = master.BatchRead(48, 1);//电流接线反向
byte[]? bytes08 = master.BatchRead(4576, 1);//电表清零
if (bytes04 != null)
{
ModbusDecoder.DecodeByT<PlcReadAndWrite1>(bytes04, plcInfo.PlcReadAndWritten1);
}
plcInfo.PlcReadAndWritten1.CheckBit = master.ModbusTcpNet.ByteTransform.TransUInt16(bytes05, 0);
plcInfo.PlcReadAndWritten1.PulsePerSecond = master.ModbusTcpNet.ByteTransform.TransUInt16(bytes06, 0);
plcInfo.PlcReadAndWritten1.CurrentReversal = master.ModbusTcpNet.ByteTransform.TransUInt16(bytes07, 0);
plcInfo.PlcReadAndWritten1.MeterReset = master.ModbusTcpNet.ByteTransform.TransUInt16(bytes08, 0);
}
*/
}
}
#endregion PLC
}
}

@ -0,0 +1,18 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HybirdFrameworkServices.Init.Entity
{
public class ChargerStaticInfo
{
/// <summary>
/// PLC管理
/// </summary>
public static readonly ConcurrentDictionary<int, PlcInfo> PlcInfos =
new ConcurrentDictionary<int, PlcInfo>();
}
}

@ -0,0 +1,18 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HybirdFrameworkServices.Init.Entity
{
/// <summary>
///PLC连接状态枚举
/// </summary>
public enum ConnectState
{
NOCONNECT = 0,
CONNECTING = 1,
CONNECTED = 2
}
}

@ -0,0 +1,86 @@
using HslCommunication;
using HslCommunication.ModBus;
using HybirdFrameworkDriver.ModbusTcpMaster;
using HybirdFrameworkDriver.TcpServer;
using HybirdFrameworkServices.Plc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HybirdFrameworkServices.Init.Entity
{
public class PlcInfo
{
#region 字段
/// <summary>
/// ModbusTcp客户端
/// </summary>
//public ModbusTcpNet _client = null;
/// <summary>
/// 设备编号
/// </summary>
private string _devNo = "001";
/// <summary>
/// 设备名称
/// </summary>
private string _devname = "换电PLC";
/// <summary>
/// 服务端连接IP
/// </summary>
private string _ipaddr = "172.0.20.48";
/// <summary>
/// 服务端连接端口
/// </summary>
private int _port = 502;
/// <summary>
/// 站号
/// </summary>
private byte _site = 0x01;
/// <summary>
/// 连接超时时间。单位秒
/// </summary>
private int _connecttimeout = 10;
/// <summary>
/// 保持活跃时间。单位秒
/// </summary>
private int _keepalive = 30;
/// <summary>
/// 连接状态
/// </summary>
private ConnectState _connect_state = ConnectState.NOCONNECT;
#endregion 字段
public string ChannelId;
public int EqmSn;
public HostToPlc hostToPlc=new HostToPlc();
public PlcToHost plcToHost =new PlcToHost();
public PlcFault plcFault = new PlcFault();
public PlcInfo(string channelId, int eqmSn)
{
ChannelId = channelId;
EqmSn = eqmSn;
}
public bool WriteUint16(ModbusProperty<UInt16> value)
{
bool bResult = false;
ModbusSession session = SessionMgr.GetModbusSession(ChannelId);
bResult = session.Write<UInt16>(value);
return bResult;
}
public bool Writeint16(ModbusProperty<Int16> value)
{
bool bResult = false;
ModbusSession session = SessionMgr.GetModbusSession(ChannelId);
bResult = session.Write<Int16>(value);
return bResult;
}
}
}

@ -0,0 +1,87 @@
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkDriver.ModbusTcpMaster;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HybirdFrameworkServices.Plc
{
public class HostToPlc
{
public ModbusProperty<short> ProtocolVersion1 { get; set; } = new(40001); // 协议版本
public ModbusProperty<short> ProtocolVersion2 { get; set; } = new(40002); // 协议版本
public ModbusProperty<short> ProtocolVersion3 { get; set; } = new(40003); // 协议版本
public ModbusProperty<ushort> CommunicationDiagnosis { get; set; } = new(40004); // 通讯诊断
public ModbusProperty<ushort> ModeControl { get; set; } = new(40005); // 模式控制
public ModbusProperty<ushort> EquipmentControl { get; set; } = new(40006); // 设备控制
public ModbusProperty<ushort> ExhaustFanControl { get; set; } = new(40007); // 排风扇控制
public ModbusProperty<ushort> LightingControl { get; set; } = new(40008); // 灯光控制
public ModbusProperty<ushort> Standby1 { get; set; } = new(40009); // 备用
public ModbusProperty<ushort> Standby2 { get; set; } = new(40010); // 备用
public ModbusProperty<ushort> Seconds { get; set; } = new(40011); // 对时时钟:秒
public ModbusProperty<ushort> Points { get; set; } = new(40012); // 对时时钟:分
public ModbusProperty<ushort> Hour { get; set; } = new(40013); // 对时时钟:时
public ModbusProperty<ushort> Day { get; set; } = new(40014); // 对时时钟:天
public ModbusProperty<ushort> Month { get; set; } = new(40015); // 对时时钟:月
public ModbusProperty<ushort> Years { get; set; } = new(40016); // 对时时钟:年
public ModbusProperty<string> Standby3 { get; set; } = new(40017, length: 4); // 备用3
public ModbusProperty<string> ChargingStatus { get; set; } = new(40021, length: 40); // 仓位充电状态
public ModbusProperty<short> ChargingStatus01 { get; set; } = new(40021); // 仓位充电状态
public ModbusProperty<short> ChargingStatus02 { get; set; } = new(40022); // 仓位充电状态
public ModbusProperty<short> ChargingStatus03 { get; set; } = new(40023); // 仓位充电状态
public ModbusProperty<short> ChargingStatus04 { get; set; } = new(40024); // 仓位充电状态
public ModbusProperty<short> ChargingStatus05 { get; set; } = new(40025); // 仓位充电状态
public ModbusProperty<short> ChargingStatus06 { get; set; } = new(40026); // 仓位充电状态
public ModbusProperty<short> ChargingStatus07 { get; set; } = new(40027); // 仓位充电状态
public ModbusProperty<short> ChargingStatus08 { get; set; } = new(40028); // 仓位充电状态
public ModbusProperty<short> ChargingStatus09 { get; set; } = new(40029); // 仓位充电状态
public ModbusProperty<short> ChargingStatus10 { get; set; } = new(40030); // 仓位充电状态
public ModbusProperty<short> ChargingStatus11 { get; set; } = new(40031); // 仓位充电状态
public ModbusProperty<short> ChargingStatus12 { get; set; } = new(40032); // 仓位充电状态
public ModbusProperty<short> ChargingStatus13 { get; set; } = new(40033); // 仓位充电状态
public ModbusProperty<short> ChargingStatus14 { get; set; } = new(40034); // 仓位充电状态
public ModbusProperty<short> ChargingStatus15 { get; set; } = new(40035); // 仓位充电状态
public ModbusProperty<short> ChargingStatus16 { get; set; } = new(40036); // 仓位充电状态
public ModbusProperty<short> ChargingStatus17 { get; set; } = new(40037); // 仓位充电状态
public ModbusProperty<short> ChargingStatus18 { get; set; } = new(40038); // 仓位充电状态
public ModbusProperty<short> ChargingStatus19 { get; set; } = new(40039); // 仓位充电状态
public ModbusProperty<short> ChargingStatus20 { get; set; } = new(40040); // 仓位充电状态
public ModbusProperty<string> BatteryType { get; set; } = new(40061, length: 40); // 仓位所在电池型号
public ModbusProperty<short> BatteryType01 { get; set; } = new(40061); // 仓位所在电池型号
public ModbusProperty<short> BatteryType02 { get; set; } = new(40062); // 仓位所在电池型号
public ModbusProperty<short> BatteryType03 { get; set; } = new(40063); // 仓位所在电池型号
public ModbusProperty<short> BatteryType04 { get; set; } = new(40064); // 仓位所在电池型号
public ModbusProperty<short> BatteryType05 { get; set; } = new(40065); // 仓位所在电池型号
public ModbusProperty<short> BatteryType06 { get; set; } = new(40066); // 仓位所在电池型号
public ModbusProperty<short> BatteryType07 { get; set; } = new(40067); // 仓位所在电池型号
public ModbusProperty<short> BatteryType08 { get; set; } = new(40068); // 仓位所在电池型号
public ModbusProperty<short> BatteryType09 { get; set; } = new(40069); // 仓位所在电池型号
public ModbusProperty<short> BatteryType10 { get; set; } = new(40070); // 仓位所在电池型号
public ModbusProperty<short> BatteryType11 { get; set; } = new(40071); // 仓位所在电池型号
public ModbusProperty<short> BatteryType12 { get; set; } = new(40072); // 仓位所在电池型号
public ModbusProperty<short> BatteryType13 { get; set; } = new(40073); // 仓位所在电池型号
public ModbusProperty<short> BatteryType14 { get; set; } = new(40074); // 仓位所在电池型号
public ModbusProperty<short> BatteryType15 { get; set; } = new(40075); // 仓位所在电池型号
public ModbusProperty<short> BatteryType16 { get; set; } = new(40076); // 仓位所在电池型号
public ModbusProperty<short> BatteryType17 { get; set; } = new(40077); // 仓位所在电池型号
public ModbusProperty<short> BatteryType18 { get; set; } = new(40078); // 仓位所在电池型号
public ModbusProperty<short> BatteryType19 { get; set; } = new(40079); // 仓位所在电池型号
public ModbusProperty<short> BatteryType20 { get; set; } = new(40080); // 仓位所在电池型号
public ModbusProperty<ushort> VehicleParkingLocation { get; set; } = new(40101); // 车辆驻车位置
public ModbusProperty<ushort> VehicleParkingStatus { get; set; } = new(40102); // 车辆驻车状态
public ModbusProperty<ushort> LightIn { get; set; } = new(40103); // "三色灯控制整站状态(入口)"
public ModbusProperty<ushort> LightOut { get; set; } = new(40104); // "三色灯控制整站状态(出口)"
public ModbusProperty<ushort> StopCommand { get; set; } = new(40105); // 电池包锁止异常,暂停命令
public ModbusProperty<string> Standby4 { get; set; } = new(40106, length: 5); // 备用4
public ModbusProperty<ushort> TaskType { get; set; } = new(40111); // 任务类型
public ModbusProperty<ushort> EntrySelection { get; set; } = new(40112); // 入仓位选择
public ModbusProperty<ushort> ExitSelection { get; set; } = new(40113); // 出仓仓位选择
public ModbusProperty<ushort> BatteryPackType { get; set; } = new(40114); // 电池包类型
public ModbusProperty<ushort> TaskEnablement { get; set; } = new(40115); // 任务使能
}
}

@ -0,0 +1,23 @@
using HybirdFrameworkDriver.ModbusTcpMaster;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HybirdFrameworkServices.Plc
{
public class PlcFault
{
public ModbusProperty<ushort> ErrorCode01 { get; set; } = new(40701); // 错误码
public ModbusProperty<ushort> ErrorCode02 { get; set; } = new(40702); // 错误码
public ModbusProperty<ushort> ErrorCode03 { get; set; } = new(40703); // 错误码
public ModbusProperty<ushort> ErrorCode04 { get; set; } = new(40704); // 错误码
public ModbusProperty<ushort> ErrorCode05 { get; set; } = new(40705); // 错误码
public ModbusProperty<ushort> ErrorCode06 { get; set; } = new(40706); // 错误码
public ModbusProperty<ushort> ErrorCode07 { get; set; } = new(40707); // 错误码
public ModbusProperty<ushort> ErrorCode08 { get; set; } = new(40708); // 错误码
public ModbusProperty<ushort> ErrorCode09 { get; set; } = new(40709); // 错误码
public ModbusProperty<ushort> ErrorCode10 { get; set; } = new(40710); // 错误码
}
}

@ -0,0 +1,69 @@
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkDriver.ModbusTcpMaster;
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace HybirdFrameworkServices.Plc
{
/// <summary>
///
/// </summary>
public class PlcToHost
{
public ModbusProperty<ushort> ProtocolVersion1 { get; set; } = new(40201); // 协议版本
public ModbusProperty<ushort> ProtocolVersion2 { get; set; } = new(40202); // 协议版本
public ModbusProperty<ushort> ProtocolVersion3 { get; set; } = new(40203); // 协议版本
public ModbusProperty<ushort> CommunicationDiagnosis { get; set; } = new(40204); // 通讯诊断
public ModbusProperty<ushort> ModeControl { get; set; } = new(40205); // 模式状态
public ModbusProperty<ushort> DeviceSystemStatus { get; set; } = new(40206); // 设备系统状态
//public ModbusProperty<bool> type00 { get; set; } = new(400206,length:1, type: ModbusDataType.Bit); //BIT0:复位
//public ModbusProperty<bool> type01 { get; set; } = new(400206,length:1, type: ModbusDataType.Bit); //BIT1:启动
//public ModbusProperty<bool> type02 { get; set; } = new(400206,length:1, type: ModbusDataType.Bit); //BIT2:暂停
//public ModbusProperty<bool> type03 { get; set; } = new(400206,length:1, type: ModbusDataType.Bit); //BIT3:急停
//public ModbusProperty<bool> type04 { get; set; } = new(400206,length:1, type: ModbusDataType.Bit); //BIT4:
//public ModbusProperty<bool> type05 { get; set; } = new(400206,length:1, type: ModbusDataType.Bit); //BIT5:整站断电
//public ModbusProperty<bool> type06 { get; set; } = new(400206,length:1, type: ModbusDataType.Bit); //BIT6:自动运行中
//public ModbusProperty<bool> type07 { get; set; } = new(400206,length:1, type: ModbusDataType.Bit); //BIT7:PLC停机报警
//public ModbusProperty<bool> type08 { get; set; } = new(400206,length:1, type: ModbusDataType.Bit); //BIT8:PLC提示预警
public ModbusProperty<ushort> RemoteLocalControlState { get; set; } = new(40207); // 遥本控状态
public ModbusProperty<ushort> LightStatus { get; set; } = new(40208); // 灯光状态
public ModbusProperty<ushort> ExhaustFanStatus { get; set; } = new(40209); // 排风扇状态
public ModbusProperty<ushort> WaterStatusStation { get; set; } = new(40210); // 站内积水状态
public ModbusProperty<string> value09 { get; set; } = new(40211, length: 30); // 备用
public ModbusProperty<string> InPosition { get; set; } = new(40241, length: 40); // 在位状态
public ModbusProperty<string> value11 { get; set; } = new(40281, length: 20); // 备用
public ModbusProperty<ushort> CarStatus { get; set; } = new(40301); // 载行车设备状态
public ModbusProperty<ushort> value13 { get; set; } = new(40302); // 备用
public ModbusProperty<ushort> value14 { get; set; } = new(40303); // 备用
public ModbusProperty<ushort> value15 { get; set; } = new(40304); // 备用
public ModbusProperty<ushort> value16 { get; set; } = new(40305); // 备用
public ModbusProperty<short> PercentageTorqueX { get; set; } = new(40306); // x轴扭矩百分比
public ModbusProperty<short> PercentageTorqueY { get; set; } = new(40307); // y轴扭矩百分比
public ModbusProperty<short> PercentageTorqueZ { get; set; } = new(40308); // z轴扭矩百分比
public ModbusProperty<string> value20 { get; set; } = new(40309, length: 92); // 备用
public ModbusProperty<ushort> RadarStatesIn{ get; set; } = new(40401); // " 入口雷达状态"
public ModbusProperty<ushort> RadarStatesOut { get; set; } = new(40402); // " 出口雷达状态"
public ModbusProperty<ushort> SpotPhotoelectricSignal { get; set; } = new(40403); // 到位光电信号
public ModbusProperty<ushort> PhysicalButtonState { get; set; } = new(40404); // 实体按钮状态
public ModbusProperty<ushort> LightIn { get; set; } = new(40405); // "三色灯控制通道状态(入口)"
public ModbusProperty<ushort> LightOut { get; set; } = new(40406); // "三色灯控制通道状态(出口)"
public ModbusProperty<ushort> TaskType { get; set; } = new(40407); // "任务类型状态(是否允许允许执行任务)"
public ModbusProperty<ushort> TaskStates { get; set; } = new(40408); // 任务状态
public ModbusProperty<ushort> OperationalTrainNumber { get; set; } = new(40409); // 执行任务行车号
public ModbusProperty<ushort> ChannelLocationState { get; set; } = new(40410); // 通道定位状态
public ModbusProperty<short> DeviationX { get; set; } = new(40411); // x偏差
public ModbusProperty<short> DeviationY { get; set; } = new(40412); // y偏差
public ModbusProperty<short> DeviationZ { get; set; } = new(40413); // z偏差
public ModbusProperty<string> value44 { get; set; } = new(40414, length: 7); // 备用
}
}

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

File diff suppressed because it is too large Load Diff

@ -0,0 +1,555 @@
using HslCommunication.ModBus;
using HslCommunication;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using HybirdFrameworkDriver.ModbusTcpMaster;
using HybirdFrameworkServices.Init.Entity;
using HybirdFrameworkServices.Plc;
using HybirdFrameworkDriver.TcpServer;
using Newtonsoft.Json.Linq;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
namespace WinFormStarter
{
public partial class FrmPlc : Form
{
public FrmPlc()
{
InitializeComponent();
}
ModbusTcpNet ModbusTcpNet;
int heart = 0;
private void BtnWrite01_Click(object sender, EventArgs e)
{
bool bConvert = ushort.TryParse(this.txtValue04.Text, out ushort iValue);
if (!bConvert)
{
MessageBox.Show("请输入有效值");
return;
}
ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo);
if (plcInfo == null)
{
MessageBox.Show("PLC未连接");
return;
}
plcInfo.hostToPlc.CommunicationDiagnosis.Value = iValue;
bool bResult = plcInfo.WriteUint16(plcInfo.hostToPlc.CommunicationDiagnosis);
}
private void BtnWrite02_Click(object sender, EventArgs e)
{
bool bConvert = ushort.TryParse(this.txtValue05.Text, out ushort iValue);
if (!bConvert)
{
MessageBox.Show("请输入有效值");
return;
}
ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo);
if (plcInfo == null)
{
MessageBox.Show("PLC未连接");
return;
}
plcInfo.hostToPlc.ModeControl.Value = iValue;
bool bResult = plcInfo.WriteUint16(plcInfo.hostToPlc.ModeControl);
}
private void BtnWrite03_Click(object sender, EventArgs e)
{
bool bConvert = ushort.TryParse(this.txtValue06.Text, out ushort iValue);
if (!bConvert)
{
MessageBox.Show("请输入有效值");
return;
}
ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo);
if (plcInfo == null)
{
MessageBox.Show("PLC未连接");
return;
}
plcInfo.hostToPlc.EquipmentControl.Value = iValue;
bool bResult = plcInfo.WriteUint16(plcInfo.hostToPlc.EquipmentControl);
}
private void BtnWrite04_Click(object sender, EventArgs e)
{
bool bConvert = ushort.TryParse(this.txtValue07.Text, out ushort iValue);
if (!bConvert)
{
MessageBox.Show("请输入有效值");
return;
}
ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo);
if (plcInfo == null)
{
MessageBox.Show("PLC未连接");
return;
}
plcInfo.hostToPlc.ExhaustFanControl.Value = iValue;
bool bResult = plcInfo.WriteUint16(plcInfo.hostToPlc.ExhaustFanControl);
}
private void BtnWrite05_Click(object sender, EventArgs e)
{
bool bConvert = ushort.TryParse(this.txtValue08.Text, out ushort iValue);
if (!bConvert)
{
MessageBox.Show("请输入有效值");
return;
}
ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo);
if (plcInfo == null)
{
MessageBox.Show("PLC未连接");
return;
}
plcInfo.hostToPlc.LightingControl.Value = iValue;
bool bResult = plcInfo.WriteUint16(plcInfo.hostToPlc.LightingControl);
}
private void BtnWrite06_Click(object sender, EventArgs e)
{
bool bConvert = ushort.TryParse(this.txtValue09.Text, out ushort iValue);
if (!bConvert)
{
MessageBox.Show("请输入有效值");
return;
}
ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo);
if (plcInfo == null)
{
MessageBox.Show("PLC未连接");
return;
}
plcInfo.hostToPlc.Seconds.Value = iValue;
bool bResult = plcInfo.WriteUint16(plcInfo.hostToPlc.Seconds);
}
private void BtnWrite07_Click(object sender, EventArgs e)
{
bool bConvert = ushort.TryParse(this.txtValue10.Text, out ushort iValue);
if (!bConvert)
{
MessageBox.Show("请输入有效值");
return;
}
ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo);
if (plcInfo == null)
{
MessageBox.Show("PLC未连接");
return;
}
plcInfo.hostToPlc.Points.Value = iValue;
bool bResult = plcInfo.WriteUint16(plcInfo.hostToPlc.Points);
}
private void BtnWrite08_Click(object sender, EventArgs e)
{
bool bConvert = ushort.TryParse(this.txtValue11.Text, out ushort iValue);
if (!bConvert)
{
MessageBox.Show("请输入有效值");
return;
}
ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo);
if (plcInfo == null)
{
MessageBox.Show("PLC未连接");
return;
}
plcInfo.hostToPlc.Hour.Value = iValue;
bool bResult = plcInfo.WriteUint16(plcInfo.hostToPlc.Hour);
}
private void BtnWrite09_Click(object sender, EventArgs e)
{
bool bConvert = ushort.TryParse(this.txtValue12.Text, out ushort iValue);
if (!bConvert)
{
MessageBox.Show("请输入有效值");
return;
}
ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo);
if (plcInfo == null)
{
MessageBox.Show("PLC未连接");
return;
}
plcInfo.hostToPlc.Day.Value = iValue;
bool bResult = plcInfo.WriteUint16(plcInfo.hostToPlc.Day);
}
private void BtnWrite10_Click(object sender, EventArgs e)
{
bool bConvert = ushort.TryParse(this.txtValue13.Text, out ushort iValue);
if (!bConvert)
{
MessageBox.Show("请输入有效值");
return;
}
ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo);
if (plcInfo == null)
{
MessageBox.Show("PLC未连接");
return;
}
plcInfo.hostToPlc.Month.Value = iValue;
bool bResult = plcInfo.WriteUint16(plcInfo.hostToPlc.Month);
}
private void BtnWrite11_Click(object sender, EventArgs e)
{
bool bConvert = ushort.TryParse(this.txtValue14.Text, out ushort iValue);
if (!bConvert)
{
MessageBox.Show("请输入有效值");
return;
}
ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo);
if (plcInfo == null)
{
MessageBox.Show("PLC未连接");
return;
}
plcInfo.hostToPlc.Years.Value = iValue;
bool bResult = plcInfo.WriteUint16(plcInfo.hostToPlc.Years);
}
/// <summary>
/// 车辆驻车位置
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void BtnWrite14_Click(object sender, EventArgs e)
{
bool bConvert = ushort.TryParse(this.txtValue15.Text, out ushort iValue);
if (!bConvert)
{
MessageBox.Show("请输入有效值");
return;
}
ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo);
if (plcInfo == null)
{
MessageBox.Show("PLC未连接");
return;
}
plcInfo.hostToPlc.VehicleParkingLocation.Value = iValue;
bool bResult = plcInfo.WriteUint16(plcInfo.hostToPlc.VehicleParkingLocation);
}
private void BtnWrite15_Click(object sender, EventArgs e)
{
bool bConvert = ushort.TryParse(this.txtValue16.Text, out ushort iValue);
if (!bConvert)
{
MessageBox.Show("请输入有效值");
return;
}
ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo);
if (plcInfo == null)
{
MessageBox.Show("PLC未连接");
return;
}
plcInfo.hostToPlc.VehicleParkingStatus.Value = iValue;
bool bResult = plcInfo.WriteUint16(plcInfo.hostToPlc.VehicleParkingStatus);
}
/// <summary>
/// 三色灯
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void BtnWrite16_Click(object sender, EventArgs e)
{
bool bConvert = ushort.TryParse(this.txtValue17.Text, out ushort iValue);
if (!bConvert)
{
MessageBox.Show("请输入有效值");
return;
}
ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo);
if (plcInfo == null)
{
MessageBox.Show("PLC未连接");
return;
}
plcInfo.hostToPlc.LightIn.Value = iValue;
bool bResult = plcInfo.WriteUint16(plcInfo.hostToPlc.LightIn);
}
private void BtnWrite17_Click(object sender, EventArgs e)
{
bool bConvert = ushort.TryParse(this.txtValue16.Text, out ushort iValue);
if (!bConvert)
{
MessageBox.Show("请输入有效值");
return;
}
ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo);
if (plcInfo == null)
{
MessageBox.Show("PLC未连接");
return;
}
plcInfo.hostToPlc.LightOut.Value = iValue;
bool bResult = plcInfo.WriteUint16(plcInfo.hostToPlc.LightOut);
}
/// <summary>
/// 锁止异常
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void BtnWrite18_Click(object sender, EventArgs e)
{
bool bConvert = ushort.TryParse(this.txtValue19.Text, out ushort iValue);
if (!bConvert)
{
MessageBox.Show("请输入有效值");
return;
}
ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo);
if (plcInfo == null)
{
MessageBox.Show("PLC未连接");
return;
}
plcInfo.hostToPlc.StopCommand.Value = iValue;
bool bResult = plcInfo.WriteUint16(plcInfo.hostToPlc.StopCommand);
}
private void button3_Click(object sender, EventArgs e)
{
bool bConvert = ushort.TryParse(this.txtValue20.Text, out ushort iValue);
if (!bConvert)
{
MessageBox.Show("请输入有效值");
return;
}
ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo);
if (plcInfo == null)
{
MessageBox.Show("PLC未连接");
return;
}
plcInfo.hostToPlc.TaskType.Value = iValue;
bool bResult = plcInfo.WriteUint16(plcInfo.hostToPlc.TaskType);
}
/// <summary>
/// 入仓仓位选择
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button2_Click(object sender, EventArgs e)
{
bool bConvert = ushort.TryParse(this.txtValue21.Text, out ushort iValue);
if (!bConvert)
{
MessageBox.Show("请输入有效值");
return;
}
ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo);
if (plcInfo == null)
{
MessageBox.Show("PLC未连接");
return;
}
plcInfo.hostToPlc.EntrySelection.Value = iValue;
bool bResult = plcInfo.WriteUint16(plcInfo.hostToPlc.EntrySelection);
}
private void button1_Click(object sender, EventArgs e)
{
bool bConvert = ushort.TryParse(this.txtValue22.Text, out ushort iValue);
if (!bConvert)
{
MessageBox.Show("请输入有效值");
return;
}
ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo);
if (plcInfo == null)
{
MessageBox.Show("PLC未连接");
return;
}
plcInfo.hostToPlc.ExitSelection.Value = iValue;
bool bResult = plcInfo.WriteUint16(plcInfo.hostToPlc.ExitSelection);
}
private void button5_Click(object sender, EventArgs e)
{
bool bConvert = ushort.TryParse(this.txtValue23.Text, out ushort iValue);
if (!bConvert)
{
MessageBox.Show("请输入有效值");
return;
}
ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo);
if (plcInfo == null)
{
MessageBox.Show("PLC未连接");
return;
}
plcInfo.hostToPlc.BatteryPackType.Value = iValue;
bool bResult = plcInfo.WriteUint16(plcInfo.hostToPlc.BatteryPackType);
}
private void button4_Click(object sender, EventArgs e)
{
bool bConvert = ushort.TryParse(this.txtValue24.Text, out ushort iValue);
if (!bConvert)
{
MessageBox.Show("请输入有效值");
return;
}
ChargerStaticInfo.PlcInfos.TryGetValue(1, out PlcInfo plcInfo);
if (plcInfo == null)
{
MessageBox.Show("PLC未连接");
return;
}
plcInfo.hostToPlc.TaskEnablement.Value = iValue;
bool bResult = plcInfo.WriteUint16(plcInfo.hostToPlc.TaskEnablement);
}
private void button6_Click(object sender, EventArgs e)
{
bool bConvert1 = short.TryParse(this.txtValue01.Text, out short iValue1);
bool bConvert2 = short.TryParse(this.txtValue02.Text, out short iValue2);
bool bConvert3 = short.TryParse(this.txtValue03.Text, out short iValue3);
ChargerStaticInfo.PlcInfos.TryGetValue(3, out PlcInfo plcInfo);
if (plcInfo != null)
{
HostToPlc hostToPlc = new HostToPlc();
hostToPlc.ProtocolVersion1.Value = iValue1;
hostToPlc.ProtocolVersion2.Value = iValue2;
hostToPlc.ProtocolVersion3.Value = iValue3;
plcInfo.Writeint16(hostToPlc.ProtocolVersion1);
plcInfo.Writeint16(hostToPlc.ProtocolVersion2);
plcInfo.Writeint16(hostToPlc.ProtocolVersion3);
}
}
/// <summary>
/// 把采集值显示上来
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void BtnCollectionAssignment_Click(object sender, EventArgs e)
{
ChargerStaticInfo.PlcInfos.TryGetValue(3, out PlcInfo plcInfo);
if (plcInfo != null)
{
lblValue01.Text = plcInfo.plcToHost.ProtocolVersion1.Value + "." +
plcInfo.plcToHost.ProtocolVersion2.Value + "." +
plcInfo.plcToHost.ProtocolVersion3.Value;
lblValue02.Text = plcInfo.plcToHost.CommunicationDiagnosis.Value.ToString();
lblValue03.Text = plcInfo.plcToHost.ModeControl.Value.ToString();
lblValue04.Text = plcInfo.plcToHost.DeviceSystemStatus.Value.ToString();
lblValue05.Text = plcInfo.plcToHost.RemoteLocalControlState.Value.ToString();
lblValue06.Text = plcInfo.plcToHost.LightStatus.Value.ToString();
lblValue07.Text = plcInfo.plcToHost.ExhaustFanStatus.Value.ToString();
lblValue08.Text = plcInfo.plcToHost.WaterStatusStation.Value.ToString();
lblValue09.Text = plcInfo.plcToHost.InPosition.Value.ToString();
lblValue10.Text = plcInfo.plcToHost.CarStatus.Value.ToString();
lblValue11.Text = plcInfo.plcToHost.PercentageTorqueX.Value.ToString();
lblValue12.Text = plcInfo.plcToHost.PercentageTorqueY.Value.ToString();
lblValue13.Text = plcInfo.plcToHost.PercentageTorqueZ.Value.ToString();
lblValue14.Text = plcInfo.plcToHost.RadarStatesIn.Value.ToString();
lblValue15.Text = plcInfo.plcToHost.RadarStatesOut.Value.ToString();
lblValue16.Text = plcInfo.plcToHost.SpotPhotoelectricSignal.Value.ToString();
lblValue17.Text = plcInfo.plcToHost.PhysicalButtonState.Value.ToString();
lblValue18.Text = plcInfo.plcToHost.LightIn.Value.ToString();
lblValue19.Text = plcInfo.plcToHost.LightOut.Value.ToString();
lblValue20.Text = plcInfo.plcToHost.TaskType.Value.ToString();
lblValue21.Text = plcInfo.plcToHost.TaskStates.Value.ToString();
lblValue22.Text = plcInfo.plcToHost.OperationalTrainNumber.Value.ToString();
lblValue23.Text = plcInfo.plcToHost.ChannelLocationState.Value.ToString();
lblValue24.Text = plcInfo.plcToHost.DeviationX.Value.ToString();
lblValue25.Text = plcInfo.plcToHost.DeviationY.Value.ToString();
lblValue26.Text = plcInfo.plcToHost.DeviationZ.Value.ToString();
txtValue01.Text = plcInfo.hostToPlc.ProtocolVersion1.Value.ToString();
txtValue02.Text = plcInfo.hostToPlc.ProtocolVersion2.Value.ToString();
txtValue03.Text = plcInfo.hostToPlc.ProtocolVersion3.Value.ToString();
txtValue04.Text = plcInfo.hostToPlc.CommunicationDiagnosis.Value.ToString();
txtValue05.Text = plcInfo.hostToPlc.ModeControl.Value.ToString();
txtValue06.Text = plcInfo.hostToPlc.EquipmentControl.Value.ToString();
txtValue07.Text = plcInfo.hostToPlc.ExhaustFanControl.Value.ToString();
txtValue08.Text = plcInfo.hostToPlc.LightingControl.Value.ToString();
txtValue09.Text = plcInfo.hostToPlc.Seconds.Value.ToString();
txtValue10.Text = plcInfo.hostToPlc.Points.Value.ToString();
txtValue11.Text = plcInfo.hostToPlc.Hour.Value.ToString();
txtValue12.Text = plcInfo.hostToPlc.Day.Value.ToString();
txtValue13.Text = plcInfo.hostToPlc.Month.Value.ToString();
txtValue14.Text = plcInfo.hostToPlc.Years.Value.ToString();
txtValue15.Text = plcInfo.hostToPlc.VehicleParkingLocation.Value.ToString();
txtValue16.Text = plcInfo.hostToPlc.VehicleParkingStatus.Value.ToString();
txtValue17.Text = plcInfo.hostToPlc.LightIn.Value.ToString();
txtValue18.Text = plcInfo.hostToPlc.LightOut.Value.ToString();
txtValue19.Text = plcInfo.hostToPlc.StopCommand.Value.ToString();
txtValue20.Text = plcInfo.hostToPlc.TaskType.Value.ToString();
txtValue21.Text = plcInfo.hostToPlc.EntrySelection.Value.ToString();
txtValue22.Text = plcInfo.hostToPlc.ExitSelection.Value.ToString();
txtValue23.Text = plcInfo.hostToPlc.BatteryPackType.Value.ToString();
txtValue24.Text = plcInfo.hostToPlc.TaskEnablement.Value.ToString();
textBox1.Text = plcInfo.hostToPlc.ChargingStatus01.Value.ToString();
textBox2.Text = plcInfo.hostToPlc.ChargingStatus02.Value.ToString();
textBox3.Text = plcInfo.hostToPlc.ChargingStatus03.Value.ToString();
textBox4.Text = plcInfo.hostToPlc.ChargingStatus04.Value.ToString();
textBox5.Text = plcInfo.hostToPlc.ChargingStatus05.Value.ToString();
textBox6.Text = plcInfo.hostToPlc.ChargingStatus06.Value.ToString();
textBox7.Text = plcInfo.hostToPlc.ChargingStatus07.Value.ToString();
textBox8.Text = plcInfo.hostToPlc.ChargingStatus08.Value.ToString();
textBox9.Text = plcInfo.hostToPlc.ChargingStatus09.Value.ToString();
textBox10.Text = plcInfo.hostToPlc.ChargingStatus10.Value.ToString();
textBox11.Text = plcInfo.hostToPlc.ChargingStatus11.Value.ToString();
textBox12.Text = plcInfo.hostToPlc.ChargingStatus12.Value.ToString();
textBox13.Text = plcInfo.hostToPlc.ChargingStatus13.Value.ToString();
textBox14.Text = plcInfo.hostToPlc.ChargingStatus14.Value.ToString();
textBox15.Text = plcInfo.hostToPlc.ChargingStatus15.Value.ToString();
textBox16.Text = plcInfo.hostToPlc.ChargingStatus16.Value.ToString();
textBox17.Text = plcInfo.hostToPlc.ChargingStatus17.Value.ToString();
textBox18.Text = plcInfo.hostToPlc.ChargingStatus18.Value.ToString();
textBox19.Text = plcInfo.hostToPlc.ChargingStatus19.Value.ToString();
textBox20.Text = plcInfo.hostToPlc.ChargingStatus20.Value.ToString();
textBox21.Text = plcInfo.hostToPlc.BatteryType01.Value.ToString();
textBox22.Text = plcInfo.hostToPlc.BatteryType02.Value.ToString();
textBox23.Text = plcInfo.hostToPlc.BatteryType03.Value.ToString();
textBox24.Text = plcInfo.hostToPlc.BatteryType04.Value.ToString();
textBox25.Text = plcInfo.hostToPlc.BatteryType05.Value.ToString();
textBox26.Text = plcInfo.hostToPlc.BatteryType06.Value.ToString();
textBox27.Text = plcInfo.hostToPlc.BatteryType07.Value.ToString();
textBox28.Text = plcInfo.hostToPlc.BatteryType08.Value.ToString();
textBox29.Text = plcInfo.hostToPlc.BatteryType09.Value.ToString();
textBox30.Text = plcInfo.hostToPlc.BatteryType10.Value.ToString();
textBox31.Text = plcInfo.hostToPlc.BatteryType11.Value.ToString();
textBox32.Text = plcInfo.hostToPlc.BatteryType12.Value.ToString();
textBox33.Text = plcInfo.hostToPlc.BatteryType13.Value.ToString();
textBox34.Text = plcInfo.hostToPlc.BatteryType14.Value.ToString();
textBox35.Text = plcInfo.hostToPlc.BatteryType15.Value.ToString();
textBox36.Text = plcInfo.hostToPlc.BatteryType16.Value.ToString();
textBox37.Text = plcInfo.hostToPlc.BatteryType17.Value.ToString();
textBox38.Text = plcInfo.hostToPlc.BatteryType18.Value.ToString();
textBox39.Text = plcInfo.hostToPlc.BatteryType19.Value.ToString();
textBox40.Text = plcInfo.hostToPlc.BatteryType20.Value.ToString();
}
}
}
}

@ -0,0 +1,60 @@
<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

@ -1,6 +1,7 @@
using Autofac;
using HybirdFrameworkCore.Autofac;
using HybirdFrameworkCore.Configuration;
using HybirdFrameworkServices;
using log4net.Config;
using SqlSugar;
using SqlSugar.IOC;
@ -50,7 +51,10 @@ internal static class Program
// 构建容器
Container = builder.Build();
AppInfo.Container = Container.BeginLifetimeScope("root");
EquipmentInit equipmentInit = AppInfo.Container.Resolve<EquipmentInit>();
equipmentInit.Connect();
Application.Run(AppInfo.Container.ResolveNamed<Form>("Form2"));
}
private static void Application_ThreadException(object sender, ThreadExceptionEventArgs ex)

@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup />
<ItemGroup />
<ItemGroup>
<Compile Update="FrmPlc.cs">
<SubType>Form</SubType>
</Compile>
</ItemGroup>
</Project>

@ -107,6 +107,18 @@
}
}
},
"HslCommunication/11.1.1": {
"dependencies": {
"Newtonsoft.Json": "13.0.3",
"System.IO.Ports": "4.7.0"
},
"runtime": {
"lib/netstandard2.1/HslCommunication.dll": {
"assemblyVersion": "11.1.1.0",
"fileVersion": "11.1.1.0"
}
}
},
"log4net/2.0.15": {
"dependencies": {
"System.Configuration.ConfigurationManager": "6.0.0"
@ -302,7 +314,7 @@
"dependencies": {
"Microsoft.Extensions.DependencyInjection": "5.0.0",
"Microsoft.Extensions.DependencyInjection.Abstractions": "6.0.0",
"Microsoft.Extensions.Logging.Abstractions": "5.0.0",
"Microsoft.Extensions.Logging.Abstractions": "6.0.0",
"Microsoft.Extensions.Options": "5.0.0"
},
"runtime": {
@ -312,11 +324,11 @@
}
}
},
"Microsoft.Extensions.Logging.Abstractions/5.0.0": {
"Microsoft.Extensions.Logging.Abstractions/6.0.0": {
"runtime": {
"lib/netstandard2.0/Microsoft.Extensions.Logging.Abstractions.dll": {
"assemblyVersion": "5.0.0.0",
"fileVersion": "5.0.20.51904"
"lib/net6.0/Microsoft.Extensions.Logging.Abstractions.dll": {
"assemblyVersion": "6.0.0.0",
"fileVersion": "6.0.21.52210"
}
}
},
@ -491,6 +503,61 @@
}
}
},
"Pipelines.Sockets.Unofficial/2.2.8": {
"dependencies": {
"System.IO.Pipelines": "5.0.1"
},
"runtime": {
"lib/net5.0/Pipelines.Sockets.Unofficial.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "2.2.8.1080"
}
}
},
"runtime.linux-arm.runtime.native.System.IO.Ports/4.7.0": {
"runtimeTargets": {
"runtimes/linux-arm/native/System.IO.Ports.Native.so": {
"rid": "linux-arm",
"assetType": "native",
"fileVersion": "0.0.0.0"
}
}
},
"runtime.linux-arm64.runtime.native.System.IO.Ports/4.7.0": {
"runtimeTargets": {
"runtimes/linux-arm64/native/System.IO.Ports.Native.so": {
"rid": "linux-arm64",
"assetType": "native",
"fileVersion": "0.0.0.0"
}
}
},
"runtime.linux-x64.runtime.native.System.IO.Ports/4.7.0": {
"runtimeTargets": {
"runtimes/linux-x64/native/System.IO.Ports.Native.so": {
"rid": "linux-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
}
}
},
"runtime.native.System.IO.Ports/4.7.0": {
"dependencies": {
"runtime.linux-arm.runtime.native.System.IO.Ports": "4.7.0",
"runtime.linux-arm64.runtime.native.System.IO.Ports": "4.7.0",
"runtime.linux-x64.runtime.native.System.IO.Ports": "4.7.0",
"runtime.osx-x64.runtime.native.System.IO.Ports": "4.7.0"
}
},
"runtime.osx-x64.runtime.native.System.IO.Ports/4.7.0": {
"runtimeTargets": {
"runtimes/osx-x64/native/System.IO.Ports.Native.dylib": {
"rid": "osx-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
}
}
},
"SQLitePCLRaw.bundle_e_sqlite3/2.1.4": {
"dependencies": {
"SQLitePCLRaw.lib.e_sqlite3": "2.1.4",
@ -695,6 +762,18 @@
}
}
},
"StackExchange.Redis/2.7.33": {
"dependencies": {
"Microsoft.Extensions.Logging.Abstractions": "6.0.0",
"Pipelines.Sockets.Unofficial": "2.2.8"
},
"runtime": {
"lib/net6.0/StackExchange.Redis.dll": {
"assemblyVersion": "2.0.0.0",
"fileVersion": "2.7.33.41805"
}
}
},
"System.Collections/4.3.0": {
"dependencies": {
"Microsoft.NETCore.Platforms": "5.0.0",
@ -868,6 +947,46 @@
"System.Threading.Tasks": "4.3.0"
}
},
"System.IO.Pipelines/5.0.1": {
"runtime": {
"lib/netcoreapp3.0/System.IO.Pipelines.dll": {
"assemblyVersion": "5.0.0.1",
"fileVersion": "5.0.120.57516"
}
}
},
"System.IO.Ports/4.7.0": {
"dependencies": {
"Microsoft.Win32.Registry": "4.7.0",
"runtime.native.System.IO.Ports": "4.7.0"
},
"runtime": {
"lib/netstandard2.0/System.IO.Ports.dll": {
"assemblyVersion": "4.0.3.0",
"fileVersion": "4.700.19.56404"
}
},
"runtimeTargets": {
"runtimes/linux/lib/netstandard2.0/System.IO.Ports.dll": {
"rid": "linux",
"assetType": "runtime",
"assemblyVersion": "4.0.3.0",
"fileVersion": "4.700.19.56404"
},
"runtimes/osx/lib/netstandard2.0/System.IO.Ports.dll": {
"rid": "osx",
"assetType": "runtime",
"assemblyVersion": "4.0.3.0",
"fileVersion": "4.700.19.56404"
},
"runtimes/win/lib/netstandard2.0/System.IO.Ports.dll": {
"rid": "win",
"assetType": "runtime",
"assemblyVersion": "4.0.3.0",
"fileVersion": "4.700.19.56404"
}
}
},
"System.Memory/4.5.3": {},
"System.Reflection/4.3.0": {
"dependencies": {
@ -1209,6 +1328,13 @@
"path": "dotnetty.transport/0.7.5",
"hashPath": "dotnetty.transport.0.7.5.nupkg.sha512"
},
"HslCommunication/11.1.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-+HUfjin0STcIuiSsZ7ksohWBbeTFW7XbkDR+/jK19/ikmzCoRwwB8688dWc4szTruuF00URB998SU8snPxtIKQ==",
"path": "hslcommunication/11.1.1",
"hashPath": "hslcommunication.11.1.1.nupkg.sha512"
},
"log4net/2.0.15": {
"type": "package",
"serviceable": true,
@ -1321,12 +1447,12 @@
"path": "microsoft.extensions.logging/5.0.0",
"hashPath": "microsoft.extensions.logging.5.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Logging.Abstractions/5.0.0": {
"Microsoft.Extensions.Logging.Abstractions/6.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-NxP6ahFcBnnSfwNBi2KH2Oz8Xl5Sm2krjId/jRR3I7teFphwiUoUeZPwTNA21EX+5PtjqmyAvKaOeBXcJjcH/w==",
"path": "microsoft.extensions.logging.abstractions/5.0.0",
"hashPath": "microsoft.extensions.logging.abstractions.5.0.0.nupkg.sha512"
"sha512": "sha512-/HggWBbTwy8TgebGSX5DBZ24ndhzi93sHUBDvP1IxbZD7FDokYzdAr6+vbWGjw2XAfR2EJ1sfKUotpjHnFWPxA==",
"path": "microsoft.extensions.logging.abstractions/6.0.0",
"hashPath": "microsoft.extensions.logging.abstractions.6.0.0.nupkg.sha512"
},
"Microsoft.Extensions.Options/5.0.0": {
"type": "package",
@ -1440,6 +1566,48 @@
"path": "oracle.manageddataaccess.core/3.21.100",
"hashPath": "oracle.manageddataaccess.core.3.21.100.nupkg.sha512"
},
"Pipelines.Sockets.Unofficial/2.2.8": {
"type": "package",
"serviceable": true,
"sha512": "sha512-zG2FApP5zxSx6OcdJQLbZDk2AVlN2BNQD6MorwIfV6gVj0RRxWPEp2LXAxqDGZqeNV1Zp0BNPcNaey/GXmTdvQ==",
"path": "pipelines.sockets.unofficial/2.2.8",
"hashPath": "pipelines.sockets.unofficial.2.2.8.nupkg.sha512"
},
"runtime.linux-arm.runtime.native.System.IO.Ports/4.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-pCaX07mRrO11GfUb+whjn2AJgCofx26slw0sI3XC9v0pEZO8101iK6q4ymZOiI2M4a9sQxLr2LawAEDvF4RNXg==",
"path": "runtime.linux-arm.runtime.native.system.io.ports/4.7.0",
"hashPath": "runtime.linux-arm.runtime.native.system.io.ports.4.7.0.nupkg.sha512"
},
"runtime.linux-arm64.runtime.native.System.IO.Ports/4.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-/J6A4bexUUJciGUwrhtzrFW4tIHqoJYlCsz5RudRmqUaqvuG2tjrbn6bEopOFs7CU4gZqAKWcU9pkp180c3DkQ==",
"path": "runtime.linux-arm64.runtime.native.system.io.ports/4.7.0",
"hashPath": "runtime.linux-arm64.runtime.native.system.io.ports.4.7.0.nupkg.sha512"
},
"runtime.linux-x64.runtime.native.System.IO.Ports/4.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-aaaiH4ttfkLizo0OKf++5kPN0yxKbgzcyAD3w52Y3YP96aB/M79fm0r06SedXJGv86Iou6ipj3wUQBMFaL8LnQ==",
"path": "runtime.linux-x64.runtime.native.system.io.ports/4.7.0",
"hashPath": "runtime.linux-x64.runtime.native.system.io.ports.4.7.0.nupkg.sha512"
},
"runtime.native.System.IO.Ports/4.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-yidiZEGEIOyGnRkZvoV6XbeqzEBg9L47PyZNBymLIsu9HHseF98wiOxR6RnHmMqQMTBlc/EONfw4NT3pw0S6YQ==",
"path": "runtime.native.system.io.ports/4.7.0",
"hashPath": "runtime.native.system.io.ports.4.7.0.nupkg.sha512"
},
"runtime.osx-x64.runtime.native.System.IO.Ports/4.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-c1h87v6gopjfeAu3WhVGguUhzCdpZFqX8oXrevO1ciuH4g/mFrxnzlo5POlp+TtZdQ1i8yu0ZzBMKbmX2bJJ0g==",
"path": "runtime.osx-x64.runtime.native.system.io.ports/4.7.0",
"hashPath": "runtime.osx-x64.runtime.native.system.io.ports.4.7.0.nupkg.sha512"
},
"SQLitePCLRaw.bundle_e_sqlite3/2.1.4": {
"type": "package",
"serviceable": true,
@ -1496,6 +1664,13 @@
"path": "sqlsugarcore.kdbndp/7.4.0",
"hashPath": "sqlsugarcore.kdbndp.7.4.0.nupkg.sha512"
},
"StackExchange.Redis/2.7.33": {
"type": "package",
"serviceable": true,
"sha512": "sha512-2kCX5fvhEE824a4Ab5Imyi8DRuGuTxyklXV01kegkRpsWJcPmO6+GAQ+HegKxvXAxlXZ8yaRspvWJ8t3mMClfQ==",
"path": "stackexchange.redis/2.7.33",
"hashPath": "stackexchange.redis.2.7.33.nupkg.sha512"
},
"System.Collections/4.3.0": {
"type": "package",
"serviceable": true,
@ -1580,6 +1755,20 @@
"path": "system.io/4.3.0",
"hashPath": "system.io.4.3.0.nupkg.sha512"
},
"System.IO.Pipelines/5.0.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-qEePWsaq9LoEEIqhbGe6D5J8c9IqQOUuTzzV6wn1POlfdLkJliZY3OlB0j0f17uMWlqZYjH7txj+2YbyrIA8Yg==",
"path": "system.io.pipelines/5.0.1",
"hashPath": "system.io.pipelines.5.0.1.nupkg.sha512"
},
"System.IO.Ports/4.7.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-tNHiZcdskfRpxU7LBBlA69YYgBqWMBE/JDdmrEIDa4iw944VK1u4+B0FeSls1FUm+Pm4X/Fl0fSGqi8MDhb8/Q==",
"path": "system.io.ports/4.7.0",
"hashPath": "system.io.ports.4.7.0.nupkg.sha512"
},
"System.Memory/4.5.3": {
"type": "package",
"serviceable": true,

@ -0,0 +1,21 @@

保持型x=4:30000
输入型x=3:40000
线圈:
线圈寄存器:
离散输入寄存器:
寄存器:
输入寄存器
保持寄存器:
功能码 描述 说明 MOUBUS地址 异常功能码(+ 0×80)
1 读取输出线圈 位操作 00001 ~ 09999 0×81
2 读取输入线圈 位操作 10001 ~ 19999 0×82
3 读取输出寄存器 字操作 40001 ~ 49999 0×83
4 读取输入寄存器 字操作 30001 ~ 39999 0×84
5 写入单个输出线圈 位操作 00001 ~ 09999 0×85
6 写入单个输出寄存器 字操作 40001 ~ 49999 0×86
OF 写入多个输出线圈 位搡作 00001 ~ 09999 Ox8F
10 写入多个输出寄存器 字操作 40001 ~ 49999 0×90
Loading…
Cancel
Save