fix(engine): stop coal_feeder before starting distributor on acc_time trigger
When accumulated_run_sec reaches acc_time_sec, the coal feeder must be stopped before entering DistributorRunning state. Previously the feeder was left running while the distributor also ran, which is incorrect per the control spec. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
3a8a2c1389
commit
0077a4ad90
|
|
@ -291,10 +291,31 @@ async fn tick_state_machine(
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check AccTime — trigger distributor
|
// Check AccTime — stop feeder then trigger distributor
|
||||||
if unit.acc_time_sec > 0
|
if unit.acc_time_sec > 0
|
||||||
&& runtime.accumulated_run_sec >= unit.acc_time_sec as i64 * 1000
|
&& runtime.accumulated_run_sec >= unit.acc_time_sec as i64 * 1000
|
||||||
{
|
{
|
||||||
|
let monitor = state
|
||||||
|
.connection_manager
|
||||||
|
.get_point_monitor_data_read_guard()
|
||||||
|
.await;
|
||||||
|
if let Some((pid, vt)) =
|
||||||
|
feeder_roles.and_then(|r| find_cmd(r, "stop_cmd", &monitor))
|
||||||
|
{
|
||||||
|
drop(monitor);
|
||||||
|
if let Err(e) =
|
||||||
|
send_pulse_command(&state.connection_manager, pid, vt.as_ref(), 300).await
|
||||||
|
{
|
||||||
|
tracing::warn!("Engine: stop coal_feeder before distributor failed: {}", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if state.config.simulate_plc {
|
||||||
|
if let Some(eq_id) = feeder_eq_id {
|
||||||
|
crate::control::command::simulate_run_feedback(state, eq_id, false)
|
||||||
|
.await;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
runtime.state = UnitRuntimeState::DistributorRunning;
|
runtime.state = UnitRuntimeState::DistributorRunning;
|
||||||
runtime.distributor_run_elapsed_sec = 0;
|
runtime.distributor_run_elapsed_sec = 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue