DAM-only Price-Quantity Example

[1]:
import generation_models as gm
from tyba_client.client import Client
import numpy as np
import pandas as pd
import os
[2]:
client = Client(os.environ["TYBA_PAT"])
[5]:
hours = 48
n = 3

model = gm.StandaloneStorageModel(
    energy_prices=gm.DARTPriceScenarios(
        rtm=np.random.random((n, hours)).tolist(),
        dam=np.random.random((n, hours)).tolist(),
        weights=[0.3, 0.2, 0.5],  # probability of each scenario
    ),
    project_term=48,
    project_term_units="hours",
    storage_inputs=gm.MultiStorageInputs(
        batteries=[gm.BatteryParams(
            power_capacity=1e3,
            energy_capacity=2 * 1e3 / 0.95,
            discharge_efficiency=0.95,
            charge_efficiency=0.95,
            degradation_rate=0.0,
        )],
        energy_strategy=gm.MarketConfig(
            da=gm.BidOfferStrategy.price_quantity,  # Makes DAM price-quantity
            rt=None  # Makes RTM cover DAM with quantity-only
        ),
    ),
)
[8]:
resp = client.schedule(model)
resp.raise_for_status()
id_ = resp.json()["id"]
[12]:
res = pd.DataFrame(client.wait_on_result(id_))
[17]:
res[["dam_discharge_offer_quantity", "dam_charge_offer_quantity", "dam_discharge_offer_price", "dam_charge_offer_price", "rtm_discharge", "rtm_charge"]]
[17]:
dam_discharge_offer_quantity dam_charge_offer_quantity dam_discharge_offer_price dam_charge_offer_price rtm_discharge rtm_charge
0 1.890044e-13 216.066482 1.000000e+06 1.000000e+06 1.890044e-13 216.066482
1 0.000000e+00 1000.000000 7.614937e-01 7.614917e-01 0.000000e+00 1000.000000
2 0.000000e+00 1000.000000 6.186046e-01 1.806109e-01 0.000000e+00 1000.000000
3 8.050000e+02 0.000000 0.000000e+00 0.000000e+00 8.050000e+02 0.000000
4 1.000000e+03 0.000000 5.573063e-01 0.000000e+00 1.000000e+03 0.000000
5 0.000000e+00 1000.000000 8.407292e-01 8.407272e-01 0.000000e+00 1000.000000
6 0.000000e+00 1000.000000 6.272627e-01 6.272607e-01 0.000000e+00 1000.000000
7 1.000000e+03 0.000000 5.772265e-01 0.000000e+00 1.000000e+03 0.000000
8 1.000000e+03 0.000000 7.198444e-01 0.000000e+00 1.000000e+03 0.000000
9 0.000000e+00 1000.000000 3.872528e-01 3.872518e-01 0.000000e+00 1000.000000
10 0.000000e+00 1000.000000 5.584570e-01 5.584550e-01 0.000000e+00 1000.000000
11 8.050000e+02 0.000000 5.767334e-01 0.000000e+00 8.050000e+02 0.000000
12 1.000000e+03 0.000000 8.582361e-01 0.000000e+00 1.000000e+03 0.000000
13 0.000000e+00 1000.000000 9.585975e-01 6.349638e-02 0.000000e+00 1000.000000
14 0.000000e+00 1000.000000 7.119654e-01 7.119644e-01 0.000000e+00 1000.000000
15 1.000000e+03 0.000000 0.000000e+00 0.000000e+00 1.000000e+03 0.000000
16 0.000000e+00 1000.000000 9.535452e-01 1.931478e-02 0.000000e+00 1000.000000
17 0.000000e+00 324.099723 8.397077e-01 0.000000e+00 0.000000e+00 324.099723
18 1.000000e+03 0.000000 4.216720e-01 0.000000e+00 1.000000e+03 0.000000
19 8.050000e+02 0.000000 4.078660e-01 0.000000e+00 8.050000e+02 0.000000
20 0.000000e+00 1000.000000 5.187792e-01 5.483235e-02 0.000000e+00 1000.000000
21 1.000000e+03 0.000000 7.054114e-01 0.000000e+00 1.000000e+03 0.000000
22 0.000000e+00 1000.000000 4.819512e-01 4.819502e-01 0.000000e+00 1000.000000
23 1.000000e+03 0.000000 3.470233e-01 0.000000e+00 1.000000e+03 0.000000
24 1.890044e-13 216.066482 1.000000e+06 2.647129e-01 1.890044e-13 216.066482
25 0.000000e+00 1000.000000 7.581790e-01 1.499880e-01 0.000000e+00 1000.000000
26 0.000000e+00 1000.000000 5.931051e-01 8.834203e-02 0.000000e+00 1000.000000
27 1.000000e+03 0.000000 0.000000e+00 0.000000e+00 1.000000e+03 0.000000
28 0.000000e+00 1000.000000 9.152580e-01 0.000000e+00 0.000000e+00 1000.000000
29 8.050000e+02 0.000000 3.562025e-01 0.000000e+00 8.050000e+02 0.000000
30 0.000000e+00 1000.000000 4.023107e-01 1.000000e+06 0.000000e+00 1000.000000
31 1.000000e+03 0.000000 4.495349e-01 0.000000e+00 1.000000e+03 0.000000
32 9.025000e+02 0.000000 7.346889e-01 0.000000e+00 9.025000e+02 0.000000
33 0.000000e+00 1000.000000 9.393563e-01 9.393543e-01 0.000000e+00 1000.000000
34 1.000000e+03 0.000000 8.192541e-01 0.000000e+00 1.000000e+03 0.000000
35 0.000000e+00 1000.000000 4.557418e-01 7.916343e-02 0.000000e+00 1000.000000
36 0.000000e+00 1000.000000 1.523515e-01 1.000000e+06 0.000000e+00 1000.000000
37 1.000000e+03 0.000000 5.690975e-01 5.690965e-01 1.000000e+03 0.000000
38 5.125000e+02 0.000000 5.343337e-01 0.000000e+00 5.125000e+02 0.000000
39 0.000000e+00 1000.000000 7.018872e-01 7.018852e-01 0.000000e+00 1000.000000
40 1.000000e+03 0.000000 3.534662e-01 0.000000e+00 1.000000e+03 0.000000
41 0.000000e+00 1000.000000 9.564798e-01 1.583405e-02 0.000000e+00 1000.000000
42 0.000000e+00 1000.000000 5.455405e-01 5.455385e-01 0.000000e+00 1000.000000
43 9.025000e+02 0.000000 4.851630e-01 0.000000e+00 9.025000e+02 0.000000
44 0.000000e+00 1000.000000 8.337567e-01 8.337547e-01 0.000000e+00 1000.000000
45 1.000000e+03 0.000000 7.589748e-01 0.000000e+00 1.000000e+03 0.000000
46 1.000000e+03 0.000000 6.131428e-01 0.000000e+00 1.000000e+03 0.000000
47 0.000000e+00 0.000000 6.833991e-01 0.000000e+00 0.000000e+00 0.000000
[16]:
res.columns
[16]:
Index(['storage_discharge_max', 'charge_lo', 'soe_lo',
       'export_limit_at_coupling', 'soe_mean', 'nominal_hvac_load',
       'pre_hvac_total_output', 'negative_rtm_base_point', 'rtm_base_point',
       'dam_discharge_offer_quantity', 'discharge_actual', 'total_output',
       'soe_hi', 'output', 'dam_charge_offer_quantity', 'charge',
       'pre_hvac_output', 'charge_hi', 'soe_actual',
       'dam_discharge_offer_price', 'discharge_efficiency', 'discharge',
       'battery_output', 'charge_actual', 'discharge_lo',
       'import_limit_at_coupling', 'internal_energy', 'internal_energy_max',
       'charge_efficiency', 'dam_charge_offer_price', 'rtm_charge',
       'discharge_hi', 'hvac_load', 'rtm_discharge', 'pre_hvac_battery_output',
       'soe_lo_hb'],
      dtype='object')
[ ]: