Compare commits
2
Commits
b485bcfb19
...
e6b97ccf33
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e6b97ccf33 | ||
|
|
b85d1d8afd |
No files matched your search
@@ -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);
|
||||
@@ -179,7 +179,7 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
var xv23 = new PipeJoin(t1X + 15, ltg6Y);
|
||||
var v22 = CreateValve(22, t1X - 15, tValveY);
|
||||
var v23 = CreateValve(23, t1X + 15, tValveY);
|
||||
var t1 = CreateTank(1, t1X, tanksY, 100000);
|
||||
var t1 = CreateTank(1, t1X, tanksY, 35000);
|
||||
CreatePipe(xv20, xv22, true);
|
||||
CreatePipe(xv21, xv23, true);
|
||||
CreatePipe(xv22, v22);
|
||||
@@ -191,7 +191,7 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
var xv25 = new PipeJoin(t2X + 15, ltg6Y);
|
||||
var v24 = CreateValve(24, t2X - 15, tValveY);
|
||||
var v25 = CreateValve(25, t2X + 15, tValveY);
|
||||
var t2 = CreateTank(2, t2X, tanksY, 100000);
|
||||
var t2 = CreateTank(2, t2X, tanksY, 35000);
|
||||
CreatePipe(xv22, xv24);
|
||||
CreatePipe(xv23, xv25);
|
||||
CreatePipe(xv24, v24);
|
||||
@@ -203,7 +203,7 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
var xv27 = new PipeJoin(t3X + 15, ltg6Y);
|
||||
var v26 = CreateValve(26, t3X - 15, tValveY);
|
||||
var v27 = CreateValve(27, t3X + 15, tValveY);
|
||||
var t3 = CreateTank(3, t3X, tanksY, 100000);
|
||||
var t3 = CreateTank(3, t3X, tanksY, 35000);
|
||||
CreatePipe(xv24, xv26);
|
||||
CreatePipe(xv25, xv27);
|
||||
CreatePipe(xv26, v26);
|
||||
@@ -220,7 +220,7 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
var xv31 = new PipeJoin(t4X + 15, ltg6Y);
|
||||
var v30 = CreateValve(30, t4X - 15, tValveY);
|
||||
var v31 = CreateValve(31, t4X + 15, tValveY);
|
||||
var t4 = CreateTank(4, t4X, tanksY, 100000);
|
||||
var t4 = CreateTank(4, t4X, tanksY, 35000);
|
||||
CreatePipe(v28, xv30);
|
||||
CreatePipe(v29, xv31);
|
||||
CreatePipe(xv30, v30);
|
||||
@@ -232,7 +232,7 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
var xv33 = new PipeJoin(t5X + 15, ltg6Y);
|
||||
var v32 = CreateValve(32, t5X - 15, tValveY);
|
||||
var v33 = CreateValve(33, t5X + 15, tValveY);
|
||||
var t5 = CreateTank(5, t5X, tanksY, 100000);
|
||||
var t5 = CreateTank(5, t5X, tanksY, 35000);
|
||||
CreatePipe(xv30, xv32);
|
||||
CreatePipe(xv31, xv33);
|
||||
CreatePipe(xv32, v32);
|
||||
@@ -249,7 +249,7 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
var xv37 = new PipeJoin(t6X - 15, ltg7Y);
|
||||
var v36 = CreateValve(36, t6X + 15, tValveY);
|
||||
var v37 = CreateValve(37, t6X - 15, tValveY);
|
||||
var t6 = CreateTank(6, t6X, tanksY, 100000);
|
||||
var t6 = CreateTank(6, t6X, tanksY, 35000);
|
||||
CreatePipe(v34, xv37);
|
||||
CreatePipe(v35, xv36);
|
||||
CreatePipe(xv37, v37);
|
||||
@@ -261,7 +261,7 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
var xv39 = new PipeJoin(t7X - 15, ltg7Y);
|
||||
var v38 = CreateValve(38, t7X + 15, tValveY);
|
||||
var v39 = CreateValve(39, t7X - 15, tValveY);
|
||||
var t7 = CreateTank(7, t7X, tanksY, 100000);
|
||||
var t7 = CreateTank(7, t7X, tanksY, 35000);
|
||||
CreatePipe(xv37, xv39);
|
||||
CreatePipe(xv36, xv38);
|
||||
CreatePipe(xv38, v38);
|
||||
@@ -273,7 +273,7 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
var xv41 = new PipeJoin(t8X - 15, ltg7Y);
|
||||
var v40 = CreateValve(40, t8X + 15, tValveY);
|
||||
var v41 = CreateValve(41, t8X - 15, tValveY);
|
||||
var t8 = CreateTank(8, t8X, tanksY, 100000);
|
||||
var t8 = CreateTank(8, t8X, tanksY, 35000);
|
||||
CreatePipe(xv38, xv40);
|
||||
CreatePipe(xv39, xv41);
|
||||
CreatePipe(xv40, v40);
|
||||
@@ -283,7 +283,7 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
|
||||
var v42 = CreateValve(42, t9X + 15, tValveY);
|
||||
var v43 = CreateValve(43, t9X - 15, tValveY);
|
||||
var t9 = CreateTank(9, t9X, tanksY, 100000);
|
||||
var t9 = CreateTank(9, t9X, tanksY, 35000);
|
||||
CreatePipe(xv40, v42);
|
||||
CreatePipe(xv41, v43);
|
||||
CreateInlet(v42, t9);
|
||||
@@ -339,8 +339,8 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
var v49 = CreateValve(49, t4X, tanksY + 220);
|
||||
CreatePipe(xv47, v49);
|
||||
|
||||
var press1 = new Press("Presse 1", pr1X, prY, 200000, () => App.Plant?.FillLevelPress1 ?? FillState.Unknown);
|
||||
var press2 = new Press("Presse 2", pr2X, prY, 150000, () => App.Plant?.FillLevelPress2 ?? FillState.Unknown);
|
||||
var press1 = new Press("Presse 1", pr1X, prY, 20000, () => App.Plant?.FillLevelPress1 ?? FillState.Unknown);
|
||||
var press2 = new Press("Presse 2", pr2X, prY, 15000, () => App.Plant?.FillLevelPress2 ?? FillState.Unknown);
|
||||
var v50 = CreateValve(50, pr1X - 45, prY - 100);
|
||||
var v51 = CreateValve(51, pr1X - 15, prY - 100);
|
||||
var v52 = CreateValve(52, pr1X + 15, prY - 100);
|
||||
|
||||
@@ -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