plc现场调试

master
CZ 4 days ago
parent df071df52f
commit e9a89e627b

@ -0,0 +1,49 @@
using HybirdFrameworkCore.Autofac.Attribute;
using HybirdFrameworkCore.Const;
using HybirdFrameworkDriver.ModbusTcpMaster;
using Minio.DataModel;
using Service.PlcAfrica.Msg;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static HybirdFrameworkCore.Const.EndingConst;
namespace Service.PlcAfrica.Client
{
[Scope]
public class PlcAfricaClient : ModbusTcpMaster
{
public PlcAfricaClient()
{
ReadAction = BatchRead;
Ip = "192.168.3.200";
Port = 502;
Duration = 1000;
AutoReConnect = true;
ByteSeq = EndingConst.ByteSeq.BA;
WordSeq = EndingConst.WordSeq.DC;
}
private bool BatchRead(ModbusTcpMaster master)
{
bool resul = Connected;
//0x03
var bytes01 = master.Read("x=3;7000", 2500).Content;
if (bytes01 != null)
{
PlcAfricaMgr.DataValidityTime = DateTime.Now;
ModbusDecoder.Decode<PlcAfricaMsg>(bytes01, PlcAfricaMgr.PlcAfricaMsg,
EndingConst.ByteSeq.AB,
EndingConst.WordSeq.DC);
var vv= PlcAfricaMgr.PlcAfricaMsg.PowerChangeMode.Value;
}
return resul;
}
}
}

@ -0,0 +1,40 @@
using Autofac;
using HybirdFrameworkCore.Autofac;
using Service.PlcAfrica.Msg;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Service.PlcAfrica.Client
{
public class PlcAfricaMgr
{
public static PlcAfricaClient? PlcAfricaClient;
public static PlcAfricaMsg PlcAfricaMsg = new PlcAfricaMsg();
/// <summary>
/// 数据有效时间。单位秒
/// </summary>
static int DataTimeSeconds = 20;
/// <summary>
/// 数据刷新时间
/// </summary>
public static DateTime DataValidityTime = DateTime.Now;
public static void PlcInit()
{
if (PlcAfricaClient == null)
{
PlcAfricaClient = AppInfo.Container.Resolve<PlcAfricaClient>();
}
Task.Run(() => PlcAfricaClient.Connect());
}
}
}

