Cizz22 3 months ago
parent bf6a2a4e27
commit 48dd7b5963

@ -86,12 +86,12 @@ async def get_calculation_parameters(
@get_calculation.get( @get_calculation.get(
"/{calculation_id}", response_model=StandardResponse[CalculationTimeConstrainsRead] "/{calculation_id}", response_model=StandardResponse[CalculationTimeConstrainsRead]
) )
async def get_calculation_results(db_session: DbSession, calculation_id, token:InternalKey): async def get_calculation_results(db_session: DbSession, calculation_id, token:InternalKey, include_risk_cost:int = Query(1, alias="risk_cost")):
if calculation_id == 'default': if calculation_id == 'default':
calculation_id = DEFAULT_TC_ID calculation_id = DEFAULT_TC_ID
results = await get_calculation_result( results = await get_calculation_result(
db_session=db_session, calculation_id=calculation_id, token=token db_session=db_session, calculation_id=calculation_id, token=token, include_risk_cost=include_risk_cost
) )
return StandardResponse( return StandardResponse(

@ -783,7 +783,7 @@ async def create_param_and_data(
return calculationData return calculationData
async def get_calculation_result(db_session: DbSession, calculation_id: str, token): async def get_calculation_result(db_session: DbSession, calculation_id: str, token, include_risk_cost):
""" """
Get calculation results with improved error handling, performance, and sparepart details Get calculation results with improved error handling, performance, and sparepart details
""" """
@ -850,7 +850,7 @@ async def get_calculation_result(db_session: DbSession, calculation_id: str, tok
loss_production_per_month = np.arange(0, total_simulation_period) loss_production_per_month = np.arange(0, total_simulation_period)
k = 5 k = 5
loss_exp = (plant_monthly_metrics['total_downtime'] * 660 * 500_000) * (np.exp(k * (loss_production_per_month / total_simulation_period)) - 1) / (np.exp(k) - 1) loss_exp = (plant_monthly_metrics['total_downtime'] * 660 * 500_000 * include_risk_cost) * (np.exp(k * (loss_production_per_month / total_simulation_period)) - 1) / (np.exp(k) - 1)
# REFERENCE_CAPACITY = 630 # or 550 # REFERENCE_CAPACITY = 630 # or 550
# COST_PER_MWH = 1_000_000 # rupiah # COST_PER_MWH = 1_000_000 # rupiah

Loading…
Cancel
Save