@@ -17,7 +17,7 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
public readonly Pump P5;
|
||||
public readonly Pump P6;
|
||||
public readonly EncasedAuger Auger1;
|
||||
public readonly EncasedAuger Auger2;
|
||||
public readonly EncasedAuger Auger3;
|
||||
|
||||
public PamhagenGraph() {
|
||||
double mw2X = 180;
|
||||
@@ -51,13 +51,13 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
Nodes.Add(trough);
|
||||
|
||||
Auger1 = new EncasedAuger("", (mw1X + mw2X) / 2 - 100, 200, () => App.Plant?.IsAuger1Active ?? false);
|
||||
var auger3 = new EncasedAuger("Pressen-\nQuerschnecke", 40, 200, () => App.Plant?.IsPresseQuerSchneckeActive ?? false, 180, clickable: false);
|
||||
Auger2 = new EncasedAuger("", 120, 80, () => App.Plant?.IsAuger2Active ?? false, 135);
|
||||
var belt = new ConveyorBelt("", 90, 160, () => App.Plant?.IsBeltActive ?? false);
|
||||
var auger0 = new EncasedAuger("Pressen-\nQuerschnecke", 40, 200, () => App.Plant?.IsPresseQuerSchneckeActive ?? false, 180, clickable: false);
|
||||
Auger3 = new EncasedAuger("", 120, 80, () => App.Plant?.IsAuger3Active ?? false, 135);
|
||||
var belt = new ConveyorBelt("", 90, 160, () => App.Plant?.IsAuger2Active ?? false);
|
||||
Nodes.Add(belt);
|
||||
Nodes.Add(Auger1);
|
||||
Nodes.Add(auger3);
|
||||
Nodes.Add(Auger2);
|
||||
Nodes.Add(auger0);
|
||||
Nodes.Add(Auger3);
|
||||
var rebler = new Rebler("Rebler", (mw1X + mw2X) / 2, 200, () => App.Plant?.IsReblerActive ?? false);
|
||||
Nodes.Add(rebler);
|
||||
var switcher = new Switcher("", (mw1X + mw2X) / 2, 260, () => App.Plant?.TroughSelector ?? 0, () => App.Plant == null ? 0 : App.Plant.WantMW1Selected ? 1 : 2);
|
||||
|
||||
@@ -53,10 +53,10 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
public bool IsReblerActive => Actuators.Rebler;
|
||||
public bool IsStirrerMW1Active => Actuators.StirrerMW1;
|
||||
public bool IsStirrerMW2Active => Actuators.StirrerMW2;
|
||||
public bool IsBeltActive => Actuators.Belt;
|
||||
public bool IsAuger1Active => Actuators.Auger1;
|
||||
public bool IsAuger2Active => Actuators.Auger2;
|
||||
public bool IsWasteDisposalActive => IsBeltActive || IsAuger1Active || IsAuger2Active;
|
||||
public bool IsAuger3Active => Actuators.Auger3;
|
||||
public bool IsWasteDisposalActive => IsAuger1Active || IsAuger2Active || IsAuger3Active;
|
||||
public bool IsGradationPumpActive => Actuators.GradationPump;
|
||||
|
||||
public bool IsMP1Active => Actuators.MP1 == MotorState.Forward || Actuators.MP1 == MotorState.Backward;
|
||||
@@ -78,10 +78,10 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
|
||||
protected static void OnUpdate(object? sender, PlantEventArgs evt) {
|
||||
if (sender is not PamhagenPlant p) return;
|
||||
if (p.IsPresseQuerSchneckeActive && !p.IsBeltActive) p.StartBelt();
|
||||
if (p.IsPresseQuerSchneckeActive && !p.IsAuger2Active) p.StartAuger2();
|
||||
if (p.IsReblerActive && !p.IsAuger1Active) p.StartAuger1();
|
||||
if (p.IsAuger1Active && !p.IsBeltActive) p.StartBelt();
|
||||
if (p.IsBeltActive && !p.IsAuger2Active) p.StartAuger2();
|
||||
if (p.IsAuger1Active && !p.IsAuger2Active) p.StartAuger2();
|
||||
if (p.IsAuger2Active && !p.IsAuger3Active) p.StartAuger3();
|
||||
if (p.IsTroughAugerActive && (!p.IsReblerActive || (p.IsMWSelected && p.FillLevelMW1 == FillState.Full) || (p.IsMW2Selected && p.FillLevelMW2 == FillState.Full)))
|
||||
p.StopTroughAuger();
|
||||
if (p.IsMP1Active && !p.MP1HasClearance) p.StopMP1();
|
||||
@@ -427,22 +427,9 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
ActuatorsChanged = true;
|
||||
}
|
||||
|
||||
public void StartBelt() {
|
||||
Actuators.Belt = true;
|
||||
StartAuger2();
|
||||
ActuatorsChanged = true;
|
||||
}
|
||||
|
||||
public void StopBelt() {
|
||||
if (IsPresseQuerSchneckeActive) throw new NoClearanceException("Presse-Querschnecke aktiv");
|
||||
if (IsAuger1Active) throw new NoClearanceException("Förderschnecke 1 aktiv");
|
||||
Actuators.Belt = false;
|
||||
ActuatorsChanged = true;
|
||||
}
|
||||
|
||||
public void StartAuger1() {
|
||||
Actuators.Auger1 = true;
|
||||
StartBelt();
|
||||
StartAuger2();
|
||||
ActuatorsChanged = true;
|
||||
}
|
||||
|
||||
@@ -454,15 +441,28 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
|
||||
public void StartAuger2() {
|
||||
Actuators.Auger2 = true;
|
||||
StartAuger3();
|
||||
ActuatorsChanged = true;
|
||||
}
|
||||
|
||||
public void StopAuger2() {
|
||||
if (IsBeltActive) throw new NoClearanceException("Förderband aktiv");
|
||||
if (IsPresseQuerSchneckeActive) throw new NoClearanceException("Presse-Querschnecke aktiv");
|
||||
if (IsAuger1Active) throw new NoClearanceException("Förderschnecke 1 aktiv");
|
||||
Actuators.Auger2 = false;
|
||||
ActuatorsChanged = true;
|
||||
}
|
||||
|
||||
public void StartAuger3() {
|
||||
Actuators.Auger3 = true;
|
||||
ActuatorsChanged = true;
|
||||
}
|
||||
|
||||
public void StopAuger3() {
|
||||
if (IsAuger2Active) throw new NoClearanceException("Förderschnecke 2 aktiv");
|
||||
Actuators.Auger3 = false;
|
||||
ActuatorsChanged = true;
|
||||
}
|
||||
|
||||
public void StartGradationPump() {
|
||||
Actuators.GradationPump = true;
|
||||
ActuatorsChanged = true;
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
public record struct ActuatorStates(
|
||||
long Valves,
|
||||
MotorState MP1, MotorState MP2, MotorState P12, MotorState P3, MotorState P4, MotorState P5, MotorState P6,
|
||||
bool TroughAuger, bool Rebler, bool StirrerMW1, bool StirrerMW2, bool Belt, bool Auger1, bool Auger2, bool GradationPump
|
||||
bool TroughAuger, bool Rebler, bool StirrerMW1, bool StirrerMW2, bool Auger2, bool Auger3, bool Auger1, bool GradationPump
|
||||
) {
|
||||
public readonly bool GetV(int n) => (Valves & (1L << (n - 1))) != 0;
|
||||
public void SetV(int n, bool val) {
|
||||
@@ -212,9 +212,9 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
(state.GetV(58) ? 0x04 : 0x00) |
|
||||
(state.StirrerMW1 ? 0x08 : 0x00) |
|
||||
(state.StirrerMW2 ? 0x10 : 0x00) |
|
||||
(state.Belt ? 0x20 : 0x00) |
|
||||
(state.Auger1 ? 0x40 : 0x00) |
|
||||
(state.Auger2 ? 0x80 : 0x00);
|
||||
(state.Auger2 ? 0x20 : 0x00) |
|
||||
(state.Auger3 ? 0x40 : 0x00) |
|
||||
(state.Auger1 ? 0x80 : 0x00);
|
||||
|
||||
int measuring =
|
||||
(state.GetV(59) ? 0x01 : 0x00) |
|
||||
|
||||
@@ -39,14 +39,14 @@
|
||||
FontSize="14" BorderThickness="2" FontWeight="Bold"
|
||||
Margin="135,10,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
|
||||
Click="Auger1Button_Click"/>
|
||||
<Button x:Name="BeltButton" Content="Förderband" Padding="2" Height="30" Width="150"
|
||||
FontSize="14" BorderThickness="2" FontWeight="Bold"
|
||||
Margin="135,45,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
|
||||
Click="BeltButton_Click"/>
|
||||
<Button x:Name="Auger2Button" Content="Förderschnecke 2" Padding="2" Height="30" Width="150"
|
||||
FontSize="14" BorderThickness="2" FontWeight="Bold"
|
||||
Margin="135,80,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
|
||||
Margin="135,45,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
|
||||
Click="Auger2Button_Click"/>
|
||||
<Button x:Name="Auger3Button" Content="Förderschnecke 3" Padding="2" Height="30" Width="150"
|
||||
FontSize="14" BorderThickness="2" FontWeight="Bold"
|
||||
Margin="135,80,10,10" VerticalAlignment="Top" HorizontalAlignment="Left"
|
||||
Click="Auger3Button_Click"/>
|
||||
|
||||
<Button x:Name="P6Button" Content="Pumpe 6" Padding="2" Height="30" Width="150"
|
||||
FontSize="14" BorderThickness="2" FontWeight="Bold"
|
||||
|
||||
@@ -76,10 +76,6 @@ namespace PamhagenSysCtrl {
|
||||
StirrerMW2Button.Foreground = plant.IsStirrerMW2Active ? Brushes.DarkGreen : Brushes.DarkRed;
|
||||
StirrerMW2Button.Background = plant.IsStirrerMW2Active ? Brushes.MintCream : Brushes.MistyRose;
|
||||
|
||||
BeltButton.BorderBrush = plant.IsBeltActive ? Brushes.DarkGreen : Brushes.DarkRed;
|
||||
BeltButton.Foreground = plant.IsBeltActive ? Brushes.DarkGreen : Brushes.DarkRed;
|
||||
BeltButton.Background = plant.IsBeltActive ? Brushes.MintCream : Brushes.MistyRose;
|
||||
|
||||
Auger1Button.BorderBrush = plant.IsAuger1Active ? Brushes.DarkGreen : Brushes.DarkRed;
|
||||
Auger1Button.Foreground = plant.IsAuger1Active ? Brushes.DarkGreen : Brushes.DarkRed;
|
||||
Auger1Button.Background = plant.IsAuger1Active ? Brushes.MintCream : Brushes.MistyRose;
|
||||
@@ -88,6 +84,10 @@ namespace PamhagenSysCtrl {
|
||||
Auger2Button.Foreground = plant.IsAuger2Active ? Brushes.DarkGreen : Brushes.DarkRed;
|
||||
Auger2Button.Background = plant.IsAuger2Active ? Brushes.MintCream : Brushes.MistyRose;
|
||||
|
||||
Auger3Button.BorderBrush = plant.IsAuger3Active ? Brushes.DarkGreen : Brushes.DarkRed;
|
||||
Auger3Button.Foreground = plant.IsAuger3Active ? Brushes.DarkGreen : Brushes.DarkRed;
|
||||
Auger3Button.Background = plant.IsAuger3Active ? Brushes.MintCream : Brushes.MistyRose;
|
||||
|
||||
MP1BackwardButton.BorderBrush = plant.MP1 == MotorState.Backward ? Brushes.DarkGreen : Brushes.SlateGray;
|
||||
MP1BackwardButton.Foreground = plant.MP1 == MotorState.Backward ? Brushes.DarkGreen : Brushes.SlateGray;
|
||||
MP1BackwardButton.Background = plant.MP1 == MotorState.Backward ? Brushes.MintCream : Brushes.WhiteSmoke;
|
||||
@@ -200,19 +200,6 @@ namespace PamhagenSysCtrl {
|
||||
}
|
||||
}
|
||||
|
||||
private void BeltButton_Click(object? sender, RoutedEventArgs? evt) {
|
||||
if (App.Plant == null) return;
|
||||
try {
|
||||
if (App.Plant.IsBeltActive) {
|
||||
App.Plant.StopBelt();
|
||||
} else {
|
||||
App.Plant.StartBelt();
|
||||
}
|
||||
} catch (NoClearanceException exc) {
|
||||
MessageBox.Show($"{exc.Message}", "Keine Freigabe", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void Auger1Button_Click(object? sender, RoutedEventArgs? evt) {
|
||||
if (App.Plant == null) return;
|
||||
try {
|
||||
@@ -239,6 +226,19 @@ namespace PamhagenSysCtrl {
|
||||
}
|
||||
}
|
||||
|
||||
private void Auger3Button_Click(object? sender, RoutedEventArgs? evt) {
|
||||
if (App.Plant == null) return;
|
||||
try {
|
||||
if (App.Plant.IsAuger3Active) {
|
||||
App.Plant.StopAuger3();
|
||||
} else {
|
||||
App.Plant.StartAuger3();
|
||||
}
|
||||
} catch (NoClearanceException exc) {
|
||||
MessageBox.Show($"{exc.Message}", "Keine Freigabe", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
}
|
||||
}
|
||||
|
||||
private void MP1BackwardButton_Click(object? sender, RoutedEventArgs? evt) {
|
||||
if (App.Plant == null) return;
|
||||
try {
|
||||
|
||||
@@ -109,18 +109,18 @@ namespace PamhagenSysCtrl.Windows {
|
||||
} else {
|
||||
App.Plant?.StartAuger1();
|
||||
}
|
||||
} else if (auger == Graph.Auger2) {
|
||||
} else if (auger == Graph.Auger3) {
|
||||
if (auger.IsActive) {
|
||||
App.Plant?.StopAuger2();
|
||||
App.Plant?.StopAuger3();
|
||||
} else {
|
||||
App.Plant?.StartAuger2();
|
||||
App.Plant?.StartAuger3();
|
||||
}
|
||||
}
|
||||
} else if (c is ConveyorBelt belt) {
|
||||
if (belt.IsActive) {
|
||||
App.Plant?.StopBelt();
|
||||
App.Plant?.StopAuger2();
|
||||
} else {
|
||||
App.Plant?.StartBelt();
|
||||
App.Plant?.StartAuger2();
|
||||
}
|
||||
} else if (c is Pump pump) {
|
||||
if (pump == Graph.MP1) {
|
||||
|
||||
Reference in New Issue
Block a user