pypsa.optimization.optimize.OptimizationAccessor.create_model

pypsa.optimization.optimize.OptimizationAccessor.create_model#

OptimizationAccessor.create_model(snapshots: Sequence | None = None, multi_investment_periods: bool = False, transmission_losses: int = 0, linearized_unit_commitment: bool = False, **kwargs: Any) Model#

Create a linopy.Model instance from a pypsa network.

The model is stored at n.model.

Parameters:
  • n (pypsa.Network)

  • snapshots (list or index slice) – A list of snapshots to optimise, must be a subset of n.snapshots, defaults to n.snapshots

  • multi_investment_periods (bool, default False) – Whether to optimise as a single investment period or to optimize in multiple investment periods. Then, snapshots should be a pd.MultiIndex.

  • transmission_losses (int, default 0)

  • linearized_unit_commitment (bool, default False) – Whether to optimise using the linearised unit commitment formulation or not.

  • **kwargs – Keyword arguments used by linopy.Model(), such as solver_dir or chunk.

Return type:

linopy.model