Update calculator.py
Browse files- calculator.py +16 -5
calculator.py
CHANGED
|
@@ -121,7 +121,7 @@ else:
|
|
| 121 |
col_logo, col_title = st.columns([1, 4])
|
| 122 |
with col_logo:
|
| 123 |
try:
|
| 124 |
-
st.image("buma ina.
|
| 125 |
except FileNotFoundError:
|
| 126 |
st.warning("⚠️ File logo 'buma_ina.PNG' tidak ditemukan. Silakan pastikan file ada di direktori yang sama dengan script.")
|
| 127 |
with col_title:
|
|
@@ -253,10 +253,21 @@ else:
|
|
| 253 |
if len(tail) < 5:
|
| 254 |
st.warning(f"Hanya {len(tail)} titik data (<= {batas} jam).")
|
| 255 |
return tail['fuel_rate_act'].mean()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 256 |
|
| 257 |
st.subheader("⛽ Prediksi Fuel Rate")
|
| 258 |
avg_blowby_awal = fuel_awal_data(unit_df, current_life)
|
| 259 |
avg_blowby_akhir = hitung_avg_blowby(unit_df, extended_life)
|
|
|
|
| 260 |
delta_life = extended_life - current_life
|
| 261 |
fuel_rate_awal = (avg_blowby_awal * 0.004) + 71.86 # L/h
|
| 262 |
fuel_rate_akhir = (avg_blowby_akhir * 0.004) + 71.86 # L/h
|
|
@@ -275,7 +286,7 @@ else:
|
|
| 275 |
with col4:
|
| 276 |
st.markdown(f"""
|
| 277 |
<div class="metric-card">
|
| 278 |
-
<h4 style="color: #34495e;">Fuel
|
| 279 |
<p style="font-size: 20px; color: #3498db;">{(fuel_rate_akhir * delta_life):,.2f} L</p>
|
| 280 |
</div>
|
| 281 |
""", unsafe_allow_html=True)
|
|
@@ -310,10 +321,10 @@ else:
|
|
| 310 |
|
| 311 |
st.subheader("💰 Analisis Keuntungan dan Kerugian")
|
| 312 |
harga_engine = 110_000 # USD
|
| 313 |
-
harga_fuel =
|
| 314 |
|
| 315 |
-
cost_per_h = harga_engine /
|
| 316 |
-
saving = cost_per_h * delta_life
|
| 317 |
fuel_cost = fuel_usage * harga_fuel
|
| 318 |
net_savings = fuel_cost - saving
|
| 319 |
|
|
|
|
| 121 |
col_logo, col_title = st.columns([1, 4])
|
| 122 |
with col_logo:
|
| 123 |
try:
|
| 124 |
+
st.image("buma ina.png", width=150)
|
| 125 |
except FileNotFoundError:
|
| 126 |
st.warning("⚠️ File logo 'buma_ina.PNG' tidak ditemukan. Silakan pastikan file ada di direktori yang sama dengan script.")
|
| 127 |
with col_title:
|
|
|
|
| 253 |
if len(tail) < 5:
|
| 254 |
st.warning(f"Hanya {len(tail)} titik data (<= {batas} jam).")
|
| 255 |
return tail['fuel_rate_act'].mean()
|
| 256 |
+
|
| 257 |
+
def fuel_awal_setelah_replacement(df, batas):
|
| 258 |
+
tmp = df[['comp_life', 'fuel_rate_act']].dropna().sort_values('comp_life')
|
| 259 |
+
tmp = tmp[tmp['comp_life'] <= batas]
|
| 260 |
+
if tmp.empty:
|
| 261 |
+
return 0
|
| 262 |
+
head = tmp.head(5)
|
| 263 |
+
if len(head) < 5:
|
| 264 |
+
st.warning(f"Hanya {len(head)} titik data (<= {batas} jam).")
|
| 265 |
+
return head['fuel_rate_act'].mean()
|
| 266 |
|
| 267 |
st.subheader("⛽ Prediksi Fuel Rate")
|
| 268 |
avg_blowby_awal = fuel_awal_data(unit_df, current_life)
|
| 269 |
avg_blowby_akhir = hitung_avg_blowby(unit_df, extended_life)
|
| 270 |
+
fuel_setelah_replacement =fuel_awal_setelah_replacement(unit_df, extended_life)
|
| 271 |
delta_life = extended_life - current_life
|
| 272 |
fuel_rate_awal = (avg_blowby_awal * 0.004) + 71.86 # L/h
|
| 273 |
fuel_rate_akhir = (avg_blowby_akhir * 0.004) + 71.86 # L/h
|
|
|
|
| 286 |
with col4:
|
| 287 |
st.markdown(f"""
|
| 288 |
<div class="metric-card">
|
| 289 |
+
<h4 style="color: #34495e;">Fuel Akumulasi</h4>
|
| 290 |
<p style="font-size: 20px; color: #3498db;">{(fuel_rate_akhir * delta_life):,.2f} L</p>
|
| 291 |
</div>
|
| 292 |
""", unsafe_allow_html=True)
|
|
|
|
| 321 |
|
| 322 |
st.subheader("💰 Analisis Keuntungan dan Kerugian")
|
| 323 |
harga_engine = 110_000 # USD
|
| 324 |
+
harga_fuel = 1 # USD/L
|
| 325 |
|
| 326 |
+
cost_per_h = harga_engine / current_life
|
| 327 |
+
saving = ((cost_per_h * delta_life) + (fuel_setelah_replacement* delta_life))
|
| 328 |
fuel_cost = fuel_usage * harga_fuel
|
| 329 |
net_savings = fuel_cost - saving
|
| 330 |
|