Skip to content

Commit e9e5e04

Browse files
committed
Remove old classes
1 parent 16c7481 commit e9e5e04

1 file changed

Lines changed: 1 addition & 93 deletions

File tree

flixopt/interface.py

Lines changed: 1 addition & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -245,98 +245,6 @@ def maximum_or_fixed_size(self) -> NonTemporalData:
245245
return self.fixed_size if self.fixed_size is not None else self.maximum_size
246246

247247

248-
# Base interface for common parameters
249-
@register_class_for_io
250-
class _BaseYearAwareInvestParameters(Interface):
251-
"""
252-
Base parameters for year-aware investment modeling.
253-
Contains common sizing and effects parameters used by all variants.
254-
"""
255-
256-
def __init__(
257-
self,
258-
# Basic sizing parameters
259-
minimum_size: Optional[Scalar] = None,
260-
maximum_size: Optional[Scalar] = None,
261-
fixed_size: Optional[Scalar] = None,
262-
optional: bool = False,
263-
# Direct effects
264-
effects_of_investment_per_size: Optional['NonTemporalEffectsUser'] = None,
265-
effects_of_investment: Optional['NonTemporalEffectsUser'] = None,
266-
):
267-
"""
268-
Initialize base year-aware investment parameters.
269-
270-
Args:
271-
minimum_size: Minimum investment size when invested. Defaults to CONFIG.modeling.EPSILON.
272-
maximum_size: Maximum possible investment size. Defaults to CONFIG.modeling.BIG.
273-
fixed_size: If specified, investment size is fixed to this value.
274-
effects_of_investment_per_size: Effects applied per unit of investment size for each year invested.
275-
Example: {'costs': 100} applies 100 * size * years_invested to total costs.
276-
effects_of_investment: One-time effects applied when investment decision is made.
277-
Example: {'costs': 1000} applies 1000 to costs in the investment year.
278-
"""
279-
self.minimum_size = minimum_size if minimum_size is not None else CONFIG.modeling.EPSILON
280-
self.maximum_size = maximum_size if maximum_size is not None else CONFIG.modeling.BIG
281-
self.fixed_size = fixed_size
282-
self.optional = optional
283-
284-
self.effects_of_investment_per_size: 'NonTemporalEffectsUser' = (
285-
effects_of_investment_per_size if effects_of_investment_per_size is not None else {}
286-
)
287-
self.effects_of_investment: 'NonTemporalEffectsUser' = (
288-
effects_of_investment if effects_of_investment is not None else {}
289-
)
290-
291-
def transform_data(self, flow_system: 'FlowSystem', name_prefix: str = '') -> None:
292-
"""Transform all parameter data to match the flow system's coordinate structure."""
293-
self._plausibility_checks(flow_system)
294-
295-
self.effects_of_investment_per_size = flow_system.fit_effects_to_model_coords(
296-
label_prefix=name_prefix,
297-
effect_values=self.effects_of_investment_per_size,
298-
label_suffix='effects_of_investment_per_size',
299-
dims=['year', 'scenario'],
300-
)
301-
self.effects_of_investment = flow_system.fit_effects_to_model_coords(
302-
label_prefix=name_prefix,
303-
effect_values=self.effects_of_investment,
304-
label_suffix='effects_of_investment',
305-
dims=['year', 'scenario'],
306-
)
307-
308-
self.minimum_size = flow_system.fit_to_model_coords(
309-
f'{name_prefix}|minimum_size', self.minimum_size, dims=['year', 'scenario']
310-
)
311-
self.maximum_size = flow_system.fit_to_model_coords(
312-
f'{name_prefix}|maximum_size', self.maximum_size, dims=['year', 'scenario']
313-
)
314-
if self.fixed_size is not None:
315-
self.fixed_size = flow_system.fit_to_model_coords(
316-
f'{name_prefix}|fixed_size', self.fixed_size, dims=['year', 'scenario']
317-
)
318-
319-
def _plausibility_checks(self, flow_system):
320-
"""Validate parameter consistency and compatibility with the flow system."""
321-
if flow_system.years is None:
322-
raise ValueError("YearAwareInvestParameters requires the flow_system to have a 'years' dimension.")
323-
324-
@property
325-
def minimum_or_fixed_size(self) -> NonTemporalData:
326-
"""Get the effective minimum size (fixed size takes precedence)."""
327-
return self.fixed_size if self.fixed_size is not None else self.minimum_size
328-
329-
@property
330-
def maximum_or_fixed_size(self) -> NonTemporalData:
331-
"""Get the effective maximum size (fixed size takes precedence)."""
332-
return self.fixed_size if self.fixed_size is not None else self.maximum_size
333-
334-
@property
335-
def is_fixed_size(self) -> bool:
336-
"""Check if investment size is fixed."""
337-
return self.fixed_size is not None
338-
339-
340248
YearOfInvestmentData = NonTemporalDataUser
341249
"""This datatype is used to define things related to the year of investment."""
342250
YearOfInvestmentDataBool = Union[bool, YearOfInvestmentData]
@@ -430,7 +338,7 @@ def __init__(
430338
def _plausibility_checks(self, flow_system):
431339
"""Validate parameter consistency."""
432340
if flow_system.years is None:
433-
raise ValueError("YearAwareInvestParameters requires the flow_system to have a 'years' dimension.")
341+
raise ValueError("InvestTimingParameters requires the flow_system to have a 'years' dimension.")
434342

435343
if (self.force_investment.sum('year') > 1).any():
436344
raise ValueError('force_investment can only be True for a single year.')

0 commit comments

Comments
 (0)