Use rotational discharge for Bento consumption
This commit is contained in:
@@ -51,23 +51,30 @@ class MaterialPollingService:
|
||||
state_store: MaterialStateStore,
|
||||
machine_id: str,
|
||||
rate_variable_id: str,
|
||||
gate_variable_id: str,
|
||||
gate_variable_id: str | None,
|
||||
gate_threshold: float,
|
||||
max_sample_gap_seconds: float,
|
||||
application_variable_ids: tuple[str, ...] = (),
|
||||
rotational_speed_variable_ids: tuple[str, ...] = (),
|
||||
specific_discharge_kg_per_rev_m: float | None = None,
|
||||
nominal_width_provider: Callable[[str], float] | None = None,
|
||||
) -> None:
|
||||
if application_variable_ids and rotational_speed_variable_ids:
|
||||
raise ValueError("Material source modes are mutually exclusive")
|
||||
self._rotational_speed_variable_ids = rotational_speed_variable_ids
|
||||
self._specific_discharge = specific_discharge_kg_per_rev_m
|
||||
self._application_variable_ids = application_variable_ids
|
||||
self._nominal_width_provider = nominal_width_provider
|
||||
if application_variable_ids and nominal_width_provider is None:
|
||||
raise ValueError("area application requires a nominal width provider")
|
||||
if ((application_variable_ids or rotational_speed_variable_ids)
|
||||
and nominal_width_provider is None):
|
||||
raise ValueError("width-based source requires a nominal width provider")
|
||||
self._gateway = gateway
|
||||
self._state_store = state_store
|
||||
self._machine_id = machine_id
|
||||
self._rate_variable_id = rate_variable_id
|
||||
self._gate_variable_id = gate_variable_id
|
||||
self._config = MaterialIntegratorConfig(
|
||||
gate_threshold=gate_threshold,
|
||||
gate_threshold=gate_threshold if gate_variable_id is not None else 0.0,
|
||||
max_sample_gap_seconds=max_sample_gap_seconds,
|
||||
)
|
||||
|
||||
@@ -79,7 +86,7 @@ class MaterialPollingService:
|
||||
return None
|
||||
|
||||
width = (self._nominal_width_provider(run.production_order)
|
||||
if self._application_variable_ids else None)
|
||||
if self._application_variable_ids or self._rotational_speed_variable_ids else None)
|
||||
saved_polling_state = self._state_store.load(
|
||||
self._machine_id,
|
||||
run.production_order,
|
||||
@@ -151,6 +158,11 @@ class MaterialPollingService:
|
||||
source_options = dict(
|
||||
application_variable_ids=self._application_variable_ids, nominal_width_m=width,
|
||||
)
|
||||
if self._rotational_speed_variable_ids:
|
||||
source_options = dict(
|
||||
rotational_speed_variable_ids=self._rotational_speed_variable_ids,
|
||||
specific_discharge_kg_per_rev_m=self._specific_discharge, nominal_width_m=width,
|
||||
)
|
||||
samples = self._gateway.get_material_samples(
|
||||
machine_id=self._machine_id,
|
||||
rate_variable_id=self._rate_variable_id,
|
||||
|
||||
Reference in New Issue
Block a user