Bugfixes and remove CommitChanges()

This commit is contained in:
2026-08-04 16:39:09 +02:00
parent 7b95cf4221
commit 59707e427d
3 changed files with 45 additions and 28 deletions
+2 -4
View File
@@ -60,7 +60,7 @@ namespace PamhagenSysCtrl.Helpers {
Nodes.Add(rebler);
MW1 = new Trough("MW1", mw1X, mpY - 70, () => App.Plant?.FillLevelA1 ?? FillState.Unknown);
MW2 = new Trough("MW2", mw2X, mpY - 70, () => App.Plant?.FillLevelA1 ?? FillState.Unknown);
MW2 = new Trough("MW2", mw2X, mpY - 70, () => App.Plant?.FillLevelA2 ?? FillState.Unknown);
MP1 = new Pump("MP1", mw1X, mpY, () => App.Plant?.IsMP1Active ?? false, () => App.Plant?.MP1HasClearance ?? false, (x) => SelectedPaths.Any(p => p.Hops.Any(h => h.Node == x)));
MP2 = new Pump("MP2", mw2X, mpY, () => App.Plant?.IsMP2Active ?? false, () => App.Plant?.MP2HasClearance ?? false, (x) => SelectedPaths.Any(p => p.Hops.Any(h => h.Node == x)));
var x1 = new PipeJoin(mw1X, mpY + 40);
@@ -336,7 +336,7 @@ namespace PamhagenSysCtrl.Helpers {
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?.FillLevelPress1 ?? FillState.Unknown);
var press2 = new Press("Presse 2", pr2X, prY, 150000, () => 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);
@@ -414,7 +414,6 @@ namespace PamhagenSysCtrl.Helpers {
plant.OpenV(v.Nr);
}
}
plant.CommitChanges();
}
}
@@ -428,7 +427,6 @@ namespace PamhagenSysCtrl.Helpers {
plant.CloseV(v.Nr);
}
}
plant.CommitChanges();
}
}
+36 -7
View File
@@ -1,5 +1,4 @@
using PamhagenSysCtrl.Helpers.Pipeline;
using System.IO;
using System.IO;
using System.Windows;
namespace PamhagenSysCtrl.Helpers {
@@ -140,10 +139,6 @@ namespace PamhagenSysCtrl.Helpers {
}
}
public void CommitChanges() {
ActuatorsChanged = true;
}
protected bool HasWTClearanceAA =>
(AreValvesOpen(12) && AreValvesClosed(15, 16, 20)) || // bypass
(AreValvesOpen(15, 18, 16) && AreValvesClosed(11, 12, 14, 17, 19, 20)) || // WT1
@@ -372,76 +367,92 @@ namespace PamhagenSysCtrl.Helpers {
protected void SetV(int n, bool val) {
if (n < 1 || n > 57) throw new ArgumentException("Invalid value for n: 1 <= #V <= 57");
Actuators.SetV(n, val);
ActuatorsChanged = true;
}
public void SelectA1() {
Actuators.SetV(58, true);
//if (IsReblerActive) Actuators.StirrerA1 = true;
ActuatorsChanged = true;
}
public void SelectA2() {
Actuators.SetV(58, false);
//if (IsReblerActive) Actuators.StirrerA2 = true;
ActuatorsChanged = true;
}
public void StartTroughAuger() {
if (!IsReblerActive || !((IsA1Selected && FillLevelA1 != FillState.Full) || (IsA2Selected && FillLevelA2 != FillState.Full)))
throw new NoClearanceException("Schnecke Auffangwanne hat keine Freigabe");
Actuators.TroughAuger = true;
ActuatorsChanged = true;
}
public void StopTroughAuger() {
Actuators.TroughAuger = false;
ActuatorsChanged = true;
}
public void StartRebler() {
Actuators.Rebler = true;
ActuatorsChanged = true;
}
public void StopRebler() {
StopTroughAuger();
Actuators.Rebler = false;
ActuatorsChanged = true;
}
public void StartStirrerA1() {
Actuators.StirrerA1 = true;
ActuatorsChanged = true;
}
public void StopStirrerA1() {
Actuators.StirrerA1 = false;
ActuatorsChanged = true;
}
public void StartStirrerA2() {
Actuators.StirrerA2 = true;
ActuatorsChanged = true;
}
public void StopStirrerA2() {
Actuators.StirrerA2 = false;
ActuatorsChanged = true;
}
public void StartBelt() {
Actuators.Belt = true;
ActuatorsChanged = true;
}
public void StopBelt() {
Actuators.Belt = false;
ActuatorsChanged = true;
}
public void StartAuger1() {
Actuators.Auger1 = true;
ActuatorsChanged = true;
}
public void StopAuger1() {
Actuators.Auger1 = false;
ActuatorsChanged = true;
}
public void StartAuger2() {
Actuators.Auger2 = true;
ActuatorsChanged = true;
}
public void StopAuger2() {
Actuators.Auger2 = false;
ActuatorsChanged = true;
}
public void StartWasteDisposal() {
@@ -458,83 +469,101 @@ namespace PamhagenSysCtrl.Helpers {
public void StartGradationPump() {
Actuators.GradationPump = true;
ActuatorsChanged = true;
}
public void StopGradationPump() {
Actuators.GradationPump = false;
ActuatorsChanged = true;
}
public void StartMP1Forward() {
if (!MP1HasClearance) throw new NoClearanceException("MP1 hat keine Freigabe");
Actuators.MP1 = MotorState.Forward;
ActuatorsChanged = true;
}
public void StartMP1Backward() {
if (!MP1HasClearance) throw new NoClearanceException("MP1 hat keine Freigabe");
Actuators.MP1 = MotorState.Backward;
ActuatorsChanged = true;
}
public void StopMP1() {
Actuators.MP1 = MotorState.Halt;
ActuatorsChanged = true;
}
public void StartMP2Forward() {
if (!MP2HasClearance) throw new NoClearanceException("MP2 hat keine Freigabe");
Actuators.MP2 = MotorState.Forward;
ActuatorsChanged = true;
}
public void StartMP2Backward() {
if (!MP2HasClearance) throw new NoClearanceException("MP2 hat keine Freigabe");
Actuators.MP2 = MotorState.Backward;
ActuatorsChanged = true;
}
public void StopMP2() {
Actuators.MP2 = MotorState.Halt;
ActuatorsChanged = true;
}
public void StartP12() {
if (!P12HasClearance) throw new NoClearanceException("P1/2 hat keine Freigabe");
Actuators.P12 = MotorState.Forward;
ActuatorsChanged = true;
}
public void StopP12() {
Actuators.P12 = MotorState.Halt;
ActuatorsChanged = true;
}
public void StartP3() {
if (!P3HasClearance) throw new NoClearanceException("P3 hat keine Freigabe");
Actuators.P3 = MotorState.Forward;
ActuatorsChanged = true;
}
public void StopP3() {
Actuators.P3 = MotorState.Halt;
ActuatorsChanged = true;
}
public void StartP4() {
if (!P4HasClearance) throw new NoClearanceException("P4 hat keine Freigabe");
Actuators.P4 = MotorState.Forward;
ActuatorsChanged = true;
}
public void StopP4() {
Actuators.P4 = MotorState.Halt;
ActuatorsChanged = true;
}
public void StartP5() {
if (!P5HasClearance) throw new NoClearanceException("P5 hat keine Freigabe");
Actuators.P5 = MotorState.Forward;
ActuatorsChanged = true;
}
public void StopP5() {
Actuators.P5 = MotorState.Halt;
ActuatorsChanged = true;
}
public void StartP6() {
if (!P6HasClearance) throw new NoClearanceException("P6 hat keine Freigabe");
Actuators.P6 = MotorState.Forward;
ActuatorsChanged = true;
}
public void StopP6() {
Actuators.P6 = MotorState.Halt;
ActuatorsChanged = true;
}
}
}