Permalink
Browse files

configuration files

  • Loading branch information...
1 parent 9021db8 commit ebfc567d5198345ada1ba820e85357e0fd35103f @adamgreenhall committed Dec 19, 2012
Showing with 91 additions and 36 deletions.
  1. +2 −0 .gitignore
  2. +1 −1 MANIFEST.in
  3. +35 −0 configuration/minpower.cfg
  4. +44 −30 minpower/config.py
  5. +5 −3 minpower/results.py
  6. +4 −2 setup.py
View
@@ -1,4 +1,6 @@
+minpower/configuration/minpower.cfg
error.txt
+out.txt
results.txt
*.lp
*.png
View
@@ -1 +1 @@
-recursive-include minpower/tests *.csv
+
@@ -0,0 +1,35 @@
+[minpower]
+duals = False
+breakpoints = 11
+hours_commitment = 24
+hours_overlap = 0
+cost_load_shedding = 10000.00
+# cost is in $/MWh
+load_shedding_allowed = False
+dispatch_decommit_allowed = False
+solver = glpk
+
+reserve_fixed = 0
+reserve_load_fraction = 0.0
+
+faststart_resolve = False
+
+visualization = False
+logging_level = 20
+# the default level is INFO
+# for debugging use:
+# logging_level = 10
+logging_filename = False
+problem_filename = False
+output_prefix = False
+
+scenarios = 0
+# if scenarios>0, this sets the max number of scenarios used
+deterministic_solve = False
+perfect_solve = False
+scenarios_directory = ""
+
+[available_solvers]
+glpk = True
+gurobi = False
+cplex = False
View
@@ -2,9 +2,9 @@
Provide the defaults and configuration for other modules.
`user_config` is treated as a global in minpower.
"""
-
-import logging
-from commonscripts import DotDict
+import os
+from ConfigParser import SafeConfigParser
+from commonscripts import DotDict, joindir
generator_kinds=[
'generic',
@@ -90,33 +90,47 @@
)
-available_solvers = ['gurobi','glpk']
-
+parser = SafeConfigParser()
+parser.read([
+ # the minpower default set, from the minpower/configuration directory
+ joindir(os.path.split(__file__)[0], 'configuration/minpower.cfg'),
+ # the user's overrides, from the home directory
+ os.path.expanduser('~/.minpower.cfg')],
+ # add another override in the specific case directory??
+ )
user_config = DotDict(dict(
- duals=False,
- breakpoints=11,
- hours_commitment=24,
- hours_overlap=0,
- cost_load_shedding=10000, #$/MWh
- load_shedding_allowed=False,
- dispatch_decommit_allowed=False,
- solver='gurobi',
-
- reserve_fixed=0,
- reserve_load_fraction=0.0,
-
- faststart_resolve=False,
-
- visualization=False,
- logging_level=logging.DEBUG,
- logging_filename=False,
- problem_filename=False,
- output_prefix=False,
-
- scenarios=None,
- deterministic_solve=False,
- perfect_solve=False,
- scenarios_directory=None,
-
+ duals = parser.getboolean('minpower', 'duals'),
+ breakpoints = parser.getint('minpower', 'breakpoints'),
+ hours_commitment = parser.getint('minpower', 'hours_commitment'),
+ hours_overlap = parser.getint('minpower', 'hours_overlap'),
+
+ cost_load_shedding = parser.getfloat('minpower', 'cost_load_shedding'),
+ load_shedding_allowed = \
+ parser.getboolean('minpower', 'load_shedding_allowed'),
+ dispatch_decommit_allowed = \
+ parser.getboolean('minpower', 'dispatch_decommit_allowed'),
+ solver = parser.get('minpower', 'solver'),
+
+ reserve_fixed = parser.getfloat('minpower', 'reserve_fixed'),
+ reserve_load_fraction = \
+ parser.getfloat('minpower', 'reserve_load_fraction'),
+
+ faststart_resolve = parser.getboolean('minpower', 'faststart_resolve'),
+
+ visualization = parser.getboolean('minpower', 'visualization'),
+ logging_level = parser.getint('minpower', 'logging_level'),
+ logging_filename = parser.getboolean('minpower', 'logging_filename'),
+ problem_filename = parser.getboolean('minpower', 'problem_filename'),
+ output_prefix = parser.getboolean('minpower', 'output_prefix'),
+
+ scenarios = parser.getint('minpower', 'scenarios'),
+ deterministic_solve = parser.getboolean('minpower', 'deterministic_solve'),
+ perfect_solve = parser.getboolean('minpower', 'perfect_solve'),
+ scenarios_directory = parser.get('minpower', 'scenarios_directory'),
))
+
+available_solvers = []
+for solver in parser.options('available_solvers'):
+ if parser.getboolean('available_solvers', solver):
+ available_solvers.append(solver)
View
@@ -453,9 +453,11 @@ def info_cost(self):
resolved = self._resolved
expected = 'expected ' if resolved else ''
observed = 'observed ' if resolved else ''
- out = ['total {}generation cost = {}'.format(
- expected, self.expected_cost.sum().sum())]
- if resolved: out.append('total {}generation cost = {}'.format(
+ out = []
+ if resolved:
+ out.append('total {}generation cost = {}'.format(
+ expected, self.expected_cost.sum().sum()))
+ out.append('total {}generation cost = {}'.format(
observed, self.observed_cost.sum().sum()))
return out
View
@@ -25,6 +25,8 @@
hyak_minpower = minpower.experiments.minpower_hyak:main
""",
+ data_files=[('configuration', 'configuration/minpower.cfg')],
+
install_requires=[
'Coopr>=3.2.6148', #3.1.5409
'coopr.core>=1.0',
@@ -61,7 +63,7 @@
"Topic :: Scientific/Engineering",
"Topic :: Scientific/Engineering :: Mathematics",
],
- long_description = """\
+ long_description = """
power systems tools made beautiful
-----------------------------------------
@@ -75,4 +77,4 @@
* `Actively developed <http://github.com/adamgreenhall/minpower>`_
"""
-)
+)

0 comments on commit ebfc567

Please sign in to comment.