Standalone with Detailed Downstream Modeling Example

[11]:
from generation_models import StandaloneStorageModel, ACLosses, BaseSystemDesign, DownstreamSystem, MultiStorageInputs, BatteryParams, DARTPrices, Transformer
from tyba_client.client import Client
import numpy as np
import pandas as pd
import os
[3]:
client = Client(os.environ["TYBA_PAT"])

Build model, including DownstreamSystem

[12]:
model = StandaloneStorageModel(
    energy_prices=DARTPrices(
        dam=np.random.random(720).tolist(),
        rtm=np.random.random(720).tolist(),
    ),
    storage_inputs=MultiStorageInputs(
        batteries=[BatteryParams(
            power_capacity=2e3,
            energy_capacity=4e3 / 0.95,
            discharge_efficiency=0.95,
            charge_efficiency=0.05,
            degradation_rate=0.04,
        )],
    ),
    downstream_system=DownstreamSystem(
        losses=ACLosses(
            ac_wiring=0.015,
            transmission=0.012,
            mv_transformer=Transformer(load_loss=0.01, no_load_loss=0.003),
            hv_transformer=Transformer(load_loss=0.009, no_load_loss=0.004),
        ),
        system_design=BaseSystemDesign(dc_capacity=2e3, ac_capacity=2.5e3, poi_limit=2e3),
        model_losses_from="DC",
        inverter="SMA America: SWR2500U [240V]",
    ),
    project_term=720,
    project_term_units="hours",
)

Run model

[13]:
resp = client.schedule(model)
[15]:
id_ = resp.json()["id"]
[17]:
res = client.wait_on_result(id_)

Check out results

[25]:
res.keys()
[25]:
dict_keys(['system', 'optimizer_outputs', 'market_awards'])
[19]:
system, optimizer, awards = (pd.DataFrame(v) for v in res.values())
[22]:
system  # analogous to the usual solar_storage
[22]:
hv_xfmr_no_load_loss gen gross_ac_power positive_poi mv_xfmr_load_loss dc_power inverter_consumption_loss poi hv_ac_power transmission_loss hv_xfmr_load_loss negative_poi dc_voltage hv_xfmr_loss inverter_tare_loss transformer_loss inverter_parasitic_loss mv_xfmr_loss inverter_clipping_loss poi_unadjusted inverter_efficiency pre_hvac_ac_power ac_power max_mv_power mv_xfmr_no_load_loss ac_wiring_loss
0 8.0 -8.00000 -0.750000 0.00000 0.000003 0.0 0.000000 -8.00000 -8.000000 0.000000 0.000000 -8.00000 0.0 8.000000 0.75 8.000000 0.75 6.000003 0.0 -8.00000 0.000000 0.0 0.0 1842.991784 6.0 0.000
1 8.0 -8.00000 -0.750000 0.00000 0.000003 0.0 0.000000 -8.00000 -8.000000 0.000000 0.000000 -8.00000 0.0 8.000000 0.75 8.000000 0.75 6.000003 0.0 -8.00000 0.000000 0.0 0.0 1842.991784 6.0 0.000
2 8.0 -8.00000 -0.750000 0.00000 0.000003 0.0 0.000000 -8.00000 -8.000000 0.000000 0.000000 -8.00000 0.0 8.000000 0.75 8.000000 0.75 6.000003 0.0 -8.00000 0.000000 0.0 0.0 1842.991784 6.0 0.000
3 8.0 -8.00000 -0.750000 0.00000 0.000003 0.0 0.000000 -8.00000 -8.000000 0.000000 0.000000 -8.00000 0.0 8.000000 0.75 8.000000 0.75 6.000003 0.0 -8.00000 0.000000 0.0 0.0 1842.991784 6.0 0.000
4 8.0 -8.00000 -0.750000 0.00000 0.000003 0.0 0.000000 -8.00000 -8.000000 0.000000 0.000000 -8.00000 0.0 8.000000 0.75 8.000000 0.75 6.000003 0.0 -8.00000 0.000000 0.0 0.0 1842.991784 6.0 0.000
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
715 8.0 -8.00000 -0.750000 0.00000 0.000003 0.0 0.000000 -8.00000 -8.000000 0.000000 0.000000 -8.00000 0.0 8.000000 0.75 8.000000 0.75 6.000003 0.0 -8.00000 0.000000 0.0 0.0 1842.991784 6.0 0.000
716 8.0 -2056.54405 -2143.152745 0.00000 22.965518 -2000.0 5.630538 -2056.54405 -2056.544050 0.000000 18.544050 -2056.54405 300.0 26.544050 0.00 26.544050 0.00 28.965518 0.0 -2056.54405 0.933205 -2000.0 -2000.0 1842.991784 6.0 30.000
717 8.0 84.50917 70.482314 84.50917 0.024839 95.0 20.973224 84.50917 85.535597 1.026427 0.039403 0.00000 300.0 8.039403 0.00 8.039403 0.00 6.024839 0.0 84.50917 0.741919 95.0 95.0 1842.991784 6.0 1.425
718 8.0 -8.00000 -0.750000 0.00000 0.000003 0.0 0.000000 -8.00000 -8.000000 0.000000 0.000000 -8.00000 0.0 8.000000 0.75 8.000000 0.75 6.000003 0.0 -8.00000 0.000000 0.0 0.0 1842.991784 6.0 0.000
719 8.0 -8.00000 -0.750000 0.00000 0.000003 0.0 0.000000 -8.00000 -8.000000 0.000000 0.000000 -8.00000 0.0 8.000000 0.75 8.000000 0.75 6.000003 0.0 -8.00000 0.000000 0.0 0.0 1842.991784 6.0 0.000

