From b6d9f147f3f883916b4621a75f9aca78b1eec8bd Mon Sep 17 00:00:00 2001 From: MrWaradana Date: Sat, 27 Dec 2025 11:10:37 +0700 Subject: [PATCH] update plant calculation --- src/modules/plant/run_plant_simulation.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/modules/plant/run_plant_simulation.py b/src/modules/plant/run_plant_simulation.py index db27960..eb2561d 100644 --- a/src/modules/plant/run_plant_simulation.py +++ b/src/modules/plant/run_plant_simulation.py @@ -426,13 +426,22 @@ def main(): eaf_v = 0 # rata-rata 3 tahun terakhir untuk net_capacity_factor - eaf_history.append(eaf_v) - cf_history.append(net_capacity_factor_v) - last_3_eaf = eaf_history[-3:] - last_3_cf = cf_history[-3:] - avg_eaf_3 = sum(last_3_eaf) / len(last_3_eaf) if last_3_eaf else 0 - avg_cf_3 = sum(last_3_cf) / len(last_3_cf) if last_3_cf else 0 - selisih_eaf_cf = abs(avg_cf_3 - avg_eaf_3) + if data["is_actual"] == 1: + eaf_history.append(eaf_v) + cf_history.append(net_capacity_factor_v) + net_capacity_factor = net_capacity_factor_v + eaf = eaf_v + else: + last_3_eaf = eaf_history[-3:] + last_3_cf = cf_history[-3:] + avg_eaf_3 = sum(last_3_eaf) / len(last_3_eaf) if last_3_eaf else 0 + avg_cf_3 = sum(last_3_cf) / len(last_3_cf) if last_3_cf else 0 + selisih_eaf_cf = abs(avg_cf_3 - avg_eaf_3) + eaf = eaf_v + net_capacity_factor = eaf_v - selisih_eaf_cf + + eaf_history.append(eaf_v) + cf_history.append(net_capacity_factor) if data["is_actual"] == 1: production_bruto = validate_number(data["production_bruto"])