PyPSA
Convexity provides two-way I/O with PyPSA (Python for Power System Analysis), the leading open-source framework for energy system modeling. Exporting your Convexity models to PyPSA format allows you to work with your models in an open-source format, which is particularly useful for:
- Migrating out of Convexity while preserving all your model data and structure
- Collaborating with stakeholders who do not have a Convexity license
- Integrating with open-source tools and leveraging PyPSA's extensive ecosystem of analysis libraries and post-processing tools
Import
You can import PyPSA models (in netCDF format) directly into Convexity. This allows you to work with models created in PyPSA or migrate existing PyPSA workflows into Convexity's graphical interface.

During the import process, select a PyPSA netCDF file (.nc) and choose a location to save the resulting Convexity .db file. The import process converts the PyPSA network structure into Convexity's data model.
PyPSA netcdf files do not include asset locations. You can define the asset locations you want in your Convexity model by creating a CSV file named like demo_model_locations.csv for a netcdf file named like demo_model.nc (that is, append _locations to its name). The CSV file should be formatted like:
name,longitude,latitude
Wind Farm A,-0.99197,53.735281
Main Coal Plant,-0.8076,53.3622where the names are the same as the names of the assets in the netcdf file.
Export

You can export any Convexity model to PyPSA format, enabling you to work with your models in Python using standard PyPSA workflows. When exporting, you can choose currently only choose the netCDF (.nc) file format After exporting, you can load and solve your model in Python:
import pypsa
# Import
n = pypsa.Network.import_from_netcdf(path_to_file)
# Solve
n.optimize(solver_name='highs')
