Code Documentation

Economic Dispatcher

Purpose of this module is to dispatch between the different types of economic dispatchers and calculated the minimum objective function

EconomicDispatcher.Dispatch(model, *data)[source]

Args:

Returns: json file with the solutions of the model

class EconomicDispatcher.Network[source]

Bases: object

Network constrained optimization problem

Parameters:
  • file
  • solver
Returns:

Json file with simple marketclearing

Return type:

solotion

BussesAdder(network, Buss, BussVnom, BussVmax, BussVmin, BussVset, BussType)[source]
Add all the buses to the network component
Parameters:
  • () (BussType) – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend

Returns:

ElectricLinesAdder(network, ElectricLines, ElectricLinesR, ElectricLinesX, ElectricLinesCcap, ElectricLinesL, ElectricLinesPhaseShift, ElectricLinesAngMax, ElectricLinesAngMin, ElectricLinesLength, ElectricLinesConnection, ElectricLinesPmax)[source]

Add the lines between buses to the network component

Parameters:
  • () (ElectricLinesPmax) – pypsa network component
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend

Returns:

GeneratorAdder(network, Generators, GeneratorConnection, PnomOrdered, PminOrdered, PmaxOrdered, CostsOrdered, RampUp, RampDown, MaxDownTime, MinDownTime, Initstatus, StartUpCost, ShutdownCost, Effciency, CapCost, PsetPoint, QsetPoint, Time)[source]

Add the generators to the network component

Parameters:
  • () (QsetPoint) – pypsa network component
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend
  • () – Pandas dataframework from frontend

Returns:

LoadAdder(network, LoadName, Loads, LoadQ, LoadBus)[source]
Add loads to the network

ToDo : Qload

Parameters:
  • LoadName – List of Load names
  • Loads – List of loads that need to be edited
  • LoadBus – List of the busses where the load is connected to
Main(model, ElectricLines, ElectricLinesR, ElectricLinesC, ElectricLinesX, Buss, BussVnom, BussType, BussVset, BussVmax, BussVmin, BussConnection, ElectricLinesCcap, ElectricLinesL, ElectricLinesPhaseShift, ElectricLinesAngMax, ElectricLinesAngMin, ElectricLinesLength, ElectricLinesConnection, ElectricLinesPmax, Generators, CostsOrdered, PnomOrdered, RampUp, RampDown, Effciency, MinDownTime, MaxDownTime, PminOrdered, GeneratorConnection, Time, PowerBlocks, PmaxOrdered, StartUpCost, ShutdownCost, Initstatus, CapCost, PsetPoint, QsetPoint, Loads, LoadP, LoadQ, LoadTime, LoadConnection, options)[source]
Main network function that calls necessary network functions
Parameters:
  • () (options) – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • ()
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend
  • () – Pandas Data Framework from the frontend

Returns:

Printer(network)[source]

Debugger that prints info

Parameters:network – pypsa main network component

Returns:

lopf(network)[source]

Function that runs the optimization procces

Returns:

class EconomicDispatcher.Simple[source]

Bases: object

Simple optimization problem, using only 3 basic constrains: Unit, Balance , Cost

Parameters:
  • file – file to be loaded with all the data
  • solver – string that defines which optimization solver to be used e.g. the free software GLPK or the commercial software Gurobi

Returns:

BalanceRule(model, t)[source]
Generated power and load needed should be matched, the sum off all the powers at a time instance \(t\) needs to match the load at an time instance \(t\)
\[\sum_{i=1}^{i=j} P[i,t] = Load[t]\]

Where \(Load[t]\) is the load at time instance \(t\)

CostRule(model)[source]
Defining the cost rule that pyomo uses
\[\sum_{t=1}^{t=t_{end}} \Big( \sum_{i=1}^{i=j} P_{cost}[i] \cdot P[i,t] \Big)\]

where \(t_{end}\) is the end time of the series, \(P_{cost}[i]\) is the cost of generator at place i (e.g. the i th generator) \(P[i,t]\) is the power that can be generated by an generator at time \(t\)

Load()[source]

Function that loads the data from an excel sheets in order to further process it.

Main(Pmax, Pmin, CostsOrdered, LoadP)[source]

Main function of the simple network model

Returns:solotion
Model(Pmax, Pmin, CostsOrdered, LoadP)[source]

Initialises the model in the pyomo framework

Printer(model)[source]

For debugging purpose only prints the output of the result if the debug option has been set

Solver(model)[source]

Solves the linear objective function

Returns:results
UnitRule(model, i, t)[source]
Power delivered from the generator on time interval \(t\) cannot be larger then maximum power of the generator and should be higher then the minimum power the generator must deliver
\[P_{min}[i] \leq P[i,t] \leq P_{max}[i]\]

Where \(P_{min}[i]\) is the minimum power generator i can deliver , \(P[i,t]\) is the desired power at time \(t\) , \(P_{max}[i]\) is the maximum power generator i can deliver