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

修复 coating 模拟控制bug

parent 02fb55ad
......@@ -28,7 +28,8 @@ namespace FLY.Simulation.Coating
FLY.ModbusModule.ServerTCP mbServer;
FLY.ModbusModule.PLCRegister mPLCRegister;
Dictionary<UInt16, string> Addrs = new Dictionary<ushort, string>();
Dictionary<UInt16, string> Addrs_reg = new Dictionary<ushort, string>();
Dictionary<UInt16, string> Addrs_coil = new Dictionary<ushort, string>();
public double PumpSet
......@@ -169,14 +170,14 @@ namespace FLY.Simulation.Coating
mPLCRegister.RegChanged += new ModbusModule.PLCRegister.RegChangedEventHandler(plcregister_RegChanged);
Addrs.Add(ADDR_D_PumpSet, "PumpSet");
Addrs.Add(ADDR_D_LeftSet, "LeftSet");
Addrs.Add(ADDR_D_Left, "Left");
Addrs.Add(ADDR_D_RightSet, "RightSet");
Addrs.Add(ADDR_D_Right, "Right");
Addrs.Add(ADDR_D_FilmVelocity, "FilmVelocity");
Addrs.Add(ADDR_C_OK, "OK");
Addrs_reg.Add(ADDR_D_PumpSet, "PumpSet");
Addrs_reg.Add(ADDR_D_LeftSet, "LeftSet");
Addrs_reg.Add(ADDR_D_Left, "Left");
Addrs_reg.Add(ADDR_D_RightSet, "RightSet");
Addrs_reg.Add(ADDR_D_Right, "Right");
Addrs_reg.Add(ADDR_D_FilmVelocity, "FilmVelocity");
Addrs_coil.Add(ADDR_C_OK, "OK");
Addrs_coil.Add(ADDR_C_STATE, "State");
Misc.BindingOperations.SetBinding(cc.NowCtrl, "Pump", this, "PumpSet", Misc.BindingOperations.BindingMode.TwoWay);
......@@ -209,19 +210,22 @@ namespace FLY.Simulation.Coating
{
if (e.RegType == ModbusModule.PLCRegister.RegChangedEventArgs.REG_TYPE.REG)
{
foreach (UInt16 key in Addrs.Keys)
foreach (UInt16 key in Addrs_reg.Keys)
{
if (e.IsCover(key))
{
NotifyPropertyChanged(Addrs[key]);
NotifyPropertyChanged(Addrs_reg[key]);
}
}
}
else
{
if (e.IsCover(ADDR_C_STATE))
foreach (UInt16 key in Addrs_coil.Keys)
{
NotifyPropertyChanged("State");
if (e.IsCover(key))
{
NotifyPropertyChanged(Addrs_coil[key]);
}
}
}
}
......
......@@ -12,6 +12,9 @@
<RowDefinition Height="auto" />
<RowDefinition Height="273*" />
</Grid.RowDefinitions>
<Grid x:Name="hmi_cc"/>
<Grid x:Name="inner_cc"/>
<Grid x:Name="hmi"/>
<StackPanel Orientation="Horizontal">
<Grid HorizontalAlignment="Left" Margin="12,3" >
<Grid.ColumnDefinitions>
......@@ -63,17 +66,29 @@
<TextBlock Style="{StaticResource textBlockStyle_title}" Text="内部设置值" />
</Button>
<TextBlock Style="{StaticResource textBlockStyle_curr}" Grid.Column="1" Grid.Row="1" Text="{Binding Pump}" Name="textblock_pump_out"/>
<TextBlock Style="{StaticResource textBlockStyle_curr}" Grid.Column="1" Grid.Row="2" Text="{Binding LeftDis}" Name="textblock_left_out"/>
<TextBlock Style="{StaticResource textBlockStyle_curr}" Grid.Column="1" Grid.Row="3" Text="{Binding RightDis}" Name="textblock_right_out"/>
<StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="1" HorizontalAlignment="Center">
<TextBlock Style="{StaticResource textBlockStyle_curr}" Text="{Binding Pump}" DataContext="{Binding DataContext,ElementName=hmi_cc}"/>
<TextBlock Text="/"/>
<TextBlock Style="{StaticResource textBlockStyle_curr}" Text="{Binding PumpSet}" DataContext="{Binding DataContext,ElementName=hmi}" />
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="2" HorizontalAlignment="Center">
<TextBlock Style="{StaticResource textBlockStyle_curr}" Text="{Binding LeftDis}" DataContext="{Binding DataContext,ElementName=hmi_cc}" />
<TextBlock Text="/"/>
<TextBlock Style="{StaticResource textBlockStyle_curr}" Text="{Binding LeftSet}" DataContext="{Binding DataContext,ElementName=hmi}"/>
</StackPanel>
<StackPanel Orientation="Horizontal" Grid.Column="1" Grid.Row="3" HorizontalAlignment="Center">
<TextBlock Style="{StaticResource textBlockStyle_curr}" Text="{Binding RightDis}" DataContext="{Binding DataContext,ElementName=hmi_cc}"/>
<TextBlock Text="/"/>
<TextBlock Style="{StaticResource textBlockStyle_curr}" Text="{Binding RightSet}" DataContext="{Binding DataContext,ElementName=hmi}" />
</StackPanel>
<TextBox Style="{StaticResource textBoxStyle_set}" Grid.Column="2" Grid.Row="1" Name="textbox_pumpset_out" />
<TextBox Style="{StaticResource textBoxStyle_set}" Grid.Column="2" Grid.Row="2" Name="textbox_leftset_out" />
<TextBox Style="{StaticResource textBoxStyle_set}" Grid.Column="2" Grid.Row="3" Name="textbox_rightset_out" />
<TextBlock Style="{StaticResource textBlockStyle_curr}" Grid.Column="3" Grid.Row="1" Text="{Binding Pump}" Name="textblock_pump_inner"/>
<TextBlock Style="{StaticResource textBlockStyle_curr}" Grid.Column="3" Grid.Row="2" Text="{Binding LeftDis}" Name="textblock_left_inner"/>
<TextBlock Style="{StaticResource textBlockStyle_curr}" Grid.Column="3" Grid.Row="3" Text="{Binding RightDis}" Name="textblock_right_inner" />
<TextBlock Style="{StaticResource textBlockStyle_curr}" Grid.Column="3" Grid.Row="1" Text="{Binding Pump}" DataContext="{Binding DataContext,ElementName=inner_cc}" />
<TextBlock Style="{StaticResource textBlockStyle_curr}" Grid.Column="3" Grid.Row="2" Text="{Binding LeftDis}" DataContext="{Binding DataContext,ElementName=inner_cc}"/>
<TextBlock Style="{StaticResource textBlockStyle_curr}" Grid.Column="3" Grid.Row="3" Text="{Binding RightDis}" DataContext="{Binding DataContext,ElementName=inner_cc}" />
<TextBox Style="{StaticResource textBoxStyle_set}" Grid.Column="4" Grid.Row="1" Name="textbox_pumpset_inner"/>
<TextBox Style="{StaticResource textBoxStyle_set}" Grid.Column="4" Grid.Row="2" Name="textbox_leftset_inner" />
......
......@@ -33,14 +33,11 @@ namespace FLYAD7_Simulation_Wpf
public void Init(Coating coating)
{
mCoating = coating;
textblock_pump_out.DataContext = mCoating.hmi_cc.NowCtrl;
textblock_left_out.DataContext = mCoating.hmi_cc.NowCtrl;
textblock_right_out.DataContext = mCoating.hmi_cc.NowCtrl;
hmi_cc.DataContext = mCoating.hmi_cc.NowCtrl;
inner_cc.DataContext = mCoating.inner_cc.NowCtrl;
hmi.DataContext = mCoating.hmi;
textblock_pump_inner.DataContext = mCoating.inner_cc.NowCtrl;
textblock_left_inner.DataContext = mCoating.inner_cc.NowCtrl;
textblock_right_inner.DataContext = mCoating.inner_cc.NowCtrl;
this.DataContext = coating;
......
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