720 rows × 26 columns

[23]:
optimizer  # same as in hybrid
[23]:
storage_discharge_max charge_lo negative_dam_base_point soe_lo export_limit_at_coupling soe_mean nominal_hvac_load dam_price rtm_base_point discharge_actual total_output soe_hi output dam_charge charge charge_hi soe_actual discharge_efficiency discharge battery_output charge_actual discharge_lo import_limit_at_coupling dam_base_point internal_energy rtm_price internal_energy_max charge_efficiency dam_discharge rtm_charge discharge_hi hvac_load rtm_discharge soe_lo_hb
0 2000.0 0.0 0.0 0.0 None 0.0 0.0 0.140269 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.95 0.0 0.0 0.0 0.0 None 0.0 0.0 0.448188 4210.526316 0.05 0.0 0.0 0.0 0.0 0.0 0.0
1 2000.0 0.0 0.0 0.0 None 0.0 0.0 0.381499 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.95 0.0 0.0 0.0 0.0 None 0.0 0.0 0.986922 4210.526316 0.05 0.0 0.0 0.0 0.0 0.0 0.0
2 2000.0 0.0 0.0 0.0 None 0.0 0.0 0.973503 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.95 0.0 0.0 0.0 0.0 None 0.0 0.0 0.532283 4210.526316 0.05 0.0 0.0 0.0 0.0 0.0 0.0
3 2000.0 0.0 0.0 0.0 None 0.0 0.0 0.309717 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.95 0.0 0.0 0.0 0.0 None 0.0 0.0 0.514577 4210.526316 0.05 0.0 0.0 0.0 0.0 0.0 0.0
4 2000.0 0.0 0.0 0.0 None 0.0 0.0 0.528634 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.95 0.0 0.0 0.0 0.0 None 0.0 0.0 0.681771 4210.526316 0.05 0.0 0.0 0.0 0.0 0.0 0.0
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
715 2000.0 0.0 0.0 0.0 None 0.0 0.0 0.914586 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.95 0.0 0.0 0.0 0.0 None 0.0 0.0 0.729848 4210.089534 0.05 0.0 0.0 0.0 0.0 0.0 0.0
716 2000.0 2000.0 2000.0 100.0 None 50.0 0.0 0.016358 -2000.0 0.0 -2000.0 100.0 -2000.0 2000.0 2000.0 2000.0 100.0 0.95 0.0 -2000.0 2000.0 0.0 None -2000.0 100.0 0.797364 4210.089534 0.05 0.0 2000.0 0.0 0.0 0.0 0.0
717 2000.0 0.0 -95.0 0.0 None 50.0 0.0 0.662193 95.0 95.0 95.0 0.0 95.0 0.0 0.0 0.0 0.0 0.95 95.0 95.0 0.0 95.0 None 95.0 0.0 0.909171 4210.089534 0.05 95.0 0.0 95.0 0.0 95.0 100.0
718 2000.0 0.0 0.0 0.0 None 0.0 0.0 0.206303 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.95 0.0 0.0 0.0 0.0 None 0.0 0.0 0.947974 4210.089534 0.05 0.0 0.0 0.0 0.0 0.0 0.0
719 2000.0 0.0 0.0 0.0 None 0.0 0.0 0.134326 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.95 0.0 0.0 0.0 0.0 None 0.0 0.0 0.074833 4210.089534 0.05 0.0 0.0 0.0 0.0 0.0 0.0

720 rows × 34 columns

[24]:
awards  # optimizer results after offer correction
[24]:
negative_dam_base_point rtm_base_point rt_tare discharge_actual total_output dam_charge charge discharge charge_actual dam_base_point dam_discharge rtm_charge rtm_discharge
0 0.00000 0.00000 -8.0 0.0 0.00000 0.00000 0.00000 0.00000 0.0 0.00000 0.00000 0.00000 0.00000
1 0.00000 0.00000 -8.0 0.0 0.00000 0.00000 0.00000 0.00000 0.0 0.00000 0.00000 0.00000 0.00000
2 0.00000 0.00000 -8.0 0.0 0.00000 0.00000 0.00000 0.00000 0.0 0.00000 0.00000 0.00000 0.00000
3 0.00000 0.00000 -8.0 0.0 0.00000 0.00000 0.00000 0.00000 0.0 0.00000 0.00000 0.00000 0.00000
4 0.00000 0.00000 -8.0 0.0 0.00000 0.00000 0.00000 0.00000 0.0 0.00000 0.00000 0.00000 0.00000
... ... ... ... ... ... ... ... ... ... ... ... ... ...
715 0.00000 0.00000 -8.0 0.0 0.00000 0.00000 0.00000 0.00000 0.0 0.00000 0.00000 0.00000 0.00000
716 2056.54405 -2056.54405 0.0 0.0 -2056.54405 2056.54405 2056.54405 0.00000 2000.0 -2056.54405 0.00000 2056.54405 0.00000
717 -84.50917 84.50917 0.0 95.0 84.50917 0.00000 0.00000 84.50917 0.0 84.50917 84.50917 0.00000 84.50917
718 0.00000 0.00000 -8.0 0.0 0.00000 0.00000 0.00000 0.00000 0.0 0.00000 0.00000 0.00000 0.00000
719 0.00000 0.00000 -8.0 0.0 0.00000 0.00000 0.00000 0.00000 0.0 0.00000 0.00000 0.00000 0.00000

720 rows × 13 columns

[ ]: