Add direct E1 material name signals
This commit is contained in:
1 parent
824b1caca7
commit
1b060377aa
6 files changed
+341
-30
No files matched your search
@@ -21,6 +21,7 @@ class DosingChannelSample:
|
||||
dosing_percentage: float
|
||||
screw_speed: float
|
||||
material_number: str | None = None
|
||||
material_name: str | None = None
|
||||
|
||||
|
||||
@dataclass(frozen=True, slots=True)
|
||||
@@ -55,9 +56,10 @@ def channel_rates(
|
||||
) -> tuple[ChannelRate, ...]:
|
||||
"""Derive rates and conservative material identity for one aligned timestamp.
|
||||
|
||||
A material value which occurs on more than one channel is deliberately not
|
||||
A material number which occurs on more than one channel is deliberately not
|
||||
attributed to either channel: PLC assignments are not reliable enough to
|
||||
resolve that ambiguity from a previous sample.
|
||||
resolve that ambiguity from a previous sample. Direct per-channel names are
|
||||
already assigned and may be shared by multiple channels.
|
||||
"""
|
||||
values = tuple(samples)
|
||||
validate_active_percentage_sum(values, tolerance=percentage_tolerance)
|
||||
@@ -71,7 +73,9 @@ def channel_rates(
|
||||
for value in values:
|
||||
if not isfinite(value.total_rate_kg_per_hour) or not isfinite(value.screw_speed):
|
||||
raise ValueError("total rate and screw speed must be finite")
|
||||
if value.material_number is None:
|
||||
if value.material_name is not None and value.material_name.strip():
|
||||
number, name, status = None, value.material_name, MATERIAL_ASSIGNED
|
||||
elif value.material_number is None:
|
||||
number, name, status = None, None, MATERIAL_UNAVAILABLE
|
||||
elif counts[value.material_number] > 1:
|
||||
number, name, status = None, None, MATERIAL_AMBIGUOUS
|
||||
|
||||
Reference in new issue
Block a user