sunpeek.core_methods.dcam_lite_collective.main.DCAMYieldStrategy#

class sunpeek.core_methods.dcam_lite_collective.main.DCAMYieldStrategy(array, reference_conditions_type, use_wind, settings, **kwargs)#

Bases: CoreStrategy, ABC

Base class for D-CAM energy yield strategy variants.

A strategy represents one combination of reference-condition handling and wind usage for one array. Subclasses implement the calculation workflow for either per-interval or fixed reference conditions.

Variables:
  • component – SunPeek array analyzed by this strategy.

  • reference_conditions_type – Mode used to determine reference conditions for 1N-to-2N collector parameter conversion.

  • use_wind – Whether wind speed is used during D-CAM data filtering.

  • settings – D-CAM yield check settings used for filtering, parameter conversion, safety factors, and forward simulation.

  • name – Human-readable strategy name used in algorithm feedback.

Strategy variants are defined by:
  • reference_conditions_type:

    per_interval -> compute ref conditions separately for each interval fixed -> compute ref conditions from all intervals combined

  • use_wind:

    include wind sensor in upstream D-CAM data filtering (if supported)

Notes for forward simulation integration#

The public method chain is intentionally preserved:

_calc() -> run_forwardsim_interval()

Methods

__init__(array, reference_conditions_type, ...)

apply_cut_time_init_error(interval, ...)

Trim the beginning of a simulated interval to remove initialization effects.

calc_outputs(interval, te_out_simulated, data)

Compute per-interval outputs.

calc_reference_conditions(data)

Compute reference conditions used to convert collector parameters.

check_output(output)

Additional checks to be performed on output of a strategy.

execute()

Try to calculate strategy, sanitize check output dict and return if ok.

from_reference_conditions(array, ...)

get_feedback(check_mode)

run_forwardsim_interval(data, p2n, array)

Run the forward simulation for one D-CAM operating interval.

apply_cut_time_init_error(interval, te_out_simulated)#

Trim the beginning of a simulated interval to remove initialization effects.

If settings.cut_time_init_error is unset, zero, or negative, the interval and simulated outlet-temperature series are returned unchanged. Otherwise, the interval start is shifted forward by that duration and te_out_simulated is sliced to the remaining timestamps.

Parameters:
  • interval (tuple[datetime, datetime]) – Original operating interval as (start, end) timestamps.

  • te_out_simulated (Series) – Simulated outlet-temperature series indexed by timestamp.

Returns:

The effective interval after trimming and the corresponding simulated outlet-temperature series.

Return type:

tuple[tuple[dt.datetime, dt.datetime], pd.Series]

Raises:

ValueError – If the configured cut duration removes the complete simulated interval.

calc_outputs(interval, te_out_simulated, data)#

Compute per-interval outputs.

Return type:

Dict[str, Series]

calc_reference_conditions(data)#

Compute reference conditions used to convert collector parameters.

Return type:

Dict[str, Quantity]

check_output(output)#

Additional checks to be performed on output of a strategy.

execute()#

Try to calculate strategy, sanitize check output dict and return if ok.

Returns:

  • elapsed_time (float, elapsed time in algorithm in seconds)

  • output (dict, strategy output, values are asserted to be unit-aware (pint-pandas) Series.)

Raises:

AlgorithmError

property f_prime_c: Quantity#

Collector heat removal factor required for 1N->2N conversion.

classmethod from_reference_conditions(array, reference_conditions_type, use_wind, settings, **kwargs)#
Return type:

DCAMYieldStrategy

Factory method returning the concrete strategy implementation. Raises

ValueError for unsupported ReferenceConditionsType.

run_forwardsim_interval(data, p2n, array)#

Run the forward simulation for one D-CAM operating interval.

In normal mode, this method builds DCAMSettings from the strategy settings and delegates to run_forward_simulation. The returned dictionary contains the simulated outlet temperature and additional solver output.

In mock mode, no solver is executed. The method returns a dictionary with the same keys as the normal solver output. T_f_outlet contains a simple mock outlet-temperature series based on measured te_out; all other solver-output keys are present and set to None.

Parameters:
  • data – Interval data returned by get_dcam_data. Required solver inputs include te_in, te_out, te_op, te_amb, rd_bti, rd_dti, iam, and mf. If index is missing, it is reconstructed from array.plant.time_index and the current interval.

  • p2n – Collector parameters converted to the D-CAM 2-N model format.

  • array – SunPeek array being simulated.

Returns:

Solver-shaped result dictionary. In both normal and mock mode, T_f_outlet contains the simulated outlet-temperature series. In normal mode, T_f, T_s, x_discrete, and initial_states contain the detailed solver outputs. In mock mode, those keys are set to None.

Return type:

Dict[str, Any]

Raises:
  • RuntimeError – If neither data["index"] nor the current interval is available.

  • DCAMError – If required interval data such as cp_mean are missing.

  • ValueError – If n_discretization is configured as a list with more than one value.

property specific_volume: Quantity#

Array specific volume required for 1N->2N conversion.

Prefer a dedicated array attribute specific_volume. For compatibility with existing plant configurations and tests, fall back to deriving it from fluidvol_total / area_gr when available.