ADGEfficiency/energy-py-linear

Battery efficiency?

Closed this issue · 3 comments

I feed in some simple prices and simple battery setup and I'm confused about the output.

I'm using prices of [100, 200] so I expect the optimal battery profile would be to import at full capacity (1MW) in the first period and then export at full capacity in the second period.

Instead, see below, it's importing at 1MW in period[0] but exporting at 0.90909091MW in period[1]. Is there an inefficiency being modelled in the battery?

Finally, the charge state at the end is 0.0 - which is either 10% loss of efficiency??

>>> import energypylinear as epl
>>> model = epl.Battery(power=1, capacity=2)
>>> info = model.optimize([100, 200, 0])
>>> pprint(info)
[{'Actual [$/5min]': 8.333333333333334,
  'Charge [MWh]': 0.0,
  'Export [MW]': 0.0,
  'Forecast [$/5min]': 8.333333333333334,
  'Forecast [$/MWh]': 100,
  'Gross [MW]': 1.0,
  'Import [MW]': 1.0,
  'Losses [MW]': 0.0,
  'Net [MW]': 1.0,
  'Prices [$/MWh]': 100},
 {'Actual [$/5min]': -13.63636365,
  'Charge [MWh]': 0.083333333,
  'Export [MW]': 0.90909091,
  'Forecast [$/5min]': -13.63636365,
  'Forecast [$/MWh]': 200,
  'Gross [MW]': -0.90909091,
  'Import [MW]': 0.0,
  'Losses [MW]': 0.090909091,
  'Net [MW]': -0.818181819,
  'Prices [$/MWh]': 200},
 {'Actual [$/5min]': None,
  'Charge [MWh]': 0.0,
  'Export [MW]': None,
  'Forecast [$/5min]': None,
  'Forecast [$/MWh]': 0,
  'Gross [MW]': None,
  'Import [MW]': None,
  'Losses [MW]': None,
  'Net [MW]': None,
  'Prices [$/MWh]': 0}]

Hi Tom,

This does seem like a real bug - Gross export during the $/MWh 200 price period should be 1 MW, with losses of 0.1 MW and net export of 0.9 MW.

The Export and Losses are ok (they sum to one) - the issue is with the Gross and Net, which I think is calclulated in generate_outputs.

Fixed this - the issue was in Battery.calc_net - changed to net = import - export - loss

This now results in

[OrderedDict([('Import [MW]', 1.0),
              ('Export [MW]', 0.0),
              ('Gross [MW]', 1.0),
              ('Net [MW]', 1.0),
              ('Losses [MW]', 0.0),
              ('Charge [MWh]', 0.0),
              ('Prices [$/MWh]', 100),
              ('Forecast [$/MWh]', 100),
              ('Actual [$/1hr]', 100.0),
              ('Forecast [$/1hr]', 100.0)]),
 OrderedDict([('Import [MW]', 0.0),
              ('Export [MW]', 0.90909091),
              ('Gross [MW]', -0.90909091),
              ('Net [MW]', -1.000000001),
              ('Losses [MW]', 0.090909091),
              ('Charge [MWh]', 1.0),
              ('Prices [$/MWh]', 200),
              ('Forecast [$/MWh]', 200),
              ('Actual [$/1hr]', -200.00000020000002),
              ('Forecast [$/1hr]', -200.00000020000002)]),
 OrderedDict([('Import [MW]', None),
              ('Export [MW]', None),
              ('Gross [MW]', None),
              ('Net [MW]', None),
              ('Losses [MW]', None),
              ('Charge [MWh]', 0.0),
              ('Prices [$/MWh]', None),
              ('Forecast [$/MWh]', None),
              ('Actual [$/1hr]', None),
              ('Forecast [$/1hr]', None)])]

👍