diff --git a/src/dispatch/Dispatcher.py b/src/dispatch/Dispatcher.py
index fd4ebbed..a217b56c 100644
--- a/src/dispatch/Dispatcher.py
+++ b/src/dispatch/Dispatcher.py
@@ -94,17 +94,18 @@ def dispatch(self, case, components, sources):
"""
raise NotImplementedError # must be implemented by inheriting classes
- def validate(self, components, activity, times):
+ def validate(self, components, activity, times, meta):
"""
Method to validate a dispatch activity.
@ In, components, list, HERON components whose cashflows should be evaluated
@ In, activity, DispatchState instance, activity by component/resources/time
@ In, times, np.array(float), time values to evaluate; may be length 1 or longer
+ @ In, meta, dict, extra information needed for validation
@ Out, validation, dict, information about validation
"""
# default implementation
if self._validator is not None:
- return self._validator.validate(components, activity, times)
+ return self._validator.validate(components, activity, times, meta)
else:
# no validator, nothing needs to be changed
return {}
diff --git a/src/dispatch/pyomo_dispatch.py b/src/dispatch/pyomo_dispatch.py
index 3dbd04a9..5cf7e2a3 100644
--- a/src/dispatch/pyomo_dispatch.py
+++ b/src/dispatch/pyomo_dispatch.py
@@ -183,7 +183,7 @@ def dispatch_window(self, time,
raise RuntimeError
# try validating
print('DEBUGG ... validating ...')
- validation_errs = self.validate(m.Components, m.Activity, m.Times)
+ validation_errs = self.validate(m.Components, m.Activity, m.Times, meta)
if validation_errs:
done_and_checked = False
print('DEBUGG ... validation concerns raised:')
diff --git a/src/validators/ExampleValidator.py b/src/validators/ExampleValidator.py
index 4a058b5b..7d804147 100644
--- a/src/validators/ExampleValidator.py
+++ b/src/validators/ExampleValidator.py
@@ -60,12 +60,13 @@ def read_input(self, inputs):
# ---------------------------------------------
# API
- def validate(self, components, dispatch, times):
+ def validate(self, components, dispatch, times, meta):
"""
Method to validate a dispatch activity.
@ In, components, list, HERON components whose cashflows should be evaluated
@ In, activity, DispatchState instance, activity by component/resources/time
@ In, times, np.array(float), time values to evaluate; may be length 1 or longer
+ @ In, meta, dict, extra information pertaining to validation
@ Out, errs, list, information about validation failures
"""
errs = [] # TODO best format for this?
@@ -73,6 +74,8 @@ def validate(self, components, dispatch, times):
for res in info:
for t, time in enumerate(times):
current = dispatch.get_activity(comp, res, time)
+ if comp.get_interaction().is_type('Storage') and t == 0:
+ init_level = comp.get_interaction().get_initial_level(meta)
if t > 0:
previous = dispatch.get_activity(comp, res, times[t-1])
delta = current - previous
diff --git a/src/validators/Validator.py b/src/validators/Validator.py
index b956db89..4a2cdc5b 100644
--- a/src/validators/Validator.py
+++ b/src/validators/Validator.py
@@ -57,13 +57,14 @@ def initialize(self, case, components, sources, **kwargs):
# ---------------------------------------------
# API
# TODO make this a virtual method?
- def validate(self, case, components, sources, dispatch):
+ def validate(self, case, components, sources, dispatch, meta):
"""
Performs technoeconomic dispatch.
@ In, case, Case, HERON case
@ In, components, list, HERON components
@ In, sources, list, HERON sources
@ In, dispatch, HERON DispatchState, proposed activity
+ @ In, meta, dict, extra information
@ Out, results, list(dict), list of violations with info about each (see Validator base class)
"""
# The return results should be a list of dictionaries
diff --git a/tests/integration_tests/validator/heron_input.xml b/tests/integration_tests/validator/heron_input.xml
index 7c8ae90e..4888e661 100644
--- a/tests/integration_tests/validator/heron_input.xml
+++ b/tests/integration_tests/validator/heron_input.xml
@@ -68,7 +68,6 @@
-
-2
@@ -105,7 +104,8 @@
-
+
+
../ARMA/Sine/arma.pk