Skip to content
Snippets Groups Projects
Commit a826be4c authored by Christoph von Oy's avatar Christoph von Oy
Browse files

Expanded Topology for sub topologies

parent 55bb70c4
No related branches found
No related tags found
No related merge requests found
......@@ -845,13 +845,14 @@ def resample_variable(variable, dynamic, target_dynamic, target_set):
if target_i_start < source_i_start or source_i_end < target_i_end:
raise ValueError("The dynamic of the source variable has to cover the dynamic of the target variable!")
assignment = dynamic.global_dynamic.get_assignment(dynamic, target_dynamic)
def rule(m, t):
target_variable = dict()
for t in target_set:
data = assignment.data[t]
if isinstance(data, list):
return pyo.quicksum(variable[variable_index] * factor for variable_index, factor in assignment.data[t])
target_variable[t] = pyo.quicksum(variable[variable_index] * factor for variable_index, factor in assignment.data[t])
else:
return variable[data[0]] * data[1]
return pyo.Expression(target_set, rule=rule)
target_variable[t] = variable[data[0]] * data[1]
return target_variable
def test_single_resampling(dynamic_1, dynamic_2, f):
import numpy as np
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment