diff --git a/src/modules/plant/run2.py b/src/modules/plant/run2.py index 6b22b3d..0fd4a60 100644 --- a/src/modules/plant/run2.py +++ b/src/modules/plant/run2.py @@ -420,13 +420,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[-4:-1] - last_3_cf = cf_history[-4:-1] - 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"]) @@ -441,8 +450,6 @@ def main(): cost_bd_om = validate_number(data["cost_bd_om"]) cost_bd_pm_nonmi = validate_number(data["cost_bd_pm_nonmi"]) cost_bd_bd = validate_number(data["cost_bd_bd"]) - net_capacity_factor = net_capacity_factor_v - eaf = eaf_v else: production_netto = net_capacity_factor * 8760 * daya_mampu_netto / 100 production_bruto = production_netto / (100 - (auxiliary + susut_trafo)) * 100 @@ -461,8 +468,6 @@ def main(): cost_bd_om = cost_bd_om cost_bd_pm_nonmi = cost_bd_pm_nonmi cost_bd_bd = cost_bd_bd - eaf = eaf_v - net_capacity_factor = eaf_v - selisih_eaf_cf # ++++++ REVENUE +++++++ revenue_total = revenue_a + revenue_b + revenue_c + revenue_d