@@ -5,15 +5,14 @@ use crate::asset::AssetRef;
55use crate :: commodity:: Commodity ;
66use crate :: finance:: { lcox, profitability_index} ;
77use crate :: model:: Model ;
8- use crate :: simulation:: prices:: ReducedCosts ;
98use crate :: units:: Capacity ;
109use anyhow:: Result ;
1110
12- mod coefficients;
11+ pub mod coefficients;
1312mod constraints;
1413mod costs;
1514mod optimisation;
16- use coefficients:: { calculate_coefficients_for_lcox , calculate_coefficients_for_npv } ;
15+ use coefficients:: ObjectiveCoefficients ;
1716use optimisation:: perform_optimisation;
1817
1918/// The output of investment appraisal required to compare potential investment decisions
@@ -37,17 +36,9 @@ fn calculate_lcox(
3736 asset : & AssetRef ,
3837 max_capacity : Option < Capacity > ,
3938 commodity : & Commodity ,
40- reduced_costs : & ReducedCosts ,
39+ coefficients : & ObjectiveCoefficients ,
4140 demand : & DemandMap ,
4241) -> Result < AppraisalOutput > {
43- // Calculate coefficients
44- let coefficients = calculate_coefficients_for_lcox (
45- asset,
46- & model. time_slice_info ,
47- reduced_costs,
48- model. parameters . value_of_lost_load ,
49- ) ;
50-
5142 // Perform optimisation to calculate capacity, activity and unmet demand
5243 let results = perform_optimisation (
5344 asset,
@@ -61,7 +52,7 @@ fn calculate_lcox(
6152
6253 // Calculate LCOX for the hypothetical investment
6354 let annual_fixed_cost = coefficients. capacity_coefficient ;
64- let activity_costs = coefficients. activity_coefficients ;
55+ let activity_costs = & coefficients. activity_coefficients ;
6556 let cost_index = lcox (
6657 results. capacity ,
6758 annual_fixed_cost,
@@ -84,12 +75,9 @@ fn calculate_npv(
8475 asset : & AssetRef ,
8576 max_capacity : Option < Capacity > ,
8677 commodity : & Commodity ,
87- reduced_costs : & ReducedCosts ,
78+ coefficients : & ObjectiveCoefficients ,
8879 demand : & DemandMap ,
8980) -> Result < AppraisalOutput > {
90- // Calculate coefficients
91- let coefficients = calculate_coefficients_for_npv ( asset, & model. time_slice_info , reduced_costs) ;
92-
9381 // Perform optimisation to calculate capacity, activity and unmet demand
9482 let results = perform_optimisation (
9583 asset,
@@ -103,7 +91,7 @@ fn calculate_npv(
10391
10492 // Calculate profitability index for the hypothetical investment
10593 let annual_fixed_cost = -coefficients. capacity_coefficient ;
106- let activity_surpluses = coefficients. activity_coefficients ;
94+ let activity_surpluses = & coefficients. activity_coefficients ;
10795 let profitability_index = profitability_index (
10896 results. capacity ,
10997 annual_fixed_cost,
@@ -128,12 +116,12 @@ pub fn appraise_investment(
128116 max_capacity : Option < Capacity > ,
129117 commodity : & Commodity ,
130118 objective_type : & ObjectiveType ,
131- reduced_costs : & ReducedCosts ,
119+ coefficients : & ObjectiveCoefficients ,
132120 demand : & DemandMap ,
133121) -> Result < AppraisalOutput > {
134122 let appraisal_method = match objective_type {
135123 ObjectiveType :: LevelisedCostOfX => calculate_lcox,
136124 ObjectiveType :: NetPresentValue => calculate_npv,
137125 } ;
138- appraisal_method ( model, asset, max_capacity, commodity, reduced_costs , demand)
126+ appraisal_method ( model, asset, max_capacity, commodity, coefficients , demand)
139127}
0 commit comments