This commit is contained in:
@@ -30,7 +30,7 @@ namespace PamhagenSysCtrl.Helpers {
|
|||||||
public bool AreValvesClosed(params int[] ns) => ns.All(IsValveClosed) && ns.All(WantValveClosed);
|
public bool AreValvesClosed(params int[] ns) => ns.All(IsValveClosed) && ns.All(WantValveClosed);
|
||||||
|
|
||||||
public int TroughSelector => Sensors.TroughSelector;
|
public int TroughSelector => Sensors.TroughSelector;
|
||||||
public bool IsMWSelected => Sensors.TroughSelector == 1;
|
public bool IsMW1Selected => Sensors.TroughSelector == 1;
|
||||||
public bool IsMW2Selected => Sensors.TroughSelector == 2;
|
public bool IsMW2Selected => Sensors.TroughSelector == 2;
|
||||||
public FillState FillLevelMW1 => Sensors.FillingLevelMW1;
|
public FillState FillLevelMW1 => Sensors.FillingLevelMW1;
|
||||||
public FillState FillLevelMW2 => Sensors.FillingLevelMW2;
|
public FillState FillLevelMW2 => Sensors.FillingLevelMW2;
|
||||||
@@ -54,6 +54,7 @@ namespace PamhagenSysCtrl.Helpers {
|
|||||||
public bool WantMW2Selected => !Actuators.GetV(58);
|
public bool WantMW2Selected => !Actuators.GetV(58);
|
||||||
|
|
||||||
public bool IsTroughAugerActive => Actuators.TroughAuger;
|
public bool IsTroughAugerActive => Actuators.TroughAuger;
|
||||||
|
public bool TroughAugerHasClearance => IsReblerActive && !(IsMW1Selected && FillLevelMW1 == FillState.Full) && !(IsMW2Selected && FillLevelMW2 == FillState.Full);
|
||||||
public bool IsReblerActive => Actuators.Rebler;
|
public bool IsReblerActive => Actuators.Rebler;
|
||||||
public bool IsStirrerMW1Active => Actuators.StirrerMW1;
|
public bool IsStirrerMW1Active => Actuators.StirrerMW1;
|
||||||
public bool IsStirrerMW2Active => Actuators.StirrerMW2;
|
public bool IsStirrerMW2Active => Actuators.StirrerMW2;
|
||||||
@@ -88,7 +89,7 @@ namespace PamhagenSysCtrl.Helpers {
|
|||||||
if (p.IsReblerActive && !p.IsAuger1Active) p.StartAuger1();
|
if (p.IsReblerActive && !p.IsAuger1Active) p.StartAuger1();
|
||||||
if (p.IsAuger1Active && !p.IsAuger2Active) p.StartAuger2();
|
if (p.IsAuger1Active && !p.IsAuger2Active) p.StartAuger2();
|
||||||
if (p.IsAuger2Active && !p.IsAuger3Active) p.StartAuger3();
|
if (p.IsAuger2Active && !p.IsAuger3Active) p.StartAuger3();
|
||||||
if (p.IsTroughAugerActive && (!p.IsReblerActive || (p.IsMWSelected && p.FillLevelMW1 == FillState.Full) || (p.IsMW2Selected && p.FillLevelMW2 == FillState.Full)))
|
if (p.IsTroughAugerActive && !p.TroughAugerHasClearance)
|
||||||
p.StopTroughAuger();
|
p.StopTroughAuger();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -410,7 +411,7 @@ namespace PamhagenSysCtrl.Helpers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void StartTroughAuger() {
|
public void StartTroughAuger() {
|
||||||
if (!ManualControlMode && (!IsReblerActive || (IsMWSelected && FillLevelMW1 == FillState.Full) || (IsMW2Selected && FillLevelMW2 == FillState.Full)))
|
if (!ManualControlMode && !TroughAugerHasClearance)
|
||||||
throw new NoClearanceException("Schnecke Auffangwanne hat keine Freigabe");
|
throw new NoClearanceException("Schnecke Auffangwanne hat keine Freigabe");
|
||||||
Actuators.TroughAuger = true;
|
Actuators.TroughAuger = true;
|
||||||
ActuatorsChanged = true;
|
ActuatorsChanged = true;
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ namespace PamhagenSysCtrl {
|
|||||||
Gradation °Oe: {plant.GradationOe:N2}
|
Gradation °Oe: {plant.GradationOe:N2}
|
||||||
Presse Querschnecke: {plant.PresseQuerSchnecke}
|
Presse Querschnecke: {plant.PresseQuerSchnecke}
|
||||||
Füllstände:
|
Füllstände:
|
||||||
Maischewanne 1: {plant.FillLevelMW1} (ausgewählt: {plant.WantMW1Selected}, Status: {plant.IsMWSelected})
|
Maischewanne 1: {plant.FillLevelMW1} (ausgewählt: {plant.WantMW1Selected}, Status: {plant.IsMW1Selected})
|
||||||
Maischewanne 2: {plant.FillLevelMW2} (ausgewählt: {plant.WantMW2Selected}, Status: {plant.IsMW2Selected})
|
Maischewanne 2: {plant.FillLevelMW2} (ausgewählt: {plant.WantMW2Selected}, Status: {plant.IsMW2Selected})
|
||||||
Presse 1: {plant.Press1HasClearance}
|
Presse 1: {plant.Press1HasClearance}
|
||||||
Presse 2: {plant.Press2HasClearance}
|
Presse 2: {plant.Press2HasClearance}
|
||||||
|
|||||||
@@ -58,91 +58,165 @@
|
|||||||
MouseMove="SchemeCanvas_MouseMove" MouseLeftButtonDown="SchemeCanvas_MouseLeftButtonDown" MouseLeftButtonUp="SchemeCanvas_MouseLeftButtonUp" Grid.ColumnSpan="2" Margin="25,0,0,0">
|
MouseMove="SchemeCanvas_MouseMove" MouseLeftButtonDown="SchemeCanvas_MouseLeftButtonDown" MouseLeftButtonUp="SchemeCanvas_MouseLeftButtonUp" Grid.ColumnSpan="2" Margin="25,0,0,0">
|
||||||
</Canvas>
|
</Canvas>
|
||||||
|
|
||||||
<Grid Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="10">
|
<Border Grid.Row="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Padding="10,10,20,20" Margin="0,0,-11,-11"
|
||||||
<Grid.ColumnDefinitions>
|
Background="WhiteSmoke"
|
||||||
<ColumnDefinition Width="160"/>
|
BorderBrush="Gray" BorderThickness="1" CornerRadius="10">
|
||||||
<ColumnDefinition Width="5"/>
|
<Grid>
|
||||||
<ColumnDefinition Width="160"/>
|
<Grid.ColumnDefinitions>
|
||||||
</Grid.ColumnDefinitions>
|
<ColumnDefinition Width="160"/>
|
||||||
<Grid.RowDefinitions>
|
<ColumnDefinition Width="5"/>
|
||||||
<RowDefinition Height="50"/>
|
<ColumnDefinition Width="160"/>
|
||||||
<RowDefinition Height="5"/>
|
</Grid.ColumnDefinitions>
|
||||||
<RowDefinition Height="50"/>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="5"/>
|
<RowDefinition Height="50"/>
|
||||||
<RowDefinition Height="50"/>
|
<RowDefinition Height="5"/>
|
||||||
<RowDefinition Height="5"/>
|
<RowDefinition Height="50"/>
|
||||||
<RowDefinition Height="50"/>
|
<RowDefinition Height="5"/>
|
||||||
<RowDefinition Height="5"/>
|
<RowDefinition Height="50"/>
|
||||||
<RowDefinition Height="50"/>
|
<RowDefinition Height="5"/>
|
||||||
<RowDefinition Height="5"/>
|
<RowDefinition Height="50"/>
|
||||||
<RowDefinition Height="50"/>
|
<RowDefinition Height="5"/>
|
||||||
<RowDefinition Height="5"/>
|
<RowDefinition Height="50"/>
|
||||||
<RowDefinition Height="50"/>
|
<RowDefinition Height="5"/>
|
||||||
</Grid.RowDefinitions>
|
<RowDefinition Height="50"/>
|
||||||
|
<RowDefinition Height="5"/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
<Button x:Name="FastSelectButton_MW1_Press1" Grid.Column="0" Grid.Row="0"
|
<Button x:Name="FastSelectButton_MW1_Press1" Grid.Column="0" Grid.Row="0"
|
||||||
Content="MW1 ⮞ Presse 1" FontSize="16" FontWeight="Bold"
|
Content="MW1 ⮞ Presse 1" FontSize="16" FontWeight="Bold"
|
||||||
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||||
BorderThickness="2"/>
|
BorderThickness="2"/>
|
||||||
<Button x:Name="FastSelectButton_MW2_Press1" Grid.Column="2" Grid.Row="0"
|
<Button x:Name="FastSelectButton_MW2_Press1" Grid.Column="2" Grid.Row="0"
|
||||||
Content="MW2 ⮞ Presse 1" FontSize="16" FontWeight="Bold"
|
Content="MW2 ⮞ Presse 1" FontSize="16" FontWeight="Bold"
|
||||||
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||||
BorderThickness="2"/>
|
BorderThickness="2"/>
|
||||||
|
|
||||||
<Button x:Name="FastSelectButton_MW1_Press2" Grid.Column="0" Grid.Row="2"
|
<Button x:Name="FastSelectButton_MW1_Press2" Grid.Column="0" Grid.Row="2"
|
||||||
Content="MW1 ⮞ Presse 2" FontSize="16" FontWeight="Bold"
|
Content="MW1 ⮞ Presse 2" FontSize="16" FontWeight="Bold"
|
||||||
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||||
BorderThickness="2"/>
|
BorderThickness="2"/>
|
||||||
<Button x:Name="FastSelectButton_MW2_Press2" Grid.Column="2" Grid.Row="2"
|
<Button x:Name="FastSelectButton_MW2_Press2" Grid.Column="2" Grid.Row="2"
|
||||||
Content="MW2 ⮞ Presse 2" FontSize="16" FontWeight="Bold"
|
Content="MW2 ⮞ Presse 2" FontSize="16" FontWeight="Bold"
|
||||||
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||||
BorderThickness="2"/>
|
BorderThickness="2"/>
|
||||||
|
|
||||||
<Button x:Name="FastSelectButton_MW1_Tank1" Grid.Column="0" Grid.Row="4"
|
<Button x:Name="FastSelectButton_MW1_Tank1" Grid.Column="0" Grid.Row="4"
|
||||||
Content="MW1 ⮞ Tank 1" FontSize="16" FontWeight="Bold"
|
Content="MW1 ⮞ Tank 1" FontSize="16" FontWeight="Bold"
|
||||||
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||||
BorderThickness="2"/>
|
BorderThickness="2"/>
|
||||||
<Button x:Name="FastSelectButton_MW2_Tank1" Grid.Column="2" Grid.Row="4"
|
<Button x:Name="FastSelectButton_MW2_Tank1" Grid.Column="2" Grid.Row="4"
|
||||||
Content="MW2 ⮞ Tank 1" FontSize="16" FontWeight="Bold"
|
Content="MW2 ⮞ Tank 1" FontSize="16" FontWeight="Bold"
|
||||||
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||||
BorderThickness="2"/>
|
BorderThickness="2"/>
|
||||||
|
|
||||||
<Button x:Name="FastSelectButton_MW1_Tank2" Grid.Column="0" Grid.Row="6"
|
<Button x:Name="FastSelectButton_MW1_Tank2" Grid.Column="0" Grid.Row="6"
|
||||||
Content="MW1 ⮞ Tank 2" FontSize="16" FontWeight="Bold"
|
Content="MW1 ⮞ Tank 2" FontSize="16" FontWeight="Bold"
|
||||||
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||||
BorderThickness="2"/>
|
BorderThickness="2"/>
|
||||||
<Button x:Name="FastSelectButton_MW2_Tank2" Grid.Column="2" Grid.Row="6"
|
<Button x:Name="FastSelectButton_MW2_Tank2" Grid.Column="2" Grid.Row="6"
|
||||||
Content="MW2 ⮞ Tank 2" FontSize="16" FontWeight="Bold"
|
Content="MW2 ⮞ Tank 2" FontSize="16" FontWeight="Bold"
|
||||||
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||||
BorderThickness="2"/>
|
BorderThickness="2"/>
|
||||||
|
|
||||||
<Button x:Name="FastSelectButton_MW1_Tank3" Grid.Column="0" Grid.Row="8"
|
<Button x:Name="FastSelectButton_MW1_Tank3" Grid.Column="0" Grid.Row="8"
|
||||||
Content="MW1 ⮞ Tank 3" FontSize="16" FontWeight="Bold"
|
Content="MW1 ⮞ Tank 3" FontSize="16" FontWeight="Bold"
|
||||||
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||||
BorderThickness="2"/>
|
BorderThickness="2"/>
|
||||||
<Button x:Name="FastSelectButton_MW2_Tank3" Grid.Column="2" Grid.Row="8"
|
<Button x:Name="FastSelectButton_MW2_Tank3" Grid.Column="2" Grid.Row="8"
|
||||||
Content="MW2 ⮞ Tank 3" FontSize="16" FontWeight="Bold"
|
Content="MW2 ⮞ Tank 3" FontSize="16" FontWeight="Bold"
|
||||||
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||||
BorderThickness="2"/>
|
BorderThickness="2"/>
|
||||||
|
|
||||||
<Button x:Name="FastSelectButton_MW1_Tank4" Grid.Column="0" Grid.Row="10"
|
<Button x:Name="FastSelectButton_MW1_Tank4" Grid.Column="0" Grid.Row="10"
|
||||||
Content="MW1 ⮞ Tank 4" FontSize="16" FontWeight="Bold"
|
Content="MW1 ⮞ Tank 4" FontSize="16" FontWeight="Bold"
|
||||||
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||||
BorderThickness="2"/>
|
BorderThickness="2"/>
|
||||||
<Button x:Name="FastSelectButton_MW2_Tank4" Grid.Column="2" Grid.Row="10"
|
<Button x:Name="FastSelectButton_MW2_Tank4" Grid.Column="2" Grid.Row="10"
|
||||||
Content="MW2 ⮞ Tank 4" FontSize="16" FontWeight="Bold"
|
Content="MW2 ⮞ Tank 4" FontSize="16" FontWeight="Bold"
|
||||||
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||||
BorderThickness="2"/>
|
BorderThickness="2"/>
|
||||||
|
|
||||||
<Button x:Name="FastSelectButton_MW1_Tank5" Grid.Column="0" Grid.Row="12"
|
<Button x:Name="FastSelectButton_MW1_Tank5" Grid.Column="0" Grid.Row="12"
|
||||||
Content="MW1 ⮞ Tank 5" FontSize="16" FontWeight="Bold"
|
Content="MW1 ⮞ Tank 5" FontSize="16" FontWeight="Bold"
|
||||||
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||||
BorderThickness="2"/>
|
BorderThickness="2"/>
|
||||||
<Button x:Name="FastSelectButton_MW2_Tank5" Grid.Column="2" Grid.Row="12"
|
<Button x:Name="FastSelectButton_MW2_Tank5" Grid.Column="2" Grid.Row="12"
|
||||||
Content="MW2 ⮞ Tank 5" FontSize="16" FontWeight="Bold"
|
Content="MW2 ⮞ Tank 5" FontSize="16" FontWeight="Bold"
|
||||||
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
Click="FastSelectButton_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||||
BorderThickness="2"/>
|
BorderThickness="2"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
</Border>
|
||||||
|
|
||||||
|
<Border HorizontalAlignment="Left" VerticalAlignment="Bottom" Padding="60,15,15,30" Margin="-11,0,0,-11"
|
||||||
|
Background="WhiteSmoke"
|
||||||
|
BorderBrush="Gray" BorderThickness="1" CornerRadius="10">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="160"/>
|
||||||
|
<ColumnDefinition Width="2.5"/>
|
||||||
|
<ColumnDefinition Width="2.5"/>
|
||||||
|
<ColumnDefinition Width="160"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="60"/>
|
||||||
|
<RowDefinition Height="5"/>
|
||||||
|
<RowDefinition Height="50"/>
|
||||||
|
<RowDefinition Height="5"/>
|
||||||
|
<RowDefinition Height="80"/>
|
||||||
|
<RowDefinition Height="80"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Button x:Name="FastSelectButton_EntryTrough_Start" Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="2"
|
||||||
|
FontSize="14" FontWeight="Bold"
|
||||||
|
Click="FastSelectButton_EntryTroughStart_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||||
|
BorderThickness="2">
|
||||||
|
<TextBlock TextAlignment="Center">Auffangwanne<LineBreak/><Run FontSize="18">Schnecke Start</Run></TextBlock>
|
||||||
|
</Button>
|
||||||
|
<Button x:Name="FastSelectButton_EntryTrough_Stop" Grid.Column="2" Grid.Row="0" Grid.ColumnSpan="2"
|
||||||
|
FontSize="14" FontWeight="Bold"
|
||||||
|
Click="FastSelectButton_EntryTroughStop_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||||
|
BorderThickness="2">
|
||||||
|
<TextBlock TextAlignment="Center">Auffangwanne<LineBreak/><Run FontSize="18">Schnecke Stop</Run></TextBlock>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
|
||||||
|
<Button x:Name="FastSelectButton_MW2" Grid.Column="0" Grid.Row="2"
|
||||||
|
Content="MW2 ⮜" FontSize="16" FontWeight="Bold"
|
||||||
|
Click="FastSelectButton_MW2_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||||
|
BorderThickness="2"/>
|
||||||
|
<Button x:Name="FastSelectButton_MW1" Grid.Column="3" Grid.Row="2"
|
||||||
|
Content="⮞ MW1" FontSize="16" FontWeight="Bold"
|
||||||
|
Click="FastSelectButton_MW1_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||||
|
BorderThickness="2"/>
|
||||||
|
|
||||||
|
<Button x:Name="FastSelectButton_MP2_Stop" Grid.Column="0" Grid.Row="4"
|
||||||
|
FontSize="16" FontWeight="Bold"
|
||||||
|
Click="FastSelectButton_MP2_Stop_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||||
|
BorderThickness="2">
|
||||||
|
<TextBlock TextAlignment="Center"><Run FontSize="24">MP2</Run><LineBreak/>Stop</TextBlock>
|
||||||
|
</Button>
|
||||||
|
<Button x:Name="FastSelectButton_MP2_Forward" Grid.Column="0" Grid.Row="5"
|
||||||
|
FontSize="16" FontWeight="Bold"
|
||||||
|
Click="FastSelectButton_MP2_Forward_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||||
|
BorderThickness="2">
|
||||||
|
<TextBlock TextAlignment="Center"><Run FontSize="24">MP2</Run><LineBreak/><Run x:Name="MP2_Target">Vor</Run></TextBlock>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button x:Name="FastSelectButton_MP1_Stop" Grid.Column="3" Grid.Row="4"
|
||||||
|
FontSize="16" FontWeight="Bold"
|
||||||
|
Click="FastSelectButton_MP1_Stop_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||||
|
BorderThickness="2">
|
||||||
|
<TextBlock TextAlignment="Center"><Run FontSize="24">MP1</Run><LineBreak/>Stop</TextBlock>
|
||||||
|
</Button>
|
||||||
|
<Button x:Name="FastSelectButton_MP1_Forward" Grid.Column="3" Grid.Row="5"
|
||||||
|
FontSize="16" FontWeight="Bold"
|
||||||
|
Click="FastSelectButton_MP1_Forward_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||||
|
BorderThickness="2">
|
||||||
|
<TextBlock TextAlignment="Center"><Run FontSize="24">MP1</Run><LineBreak/><Run x:Name="MP1_Target">Vor</Run></TextBlock>
|
||||||
|
</Button>
|
||||||
|
</Grid>
|
||||||
|
</Border>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<StatusBar Grid.Row="2" BorderThickness="0,1,0,0" BorderBrush="Gray">
|
<StatusBar Grid.Row="2" BorderThickness="0,1,0,0" BorderBrush="Gray">
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ namespace PamhagenSysCtrl.Windows {
|
|||||||
|
|
||||||
public Path? HoveringPath {
|
public Path? HoveringPath {
|
||||||
get {
|
get {
|
||||||
foreach (var b in FastSelectButtons.Where(b => b.Key.IsMouseOver)) {
|
foreach (var b in FastSelectPaths.Where(b => b.Key.IsMouseOver)) {
|
||||||
if (Graph.SelectedPaths.Any(p => p.Start == b.Value.Source && p.Hops.Last().Node == b.Value.Sink))
|
if (Graph.SelectedPaths.Any(p => p.Start == b.Value.Source && p.Hops.Last().Node == b.Value.Sink))
|
||||||
continue;
|
continue;
|
||||||
return Graph.GetFreePath([b.Value.Source, b.Value.Sink], true);
|
return Graph.GetFreePath([b.Value.Source, b.Value.Sink], true);
|
||||||
@@ -38,13 +38,13 @@ namespace PamhagenSysCtrl.Windows {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Dictionary<Button, (ISource Source, Pump Pump, ISink Sink)> FastSelectButtons;
|
protected Dictionary<Button, (ISource Source, Pump Pump, ISink Sink)> FastSelectPaths;
|
||||||
|
|
||||||
public PlantSchemeWindow() {
|
public PlantSchemeWindow() {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Graph = new();
|
Graph = new();
|
||||||
Graph.Draw(SchemeCanvas);
|
Graph.Draw(SchemeCanvas);
|
||||||
FastSelectButtons = new Dictionary<Button, (ISource, Pump, ISink)> {
|
FastSelectPaths = new Dictionary<Button, (ISource, Pump, ISink)> {
|
||||||
[FastSelectButton_MW1_Press1] = (Graph.MW1, Graph.MP1, Graph.Press1),
|
[FastSelectButton_MW1_Press1] = (Graph.MW1, Graph.MP1, Graph.Press1),
|
||||||
[FastSelectButton_MW2_Press1] = (Graph.MW2, Graph.MP2, Graph.Press1),
|
[FastSelectButton_MW2_Press1] = (Graph.MW2, Graph.MP2, Graph.Press1),
|
||||||
[FastSelectButton_MW1_Press2] = (Graph.MW1, Graph.MP1, Graph.Press2),
|
[FastSelectButton_MW1_Press2] = (Graph.MW1, Graph.MP1, Graph.Press2),
|
||||||
@@ -117,6 +117,70 @@ namespace PamhagenSysCtrl.Windows {
|
|||||||
} catch { }
|
} catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void FastSelectButton_EntryTroughStart_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
try {
|
||||||
|
App.Plant?.StartTroughAuger();
|
||||||
|
} catch (NoClearanceException exc) {
|
||||||
|
MessageBox.Show($"{exc.Message}", "Keine Freigabe", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FastSelectButton_EntryTroughStop_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
try {
|
||||||
|
App.Plant?.StopTroughAuger();
|
||||||
|
} catch (NoClearanceException exc) {
|
||||||
|
MessageBox.Show($"{exc.Message}", "Keine Freigabe", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FastSelectButton_MW1_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
try {
|
||||||
|
App.Plant?.SelectMW1();
|
||||||
|
} catch (NoClearanceException exc) {
|
||||||
|
MessageBox.Show($"{exc.Message}", "Keine Freigabe", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FastSelectButton_MW2_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
try {
|
||||||
|
App.Plant?.SelectMW2();
|
||||||
|
} catch (NoClearanceException exc) {
|
||||||
|
MessageBox.Show($"{exc.Message}", "Keine Freigabe", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FastSelectButton_MP1_Forward_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
try {
|
||||||
|
App.Plant?.StartMP1Forward();
|
||||||
|
} catch (NoClearanceException exc) {
|
||||||
|
MessageBox.Show($"{exc.Message}", "Keine Freigabe", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FastSelectButton_MP1_Stop_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
try {
|
||||||
|
App.Plant?.StopMP1();
|
||||||
|
} catch (NoClearanceException exc) {
|
||||||
|
MessageBox.Show($"{exc.Message}", "Keine Freigabe", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FastSelectButton_MP2_Forward_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
try {
|
||||||
|
App.Plant?.StartMP2Forward();
|
||||||
|
} catch (NoClearanceException exc) {
|
||||||
|
MessageBox.Show($"{exc.Message}", "Keine Freigabe", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void FastSelectButton_MP2_Stop_Click(object sender, RoutedEventArgs evt) {
|
||||||
|
try {
|
||||||
|
App.Plant?.StopMP2();
|
||||||
|
} catch (NoClearanceException exc) {
|
||||||
|
MessageBox.Show($"{exc.Message}", "Keine Freigabe", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void FastSelectButton_Enter(object sender, MouseEventArgs evt) {
|
private void FastSelectButton_Enter(object sender, MouseEventArgs evt) {
|
||||||
UpdateScheme(evt.GetPosition(SchemeCanvas), evt.LeftButton == MouseButtonState.Pressed);
|
UpdateScheme(evt.GetPosition(SchemeCanvas), evt.LeftButton == MouseButtonState.Pressed);
|
||||||
}
|
}
|
||||||
@@ -126,7 +190,7 @@ namespace PamhagenSysCtrl.Windows {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void FastSelectButton_Click(object sender, RoutedEventArgs evt) {
|
private void FastSelectButton_Click(object sender, RoutedEventArgs evt) {
|
||||||
if (sender is not Button b || !FastSelectButtons.TryGetValue(b, out var val))
|
if (sender is not Button b || !FastSelectPaths.TryGetValue(b, out var val))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (Graph.SelectedPaths.Select(p => (Path?)p).FirstOrDefault(p => p?.Start == val.Source, null) is Path p1) {
|
if (Graph.SelectedPaths.Select(p => (Path?)p).FirstOrDefault(p => p?.Start == val.Source, null) is Path p1) {
|
||||||
@@ -278,7 +342,7 @@ namespace PamhagenSysCtrl.Windows {
|
|||||||
UpdateScheme(pos, evt.LeftButton == MouseButtonState.Pressed);
|
UpdateScheme(pos, evt.LeftButton == MouseButtonState.Pressed);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SetFastSelectButton(Button b, int m, bool disabled) {
|
private static void SetFastSelectButton(Button b, int m, bool disabled = false) {
|
||||||
b.IsEnabled = !disabled;
|
b.IsEnabled = !disabled;
|
||||||
if (m == 1) {
|
if (m == 1) {
|
||||||
b.Background = Brushes.MintCream;
|
b.Background = Brushes.MintCream;
|
||||||
@@ -295,8 +359,8 @@ namespace PamhagenSysCtrl.Windows {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateFastSelectButton(IEnumerable<Path> paths, Path? hoverPathDeactivate, Button b) {
|
private void UpdateFastSelectPathButton(IEnumerable<Path> paths, Path? hoverPathDeactivate, Button b) {
|
||||||
var e = FastSelectButtons[b];
|
var e = FastSelectPaths[b];
|
||||||
SetFastSelectButton(b,
|
SetFastSelectButton(b,
|
||||||
paths.Any(p => p.Start == e.Source && p.Hops.Last().Node == e.Sink) ? (hoverPathDeactivate?.Start == e.Source && hoverPathDeactivate?.Hops.Last().Node == e.Sink) ? 2 : 1 : 0,
|
paths.Any(p => p.Start == e.Source && p.Hops.Last().Node == e.Sink) ? (hoverPathDeactivate?.Start == e.Source && hoverPathDeactivate?.Hops.Last().Node == e.Sink) ? 2 : 1 : 0,
|
||||||
e.Pump.IsActive || Graph.GetFreePath([e.Source, e.Sink], overrideStart: true) == null);
|
e.Pump.IsActive || Graph.GetFreePath([e.Source, e.Sink], overrideStart: true) == null);
|
||||||
@@ -313,17 +377,29 @@ namespace PamhagenSysCtrl.Windows {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var b in FastSelectButtons) {
|
SetFastSelectButton(FastSelectButton_EntryTrough_Start, App.Plant?.IsTroughAugerActive ?? false ? 1 : 0, !(App.Plant?.TroughAugerHasClearance ?? false));
|
||||||
|
SetFastSelectButton(FastSelectButton_EntryTrough_Stop, App.Plant?.IsTroughAugerActive ?? false ? 0 : 2);
|
||||||
|
SetFastSelectButton(FastSelectButton_MW1, App.Plant?.IsMW1Selected ?? false ? 1 : 0);
|
||||||
|
SetFastSelectButton(FastSelectButton_MW2, App.Plant?.IsMW2Selected ?? false ? 1 : 0);
|
||||||
|
SetFastSelectButton(FastSelectButton_MP1_Forward, App.Plant?.MP1 == MotorState.Forward ? 1 : 0, !(App.Plant?.MP1HasClearance ?? false));
|
||||||
|
SetFastSelectButton(FastSelectButton_MP1_Stop, App.Plant?.MP1 == MotorState.Halt ? 2 : 0);
|
||||||
|
SetFastSelectButton(FastSelectButton_MP2_Forward, App.Plant?.MP2 == MotorState.Forward ? 1 : 0, !(App.Plant?.MP2HasClearance ?? false));
|
||||||
|
SetFastSelectButton(FastSelectButton_MP2_Stop, App.Plant?.MP2 == MotorState.Halt ? 2 : 0);
|
||||||
|
foreach (var b in FastSelectPaths) {
|
||||||
SetFastSelectButton(b.Key, 0, false);
|
SetFastSelectButton(b.Key, 0, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
_hover = Graph.GetHover(pos.X, pos.Y);
|
_hover = Graph.GetHover(pos.X, pos.Y);
|
||||||
var hoverButtons = FastSelectButtons.Where(b => b.Key.IsMouseOver).ToDictionary();
|
var hoverButtons = FastSelectPaths.Where(b => b.Key.IsMouseOver).ToDictionary();
|
||||||
Path? hoverPathDeactivate = null;
|
Path? hoverPathDeactivate = null;
|
||||||
if (App.Plant?.ManualControlMode ?? false) {
|
if (App.Plant?.ManualControlMode ?? false) {
|
||||||
foreach (var src in Graph.Nodes.Where(n => n is Pump)) {
|
foreach (var src in Graph.Nodes.Where(n => n is Pump)) {
|
||||||
Graph.ColorPipesByValves(src, PamhagenBrushes.Green, (src as Pump)?.State ?? default, PamhagenBrushes.DimOrange);
|
Graph.ColorPipesByValves(src, PamhagenBrushes.Green, (src as Pump)?.State ?? default, PamhagenBrushes.DimOrange);
|
||||||
}
|
}
|
||||||
|
MP1_Target.Text = "Vor";
|
||||||
|
MP2_Target.Text = "Vor";
|
||||||
|
MP1_Target.FontSize = 16;
|
||||||
|
MP2_Target.FontSize = 16;
|
||||||
} else {
|
} else {
|
||||||
foreach (var p in Graph.SelectedPaths) {
|
foreach (var p in Graph.SelectedPaths) {
|
||||||
Graph.ColorPipesAdjacientToPath(p, PamhagenBrushes.Green, p.Hops.Select(h => (h.Node as Pump)?.State ?? default).FirstOrDefault(n => n != MotorState.Halt), PamhagenBrushes.DimOrange);
|
Graph.ColorPipesAdjacientToPath(p, PamhagenBrushes.Green, p.Hops.Select(h => (h.Node as Pump)?.State ?? default).FirstOrDefault(n => n != MotorState.Halt), PamhagenBrushes.DimOrange);
|
||||||
@@ -357,12 +433,31 @@ namespace PamhagenSysCtrl.Windows {
|
|||||||
if (HoveringPath is Path hoveringPath) {
|
if (HoveringPath is Path hoveringPath) {
|
||||||
Graph.ColorPipesAdjacientToPath(hoveringPath, PamhagenBrushes.Green, default, PamhagenBrushes.DimOrange);
|
Graph.ColorPipesAdjacientToPath(hoveringPath, PamhagenBrushes.Green, default, PamhagenBrushes.DimOrange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Graph.SelectedPaths.Select(p => (Path?)p).FirstOrDefault(p => p?.Start == Graph.MW1) is Path pmw1) {
|
||||||
|
MP1_Target.Text = "\u2b9e " + string.Join(" \u2b9e ", pmw1.Hops
|
||||||
|
.Select(h => h.Node is Valve || h.Node is Pump || h.Node is CenterValve ? null : h.Node.Label)
|
||||||
|
.Where(l => !string.IsNullOrWhiteSpace(l)));
|
||||||
|
} else {
|
||||||
|
MP1_Target.Text = "Vor";
|
||||||
|
}
|
||||||
|
if (Graph.SelectedPaths.Select(p => (Path?)p).FirstOrDefault(p => p?.Start == Graph.MW2) is Path pmw2) {
|
||||||
|
MP2_Target.Text = "\u2b9e " + string.Join(" \u2b9e ", pmw2.Hops
|
||||||
|
.Select(h => h.Node is Valve || h.Node is Pump || h.Node is CenterValve ? null : h.Node.Label)
|
||||||
|
.Where(l => !string.IsNullOrWhiteSpace(l)));
|
||||||
|
} else {
|
||||||
|
MP2_Target.Text = "Vor";
|
||||||
|
}
|
||||||
|
var len1 = MP1_Target.Text.Length;
|
||||||
|
var len2 = MP2_Target.Text.Length;
|
||||||
|
MP1_Target.FontSize = len1 > 24 ? 8 : len1 > 20 ? 10 : len1 > 16 ? 12 : len1 > 12 ? 14 : 16;
|
||||||
|
MP2_Target.FontSize = len2 > 24 ? 8 : len2 > 20 ? 10 : len2 > 16 ? 12 : len2 > 12 ? 14 : 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
var paths = Graph.SelectedPaths;
|
var paths = Graph.SelectedPaths;
|
||||||
if (HoveringPath is Path hp) paths = paths.Append(hp);
|
if (HoveringPath is Path hp) paths = paths.Append(hp);
|
||||||
foreach (var b in FastSelectButtons.Keys) {
|
foreach (var b in FastSelectPaths.Keys) {
|
||||||
UpdateFastSelectButton(paths, hoverPathDeactivate, b);
|
UpdateFastSelectPathButton(paths, hoverPathDeactivate, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
Graph.Update(_hover, down);
|
Graph.Update(_hover, down);
|
||||||
|
|||||||
Reference in New Issue
Block a user