Skip to content

Commit

Permalink
added test
Browse files Browse the repository at this point in the history
  • Loading branch information
aalfonsi authored and aalfonsi committed Oct 10, 2023
1 parent f60da78 commit 6673ee4
Show file tree
Hide file tree
Showing 4 changed files with 143 additions and 0 deletions.
77 changes: 77 additions & 0 deletions tests/CashFlow_test_NPV_delayed_construction.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<Simulation verbosity="debug">
<TestInfo>
<name>CashFlow_test_delayed_contruction_time</name>
<author>A. Alfonsi</author>
<created>2023-10-10</created>
<description>
This test tests the possibility to allow for CAPEX construction times spanning on multiple years (not only in the first one).

</description>
<classesTested>Models.ExternalModel.TEAL</classesTested>
<revisions>
<revision author="alfoa" date="2023-10-10">Addressed issue #17</revision>
</revisions>
</TestInfo>

<RunInfo>
<WorkingDir>.</WorkingDir>
<Sequence>MCrun,printTOfile</Sequence>
</RunInfo>

<VariableGroups>
<Group name="GRO_CashFlow_in">BOP_capacity, BOP_TOT_revenueEL, IP_capacity, IP_TOT_revenueBY, Multiplier</Group>
<Group name="GRO_CashFlow_out">NPV</Group>
</VariableGroups>

<Models>
<ExternalModel name="Cash_Flow" subType="TEAL.CashFlow">
<variables> GRO_CashFlow_in, GRO_CashFlow_out</variables>
<ExternalXML node="Economics" xmlToLoad="Cash_Flow_input_NPV_delayed_construction.xml"/>
</ExternalModel>
</Models>

<Samplers>
<MonteCarlo name="test_MC">
<samplerInit>
<limit>1</limit>
</samplerInit>
<constant name="BOP_capacity">300.0E6</constant>
<constant name="BOP_TOT_revenueEL">350.0E6</constant>
<constant name="IP_capacity">51.0E6</constant>
<constant name="IP_TOT_revenueBY">31.5E6</constant>
<constant name="Multiplier">1.0</constant>
</MonteCarlo>
</Samplers>

<DataObjects>
<PointSet name="SET_CashFlow_in">
<Input>GRO_CashFlow_in</Input>
<Output>OutputPlaceHolder</Output>
</PointSet>
<PointSet name="SET_CashFlow_out">
<Input>GRO_CashFlow_in</Input>
<Output>GRO_CashFlow_out</Output>
</PointSet>
</DataObjects>

<Steps>
<MultiRun name="MCrun" pauseAtEnd="True">
<Input class="DataObjects" type="PointSet">SET_CashFlow_in</Input>
<Model class="Models" type="ExternalModel">Cash_Flow</Model>
<Sampler class="Samplers" type="MonteCarlo">test_MC</Sampler>
<Output class="DataObjects" type="PointSet">SET_CashFlow_out</Output>
</MultiRun>
<IOStep name="printTOfile">
<Input class="DataObjects" type="PointSet">SET_CashFlow_out</Input>
<Output class="OutStreams" type="Print">dumpNPVDelay</Output>
</IOStep>
</Steps>

<OutStreams>
<Print name="dumpNPVDelay">
<type>csv</type>
<source>SET_CashFlow_out</source>
<what>input,output</what>
</Print>
</OutStreams>
</Simulation>
56 changes: 56 additions & 0 deletions tests/Cash_Flow_input_NPV_delayed_construction.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<Economics verbosity="0"> <!-- "0" all debug output, "1" some output, "100" only errors -->
<Global>
<DiscountRate>0.05</DiscountRate> <!-- %/100 -->
<tax>0.392</tax> <!-- %/100 -->
<inflation>0.04</inflation> <!-- %/100 -->
<Indicator name='NPV' target='0'>
BOP|CA
BOP|RE
IP|CA
IP|RE
</Indicator>
</Global>

<Component name="BOP">
<Life_time>15</Life_time> <!-- years -->
<CashFlows>
<!-- Capital Cost -->
<!-- alpha in $ for the <reference> MW plant -->
<Capex name="CA" tax="false" inflation="none" mult_target="false" multiply="Multiplier">
<driver>BOP_capacity</driver>
<alpha>-4510000000 -4510000000 0 0 0 0 0 0 0 0 0 0 0 0 0 0</alpha>
<reference>1100000000</reference>
<X>0.64</X>
<depreciation scheme='custom'>5. 9.50 8.55 7.70 6.93 6.23 5.90 5.90 5.91 5.90 5.91 5.90 5.91 5.90 5.91</depreciation>
</Capex>

<!-- Electric Revenue -->
<!-- alpha is 1.0 -->
<Recurring name="RE" tax="true" inflation="none" mult_target="true">
<driver>BOP_TOT_revenueEL</driver>
<alpha>1.0</alpha>
</Recurring>
</CashFlows>
</Component>

<Component name="IP">
<Life_time>15</Life_time> <!-- years -->
<CashFlows>
<!-- Capital Cost -->
<!-- alpha in $ for the <reference> MW plant, i.e. $/W(th)h -->
<Capex name="CA" tax="false" inflation="none" mult_target="false">
<alpha>-153000000</alpha>
<driver>IP_capacity</driver>
<reference>231000000</reference>
<X>1.0</X>
</Capex>

<!-- Non electric Revenue -->
<!-- alpha is 1.0 -->
<Recurring name="RE" tax="true" inflation="none" mult_target="true">
<driver>IP_TOT_revenueBY</driver>
<alpha>1.0</alpha>
</Recurring>
</CashFlows>
</Component>
</Economics>
2 changes: 2 additions & 0 deletions tests/gold/dumpNPVDelay.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
BOP_capacity,BOP_TOT_revenueEL,IP_capacity,IP_TOT_revenueBY,Multiplier,NPV
300000000.0,350000000.0,51000000.0,31500000.0,1.0,-1049009630.29
8 changes: 8 additions & 0 deletions tests/tests
Original file line number Diff line number Diff line change
Expand Up @@ -115,4 +115,12 @@
rel_err = 0.001
[../]

[./CashFlow_test_delayed_contruction_time]
type = 'RavenFramework'
input = 'CashFlow_test_NPV_delayed_construction.xml'
UnorderedCsv = 'dumpNPVDelay.csv'
max_time = 500
rel_err = 0.001
[../]

[]

0 comments on commit 6673ee4

Please sign in to comment.