sunpeek.core_methods.common.main.CoreAlgorithm#
- class sunpeek.core_methods.common.main.CoreAlgorithm(component, strategies=None, *args, **kwargs)#
Bases:
ABCSuperclass for all SunPeek core algorithms, mainly virtual sensors, Power Check and D-CAT energy yield methods.
This class handles various strategies for an algorithm (e.g. various implementations to calculate thermal power, or various Performance Check methods, equations etc.
*args and **kwargs passed to object creation are forwarded to
define_strategies().Methods
__init__(component[, strategies])allowed_components()check_interval([eval_start, eval_end])Make sure we have data in the specified interval, and check that plant's virtual sensors are up-to-date.
create_variants(arg, allowed_type, default)Create list with sanitized inputs for algo strategies.
define_strategies(*args, **kwargs)Cycle through all algo strategies, return CoreMethodFeedback of all strategy problems.
run([on_strategy_error])Calculates algorithm using its defined strategies, stopping at the first successful strategy.
- check_interval(eval_start=None, eval_end=None)#
Make sure we have data in the specified interval, and check that plant’s virtual sensors are up-to-date.
- Return type:
- static create_variants(arg, allowed_type, default)#
Create list with sanitized inputs for algo strategies. Set default if needed.
:raises TypeError :
if `arg`ordefaultdoes not matchallowed_type.: :raises AlgorithmError :if no valid variants are found:
- get_config_feedback()#
Cycle through all algo strategies, return CoreMethodFeedback of all strategy problems. Stops at first successful strategy, copies problem slots from strategy.
- Return type:
CoreMethodFeedback
- run(on_strategy_error='skip')#
Calculates algorithm using its defined strategies, stopping at the first successful strategy.
- Parameters:
on_strategy_error (
str, optional) – If ‘raise’, exceptions that occur during a strategy.execute() are raised. If not, they are saved as own_feedback in self.problems. In any case, errors are logged.- Return type:
:raises AlgorithmError :
if algorithm has no strategies defined, orif getting some strategy problems fails.: