Commit 2422f671 authored by 潘栩锋's avatar 潘栩锋 🚴
parents 58852a0d 02fb55ad
...@@ -21,6 +21,7 @@ namespace FLY.Simulation.Coating ...@@ -21,6 +21,7 @@ namespace FLY.Simulation.Coating
const UInt16 ADDR_D_FilmVelocity=6;//float const UInt16 ADDR_D_FilmVelocity=6;//float
const UInt16 ADDR_C_STATE = 0;//涂布状态 bit 0 const UInt16 ADDR_C_STATE = 0;//涂布状态 bit 0
const UInt16 ADDR_C_OK = 2;//设置 0->1 设置
CoatingCtrl mCoatingCtrl; CoatingCtrl mCoatingCtrl;
...@@ -109,6 +110,7 @@ namespace FLY.Simulation.Coating ...@@ -109,6 +110,7 @@ namespace FLY.Simulation.Coating
} }
} }
public double FilmVelocity public double FilmVelocity
{ {
get get
...@@ -143,6 +145,21 @@ namespace FLY.Simulation.Coating ...@@ -143,6 +145,21 @@ namespace FLY.Simulation.Coating
} }
} }
public bool OK
{
get
{
return mPLCRegister.GetBool(ADDR_C_OK);
}
set
{
if (OK != value)
{
mPLCRegister.SetBool(ADDR_C_OK, value);
NotifyPropertyChanged("OK");
}
}
}
public HMI(Coating coating, CoatingCtrl cc, int port) public HMI(Coating coating, CoatingCtrl cc, int port)
{ {
mCoatingCtrl = cc; mCoatingCtrl = cc;
...@@ -158,6 +175,9 @@ namespace FLY.Simulation.Coating ...@@ -158,6 +175,9 @@ namespace FLY.Simulation.Coating
Addrs.Add(ADDR_D_RightSet, "RightSet"); Addrs.Add(ADDR_D_RightSet, "RightSet");
Addrs.Add(ADDR_D_Right, "Right"); Addrs.Add(ADDR_D_Right, "Right");
Addrs.Add(ADDR_D_FilmVelocity, "FilmVelocity"); Addrs.Add(ADDR_D_FilmVelocity, "FilmVelocity");
Addrs.Add(ADDR_C_OK, "OK");
Misc.BindingOperations.SetBinding(cc.NowCtrl, "Pump", this, "PumpSet", Misc.BindingOperations.BindingMode.TwoWay); Misc.BindingOperations.SetBinding(cc.NowCtrl, "Pump", this, "PumpSet", Misc.BindingOperations.BindingMode.TwoWay);
Misc.BindingOperations.SetBinding(cc.NowCtrl, "LeftDis", this, "Left"); Misc.BindingOperations.SetBinding(cc.NowCtrl, "LeftDis", this, "Left");
...@@ -169,13 +189,19 @@ namespace FLY.Simulation.Coating ...@@ -169,13 +189,19 @@ namespace FLY.Simulation.Coating
LeftSet = Left; LeftSet = Left;
RightSet = Right; RightSet = Right;
this.PropertyChanged += new PropertyChangedEventHandler(HMI_PropertyChanged); this.PropertyChanged += new PropertyChangedEventHandler(HMI_PropertyChanged);
} }
void HMI_PropertyChanged(object sender, PropertyChangedEventArgs e) void HMI_PropertyChanged(object sender, PropertyChangedEventArgs e)
{ {
if ((e.PropertyName == "PumpSet") || (e.PropertyName == "LeftSet") || (e.PropertyName == "RightSet"))
if (e.PropertyName == "OK")
{ {
mCoatingCtrl.SetCoatingCtrl(PumpSet, LeftSet, RightSet); if (OK == true)
{
mCoatingCtrl.SetCoatingCtrl(PumpSet, LeftSet, RightSet);
}
} }
} }
......
...@@ -12,74 +12,82 @@ ...@@ -12,74 +12,82 @@
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
<RowDefinition Height="273*" /> <RowDefinition Height="273*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid HorizontalAlignment="Left" Margin="12,3" Name="grid1" > <StackPanel Orientation="Horizontal">
<Grid.ColumnDefinitions> <Grid HorizontalAlignment="Left" Margin="12,3" >
<ColumnDefinition Width="Auto" /> <Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="auto" /> <ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" /> <ColumnDefinition Width="auto" />
<ColumnDefinition Width="auto" /> <ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions> <ColumnDefinition Width="auto" />
<Grid.RowDefinitions> </Grid.ColumnDefinitions>
<RowDefinition Height="Auto" /> <Grid.RowDefinitions>
<RowDefinition Height="auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
<RowDefinition Height="auto" /> <RowDefinition Height="auto" />
</Grid.RowDefinitions> <RowDefinition Height="auto" />
<Grid.Resources> </Grid.RowDefinitions>
<Style TargetType="TextBlock" x:Key="textBlockStyle_title"> <Grid.Resources>
<Setter Property="FontSize" Value="18"/> <Style TargetType="TextBlock" x:Key="textBlockStyle_title">
<Setter Property="FontWeight" Value="Bold"/> <Setter Property="FontSize" Value="18"/>
<Setter Property="HorizontalAlignment" Value="Left"/> <Setter Property="FontWeight" Value="Bold"/>
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="HorizontalAlignment" Value="Left"/>
<Setter Property="Margin" Value="5"/> <Setter Property="VerticalAlignment" Value="Center"/>
</Style> <Setter Property="Margin" Value="5"/>
<Style TargetType="TextBlock" x:Key="textBlockStyle_curr"> </Style>
<Setter Property="HorizontalAlignment" Value="Center"/> <Style TargetType="TextBlock" x:Key="textBlockStyle_curr">
<Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="HorizontalAlignment" Value="Center"/>
<Setter Property="Margin" Value="2"/> <Setter Property="VerticalAlignment" Value="Center"/>
<Setter Property="Foreground" Value="Gray"/> <Setter Property="Margin" Value="2"/>
</Style> <Setter Property="Foreground" Value="Gray"/>
</Style>
<Style TargetType="TextBox" x:Key="textBoxStyle_set"> <Style TargetType="TextBox" x:Key="textBoxStyle_set">
<Setter Property="HorizontalContentAlignment" Value="Center"/> <Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/> <Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Margin" Value="2"/> <Setter Property="Margin" Value="2"/>
</Style> </Style>
</Grid.Resources> </Grid.Resources>
<TextBlock Style="{StaticResource textBlockStyle_title}" Text="泵速(R/min)" Grid.Row="1" /> <TextBlock Style="{StaticResource textBlockStyle_title}" Text="泵速(R/min)" Grid.Row="1" />
<TextBlock Style="{StaticResource textBlockStyle_title}" Text="左刀间距(um)" Grid.Row="2" /> <TextBlock Style="{StaticResource textBlockStyle_title}" Text="左刀间距(um)" Grid.Row="2" />
<TextBlock Style="{StaticResource textBlockStyle_title}" Text="右刀间距(um)" Grid.Row="3" /> <TextBlock Style="{StaticResource textBlockStyle_title}" Text="右刀间距(um)" Grid.Row="3" />
<TextBlock Style="{StaticResource textBlockStyle_title}" Text="对外当前值" Grid.Column="1" /> <TextBlock Style="{StaticResource textBlockStyle_title}" Text="对外当前值" Grid.Column="1" />
<Button Margin="3" Click="button_set_out_Click" Grid.Column="2"> <Button Margin="3" Click="button_set_out_Click" Grid.Column="2">
<TextBlock Style="{StaticResource textBlockStyle_title}" Text="对外设置值" /> <TextBlock Style="{StaticResource textBlockStyle_title}" Text="对外设置值" />
</Button> </Button>
<TextBlock Style="{StaticResource textBlockStyle_title}" Text="内部当前值" Grid.Column="3" /> <TextBlock Style="{StaticResource textBlockStyle_title}" Text="内部当前值" Grid.Column="3" />
<Button Margin="3" Click="button_set_inner_Click" Grid.Column="4"> <Button Margin="3" Click="button_set_inner_Click" Grid.Column="4">
<TextBlock Style="{StaticResource textBlockStyle_title}" Text="内部设置值" /> <TextBlock Style="{StaticResource textBlockStyle_title}" Text="内部设置值" />
</Button> </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="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="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"/> <TextBlock Style="{StaticResource textBlockStyle_curr}" Grid.Column="1" Grid.Row="3" Text="{Binding RightDis}" Name="textblock_right_out"/>
<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="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="2" Name="textbox_leftset_out" />
<TextBox Style="{StaticResource textBoxStyle_set}" Grid.Column="2" Grid.Row="3" Name="textbox_rightset_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="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="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="3" Text="{Binding RightDis}" Name="textblock_right_inner" />
<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="1" Name="textbox_pumpset_inner"/>
<TextBox Style="{StaticResource textBoxStyle_set}" Grid.Column="4" Grid.Row="2" Name="textbox_leftset_inner" /> <TextBox Style="{StaticResource textBoxStyle_set}" Grid.Column="4" Grid.Row="2" Name="textbox_leftset_inner" />
<TextBox Style="{StaticResource textBoxStyle_set}" Grid.Column="4" Grid.Row="3" Name="textbox_rightset_inner"/> <TextBox Style="{StaticResource textBoxStyle_set}" Grid.Column="4" Grid.Row="3" Name="textbox_rightset_inner"/>
</Grid>
<StackPanel>
<CheckBox Content="设置位" FontSize="18" FontWeight="Bold" Height="23" Margin="3" VerticalAlignment="Center" FlowDirection="RightToLeft" IsChecked="{Binding OK}" IsEnabled="False"/>
<CheckBox Content="涂布状态" FontSize="18" FontWeight="Bold" Height="23" Margin="3" VerticalAlignment="Center" FlowDirection="RightToLeft" IsChecked="{Binding DeviceState}" IsEnabled="False"/>
</StackPanel>
</StackPanel>
</Grid>
<StackPanel Orientation="Horizontal" Grid.Row="1" Margin="12,3"> <StackPanel Orientation="Horizontal" Grid.Row="1" Margin="12,3">
<StackPanel Orientation="Horizontal" Margin="3"> <StackPanel Orientation="Horizontal" Margin="3">
<TextBlock Text="modbusTCP 端口:" /> <TextBlock Text="modbusTCP 端口:" />
...@@ -97,7 +105,6 @@ ...@@ -97,7 +105,6 @@
<TextBlock Text="转移涂布"/> <TextBlock Text="转移涂布"/>
</ComboBoxItem> </ComboBoxItem>
</ComboBox> </ComboBox>
<CheckBox Content="涂布状态" FontSize="18" FontWeight="Bold" Height="23" Margin="3" Name="checkBox1" VerticalAlignment="Center" FlowDirection="RightToLeft" IsChecked="{Binding DeviceState}"/>
<TextBlock FontSize="18" FontWeight="Bold" Height="23" Margin="3" VerticalAlignment="Center" > <TextBlock FontSize="18" FontWeight="Bold" Height="23" Margin="3" VerticalAlignment="Center" >
<Run Text="当前平均值:" /> <Run Text="当前平均值:" />
<Run Text="{Binding Avg}" /> <Run Text="{Binding Avg}" />
......
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