Skip to content

Commit

Permalink
Merge branch 'master' into feature/GSYE-835
Browse files Browse the repository at this point in the history
  • Loading branch information
hannesdiedrich authored Jan 16, 2025
2 parents 34e4fdd + e107389 commit ac0385a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
9 changes: 8 additions & 1 deletion src/gsy_e/gsy_e_core/user_profile_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,11 @@ def _read_new_datapoints_from_buffer_or_rotate_profile(
)

def rotate_profile(
self, profile_type: InputProfileTypes, profile, profile_uuid: str = None
self,
profile_type: InputProfileTypes,
profile,
profile_uuid: str = None,
input_profile_path: str = None,
) -> Dict[DateTime, float]:
"""Reads a new chunk of profile if the buffer does not contain the current time stamp
Profile chunks are either generated from single values, input daily profiles or profiles
Expand All @@ -491,11 +495,14 @@ def rotate_profile(
profile (any of str, dict, float): Any arbitrary input
(same input as for read_arbitrary_profile)
profile_uuid (str): optional, if set the profiles is read from the DB
input_profile_path (str), optional, for profiles provided by files
Returns: Profile chunk as dictionary
"""
if profile_uuid is None and self.should_create_profile(profile):
if input_profile_path:
profile = input_profile_path
return read_arbitrary_profile(
profile_type, profile, current_timestamp=self.current_timestamp
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from abc import ABC, abstractmethod
from typing import Optional, Dict, Union, List
from statistics import mean

from gsy_framework.constants_limits import ConstSettings, GlobalConfig, FLOATING_POINT_TOLERANCE
from gsy_framework.read_user_profile import InputProfileTypes
Expand Down Expand Up @@ -44,6 +45,7 @@ def get_results_dict(self, current_time_slot: DateTime) -> dict:
return {
"tanks": tanks_state,
**self._hp_state.get_results_dict(current_time_slot),
"storage_temp_C": mean([tank["storage_temp_C"] for tank in tanks_state]),
}
return {**self._hp_state.get_results_dict(current_time_slot), **tanks_state}

Expand Down
5 changes: 4 additions & 1 deletion src/gsy_e/models/strategy/strategy_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,10 @@ def read_or_rotate_profiles(self, reconfigure=False):
profile = self.profile

self.profile = global_objects.profiles_handler.rotate_profile(
profile_type=self.profile_type, profile=profile, profile_uuid=self.input_profile_uuid
profile_type=self.profile_type,
profile=profile,
profile_uuid=self.input_profile_uuid,
input_profile_path=self.input_profile,
)


Expand Down

0 comments on commit ac0385a

Please sign in to comment.