Skip to content

DER Scenario Sizing Strategy

DER Scenario Sizining Strategy

Module for managing pv sizing strategies when creating solar scenarios.

EnergyBasedSolarSizingStrategy

Bases: SizingStrategy

Default strategy is to size solar based on load factor, solar capacity factor and percentage energy to be replaced by solar annually.

Source code in emerge\scenarios\sizing_strategy.py
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
class EnergyBasedSolarSizingStrategy(SizingStrategy):
    """Default strategy is to size solar based on
    load factor, solar capacity factor and percentage energy
    to be replaced by solar annually."""

    def __init__(
        self,
        config: Union[
            EnergyBasedSolarSizingStrategyInput, Dict[str, EnergyBasedSolarSizingStrategyInput]
        ],
    ):
        self.config = config

    def return_kw_and_profile(self, customer: CustomerModel) -> Optional[Tuple[float, str]]:

        def _return_size(load_kw: float, _config: EnergyBasedSolarSizingStrategyInput):
            return round(
                (load_kw * _config.load_factor * _config.max_pct_production)
                / (100 * _config.capacity_factor),
                3,
            )

        if isinstance(self.config, dict):
            if customer.cust_type not in self.config:
                print(
                    f"{customer.cust_type} missing from config data {self.config}"
                )
                return (None, None)
            (_return_size(customer.kw, self.config.get(customer.cust_type)), 
             self.config.get(customer.cust_type).profile)
        (_return_size(customer.kw, self.config), self.config.profile)

FixedSizingStrategy

Bases: SizingStrategy

Fixed sizing strategy uses fixed kw with user defined value to get the DER size. e.g. Level 1 EV charger

Source code in emerge\scenarios\sizing_strategy.py
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
class FixedSizingStrategy(SizingStrategy):
    """Fixed sizing strategy uses fixed kw with user defined
    value to get the DER size. e.g. Level 1 EV charger"""

    def __init__(
        self,
        config: Union[
            SizeWithProbabilityModel,
            Dict[str, SizeWithProbabilityModel],
        ],
    ):
        self.config = config


    def return_kw_and_profile(
        self,
        customer: CustomerModel,
    ) -> Optional[Tuple[float, str]]:

        def _get_kw_and_profile(config: Optional[SizeWithProbabilityModel]):

            fixed_value = _get_value_from_proability(config)
            profile = dict(zip(config.sizes, config.profile)).get(fixed_value) \
                if isinstance(config.profile, list) else config.profile

            return (fixed_value, profile)

        if isinstance(self.config, dict):
            if customer.cust_type not in self.config:
                print(
                    f"{customer.cust_type} missing from config data {self.config}"
                )
                return (None, None)
            return _get_kw_and_profile(self.config.get(customer.cust_type))

        return _get_kw_and_profile(self.config)

PeakMultiplierSizingStrategy

Bases: SizingStrategy

Peak multiplier strategy multiplier peak kw with user defined multiplier to get the DER size. e.g. ReOpt suggested solar multiplier.

Source code in emerge\scenarios\sizing_strategy.py
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
class PeakMultiplierSizingStrategy(SizingStrategy):
    """Peak multiplier strategy multiplier peak kw with user defined
    multiplier to get the DER size. e.g. ReOpt suggested solar multiplier."""

    def __init__(
        self,
        config: Union[
            SizeWithProbabilityModel,
            Dict[str, SizeWithProbabilityModel],
        ],
    ):
        self.config = config


    def return_kw_and_profile(
        self,
        customer: CustomerModel,
    ) -> Optional[Tuple[float, str]]:

        def _get_kw_and_profile(config: Optional[SizeWithProbabilityModel]):

            multiplier = _get_value_from_proability(config)
            profile = dict(zip(config.sizes, config.profile)).get(multiplier) \
                if isinstance(config.profile, list) else config.profile

            return (round(
                customer.kw * multiplier , 3
            ), profile)

        if isinstance(self.config, dict):
            if customer.cust_type not in self.config:
                print(
                    f"{customer.cust_type} missing from config data {self.config}"
                )
                return (None, None)
            return _get_kw_and_profile(self.config.get(customer.cust_type))

        return _get_kw_and_profile(self.config)

SizingStrategy

Bases: abc.ABC

Abstract class for sizing strategy.

Source code in emerge\scenarios\sizing_strategy.py
25
26
27
28
29
30
class SizingStrategy(abc.ABC):
    """Abstract class for sizing strategy."""

    @abc.abstractmethod
    def return_kw_and_profile(self, customer: CustomerModel) -> Optional[Tuple[float, str]]:
        """Abstract method for returning size."""
return_kw_and_profile(customer) abstractmethod

Abstract method for returning size.

Source code in emerge\scenarios\sizing_strategy.py
28
29
30
@abc.abstractmethod
def return_kw_and_profile(self, customer: CustomerModel) -> Optional[Tuple[float, str]]:
    """Abstract method for returning size."""