@ -0,0 +1,591 @@
using HybirdFrameworkDriver.ModbusTcpMaster;
namespace Service.PlcAfrica.Msg;
public class PlcAfricaMsg
{
/// <summary>
/// 当前换电模式
/// 0-无效
/// 1-手动模式
/// 2-自动模式
/// 3-本地模式
/// </summary>
public ModbusProperty<ushort> PowerChangeMode {get;set;}= new(47000);
/// <summary>
/// PLC/换电机器人状态
/// 0-启动/未就绪
/// 1-就绪
/// 2-工作中
/// 3-自动/单步操作完成
/// </summary>
public ModbusProperty<ushort> PowerChangeModeRobot {get;set;}= new(47001);
/// <summary>
/// 暂停状态
/// 0位-暂停true为暂停1位-急停状态(true为急停)
/// </summary>
public ModbusProperty<ushort> SuspendedState {get;set;}= new(47002,start:0,length:2,type:ModbusDataType.Bit);
/// <summary>
/// 交通灯灯光功能
/// 0-不亮1-亮红灯2-绿灯3-绿灯闪
/// </summary>
public ModbusProperty<ushort> TrafficLightFunction {get;set;}= new(47003);
/// <summary>
/// 被换车辆车型的标定
/// </summary>
public ModbusProperty<ushort> ModelCalibration {get;set;}= new(47004);
/// <summary>
/// 放电池仓位代码
/// 0-无
/// 1-1仓
/// 2-2仓
/// 3-3仓
/// “-”“
/// 110-维修仓1预留
/// 119-消防仓
/// </summary>
public ModbusProperty<ushort> BatteryLocationCodeIn {get;set;}= new(47008);
/// <summary>
/// 取电池仓位代码
/// </summary>
public ModbusProperty<ushort> BatteryLocationCodeUp {get;set;}= new(47009);
/// <summary>
/// 站控操作指令
/// </summary>
public ModbusProperty<ushort> OperationInstruction {get;set;}= new(47010);
/// <summary>
/// 换电模式切换
/// 0
/// 1切换至手动模式指令
/// 2切换至自动模式指令
/// 3切换至单步模式指令
/// </summary>
public ModbusProperty<ushort> ChangePowerMode {get;set;}= new(47011);
/// <summary>
/// 站控指令反馈
/// </summary>
public ModbusProperty<ushort> StationCommandFeedback {get;set;}= new(47012);
/// <summary>
/// 车上亏电电池高度
/// </summary>
public ModbusProperty<ushort> BatteryHeight {get;set;}= new(47011);
/// <summary>
/// 车上亏电电池长度
/// </summary>
public ModbusProperty<ushort> BatteryLength {get;set;}= new(47012);
/// <summary>
/// 车上亏电电池宽度
/// </summary>
public ModbusProperty<ushort> BatteryWidth {get;set;}= new(47013);
/// <summary>
/// 备用
/// </summary>
public ModbusProperty<bool> standby01 {get;set;}= new(47050,start:0,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 备用
/// </summary>
public ModbusProperty<bool> standby02 {get;set;}= new(47050,start:2,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 备用
/// </summary>
public ModbusProperty<bool> standby03 {get;set;}= new(47050,start:3,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 备用
/// </summary>
public ModbusProperty<bool> standby04 {get;set;}= new(47050,start:4,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 充电机散热风扇1 0-关闭排风扇1-开启排风
/// </summary>
public ModbusProperty<bool> ChargerCoolingFan1 {get;set;}= new(47050,start:5,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 充电机散热风扇2
/// </summary>
public ModbusProperty<bool> ChargerCoolingFan2 {get;set;}= new(47050,start:6,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 充电机散热风扇3
/// </summary>
public ModbusProperty<bool> ChargerCoolingFan3 {get;set;}= new(47050,start:7,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 充电机散热风扇4
/// </summary>
public ModbusProperty<bool> ChargerCoolingFan4 {get;set;}= new(47050,start:8,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 备用
/// </summary>
public ModbusProperty<bool> standby05 {get;set;}= new(47050,start:9,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 备用
/// </summary>
public ModbusProperty<bool> standby06 {get;set;}= new(47050,start:10,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 备用
/// </summary>
public ModbusProperty<bool> standby07 {get;set;}= new(47050,start:11,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 备用
/// </summary>
public ModbusProperty<bool> standby08 {get;set;}= new(47050,start:12,length:1,type:ModbusDataType.Bit);
/// <summary>
/// PLC向站控发送关机指令 0-无动作
/// 1-断电关机
/// </summary>
public ModbusProperty<ushort> SendShutdown {get;set;}= new(48002);
/// <summary>
/// 当前自动流程动作代码
/// </summary>
public ModbusProperty<ushort> ActionCode {get;set;}= new(48000);
/// <summary>
/// 电池定位伺服位移
/// </summary>
public ModbusProperty<ushort> BatteryPositioning {get;set;}= new(49016);
/// <summary>
/// y位移
/// </summary>
public ModbusProperty<ushort> YDisplacement {get;set;}= new(49020);
/// <summary>
/// x位移
/// </summary>
public ModbusProperty<ushort> XDisplacement {get;set;}= new(49024);
/// <summary>
/// z位移
/// </summary>
public ModbusProperty<ushort> ZDisplacement {get;set;}= new(49028);
/// <summary>
/// 当前生效故障码1
/// </summary>
public ModbusProperty<ushort> FaultCode1 {get;set;}= new(49032);
/// <summary>
/// 当前生效故障码2
/// </summary>
public ModbusProperty<ushort> FaultCode2 {get;set;}= new(49033);
/// <summary>
/// 当前生效故障码3
/// </summary>
public ModbusProperty<ushort> FaultCode3 {get;set;}= new(49034);
/// <summary>
/// 当前生效故障码4
/// </summary>
public ModbusProperty<ushort> FaultCode4 {get;set;}= new(49035);
/// <summary>
/// 当前生效故障码5
/// </summary>
public ModbusProperty<ushort> FaultCode5 {get;set;}= new(49036);
/// <summary>
/// 当前生效故障码6
/// </summary>
public ModbusProperty<ushort> FaultCode6 {get;set;}= new(49037);
/// <summary>
/// 当前生效故障码7
/// </summary>
public ModbusProperty<ushort> FaultCode7 {get;set;}= new(49038);
/// <summary>
/// 当前生效故障码8
/// </summary>
public ModbusProperty<ushort> FaultCode8 {get;set;}= new(49039);
/// <summary>
/// 当前生效故障码9
/// </summary>
public ModbusProperty<ushort> FaultCode9 {get;set;}= new(49040);
/// <summary>
/// 当前生效故障码10
/// </summary>
public ModbusProperty<ushort> FaultCode10 {get;set;}= new(49041);
/// <summary>
/// 转锁传感器1
/// </summary>
public ModbusProperty<bool> TwistlockSensor1 {get;set;}= new(49042,start:0,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 转锁传感器2
/// </summary>
public ModbusProperty<bool> TwistlockSensor2 {get;set;}= new(49042,start:1,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 吊具落座传感器1
/// </summary>
public ModbusProperty<bool> SpreaderSeatSensor1 {get;set;}= new(49042,start:2,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 吊具落座传感器2
/// </summary>
public ModbusProperty<bool> SpreaderSeatSensor2 {get;set;}= new(49042,start:3,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 光栅状态
/// </summary>
public ModbusProperty<bool> RasterState {get;set;}= new(49042,start:4,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 车辆到位传感器
/// </summary>
public ModbusProperty<bool> VehiclePositionSensor {get;set;}= new(49042,start:5,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 转锁传感器3
/// </summary>
public ModbusProperty<bool> TwistlockSensor3 {get;set;}= new(49042,start:6,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 转锁传感器4
/// </summary>
public ModbusProperty<bool> TwistlockSensor4 {get;set;}= new(49042,start:7,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 吊具落座传感器3
/// </summary>
public ModbusProperty<bool> SpreaderSeatSensor3 {get;set;}= new(49042,start:8,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 吊具落座传感器4
/// </summary>
public ModbusProperty<bool> SpreaderSeatSensor4 {get;set;}= new(49042,start:9,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 吊具电池有无
/// </summary>
public ModbusProperty<bool> SlingDatteryAvailable {get;set;}= new(49042,start:10,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 仓门全部关闭
/// </summary>
public ModbusProperty<bool> AllWarehouseDoorsClosed {get;set;}= new(49042,start:11,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 仓门全部打开
/// </summary>
public ModbusProperty<bool> AllBarnDoorsOpen {get;set;}= new(49042,start:12,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 预留
/// </summary>
public ModbusProperty<bool> reserve01 {get;set;}= new(49042,start:13,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 预留
/// </summary>
public ModbusProperty<bool> reserve02 {get;set;}= new(49042,start:14,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 预留
/// </summary>
public ModbusProperty<bool> reserve03 {get;set;}= new(49042,start:15,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 加载机1落座传感器1 0-不在位1-在位
/// </summary>
public ModbusProperty<bool> Loader1SeatSensor1 {get;set;}= new(49043,start:0,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 加载机1落座传感器2
/// </summary>
public ModbusProperty<bool> Loader1SeatSensor2 {get;set;}= new(49043,start:1,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 加载机2落座传感器1
/// </summary>
public ModbusProperty<bool> Loader2SeatSensor1 {get;set;}= new(49043,start:2,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 加载机2落座传感器2
/// </summary>
public ModbusProperty<bool> Loader2SeatSensor2 {get;set;}= new(49043,start:3,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 加载机3落座传感器1
/// </summary>
public ModbusProperty<bool> Loader3SeatSensor1 {get;set;}= new(49043,start:4,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 加载机3落座传感器2
/// </summary>
public ModbusProperty<bool> Loader3SeatSensor2 {get;set;}= new(49043,start:5,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 加载机4落座传感器1
/// </summary>
public ModbusProperty<bool> Loader4SeatSensor1 {get;set;}= new(49043,start:6,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 加载机4落座传感器2
/// </summary>
public ModbusProperty<bool> Loader4SeatSensor2 {get;set;}= new(49043,start:7,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 加载机5落座传感器1
/// </summary>
public ModbusProperty<bool> Loader5SeatSensor1 {get;set;}= new(49043,start:8,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 加载机5落座传感器2
/// </summary>
public ModbusProperty<bool> Loader5SeatSensor2 {get;set;}= new(49043,start:9,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 加载机6落座传感器1
/// </summary>
public ModbusProperty<bool> Loader6SeatSensor1 {get;set;}= new(49043,start:10,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 加载机6落座传感器2
/// </summary>
public ModbusProperty<bool> Loader6SeatSensor2 {get;set;}= new(49043,start:11,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 加载机7落座传感器1
/// </summary>
public ModbusProperty<bool> Loader7SeatSensor1 {get;set;}= new(49043,start:12,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 加载机7落座传感器2
/// </summary>
public ModbusProperty<bool> Loader7SeatSensor2 {get;set;}= new(49043,start:13,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 加载机8落座传感器1
/// </summary>
public ModbusProperty<bool> Loader8SeatSensor1 {get;set;}= new(49043,start:14,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 加载机8落座传感器2
/// </summary>
public ModbusProperty<bool> Loader8SeatSensor2 {get;set;}= new(49043,start:15,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 换电机器人设备编号
/// </summary>
public ModbusProperty<string> RobotNumber {get;set;}= new(49110,length:20);
/// <summary>
/// PLC软件版本
/// </summary>
public ModbusProperty<ushort> PlcSoftwareVersion {get;set;}= new(49130);
/// <summary>
/// PLC硬件版本
/// </summary>
public ModbusProperty<ushort> PlcHardwareVersion {get;set;}= new(49140);
/// <summary>
/// 架载机状态
/// </summary>
public ModbusProperty<ushort> BoardStatus {get;set;}= new(49150);
/// <summary>
/// TBOX解锁
/// </summary>
public ModbusProperty<ushort> TboxUnlock {get;set;}= new(49151);
/// <summary>
/// 充电机1#进口温度
/// </summary>
public ModbusProperty<ushort> ChargerTempIn1 {get;set;}= new(49450);
/// <summary>
/// 充电机1#出口温度
/// </summary>
public ModbusProperty<ushort> ChargerTempOut1 {get;set;}= new(49451);
/// <summary>
/// 充电机2#进口温度
/// </summary>
public ModbusProperty<ushort> ChargerTempIn2 {get;set;}= new(49452);
/// <summary>
/// 充电机2#出口温度
/// </summary>
public ModbusProperty<ushort> ChargerTempOut2 {get;set;}= new(49453);
/// <summary>
/// 充电机3#进口温度
/// </summary>
public ModbusProperty<ushort> ChargerTempIn3 {get;set;}= new(49454);
/// <summary>
/// 充电机3#出口温度
/// </summary>
public ModbusProperty<ushort> ChargerTempOut3 {get;set;}= new(49455);
/// <summary>
/// 充电机4#进口温度
/// </summary>
public ModbusProperty<ushort> ChargerTempIn4 {get;set;}= new(49456);
/// <summary>
/// 充电机4#出口温度
/// </summary>
public ModbusProperty<ushort> ChargerTempOut4 {get;set;}= new(49457);
/// <summary>
/// 充电机5#进口温度
/// </summary>
public ModbusProperty<ushort> ChargerTempIn5 {get;set;}= new(49458);
/// <summary>
/// 充电机5#出口温度
/// </summary>
public ModbusProperty<ushort> ChargerTempOut5 {get;set;}= new(49459);
/// <summary>
/// 充电机6#进口温度
/// </summary>
public ModbusProperty<ushort> ChargerTempIn6 {get;set;}= new(49460);
/// <summary>
/// 充电机6#出口温度
/// </summary>
public ModbusProperty<ushort> ChargerTempOut6 {get;set;}= new(49461);
/// <summary>
/// 充电机7#进口温度
/// </summary>
public ModbusProperty<ushort> ChargerTempIn7 {get;set;}= new(49462);
/// <summary>
/// 充电机7#出口温度
/// </summary>
public ModbusProperty<ushort> ChargerTempOut7 {get;set;}= new(49463);
/// <summary>
/// 充电机8#进口温度
/// </summary>
public ModbusProperty<ushort> ChargerTempIn8 {get;set;}= new(49464);
/// <summary>
/// 充电机8#出口温度
/// </summary>
public ModbusProperty<ushort> ChargerTempOut8 {get;set;}= new(49465);
/// <summary>
/// 消防报警信号
/// </summary>
public ModbusProperty<ushort> FireAlarmSignal {get;set;}= new(49467);
/// <summary>
/// 取电池规格(长)
/// </summary>
public ModbusProperty<ushort> BatterySizeTakeLength {get;set;}= new(49468);
/// <summary>
/// 取电池规格(宽)
/// </summary>
public ModbusProperty<ushort> BatterySizeTakeWidth {get;set;}= new(49469);
/// <summary>
/// 取电池规格(高)
/// </summary>
public ModbusProperty<ushort> BatterySizeTakeHigh {get;set;}= new(49470);
/// <summary>
/// 取电池规格(重量)
/// </summary>
public ModbusProperty<ushort> BatteryTakeWeight {get;set;}= new(49471);
/// <summary>
/// 放电池规格(长)
/// </summary>
public ModbusProperty<ushort> BatterySizePutLength {get;set;}= new(49472);
/// <summary>
/// 放电池规格(宽)
/// </summary>
public ModbusProperty<ushort> BatterySizePutWidth {get;set;}= new(49473);
/// <summary>
/// 放电池规格(高)
/// </summary>
public ModbusProperty<ushort> BatterySizePutHigh {get;set;}= new(49474);
/// <summary>
/// 放电池规格(重量)
/// </summary>
public ModbusProperty<ushort> BatteryWeight {get;set;}= new(49475);
/// <summary>
/// X轴伺服故障码
/// </summary>
public ModbusProperty<ushort> XAxisServoFaultCode {get;set;}= new(49476);
/// <summary>
/// 备用(伺服故障码)
/// </summary>
public ModbusProperty<ushort> BackupServoFaultCode {get;set;}= new(49478);
/// <summary>
/// Y轴伺服故障码
/// </summary>
public ModbusProperty<ushort> YAxisServoFaultCode {get;set;}= new(49480);
/// <summary>
/// Z轴伺服故障码
/// </summary>
public ModbusProperty<ushort> ZAxisServoFaultCode {get;set;}= new(49482);
/// <summary>
/// 电池定位伺服故障码
/// </summary>
public ModbusProperty<ushort> BatteryLocationFaultCode {get;set;}= new(49484);
/// <summary>
/// 原点位置状态
/// </summary>
public ModbusProperty<ushort> OriginPositionState {get;set;}= new(49436);
/// <summary>
/// 回原点状态
/// </summary>
public ModbusProperty<ushort> BackOriginState {get;set;}= new(49437);
/// <summary>
/// 中转仓落座传感器1
/// </summary>
public ModbusProperty<bool> TransferBinSeatSensor1 {get;set;}= new(49038,start:0,length:1,type:ModbusDataType.Bit);
/// <summary>
/// 中转仓落座传感器2
/// </summary>
public ModbusProperty<bool> TransferBinSeatSensor2 {get;set;}= new(49038,start:1,length:1,type:ModbusDataType.Bit);
}

@ -20,6 +20,7 @@ using Service.Charger.Client;
using Service.Execute; using Service.Execute;
using Service.Led; using Service.Led;
using Service.Padar.Client; using Service.Padar.Client;
using Service.PlcAfrica.Client;
using Service.RealTime; using Service.RealTime;
using Service.Sound.SoundClient; using Service.Sound.SoundClient;
using Service.Ups; using Service.Ups;
@ -218,7 +219,7 @@ if (AppSettingsHelper.GetBool("upsAfrica", "enable"))
{ {
UpsAfricaMgr.UpsInit(); UpsAfricaMgr.UpsInit();
} }
PlcAfricaMgr.PlcInit();
//new SoundClient().SoundConn(); //new SoundClient().SoundConn();
//TaskInit.Init(); //TaskInit.Init();

File diff suppressed because it is too large Load Diff

@ -0,0 +1,481 @@
using Microsoft.AspNetCore.Mvc.ApplicationModels;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Math;
using Service.PlcAfrica.Client;
using Service.PlcAfrica.Msg;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.ServiceModel;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using OfficeOpenXml.FormulaParsing.Excel.Functions.Text;
namespace WinFormStarter
{
public partial class FrmAfrica : Form
{
//一直到24
public FrmAfrica()
{
InitializeComponent();
PlcAfricaMgr.PlcInit();
}
PlcAfricaClient PlcAfricaClient
{
get
{
return PlcAfricaMgr.PlcAfricaClient;
}
}
PlcAfricaMsg PlcAfricaMsg = PlcAfricaMgr.PlcAfricaMsg;
#region 1
private void button6_Click(object sender, EventArgs e)
{
if (!PlcAfricaMgr.PlcAfricaClient.Connected) return;
PlcAfricaMsg.TrafficLightFunction.Value = Convert.ToUInt16(tct11.Text);
bool bv= PlcAfricaMgr.PlcAfricaClient.WriteValue(PlcAfricaMsg.TrafficLightFunction);
}
private void BtnWrite01_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.ModelCalibration.Value = Convert.ToUInt16(txt12.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.ModelCalibration);
}
private void BtnWrite02_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.BatteryLocationCodeIn.Value = Convert.ToUInt16(txt13.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.BatteryLocationCodeIn);
}
private void BtnWrite03_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.BatteryLocationCodeUp.Value = Convert.ToUInt16(txt14.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.BatteryLocationCodeUp);
}
#endregion
#region 2
private void BtnWrite04_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.OperationInstruction.Value = Convert.ToUInt16(txt21.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.OperationInstruction);
}
/// <summary>
/// 换电模式切换
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void BtnWrite05_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.ChangePowerMode.Value = Convert.ToUInt16(txt22.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.ChangePowerMode);
}
private void BtnWrite06_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.BatteryHeight.Value = Convert.ToUInt16(txt23.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.BatteryHeight);
}
private void BtnWrite07_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.BatteryLength.Value = Convert.ToUInt16(txt24.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.BatteryLength);
}
#endregion
#region 3
private void BtnWrite08_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.BatteryWidth.Value = Convert.ToUInt16(txt31.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.BatteryWidth);
}
private void BtnWrite09_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.standby01.Value = Convert.ToBoolean(txt32.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.standby01);
}
private void BtnWrite10_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.standby02.Value = Convert.ToBoolean(txt33.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.standby02);
}
private void BtnWrite11_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.standby03.Value = Convert.ToBoolean(txt34.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.standby03);
}
#endregion
#region 4
private void BtnWrite14_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.standby04.Value = Convert.ToBoolean(txt41.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.standby04);
}
private void BtnWrite15_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.ChargerCoolingFan1.Value = Convert.ToBoolean(txt42.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.ChargerCoolingFan1);
}
private void BtnWrite16_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.ChargerCoolingFan2.Value = Convert.ToBoolean(txt43.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.ChargerCoolingFan2);
}
private void BtnWrite17_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.ChargerCoolingFan3.Value = Convert.ToBoolean(txt44.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.ChargerCoolingFan3);
}
#endregion
#region 5
private void BtnWrite18_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.ChargerCoolingFan4.Value = Convert.ToBoolean(txt51.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.ChargerCoolingFan4);
}
private void button3_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.standby05.Value = Convert.ToBoolean(txt52.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.standby05);
}
private void button2_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.standby06.Value = Convert.ToBoolean(txt53.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.standby06);
}
private void button1_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.standby07.Value = Convert.ToBoolean(txt54.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.standby07);
}
#endregion
#region 6
private void button5_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.standby08.Value = Convert.ToBoolean(txt61.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.standby08);
}
private void button4_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.BoardStatus.Value = Convert.ToUInt16(txt62.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.BoardStatus);
}
private void button8_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.TboxUnlock.Value = Convert.ToUInt16(txt63.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.TboxUnlock);
}
private void button7_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.ChargerTempIn1.Value = Convert.ToUInt16(txt64.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.ChargerTempIn1);
}
#endregion
#region 7
private void button12_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.ChargerTempOut1.Value = Convert.ToUInt16(txt71.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.ChargerTempOut1);
}
private void button11_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.ChargerTempIn2.Value = Convert.ToUInt16(txt72.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.ChargerTempIn2);
}
private void button10_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.ChargerTempOut2.Value = Convert.ToUInt16(txt73.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.ChargerTempOut2);
}
private void button9_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.ChargerTempIn3.Value = Convert.ToUInt16(txt74.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.ChargerTempIn3);
}
#endregion
#region 8
private void button16_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.ChargerTempOut3.Value = Convert.ToUInt16(txt81.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.ChargerTempOut3);
}
private void button15_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.ChargerTempIn4.Value = Convert.ToUInt16(txt82.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.ChargerTempIn4);
}
private void button14_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.ChargerTempOut4.Value = Convert.ToUInt16(txt83.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.ChargerTempOut4);
}
private void button13_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.ChargerTempIn5.Value = Convert.ToUInt16(txt84.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.ChargerTempIn5);
}
#endregion
#region 9
private void button20_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.ChargerTempOut5.Value = Convert.ToUInt16(txt91.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.ChargerTempOut5);
}
private void button19_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.ChargerTempIn5.Value = Convert.ToUInt16(txt92.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.ChargerTempIn5);
}
private void button18_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.ChargerTempOut6.Value = Convert.ToUInt16(txt93.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.ChargerTempOut6);
}
private void button17_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.ChargerTempIn7.Value = Convert.ToUInt16(txt94.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.ChargerTempIn7);
}
#endregion
#region 10
private void button24_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.ChargerTempOut7.Value = Convert.ToUInt16(txt101.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.ChargerTempOut7);
}
private void button23_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.ChargerTempIn8.Value = Convert.ToUInt16(txt102.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.ChargerTempIn8);
}
private void button22_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.ChargerTempOut8.Value = Convert.ToUInt16(txt103.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.ChargerTempOut8);
}
private void button21_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.FireAlarmSignal.Value = Convert.ToUInt16(txt104.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.FireAlarmSignal);
}
#endregion
#region 11
private void button28_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.BatterySizeTakeLength.Value = Convert.ToUInt16(txt111.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.BatterySizeTakeLength);
}
private void button27_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.BatterySizeTakeWidth.Value = Convert.ToUInt16(txt112.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.BatterySizeTakeWidth);
}
private void button26_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.BatterySizeTakeHigh.Value = Convert.ToUInt16(txt113.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.BatterySizeTakeHigh);
}
private void button25_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.BatteryTakeWeight.Value = Convert.ToUInt16(txt114.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.BatteryTakeWeight);
}
#endregion
#region 12
private void button32_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.BatterySizePutLength.Value = Convert.ToUInt16(txt121.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.BatterySizePutLength);
}
private void button31_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.BatterySizePutWidth.Value = Convert.ToUInt16(txt122.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.BatterySizePutWidth);
}
private void button30_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.BatterySizePutHigh.Value = Convert.ToUInt16(txt123.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.BatterySizePutHigh);
}
private void button29_Click(object sender, EventArgs e)
{
if (!PlcAfricaClient.Connected) return;
PlcAfricaMsg.BatteryWeight.Value = Convert.ToUInt16(txt124.Text);
PlcAfricaClient.WriteValue(PlcAfricaMsg.BatteryWeight);
}
#endregion
public void setvalue()
{
#region 1
lbl11.Text = PlcAfricaMgr.PlcAfricaMsg.PowerChangeMode.Value.ToString();
lbl21.Text = PlcAfricaMgr.PlcAfricaMsg.BatteryPositioning.Value.ToString();
lbl31.Text = PlcAfricaMgr.PlcAfricaMsg.FaultCode3.Value.ToString();
lbl41.Text = PlcAfricaMgr.PlcAfricaMsg.FaultCode9.Value.ToString();
lbl51.Text = PlcAfricaMgr.PlcAfricaMsg.RasterState.Value.ToString();
lbl61.Text = PlcAfricaMgr.PlcAfricaMsg.SlingDatteryAvailable.Value.ToString();
lbl71.Text = PlcAfricaMgr.PlcAfricaMsg.Loader1SeatSensor1.Value.ToString();
lbl81.Text = PlcAfricaMgr.PlcAfricaMsg.Loader4SeatSensor1.Value.ToString();
lbl91.Text = PlcAfricaMgr.PlcAfricaMsg.Loader7SeatSensor1.Value.ToString();
lbl101.Text = PlcAfricaMgr.PlcAfricaMsg.PlcHardwareVersion.Value.ToString();
lbl111.Text = PlcAfricaMgr.PlcAfricaMsg.OriginPositionState.Value.ToString();
#endregion
#region 2
lbl12.Text = PlcAfricaMgr.PlcAfricaMsg.PowerChangeModeRobot.Value.ToString();
lbl22.Text = PlcAfricaMgr.PlcAfricaMsg.YDisplacement.Value.ToString();
lbl32.Text = PlcAfricaMgr.PlcAfricaMsg.FaultCode4.Value.ToString();
lbl42.Text = PlcAfricaMgr.PlcAfricaMsg.FaultCode10.Value.ToString();
lbl52.Text = PlcAfricaMgr.PlcAfricaMsg.VehiclePositionSensor.Value.ToString();
lbl62.Text = PlcAfricaMgr.PlcAfricaMsg.AllWarehouseDoorsClosed.Value.ToString();
lbl72.Text = PlcAfricaMgr.PlcAfricaMsg.Loader1SeatSensor2.Value.ToString();
lbl82.Text = PlcAfricaMgr.PlcAfricaMsg.Loader4SeatSensor2.Value.ToString();
lbl92.Text = PlcAfricaMgr.PlcAfricaMsg.Loader7SeatSensor2.Value.ToString();
lbl102.Text = PlcAfricaMgr.PlcAfricaMsg.XAxisServoFaultCode.Value.ToString();
lbl112.Text = PlcAfricaMgr.PlcAfricaMsg.BackOriginState.Value.ToString();
#endregion
#region 3
lbl13.Text = PlcAfricaMgr.PlcAfricaMsg.SuspendedState.Value.ToString();
lbl23.Text = PlcAfricaMgr.PlcAfricaMsg.XDisplacement.Value.ToString();
lbl33.Text = PlcAfricaMgr.PlcAfricaMsg.FaultCode5.Value.ToString();
lbl43.Text = PlcAfricaMgr.PlcAfricaMsg.TwistlockSensor1.Value.ToString();
lbl53.Text = PlcAfricaMgr.PlcAfricaMsg.TwistlockSensor3.Value.ToString();
lbl63.Text = PlcAfricaMgr.PlcAfricaMsg.AllBarnDoorsOpen.Value.ToString();
lbl73.Text = PlcAfricaMgr.PlcAfricaMsg.Loader2SeatSensor1.Value.ToString();
lbl83.Text = PlcAfricaMgr.PlcAfricaMsg.Loader5SeatSensor1.Value.ToString();
lbl93.Text = PlcAfricaMgr.PlcAfricaMsg.Loader8SeatSensor1.Value.ToString();
lbl103.Text = PlcAfricaMgr.PlcAfricaMsg.Loader8SeatSensor2.Value.ToString();
lbl113.Text = PlcAfricaMgr.PlcAfricaMsg.TransferBinSeatSensor1.Value.ToString();
#endregion
#region 4
lbl14.Text = PlcAfricaMgr.PlcAfricaMsg.StationCommandFeedback.Value.ToString();
lbl24.Text = PlcAfricaMgr.PlcAfricaMsg.ZDisplacement.Value.ToString();
lbl34.Text = PlcAfricaMgr.PlcAfricaMsg.FaultCode6.Value.ToString();
lbl44.Text = PlcAfricaMgr.PlcAfricaMsg.TwistlockSensor2.Value.ToString();
lbl54.Text = PlcAfricaMgr.PlcAfricaMsg.TwistlockSensor4.Value.ToString();
//lbl64.Text =
lbl74.Text = PlcAfricaMgr.PlcAfricaMsg.Loader2SeatSensor2.Value.ToString();
lbl84.Text = PlcAfricaMgr.PlcAfricaMsg.Loader5SeatSensor2.Value.ToString();
lbl94.Text = PlcAfricaMgr.PlcAfricaMsg.Loader8SeatSensor2.Value.ToString();
lbl104.Text = PlcAfricaMgr.PlcAfricaMsg.YAxisServoFaultCode.Value.ToString();
lbl114.Text = PlcAfricaMgr.PlcAfricaMsg.TransferBinSeatSensor2.Value.ToString();
#endregion
#region 5
lbl15.Text = PlcAfricaMgr.PlcAfricaMsg.SendShutdown.Value.ToString();
lbl25.Text = PlcAfricaMgr.PlcAfricaMsg.FaultCode1.Value.ToString();
lbl35.Text = PlcAfricaMgr.PlcAfricaMsg.FaultCode7.Value.ToString();
lbl45.Text = PlcAfricaMgr.PlcAfricaMsg.SpreaderSeatSensor1.Value.ToString();
lbl55.Text = PlcAfricaMgr.PlcAfricaMsg.SpreaderSeatSensor3.Value.ToString();
//lbl65.Text =
lbl75.Text = PlcAfricaMgr.PlcAfricaMsg.Loader3SeatSensor1.Value.ToString();
lbl85.Text = PlcAfricaMgr.PlcAfricaMsg.Loader6SeatSensor1.Value.ToString();
lbl95.Text = PlcAfricaMgr.PlcAfricaMsg.ZAxisServoFaultCode.Value.ToString();
lbl105.Text = PlcAfricaMgr.PlcAfricaMsg.ZAxisServoFaultCode.Value.ToString();
#endregion
#region 6
lbl16.Text = PlcAfricaMgr.PlcAfricaMsg.ActionCode.Value.ToString();
lbl26.Text = PlcAfricaMgr.PlcAfricaMsg.FaultCode2.Value.ToString();
lbl36.Text = PlcAfricaMgr.PlcAfricaMsg.FaultCode8.Value.ToString();
lbl46.Text = PlcAfricaMgr.PlcAfricaMsg.SpreaderSeatSensor2.Value.ToString();
lbl56.Text = PlcAfricaMgr.PlcAfricaMsg.SpreaderSeatSensor4.Value.ToString();
//lbl76.Text =
lbl86.Text = PlcAfricaMgr.PlcAfricaMsg.Loader3SeatSensor2.Value.ToString();
lbl96.Text = PlcAfricaMgr.PlcAfricaMsg.Loader6SeatSensor2.Value.ToString();
lbl106.Text = PlcAfricaMgr.PlcAfricaMsg.PlcSoftwareVersion.Value.ToString();
lbl116.Text = PlcAfricaMgr.PlcAfricaMsg.BatteryLocationFaultCode.Value.ToString();
#endregion
}
private void button2_Click_1(object sender, EventArgs e)
{
setvalue();
}
}
}

@ -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>
Loading…
Cancel
Save