Compare commits
5
Commits
f2a3ad3423
...
dev
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a0219dc308 | ||
|
|
3c307da0ca | ||
|
|
d303f0767a | ||
|
|
a18f253fe4 | ||
|
|
7542b70595 |
@@ -512,6 +512,7 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
HashSet<IEdge> visited = [];
|
||||
foreach (var (edge, node) in path.Hops) {
|
||||
edge.Highlight = color1;
|
||||
(edge.Start as PipeJoin)?.Highlight = color1;
|
||||
if (flowArrows > MotorState.Halt) {
|
||||
var dir = edge.End == node;
|
||||
if (flowArrows == MotorState.Backward) dir = !dir;
|
||||
@@ -520,7 +521,10 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
}
|
||||
visited.Add(edge);
|
||||
if (node is Pump) color = color2;
|
||||
TraverseSubgraph(node, (n) => n is Valve || n is ISink || n is Pump, visited, edgeAction: (s, r, e) => e.Highlight = color);
|
||||
TraverseSubgraph(node, (n) => n is Valve || n is ISink || n is Pump, visited, edgeAction: (s, r, e) => {
|
||||
(s as PipeJoin)?.Highlight = color;
|
||||
e.Highlight = color;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -530,6 +534,8 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
edgeAction: (s, r, e) => {
|
||||
if (((e.Start as Valve)?.IsOpen ?? true) && ((e.End as Valve)?.IsOpen ?? true)) {
|
||||
e.Highlight = color1;
|
||||
(e.Start as PipeJoin)?.Highlight = color1;
|
||||
(e.End as PipeJoin)?.Highlight = color1;
|
||||
if (flowArrows == MotorState.Forward || flowArrows == MotorState.Backward) {
|
||||
var dir = e.Start == s;
|
||||
if (r) dir = !dir;
|
||||
|
||||
@@ -21,6 +21,11 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
FillState.Unknown, FillState.Unknown, FillState.Unknown, FillState.Unknown, FillState.Unknown, FillState.Unknown, FillState.Unknown, FillState.Unknown, FillState.Unknown
|
||||
], default);
|
||||
|
||||
public string? PlcPortName => Plc?.PortName;
|
||||
public T1.Status? LastPlcStatus => Plc?.LastPlcStatus;
|
||||
public T1Error? LastPlcError => Plc?.LastPlcError;
|
||||
public long? LastRttNs { get; private set; }
|
||||
|
||||
public bool IsValveOpen(int n) => !IsValveClosed(n);
|
||||
public bool IsValveClosed(int n) => Sensors.GetDS(n);
|
||||
public bool WantValveClosed(int n) => !WantValveOpen(n);
|
||||
@@ -133,14 +138,17 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
|
||||
protected async void BackgroundLoop(object? parameters) {
|
||||
while (IsRunning && Plc != null) {
|
||||
var start = DateTime.Now;
|
||||
try {
|
||||
if (ActuatorsChanged) {
|
||||
await Plc.WriteOutputs(Actuators);
|
||||
ActuatorsChanged = false;
|
||||
}
|
||||
Sensors = await Plc.ReadInputs();
|
||||
LastRttNs = (long)(DateTime.Now - start).TotalNanoseconds;
|
||||
RaiseUpdateEvent(new());
|
||||
} catch (Exception exc) {
|
||||
LastRttNs = null;
|
||||
var str = "Bei der SPS ist ein Fehler aufgetreten:\n\n" + exc.Message;
|
||||
if (exc.InnerException != null) str += "\n\n" + exc.InnerException.Message;
|
||||
MessageBox.Show(str, "SPS-Fehler", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
|
||||
@@ -34,6 +34,10 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
|
||||
protected readonly T1 Plc;
|
||||
|
||||
public string PortName => Plc.PortName;
|
||||
public T1.Status LastPlcStatus => Plc.LastStatus;
|
||||
public T1Error LastPlcError => Plc.LastError;
|
||||
|
||||
public PamhagenPlc(string portName, Parity parity = Parity.Odd) {
|
||||
Plc = new T1(portName, parity);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
public class PipeJoin : INode {
|
||||
@@ -12,11 +11,12 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
public double CenterX { get; set; }
|
||||
public double CenterY { get; set; }
|
||||
public string Label => "";
|
||||
public Brush? Highlight { get; set; }
|
||||
|
||||
public ISet<IEdge> Inputs { get; init; }
|
||||
public ISet<IEdge> Outputs { get; init; }
|
||||
|
||||
private Polygon? _rect;
|
||||
private System.Windows.Shapes.Path? _rect;
|
||||
|
||||
public PipeJoin(double x, double y) {
|
||||
CenterX = x;
|
||||
@@ -26,8 +26,8 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
}
|
||||
|
||||
public void Draw(Canvas canvas) {
|
||||
_rect = new Polygon() {
|
||||
Fill = Brushes.Black,
|
||||
_rect = new System.Windows.Shapes.Path() {
|
||||
Fill = Brushes.DarkGray,
|
||||
Stroke = Brushes.Black,
|
||||
};
|
||||
canvas.Children.Add(_rect);
|
||||
@@ -43,43 +43,66 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
var il = Inputs.Any(e => (e.Start.CenterX < CenterX && (e.Orientation || e.Start.CenterY == CenterY)) || (e.IsTwoWay && e.End.CenterX < CenterX && (e.Orientation || e.End.CenterY == CenterY)));
|
||||
var ol = Outputs.Any(e => (e.End.CenterX < CenterX && (!e.Orientation || e.End.CenterY == CenterY)) || (e.IsTwoWay && e.Start.CenterX < CenterX && (!e.Orientation || e.Start.CenterY == CenterY)));
|
||||
|
||||
var points = new List<Point> {
|
||||
new(0, 0)
|
||||
};
|
||||
if (ot && it) {
|
||||
points.AddRange([new(SIZE / 2 - POINT, 0), new(SIZE / 2, -POINT / 2), new(SIZE / 2, POINT / 2), new(SIZE / 2 + POINT, 0)]);
|
||||
} else if (ot) {
|
||||
points.AddRange([new(SIZE / 2 - POINT, 0), new(SIZE / 2, -POINT), new(SIZE / 2 + POINT, 0)]);
|
||||
} else if (it) {
|
||||
points.AddRange([new(SIZE / 2 - POINT, 0), new(SIZE / 2, POINT), new(SIZE / 2 + POINT, 0)]);
|
||||
}
|
||||
points.Add(new(SIZE, 0));
|
||||
if (or && ir) {
|
||||
points.AddRange([new(SIZE, SIZE / 2 - POINT), new(SIZE + POINT / 2, SIZE / 2), new(SIZE - POINT / 2, SIZE / 2), new(SIZE, SIZE / 2 + POINT)]);
|
||||
} else if (or) {
|
||||
points.AddRange([new(SIZE, SIZE / 2 - POINT), new(SIZE + POINT, SIZE / 2), new(SIZE, SIZE / 2 + POINT)]);
|
||||
} else if (ir) {
|
||||
points.AddRange([new(SIZE, SIZE / 2 - POINT), new(SIZE - POINT, SIZE / 2), new(SIZE, SIZE / 2 + POINT)]);
|
||||
}
|
||||
points.Add(new(SIZE, SIZE));
|
||||
if (ob && ib) {
|
||||
points.AddRange([new(SIZE / 2 + POINT, SIZE), new(SIZE / 2, SIZE + POINT / 2), new(SIZE / 2, SIZE - POINT / 2), new(SIZE / 2 - POINT, SIZE)]);
|
||||
} else if (ob) {
|
||||
points.AddRange([new(SIZE / 2 + POINT, SIZE), new(SIZE / 2, SIZE + POINT), new(SIZE / 2 - POINT, SIZE)]);
|
||||
} else if (ib) {
|
||||
points.AddRange([new(SIZE / 2 + POINT, SIZE), new(SIZE / 2, SIZE - POINT), new(SIZE / 2 - POINT, SIZE)]);
|
||||
}
|
||||
points.Add(new(0, SIZE));
|
||||
if (ol && il) {
|
||||
points.AddRange([new(0, SIZE / 2 + POINT), new(-POINT / 2, SIZE / 2), new(POINT / 2, SIZE / 2), new(0, SIZE / 2 - POINT)]);
|
||||
} else if (ol) {
|
||||
points.AddRange([new(0, SIZE / 2 + POINT), new(-POINT, SIZE / 2), new(0, SIZE / 2 - POINT)]);
|
||||
} else if (il) {
|
||||
points.AddRange([new(0, SIZE / 2 + POINT), new(POINT, SIZE / 2), new(0, SIZE / 2 - POINT)]);
|
||||
var size = new Size(SIZE / 2 * scale, SIZE / 2 * scale);
|
||||
var geo = new StreamGeometry();
|
||||
using (var ctx = geo.Open()) {
|
||||
var points = new List<Point> {
|
||||
new(0, 0)
|
||||
};
|
||||
|
||||
ctx.BeginFigure(new((SIZE / 2 - POINT) * scale, 0), true, false);
|
||||
if (ot && it) {
|
||||
points.AddRange([new(SIZE / 2, -POINT / 2), new(SIZE / 2, POINT / 2), new(SIZE / 2 + POINT, 0)]);
|
||||
} else if (ot) {
|
||||
ctx.PolyLineTo([new(SIZE / 2 * scale, -POINT * scale), new((SIZE / 2 + POINT) * scale, 0)], true, false);
|
||||
} else if (it) {
|
||||
ctx.PolyLineTo([new(SIZE / 2 * scale, POINT * scale), new((SIZE / 2 + POINT) * scale, 0)], true, false);
|
||||
} else {
|
||||
ctx.ArcTo(new((SIZE / 2 + POINT) * scale, 0), size, 0, false, SweepDirection.Clockwise, true, false);
|
||||
}
|
||||
|
||||
ctx.ArcTo(new(SIZE * scale, (SIZE / 2 - POINT) * scale), size, 0, false, SweepDirection.Clockwise, true, false);
|
||||
points.Add(new(SIZE, 0));
|
||||
if (or && ir) {
|
||||
points.AddRange([new(SIZE, SIZE / 2 - POINT), new(SIZE + POINT / 2, SIZE / 2), new(SIZE - POINT / 2, SIZE / 2), new(SIZE, SIZE / 2 + POINT)]);
|
||||
} else if (or) {
|
||||
ctx.PolyLineTo([new((SIZE + POINT) * scale, SIZE / 2 * scale), new(SIZE * scale, (SIZE / 2 + POINT) * scale)], true, false);
|
||||
} else if (ir) {
|
||||
ctx.PolyLineTo([new((SIZE - POINT) * scale, SIZE / 2 * scale), new(SIZE * scale, (SIZE / 2 + POINT) * scale)], true, false);
|
||||
} else {
|
||||
ctx.ArcTo(new(SIZE * scale, (SIZE / 2 + POINT) * scale), size, 0, false, SweepDirection.Clockwise, true, false);
|
||||
}
|
||||
|
||||
ctx.ArcTo(new((SIZE / 2 + POINT) * scale, SIZE * scale), size, 0, false, SweepDirection.Clockwise, true, false);
|
||||
points.Add(new(SIZE, SIZE));
|
||||
if (ob && ib) {
|
||||
points.AddRange([new(SIZE / 2 + POINT, SIZE), new(SIZE / 2, SIZE + POINT / 2), new(SIZE / 2, SIZE - POINT / 2), new(SIZE / 2 - POINT, SIZE)]);
|
||||
} else if (ob) {
|
||||
ctx.PolyLineTo([new(SIZE / 2 * scale, (SIZE + POINT) * scale), new((SIZE / 2 - POINT) * scale, SIZE * scale)], true, false);
|
||||
} else if (ib) {
|
||||
ctx.PolyLineTo([new(SIZE / 2 * scale, (SIZE - POINT) * scale), new((SIZE / 2 - POINT) * scale, SIZE * scale)], true, false);
|
||||
} else {
|
||||
ctx.ArcTo(new((SIZE / 2 - POINT) * scale, SIZE * scale), size, 0, false, SweepDirection.Clockwise, true, false);
|
||||
}
|
||||
|
||||
ctx.ArcTo(new(0, (SIZE / 2 + POINT) * scale), size, 0, false, SweepDirection.Clockwise, true, false);
|
||||
points.Add(new(0, SIZE));
|
||||
if (ol && il) {
|
||||
points.AddRange([new(0, SIZE / 2 + POINT), new(-POINT / 2, SIZE / 2), new(POINT / 2, SIZE / 2), new(0, SIZE / 2 - POINT)]);
|
||||
} else if (ol) {
|
||||
ctx.PolyLineTo([new(-POINT * scale, SIZE / 2 * scale), new(0, (SIZE / 2 - POINT) * scale)], true, false);
|
||||
} else if (il) {
|
||||
ctx.PolyLineTo([new(POINT * scale, SIZE / 2 * scale), new(0, (SIZE / 2 - POINT) * scale)], true, false);
|
||||
} else {
|
||||
ctx.ArcTo(new(0, (SIZE / 2 - POINT) * scale), size, 0, false, SweepDirection.Clockwise, true, false);
|
||||
}
|
||||
|
||||
ctx.ArcTo(new((SIZE / 2 - POINT) * scale, 0), size, 0, false, SweepDirection.Clockwise, true, false);
|
||||
}
|
||||
|
||||
_rect?.Points = [.. points.Select(p => new Point(p.X * scale, p.Y * scale))];
|
||||
_rect?.StrokeThickness = 2;
|
||||
_rect?.Data = geo;
|
||||
// [.. points.Select(p => new Point(p.X * scale, p.Y * scale))];
|
||||
_rect?.StrokeThickness = Graph.ToBorder(scale);
|
||||
_rect?.SetValue(Canvas.LeftProperty, (CenterX - SIZE / 2) * scale);
|
||||
_rect?.SetValue(Canvas.TopProperty, (CenterY - SIZE / 2) * scale);
|
||||
}
|
||||
@@ -89,7 +112,7 @@ namespace PamhagenSysCtrl.Helpers.Pipeline {
|
||||
}
|
||||
|
||||
public void Update(bool isHovering, bool isPressed) {
|
||||
_rect?.Stroke = isHovering ? Brushes.Black : Brushes.Black;
|
||||
_rect?.Fill = Highlight ?? Brushes.DarkGray;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,12 +10,16 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
|
||||
protected SerialPort Serial;
|
||||
|
||||
public string PortName => Serial.PortName;
|
||||
public Status LastStatus { get; private set; }
|
||||
public T1Error LastError { get; private set; }
|
||||
|
||||
public T1(string portName, Parity parity = Parity.Odd) {
|
||||
Serial = new SerialPort(portName, 9600, parity, 8, StopBits.One) {
|
||||
Handshake = Handshake.None,
|
||||
NewLine = "\r",
|
||||
ReadTimeout = 1000,
|
||||
WriteTimeout = 1000,
|
||||
ReadTimeout = 500,
|
||||
WriteTimeout = 500,
|
||||
DtrEnable = true,
|
||||
RtsEnable = true,
|
||||
Encoding = Encoding.ASCII,
|
||||
@@ -97,14 +101,16 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
public async Task<Status> StatusRead() {
|
||||
await SendCommand("ST", checksum: false);
|
||||
var (_, res) = await ReceiveResponse("ST");
|
||||
return new Status((Mode)(res[3] - '0'), ((res[0] - '0') << 4) | (res[1] - '0'));
|
||||
LastStatus = new Status((Mode)(res[3] - '0'), ((res[0] - '0') << 4) | (res[1] - '0'));
|
||||
return LastStatus;
|
||||
}
|
||||
|
||||
public async Task<T1Error> ErrorStatusRead() {
|
||||
await SendCommand("ER", checksum: false);
|
||||
var (_, res) = await ReceiveResponse("ER");
|
||||
var code = Convert.ToInt32(res, 10);
|
||||
return Enum.IsDefined(typeof(T1Error), code) ? (T1Error)code : T1Error.UNKNOWN_ERROR;
|
||||
LastError = Enum.IsDefined(typeof(T1Error), code) ? (T1Error)code : T1Error.UNKNOWN_ERROR;
|
||||
return LastError;
|
||||
}
|
||||
|
||||
public Task<ushort[]> DataRead(string register, int length) {
|
||||
|
||||
@@ -53,11 +53,47 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
}
|
||||
public static string GetName(this T1Error error) {
|
||||
return error switch {
|
||||
T1Error.UNKNOWN_ERROR => "Unknown error",
|
||||
T1Error.NO_ERROR => "No error",
|
||||
T1Error.SYSTEM_POWER_ON => "System power on",
|
||||
T1Error.SYSTEM_POWER_OFF => "System power off",
|
||||
// TODO
|
||||
_ => "Unknown error",
|
||||
T1Error.RAM_CHECK_ERROR => "RAM check error",
|
||||
T1Error.PROGRAM_BCC_ERROR => "Program BCC error",
|
||||
T1Error.BATTERY_VOLTAGE_DROP => "Battery voltage drop",
|
||||
T1Error.EEPROM_BCC_ERROR => "EEPROM BCC error",
|
||||
T1Error.EEPROM_WARNING => "EEPROM warning",
|
||||
T1Error.SYSTEM_RAM_CHECK_ERROR => "System RAM check error",
|
||||
T1Error.SYSTEM_ROM_BCC_ERROR => "System ROM BCC error",
|
||||
T1Error.PERIPHERAL_LSI_ERROR => "Peripheral LSI error",
|
||||
T1Error.CLOCK_CALENDAR_CHECK_ERROR => "Clock-calendar check error",
|
||||
T1Error.ILLEGAL_SYSTEM_INTERRUPT => "Illegal system interrupt",
|
||||
T1Error.WD_TIMER_ERROR => "WD timer error",
|
||||
T1Error.IO_BUS_ERROR => "I/O bus error",
|
||||
T1Error.IO_MISMATCH => "I/O mismatch",
|
||||
T1Error.IO_NO_ANSWER => "I/O no answer",
|
||||
T1Error.IO_PARITY_ERROR => "I/O parity error",
|
||||
T1Error.ILLEGAL_IO_REGISTER => "Illegal I/O register",
|
||||
T1Error.COMMUNICATION_BUSY => "Communication busy",
|
||||
T1Error.FORMAT_ERROR => "Format error",
|
||||
T1Error.SCAN_TIME_OVER => "Scan time over",
|
||||
T1Error.NO_END_IRET_ERROR => "No END/IRET error",
|
||||
T1Error.PAIR_INSTRUCTION_ERROR => "Pair instruction error",
|
||||
T1Error.OPERAND_ERROR => "Operand error",
|
||||
T1Error.INVALID_PROGRAM => "Invalid program",
|
||||
T1Error.NO_SUBROUTINE_ENTRY => "No subroutine entry",
|
||||
T1Error.NO_RET_ERROR => "No RET error",
|
||||
T1Error.SUBROUTINE_NESTING_ERROR => "Subroutine nesting error",
|
||||
T1Error.LOOP_NESTING_ERROR => "Loop nesting error",
|
||||
T1Error.INVALID_FUNCTION_INSTRUCTION => "Invalid function instruction",
|
||||
T1Error.PASSWORD_PROTECT => "Password protect",
|
||||
T1Error.ILLEGAL_INSTRUCTION => "Illegal instruction",
|
||||
T1Error.REGISTER_ADDRESS_ERROR => "Register address error",
|
||||
T1Error.BOUNDARY_ERROR => "Boundary error",
|
||||
T1Error.MEMORY_FULL => "Memory full",
|
||||
T1Error.MODE_MISMATCH => "Mode mismatch",
|
||||
T1Error.REGISTER_ADDRESS_SIZE_ERROR => "Register address/size error",
|
||||
T1Error.DUPLICATE_ENTRY_NR => "Duplicate entry No.",
|
||||
_ => error.ToString(),
|
||||
};
|
||||
}
|
||||
public static string? GetDescription(this T1Error error) {
|
||||
@@ -65,7 +101,42 @@ namespace PamhagenSysCtrl.Helpers {
|
||||
T1Error.NO_ERROR => "No error recorded",
|
||||
T1Error.SYSTEM_POWER_ON => "Power on (no error)",
|
||||
T1Error.SYSTEM_POWER_OFF => "Power off (no error)",
|
||||
// TODO
|
||||
T1Error.RAM_CHECK_ERROR => "RAM read/write error has been detected",
|
||||
T1Error.PROGRAM_BCC_ERROR => "Program BCC (memory check code) error has been detected",
|
||||
T1Error.BATTERY_VOLTAGE_DROP => "Data invalidity of RAM (back-up area) has been detected",
|
||||
T1Error.EEPROM_BCC_ERROR => "BCC error of built-in EEPROM has been detected",
|
||||
T1Error.EEPROM_WARNING => "EEPROM write operation has exceeded 100,000 times",
|
||||
T1Error.SYSTEM_RAM_CHECK_ERROR => "System RAM read/write error has been detected",
|
||||
T1Error.SYSTEM_ROM_BCC_ERROR => "BCC error of system ROM has been detected",
|
||||
T1Error.PERIPHERAL_LSI_ERROR => "CPU hardware error has been detected",
|
||||
T1Error.CLOCK_CALENDAR_CHECK_ERROR => "Invalid clock-calendar data has been detected",
|
||||
T1Error.ILLEGAL_SYSTEM_INTERRUPT => "Unregistered interrupt has occurred",
|
||||
T1Error.WD_TIMER_ERROR => "Watchdog timer error has occurred",
|
||||
T1Error.IO_BUS_ERROR => "I/O bus error has been detected",
|
||||
T1Error.IO_MISMATCH => "Registered I/O allocation table and actual I/O configuration are not identical",
|
||||
T1Error.IO_NO_ANSWER => "No response from I/O module has been received",
|
||||
T1Error.IO_PARITY_ERROR => "I/O bus parity error has been detected",
|
||||
T1Error.ILLEGAL_IO_REGISTER => "Excess I/O register allocation has been detected",
|
||||
T1Error.COMMUNICATION_BUSY => "The T1/T1S is busy in processing for other peripheral communications",
|
||||
T1Error.FORMAT_ERROR => "Received request is invalid (detected by the T1/T1S)",
|
||||
T1Error.SCAN_TIME_OVER => "Scan time has exceeded 200 ms",
|
||||
T1Error.NO_END_IRET_ERROR => "END or IRET instruction has not been programmed",
|
||||
T1Error.PAIR_INSTRUCTION_ERROR => "Illegal combination of pair instructions has been programmed",
|
||||
T1Error.OPERAND_ERROR => "Illegal operand has been detected",
|
||||
T1Error.INVALID_PROGRAM => "Program abnormality has been detected",
|
||||
T1Error.NO_SUBROUTINE_ENTRY => "Subroutine corresponding to CALL instruction has not been programmed",
|
||||
T1Error.NO_RET_ERROR => "RET (subroutine return) instruction has not been in a subroutine",
|
||||
T1Error.SUBROUTINE_NESTING_ERROR => "CALL instruction has been programmed in a subroutine (subroutine nesting)",
|
||||
T1Error.LOOP_NESTING_ERROR => "Nesting of FOR-NEXT loop has been programmed",
|
||||
T1Error.INVALID_FUNCTION_INSTRUCTION => "Function instruction which is not supported by T1/T1S has been programmed",
|
||||
T1Error.PASSWORD_PROTECT => "Requested operation is protected by password",
|
||||
T1Error.ILLEGAL_INSTRUCTION => "Illegal instruction has been detected",
|
||||
T1Error.REGISTER_ADDRESS_ERROR => "Excess register address range has been programmed",
|
||||
T1Error.BOUNDARY_ERROR => "Illegal register address is designated by index modification",
|
||||
T1Error.MEMORY_FULL => "Program memory is insufficient for the requested command",
|
||||
T1Error.MODE_MISMATCH => "Received command is invalid in the current T1/T1S operation mode",
|
||||
T1Error.REGISTER_ADDRESS_SIZE_ERROR => "Specified register range exceeds the limit",
|
||||
T1Error.DUPLICATE_ENTRY_NR => "Multiple subroutines which has same subroutine number have been programmed",
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -175,19 +175,18 @@
|
||||
<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 x:Name="FastSelectButton_EntryTrough_Start_Run" FontSize="18">Schnecke Start</Run></TextBlock>
|
||||
</Button>
|
||||
<Button x:Name="FastSelectButton_EntryTrough_Stop" Grid.Column="2" Grid.Row="0" Grid.ColumnSpan="2"
|
||||
<Button x:Name="FastSelectButton_EntryTrough_Stop" Grid.Column="0" 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 x:Name="FastSelectButton_EntryTrough_Stop_Run" FontSize="18">Schnecke Stop</Run></TextBlock>
|
||||
</Button>
|
||||
|
||||
<Button x:Name="FastSelectButton_EntryTrough_Start" Grid.Column="2" 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 x:Name="FastSelectButton_EntryTrough_Start_Run" FontSize="18">Schnecke Start</Run></TextBlock>
|
||||
</Button>
|
||||
|
||||
<Button x:Name="FastSelectButton_MW2" Grid.Column="0" Grid.Row="2"
|
||||
Content="MW2 ⮜" FontSize="16" FontWeight="Bold"
|
||||
@@ -198,37 +197,74 @@
|
||||
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 x:Name="FastSelectButton_MP2_Stop_Run" FontSize="24">MP2</Run><LineBreak/>Stop</TextBlock>
|
||||
</Button>
|
||||
<Button x:Name="FastSelectButton_MP2_Forward" Grid.Column="0" Grid.Row="5"
|
||||
<Button x:Name="FastSelectButton_MP2_Forward" Grid.Column="0" Grid.Row="4"
|
||||
FontSize="16" FontWeight="Bold"
|
||||
Click="FastSelectButton_MP2_Forward_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||
BorderThickness="2">
|
||||
<TextBlock TextAlignment="Center"><Run x:Name="FastSelectButton_MP2_Forward_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"
|
||||
<Button x:Name="FastSelectButton_MP2_Stop" Grid.Column="0" Grid.Row="5"
|
||||
FontSize="16" FontWeight="Bold"
|
||||
Click="FastSelectButton_MP1_Stop_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||
Click="FastSelectButton_MP2_Stop_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||
BorderThickness="2">
|
||||
<TextBlock TextAlignment="Center"><Run x:Name="FastSelectButton_MP1_Stop_Run" FontSize="24">MP1</Run><LineBreak/>Stop</TextBlock>
|
||||
<TextBlock TextAlignment="Center"><Run x:Name="FastSelectButton_MP2_Stop_Run" FontSize="24">MP2</Run><LineBreak/>Stop</TextBlock>
|
||||
</Button>
|
||||
<Button x:Name="FastSelectButton_MP1_Forward" Grid.Column="3" Grid.Row="5"
|
||||
|
||||
<Button x:Name="FastSelectButton_MP1_Forward" Grid.Column="3" Grid.Row="4"
|
||||
FontSize="16" FontWeight="Bold"
|
||||
Click="FastSelectButton_MP1_Forward_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||
BorderThickness="2">
|
||||
<TextBlock TextAlignment="Center"><Run x:Name="FastSelectButton_MP1_Forward_Run" FontSize="24">MP1</Run><LineBreak/><Run x:Name="MP1_Target">Vor</Run></TextBlock>
|
||||
</Button>
|
||||
<Button x:Name="FastSelectButton_MP1_Stop" Grid.Column="3" Grid.Row="5"
|
||||
FontSize="16" FontWeight="Bold"
|
||||
Click="FastSelectButton_MP1_Stop_Click" MouseEnter="FastSelectButton_Enter" MouseLeave="FastSelectButton_Leave"
|
||||
BorderThickness="2">
|
||||
<TextBlock TextAlignment="Center"><Run x:Name="FastSelectButton_MP1_Stop_Run" FontSize="24">MP1</Run><LineBreak/>Stop</TextBlock>
|
||||
</Button>
|
||||
</Grid>
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
<StatusBar Grid.Row="2" BorderThickness="0,1,0,0" BorderBrush="Gray">
|
||||
|
||||
<StatusBar.ItemsPanel>
|
||||
<ItemsPanelTemplate>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="3*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="Auto"/>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
</Grid>
|
||||
</ItemsPanelTemplate>
|
||||
</StatusBar.ItemsPanel>
|
||||
<StatusBarItem>
|
||||
<TextBlock>
|
||||
SPS-Verbindung: <Run x:Name="Status_Connection" Text="-"/>
|
||||
</TextBlock>
|
||||
</StatusBarItem>
|
||||
<Separator Grid.Column="1"/>
|
||||
<StatusBarItem Grid.Column="2">
|
||||
<TextBlock>
|
||||
SPS-Status: <Run x:Name="Status_Plc" Text="-"/>
|
||||
</TextBlock>
|
||||
</StatusBarItem>
|
||||
<Separator Grid.Column="3"/>
|
||||
<StatusBarItem Grid.Column="4">
|
||||
<TextBlock>
|
||||
Druckluft: <Run x:Name="Status_CompressedAir" Text="-"/>
|
||||
</TextBlock>
|
||||
</StatusBarItem>
|
||||
<Separator Grid.Column="5"/>
|
||||
<StatusBarItem Grid.Column="6">
|
||||
<TextBlock>
|
||||
Ventile offen: <Run x:Name="Status_ValvesOpen" Text="-"/>
|
||||
</TextBlock>
|
||||
</StatusBarItem>
|
||||
</StatusBar>
|
||||
</Grid>
|
||||
</Window>
|
||||
|
||||
@@ -502,6 +502,8 @@ namespace PamhagenSysCtrl.Windows {
|
||||
foreach (var n in Graph.Nodes) {
|
||||
if (n is Pump p) {
|
||||
p.Highlight = null;
|
||||
} else if (n is PipeJoin j) {
|
||||
j.Highlight = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -593,7 +595,12 @@ namespace PamhagenSysCtrl.Windows {
|
||||
}
|
||||
|
||||
public void OnUpdate(object? sender, PlantEventArgs? evt) {
|
||||
if (sender is not PamhagenPlant plant) return;
|
||||
if (App.Plant is PamhagenPlant p) {
|
||||
Status_Connection.Text = $"Ja ({p.PlcPortName}" + (p.LastRttNs != null ? $", {p.LastRttNs / 1000000.0:N0} ms" : "") + ")";
|
||||
Status_Plc.Text = $"{p.LastPlcStatus?.Mode} ({p.LastPlcStatus?.Flags:X3}) / {p.LastPlcError?.GetName()} ({(int?)p.LastPlcError:0000})";
|
||||
Status_CompressedAir.Text = Enumerable.Range(1, 57).Any(p.IsValveClosed) ? "Ein" : Enumerable.Range(1, 57).Any(p.WantValveClosed) ? "Aus" : "?";
|
||||
Status_ValvesOpen.Text = Enumerable.Range(1, 57).Count(p.IsValveOpen) + " / " + Enumerable.Range(1, 57).Count(p.WantValveOpen) + " / 57";
|
||||
}
|
||||
UpdateScheme(Mouse.GetPosition(SchemeCanvas), Mouse.LeftButton == MouseButtonState.Pressed);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user