Commit c81e4c9e authored by 潘栩锋's avatar 潘栩锋 🚴

1.修复 自动风环 PLC写加热 无效

parent 4032422a
...@@ -47,6 +47,7 @@ ...@@ -47,6 +47,7 @@
<Reference Include="Microsoft.CSharp" /> <Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" /> <Reference Include="System.Data" />
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="Client\FeedbackHeatServiceClient.cs" /> <Compile Include="Client\FeedbackHeatServiceClient.cs" />
......
...@@ -161,7 +161,7 @@ namespace FLY.FeedbackRenZiJia.Server ...@@ -161,7 +161,7 @@ namespace FLY.FeedbackRenZiJia.Server
public FeedbackHeat() public FeedbackHeat()
{ {
PLCep = Misc.StringConverter.ToIPEndPoint("192.168.251.9:502"); PLCep = Misc.StringConverter.ToIPEndPoint("192.168.50.60:502");
Load(); Load();
if (IsClient) if (IsClient)
plc = new PLCLink(PLCep); plc = new PLCLink(PLCep);
...@@ -169,8 +169,11 @@ namespace FLY.FeedbackRenZiJia.Server ...@@ -169,8 +169,11 @@ namespace FLY.FeedbackRenZiJia.Server
plc = new HMI(); plc = new HMI();
plc.PropertyChanged += new PropertyChangedEventHandler(hmi_PropertyChanged); plc.PropertyChanged += new PropertyChangedEventHandler(hmi_PropertyChanged);
Misc.BindingOperations.SetBinding(plc, "HasElectricity", this, "HasElectricity"); HasCheckFilmVelocity = plc.HasElectricity;
Misc.BindingOperations.SetBinding(plc, "HasFan", this, "HasFan"); HasFan = plc.HasFan;
InitBuf(); InitBuf();
...@@ -238,7 +241,7 @@ namespace FLY.FeedbackRenZiJia.Server ...@@ -238,7 +241,7 @@ namespace FLY.FeedbackRenZiJia.Server
mHeatCheck.Init(mHeatCell); mHeatCheck.Init(mHeatCell);
mHeatCheck.PropertyChanged += new PropertyChangedEventHandler(mHeatCheck_PropertyChanged); mHeatCheck.PropertyChanged += new PropertyChangedEventHandler(mHeatCheck_PropertyChanged);
Misc.BindingOperations.SetBinding(plc, "HasElectricity", mHeatCheck, "HasElectricity"); Misc.BindingOperations.SetBinding(this, "HasElectricity", mHeatCheck, "HasElectricity");
Misc.BindingOperations.SetBinding(this, "HasCheck", mHeatCheck, "Has"); Misc.BindingOperations.SetBinding(this, "HasCheck", mHeatCheck, "Has");
Misc.BindingOperations.SetBinding(mHeatCheck, "Enable", this, "CheckEnable", Misc.BindingOperations.BindingMode.TwoWay); Misc.BindingOperations.SetBinding(mHeatCheck, "Enable", this, "CheckEnable", Misc.BindingOperations.BindingMode.TwoWay);
Misc.BindingOperations.SetBinding(mHeatCheck, "CheckNo", this, "CheckNo"); Misc.BindingOperations.SetBinding(mHeatCheck, "CheckNo", this, "CheckNo");
...@@ -398,8 +401,11 @@ namespace FLY.FeedbackRenZiJia.Server ...@@ -398,8 +401,11 @@ namespace FLY.FeedbackRenZiJia.Server
mSnapShotBuf.Init(NBolts, ChannelCnt); mSnapShotBuf.Init(NBolts, ChannelCnt);
} }
void hmi_PropertyChanged(object sender, PropertyChangedEventArgs e) void hmi_PropertyChanged(object s, PropertyChangedEventArgs _e)
{ {
FObjBase.PollModule.Current.Dispatcher.Invoke(
new PropertyChangedEventHandler(
(sender, e)=> {
if (e.PropertyName == "Errno") if (e.PropertyName == "Errno")
{ {
if (plc.Errno == -1) if (plc.Errno == -1)
...@@ -414,8 +420,16 @@ namespace FLY.FeedbackRenZiJia.Server ...@@ -414,8 +420,16 @@ namespace FLY.FeedbackRenZiJia.Server
RecoverPLC(); RecoverPLC();
} }
} }
else if (e.PropertyName == "HasElectricity")
{
HasElectricity = plc.HasElectricity;
}
else if (e.PropertyName == "HasFan")
{
HasFan = plc.HasFan;
}
}), s, _e);
} }
List<FlyData_FeedbackHeat> test_data = new List<FlyData_FeedbackHeat>(); List<FlyData_FeedbackHeat> test_data = new List<FlyData_FeedbackHeat>();
int test_index = 0; int test_index = 0;
......
...@@ -288,6 +288,7 @@ namespace FLY.FeedbackRenZiJia.Server ...@@ -288,6 +288,7 @@ namespace FLY.FeedbackRenZiJia.Server
UInt16[] buf1 = new UInt16[cnt1]; UInt16[] buf1 = new UInt16[cnt1];
Array.Copy(buf, offset, buf1, 0, cnt1); Array.Copy(buf, offset, buf1, 0, cnt1);
RegWrite rw = new RegWrite(PLCAddressArea.Register, addr+offset, buf1); RegWrite rw = new RegWrite(PLCAddressArea.Register, addr+offset, buf1);
writes.Add(rw);
offset += cnt1; offset += cnt1;
cnt -= cnt1; cnt -= cnt1;
......
...@@ -257,16 +257,16 @@ namespace FLY.Modbus.WithThread ...@@ -257,16 +257,16 @@ namespace FLY.Modbus.WithThread
} }
//强制令读时,推送数据 //强制令读时,推送数据
rw.dr.isPlcValueChanged = true; rw.dr.isPlcValueChanged = true;
object plc_value = rw.dr.ToPLCObj(rw.val);
switch (rw.dr.dataArea) switch (rw.dr.dataArea)
{ {
case PLCAddressArea.Coil: case PLCAddressArea.Coil:
if (!Client.Do_0F((UInt16)rw.dr.addr, new bool[] {(bool)rw.dr.plcValue})) if (!Client.Do_0F((UInt16)rw.dr.addr, new bool[] {(bool)plc_value }))
return false; return false;
break; break;
default: default:
//case PLCAddressArea.Register: //case PLCAddressArea.Register:
if (!Client.Do_10((UInt16)rw.dr.addr, (UInt16[])rw.dr.plcValue)) if (!Client.Do_10((UInt16)rw.dr.addr, (UInt16[])plc_value))
return false; return false;
break; break;
} }
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<PLCGroup> <PLCGroup>
<Devices> <Devices>
<PLCDevice EP="127.168.50.2:502" /> <PLCDevice EP="192.168.1.1:502" />
<PLCDevice EP="127.168.50.1:502" /> <PLCDevice EP="192.168.1.1:502" />
<PLCDevice EP="127.168.50.3:502" /> <PLCDevice EP="192.168.1.1:502" />
</Devices> </Devices>
<Variables> <Variables>
<PLCVariable DeviceIndex="1" Mode="0" Addr="970" Type="bool" Scale="1" OwnerName="Items[0]" PropertyName="AlarmIsOn" /> <PLCVariable DeviceIndex="1" Mode="0" Addr="970" Type="bool" Scale="1" OwnerName="Items[0]" PropertyName="AlarmIsOn" />
......
No preview for this file type
[POU_PlusSign]
1=1
2=1
17=1
18=0
19=0
20=1
[Comm_Param]
Type=4
Port=3
Timeout=2000
ip=192.168.1.1
[POU_PlusSign]
1=1
2=1
17=1
18=0
19=0
20=1
[Comm_Param]
Type=0
Port=3
Timeout=2000
[POU_PlusSign]
1=1
2=1
17=1
18=0
19=0
20=1
[Comm_Param]
Type=4
Port=3
Timeout=2000
ip=192.168.1.1
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment