multiple_hubs

Solving energy hub model for n number of hubs with any network of connections wanted between the hubs.

To run for multiple hubs:

$ python multiple_hubs.py -n NUMBER OF HUBS

If n (NUMBER OF HUBS) is not inputted the code will not run.

Naming input excel files:

file names should start with “hub” followed by increasing numbers starting from 0. The files should be in the ‘network’ folder

To set the connections between the hubs ( the links):

All the links between the hubs should be set in a separate excel file in the ‘network’ folder. It should be called “network.xlsx”

The default set up is one directional connections. To set bidirectional connections, the connections should be defined per each direction, i.e:

one direction: link 0: start_id: 0 end_id: 1

bidirectional: link 0: start_id: 0 end_id: 1,

link 1: start_id: 1 end_id: 0

The link ids should start from 0 and increase by 1. The node ids (start_id and end_id) correspond to hubs numbering in the names of the hubs excel files.

Note: Do not name constraints specific names in the EHubModel class -> will not be able to construct constraints in multiple_hubs

class multiple_hubs.NetworkModel(*, excel=None, request=None, name=None, network=None, network_request=None, hub_id=None, max_carbon=None)[source]

A subclass that allows connections between hubs.

calc_network_investment_cost()[source]

Calculating investment cost for the links the hub has. Cost split between 2 hubs that are connected with the same link

calc_total_cost()[source]

Modifying total cost constraint. Adding network cost to the total cost.

Set binary to 1 if capacity of link is > 0. :param link: A link

Set binary to 1 if capacity of link is > 0. :param link: A link

multiple_hubs.linear_power_flow_constraint(power, angle_from, angle_to, time, reactance)[source]

Constraint for linear powerflows

Constraint for the flow in the links.

multiple_hubs.multiple_hubs(minimize_carbon=False, output_filename=None, input_files=None, network_excel=None, network_request=None, max_carbon=None, n=0, solver='glpk')[source]

Core function for solving of multiple PyEHub models.

multiple_hubs.network_constraint(hub, link_end, link_start)[source]

Yields the constraints that allow a network connection between two hubs.

Parameters:
  • hub – The hub

  • link_end – all the links that the hub ends at

  • link_start – all the links that the hub start at

Yields:

A network energy balanced constraints for each hub