diff --git a/examples/3zone_toy/outputs/total_cost.txt b/examples/3zone_toy/outputs/total_cost.txt index ef566d248..404f8509e 100644 --- a/examples/3zone_toy/outputs/total_cost.txt +++ b/examples/3zone_toy/outputs/total_cost.txt @@ -1 +1 @@ -112306455.975 +114415586.323 diff --git a/examples/carbon_cap/outputs/total_cost.txt b/examples/carbon_cap/outputs/total_cost.txt index c4157c755..aac4158ae 100644 --- a/examples/carbon_cap/outputs/total_cost.txt +++ b/examples/carbon_cap/outputs/total_cost.txt @@ -1 +1 @@ -117115037.675 +119224168.023 diff --git a/examples/copperplate0/outputs/BaseloadOperatingLevelForPeriod.tab b/examples/copperplate0/outputs/BaseloadOperatingLevelForPeriod.tab deleted file mode 100644 index cdc3b96cf..000000000 --- a/examples/copperplate0/outputs/BaseloadOperatingLevelForPeriod.tab +++ /dev/null @@ -1,2 +0,0 @@ -DispatchBaseloadByPeriod_index_1 DispatchBaseloadByPeriod_index_2 DispatchBaseloadByPeriod -S-Geothermal 2020 0.96858075 diff --git a/examples/copperplate0/outputs/BuildProj.tab b/examples/copperplate0/outputs/BuildGen.tab similarity index 82% rename from examples/copperplate0/outputs/BuildProj.tab rename to examples/copperplate0/outputs/BuildGen.tab index c2f14ea4c..aafa93867 100644 --- a/examples/copperplate0/outputs/BuildProj.tab +++ b/examples/copperplate0/outputs/BuildGen.tab @@ -3,5 +3,5 @@ S-Geothermal 1998 1.0 S-Central_PV-1 2020 0.0 S-Central_PV-1 2000 1.0 S-NG_CC 2000 5.0 -S-NG_CC 2020 1.84427579787234 +S-NG_CC 2020 2.34276595744681 S-Geothermal 2020 0.0 diff --git a/examples/copperplate0/outputs/ProjCommitToMinBuild.tab b/examples/copperplate0/outputs/BuildMinGenCap.tab similarity index 100% rename from examples/copperplate0/outputs/ProjCommitToMinBuild.tab rename to examples/copperplate0/outputs/BuildMinGenCap.tab diff --git a/examples/copperplate0/outputs/DispatchProj.tab b/examples/copperplate0/outputs/DispatchProj.tab deleted file mode 100644 index 3e5effd2b..000000000 --- a/examples/copperplate0/outputs/DispatchProj.tab +++ /dev/null @@ -1,7 +0,0 @@ -GEN_TPS_1 GEN_TPS_2 DispatchGen -S-Geothermal 2 0.96858075 -S-Geothermal 1 0.96858075 -S-NG_CC 1 6.43361925 -S-NG_CC 2 0.0 -S-Central_PV-1 2 0.0 -S-Central_PV-1 1 0.5978 diff --git a/examples/copperplate0/outputs/DumpPower.tab b/examples/copperplate0/outputs/DumpPower.tab deleted file mode 100644 index 60474c591..000000000 --- a/examples/copperplate0/outputs/DumpPower.tab +++ /dev/null @@ -1,3 +0,0 @@ -DumpPower_index_1 DumpPower_index_2 DumpPower -South 1 0.0 -South 2 0.46858075 diff --git a/examples/copperplate0/outputs/ProjFuelUseRate.tab b/examples/copperplate0/outputs/ProjFuelUseRate.tab deleted file mode 100644 index e785210e3..000000000 --- a/examples/copperplate0/outputs/ProjFuelUseRate.tab +++ /dev/null @@ -1,3 +0,0 @@ -GEN_TP_FUELS_1 GEN_TP_FUELS_2 GEN_TP_FUELS_3 GenFuelUseRate -S-NG_CC 1 NaturalGas 43.13741707125 -S-NG_CC 2 NaturalGas 0.0 diff --git a/examples/copperplate0/outputs/dispatch.txt b/examples/copperplate0/outputs/dispatch.txt index 498125c7c..020a89a8c 100644 --- a/examples/copperplate0/outputs/dispatch.txt +++ b/examples/copperplate0/outputs/dispatch.txt @@ -1,3 +1,3 @@ -timestamp S-Geothermal S-NG_CC S-Central_PV-1 -2025011512 0.5 6.9022 0.5978 -2025011600 0.5 0 0 +timestamp S-Central_PV-1 S-Geothermal S-NG_CC +2025011512 0.5978 0.5 6.9022 +2025011600 0 0.5 0 diff --git a/examples/planning_reserves/outputs/total_cost.txt b/examples/planning_reserves/outputs/total_cost.txt index 9268234e0..640b2eec5 100644 --- a/examples/planning_reserves/outputs/total_cost.txt +++ b/examples/planning_reserves/outputs/total_cost.txt @@ -1 +1 @@ -113475282.655 +115584413.003 diff --git a/examples/rps_simple/outputs/total_cost.txt b/examples/rps_simple/outputs/total_cost.txt index 5cbf235d5..01fae2e13 100644 --- a/examples/rps_simple/outputs/total_cost.txt +++ b/examples/rps_simple/outputs/total_cost.txt @@ -1 +1 @@ -117916387.239 +120025517.587 diff --git a/setup.py b/setup.py index 30c51089c..698a45fdc 100644 --- a/setup.py +++ b/setup.py @@ -15,12 +15,19 @@ import os from setuptools import setup, find_packages +# Get the version number. Strategy #3 from https://packaging.python.org/single_source_version/ +version_path = os.path.join(os.path.dirname(__file__), 'switch_model', 'version.py') +version = {} +with open(version_path) as f: + exec(f.read(), version) +__version__ = version['__version__'] + def read(*rnames): return open(os.path.join(os.path.dirname(__file__), *rnames)).read() setup( name='switch_model', - version='2.0.0b2', + version=__version__, maintainer='Switch Authors', maintainer_email='authors@switch-model.org', url='http://switch-model.org', diff --git a/switch_model/__init__.py b/switch_model/__init__.py index a13c1d647..888e460a8 100644 --- a/switch_model/__init__.py +++ b/switch_model/__init__.py @@ -17,7 +17,7 @@ Most applications of Switch will also benefit from optional modules such as transmission, local_td, reserves, etc. """ -__version__='2.0.0b2' +from .version import __version__ core_modules = [ 'switch_model.timescales', 'switch_model.financials', diff --git a/switch_model/main.py b/switch_model/main.py index d921dd946..ed59eb91e 100644 --- a/switch_model/main.py +++ b/switch_model/main.py @@ -4,11 +4,12 @@ """Script to handle switch calls from the command line.""" import sys, os +import switch_model # print "running {} as {}.".format(__file__, __name__) def main(): - cmds = ["solve", "solve-scenarios", "test", "upgrade"] + cmds = ["solve", "solve-scenarios", "test", "upgrade", "--version"] if len(sys.argv) >= 2 and sys.argv[1] in cmds: # If users run a script from the command line, the location of the script # gets added to the start of sys.path; if they call a module from the @@ -23,6 +24,9 @@ def main(): cmd = sys.argv[1] sys.argv[0] += " " + cmd del sys.argv[1] + if cmd == "--version": + print "Switch model version " + switch_model.__version__ + return 0 if cmd == "solve": from .solve import main elif cmd == "solve-scenarios": diff --git a/switch_model/transmission/transport/build.py b/switch_model/transmission/transport/build.py index 23587dd80..84aee96a7 100644 --- a/switch_model/transmission/transport/build.py +++ b/switch_model/transmission/transport/build.py @@ -205,7 +205,7 @@ def define_components(mod): within=mod.BLD_YRS_FOR_TX, initialize=lambda m, p: set( (tx, bld_yr) for (tx, bld_yr) in m.BLD_YRS_FOR_TX - if bld_yr <= p)) + if bld_yr == 'Legacy' or bld_yr <= p)) def bounds_BuildTx(model, tx, bld_yr): if((tx, bld_yr) in model.BLD_YRS_FOR_EXISTING_TX): diff --git a/switch_model/version.py b/switch_model/version.py new file mode 100644 index 000000000..228d73dad --- /dev/null +++ b/switch_model/version.py @@ -0,0 +1,9 @@ +# Copyright (c) 2015-2017 The Switch Authors. All rights reserved. +# Licensed under the Apache License, Version 2.0, which is in the LICENSE file. +""" +This file should only include the version. Do not import any packages or +modules in here because this file needs to be executed before SWITCH is +installed and executed in environments that don't have any dependencies +installed. +""" +__version__='2.0.0b3' \ No newline at end of file diff --git a/tests/upgrade_dat/3zone_toy/outputs/total_cost.txt b/tests/upgrade_dat/3zone_toy/outputs/total_cost.txt index ef566d248..404f8509e 100644 --- a/tests/upgrade_dat/3zone_toy/outputs/total_cost.txt +++ b/tests/upgrade_dat/3zone_toy/outputs/total_cost.txt @@ -1 +1 @@ -112306455.975 +114415586.323