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

Gave profiles their own dynamic

parent 31fc9217
Branches
No related tags found
No related merge requests found
......@@ -335,6 +335,19 @@ class PartialDynamic(Dynamic):
raise IndexError("The dynamic does not have all requested indices for the sub dynamic!")
return PartialDynamic(self.reference, reference_start, reference_end)
class Profile:
def __init__(self, values, dynamic):
self.values = values
self.dynamic = dynamic
# returns a profile resampled to the given dynamic
def resample(self, target_dynamic):
return Profile(resample(self.values, self.dynamic, target_dynamic), target_dynamic)
# return values resampled to the given dynamic
def resample_values(self, target_dynamic):
return resample(self.values, self.dynamic, target_dynamic)
# only works if both dynamics share the same root dynamic
def resample(values, dynamic, target_dynamic):
if dynamic.get_root_dynamic() != target_dynamic.get_root_dynamic():
......
......@@ -28,6 +28,7 @@ from Tooling.demand_generator.electrical_demand.ElectricalDemand import Electric
from Tooling.demand_generator.thermal_demand.ThermalDemand import ThermalDemand
from Tooling.input_profile_processor.calc_irradiance import generate_g_t_series
from Tooling.modifier import Modifier
from Tooling.dynamics.Dynamic import Profile
def process_input_profiles(input_profile_dict, t_start, dynamic):
......@@ -74,7 +75,7 @@ def process_input_profiles(input_profile_dict, t_start, dynamic):
input_profile = input_profile.squeeze()
input_profile.set_axis(list(range(dynamic.number_of_steps())), inplace = True)
input_profiles[input_profile_name] = input_profile
input_profiles[input_profile_name] = Profile(input_profile, dynamic)
return input_profiles
def resample_profile(name, profile, t_start, dynamic, d_step_min, t_last):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment