Skip to content

Commit

Permalink
adding dual debug mode tests for opt mode
Browse files Browse the repository at this point in the history
  • Loading branch information
GabrielSoto-INL committed Aug 15, 2024
1 parent 59f598d commit a341a23
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 7 deletions.
113 changes: 113 additions & 0 deletions tests/integration_tests/mechanics/debug_mode/opt/heron_input.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
<HERON>
<TestInfo>
<name>DebugMode</name>
<author>talbpaul</author>
<created>2021-02-22</created>
<description>
Tests a debug mode of operation, where a single outer runs a single sample of inner
and outputs the optimized dispatch.
</description>
<classesTested>HERON</classesTested>
</TestInfo>

<Case name="Debug_Run">
<mode>opt</mode>
<debug>
<inner_samples>2</inner_samples>
<macro_steps>2</macro_steps>
<dispatch_plot>True</dispatch_plot>
</debug>
<num_arma_samples>1</num_arma_samples>
<time_discretization>
<time_variable>Time</time_variable>
<end_time>2</end_time>
<num_steps>21</num_steps>
</time_discretization>
<economics>
<ProjectTime>3</ProjectTime>
<DiscountRate>0.08</DiscountRate>
<tax>0.3</tax>
<inflation>0.02</inflation>
<verbosity>50</verbosity>
</economics>
<dispatcher>
<pyomo/>
</dispatcher>
</Case>

<Components>
<Component name="steamer">
<produces resource="steam" dispatch="fixed">
<capacity resource="steam">
<opt_bounds debug_value="3.14">1, 100</opt_bounds>
</capacity>
</produces>
<economics>
<lifetime>5</lifetime>
</economics>
</Component>

<Component name="generator">
<produces resource="electricity" dispatch="independent">
<consumes>steam</consumes>
<capacity resource="steam">
<fixed_value>-100</fixed_value>
</capacity>
<transfer>
<linear>
<rate resource="steam">-1</rate>
<rate resource="electricity">0.5</rate>
</linear>
</transfer>
</produces>
<economics>
<lifetime>5</lifetime>
</economics>
</Component>

<Component name="electr_market">
<demands resource="electricity" dispatch="dependent">
<capacity>
<fixed_value>-2</fixed_value>
</capacity>
</demands>
<economics>
<lifetime>30</lifetime>
<CashFlow name="e_sales" type="repeating" taxable='True' inflation='none' >
<driver>
<activity>electricity</activity>
</driver>
<reference_price>
<fixed_value>0.5</fixed_value>
</reference_price>
</CashFlow>
</economics>
</Component>

<Component name="electr_flex">
<demands resource="electricity" dispatch="dependent">
<capacity>
<fixed_value>-1e200</fixed_value>
</capacity>
</demands>
<economics>
<lifetime>30</lifetime>
<CashFlow name="e_sales" type="repeating" taxable='True' inflation='none' >
<driver>
<activity>electricity</activity>
</driver>
<reference_price>
<Function method="flex_price">transfers</Function>
</reference_price>
</CashFlow>
</economics>
</Component>

</Components>

<DataGenerators>
<ARMA name='Price' variable="Signal">%HERON_DATA%/TSA/Sine/arma.pk</ARMA>
<Function name="transfers">../transfers.py</Function>
</DataGenerators>

</HERON>
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@

<DataGenerators>
<ARMA name='Price' variable="Signal">%HERON_DATA%/TSA/Sine/arma.pk</ARMA>
<Function name="transfers">transfers.py</Function>
<Function name="transfers">../transfers.py</Function>
</DataGenerators>

</HERON>
35 changes: 29 additions & 6 deletions tests/integration_tests/mechanics/debug_mode/tests
Original file line number Diff line number Diff line change
@@ -1,25 +1,48 @@
[Tests]
[./DebugMode]
[./DebugModeWithSweep]
type = 'HeronIntegration'
input = heron_input.xml
input = 'sweep/heron_input.xml'
[./dispatch_db]
type = NetCDF
output = 'Debug_Run_o/dispatch.nc'
output = 'sweep/Debug_Run_o/dispatch.nc'
gold_files = 'dispatch.nc'
[../]
[./dispatch_csv]
type = UnorderedCSV
output = 'Debug_Run_o/dispatch_print.csv'
output = 'sweep/Debug_Run_o/dispatch_print.csv'
gold_files = 'dispatch_print.csv'
rel_err = 1e-8
[../]
[./debug_plot]
type = Exists
output = 'Debug_Run_o/dispatch_id0_y10_c0_f1.png Debug_Run_o/dispatch_id0_y11_c0_f1.png Debug_Run_o/dispatch_id1_y10_c0_f1.png Debug_Run_o/dispatch_id1_y11_c0_f1.png'
output = 'sweep/Debug_Run_o/dispatch_id0_y10_c0_f1.png sweep/Debug_Run_o/dispatch_id0_y11_c0_f1.png sweep/Debug_Run_o/dispatch_id1_y10_c0_f1.png sweep/Debug_Run_o/dispatch_id1_y11_c0_f1.png'
[../]
[./debug_plot]
type = Exists
output = 'network.png'
output = 'sweep/network.png'
[../]
[../]
[./DebugModeWithOpt]
type = 'HeronIntegration'
input = 'opt/heron_input.xml'
[./dispatch_db]
type = NetCDF
output = 'opt/Debug_Run_o/dispatch.nc'
gold_files = 'dispatch.nc'
[../]
[./dispatch_csv]
type = UnorderedCSV
output = 'opt/Debug_Run_o/dispatch_print.csv'
gold_files = 'dispatch_print.csv'
rel_err = 1e-8
[../]
[./debug_plot]
type = Exists
output = 'opt/Debug_Run_o/dispatch_id0_y10_c0_f1.png opt/Debug_Run_o/dispatch_id0_y11_c0_f1.png opt/Debug_Run_o/dispatch_id1_y10_c0_f1.png opt/Debug_Run_o/dispatch_id1_y11_c0_f1.png'
[../]
[./debug_plot]
type = Exists
output = 'opt/network.png'
[../]
[../]
[]
Expand Down

0 comments on commit a341a23

Please sign in to comment.