switch_model/generators/extensions/storage.py
def post_solve(instance, outdir):
    """
    Export storage build information to storage_builds.csv,
    storage capacity to storage_capacity.csv, and storage
    dispatch info to storage_dispatch.csv
    """
    import switch_model.reporting as reporting
    # Write how much is built each build year for each project to storage_builds.csv
    reporting.write_table(
        instance, instance.STORAGE_GEN_BLD_YRS,
        output_file=os.path.join(outdir, "storage_builds.csv"),
        headings=("generation_project", "build_year", "load_zone",
                  "IncrementalPowerCapacityMW", "IncrementalEnergyCapacityMWh"),
        values=lambda m, g, bld_yr: (
            g, bld_yr, m.gen_load_zone[g],
            m.BuildGen[g, bld_yr], m.BuildStorageEnergy[g, bld_yr],
            ))
    # Write the total capacity for each project at each period to storage_capacity.csv
    reporting.write_table(
        instance, instance.STORAGE_GEN_PERIODS,
        output_file=os.path.join(outdir, "storage_capacity.csv"),
        headings=("generation_project", "period", "load_zone",
                  "OnlinePowerCapacityMW", "OnlineEnergyCapacityMWh"),
        values=lambda m, g, p: (
            g, p, m.gen_load_zone[g],
            m.GenCapacity[g, p], m.StorageEnergyCapacity[g, p])
    )
    # Write how much is dispatched by each project at each time point to storage_dispatch.csv
    reporting.write_table(
        instance, instance.STORAGE_GEN_TPS,
        output_file=os.path.join(outdir, "storage_dispatch.csv"),
        # TODO renaming heading to timestamp (and update graphing accordingly)
        headings=("generation_project", "timepoint", "load_zone",
                  "ChargeMW", "DischargeMW", "StateOfCharge"),
        values=lambda m, g, t: (
            g, m.tp_timestamp[t], m.gen_load_zone[g],
            m.ChargeStorage[g, t], m.DispatchGen[g, t],
            m.StateOfCharge[g, t]
        ))

    Export storage build information to storage_builds.csv,
    storage capacity to storage_capacity.csv, and storage
    dispatch info to storage_dispatch.csv
    
Export storage build information to storage_builds.csv,
storage capacity to storage_capacity.csv, and storage
dispatch info to storage_dispatch.csv
Export storage build information to storage_builds . csv storage capacity to storage_capacity . csv and storage dispatch info to storage_dispatch . csv
def post_solve(instance, outdir):
    import switch_model.reporting as reporting
    reporting.write_table(
        instance, instance.STORAGE_GEN_BLD_YRS,
        output_file=os.path.join(outdir, "storage_builds.csv"),
        headings=("generation_project", "build_year", "load_zone",
                  "IncrementalPowerCapacityMW", "IncrementalEnergyCapacityMWh"),
        values=lambda m, g, bld_yr: (
            g, bld_yr, m.gen_load_zone[g],
            m.BuildGen[g, bld_yr], m.BuildStorageEnergy[g, bld_yr],
            ))
    reporting.write_table(
        instance, instance.STORAGE_GEN_PERIODS,
        output_file=os.path.join(outdir, "storage_capacity.csv"),
        headings=("generation_project", "period", "load_zone",
                  "OnlinePowerCapacityMW", "OnlineEnergyCapacityMWh"),
        values=lambda m, g, p: (
            g, p, m.gen_load_zone[g],
            m.GenCapacity[g, p], m.StorageEnergyCapacity[g, p])
    )
    reporting.write_table(
        instance, instance.STORAGE_GEN_TPS,
        output_file=os.path.join(outdir, "storage_dispatch.csv"),
        headings=("generation_project", "timepoint", "load_zone",
                  "ChargeMW", "DischargeMW", "StateOfCharge"),
        values=lambda m, g, t: (
            g, m.tp_timestamp[t], m.gen_load_zone[g],
            m.ChargeStorage[g, t], m.DispatchGen[g, t],
            m.StateOfCharge[g, t]
        ))
def post_solve ( instance , outdir ) : import switch_model . reporting as reporting reporting . write_table ( instance , instance . STORAGE_GEN_BLD_YRS , output_file = os . path . join ( outdir , "storage_builds.csv" ) , headings = ( "generation_project" , "build_year" , "load_zone" , "IncrementalPowerCapacityMW" , "IncrementalEnergyCapacityMWh" ) , values = lambda m , g , bld_yr : ( g , bld_yr , m . gen_load_zone [ g ] , m . BuildGen [ g , bld_yr ] , m . BuildStorageEnergy [ g , bld_yr ] , ) ) reporting . write_table ( instance , instance . STORAGE_GEN_PERIODS , output_file = os . path . join ( outdir , "storage_capacity.csv" ) , headings = ( "generation_project" , "period" , "load_zone" , "OnlinePowerCapacityMW" , "OnlineEnergyCapacityMWh" ) , values = lambda m , g , p : ( g , p , m . gen_load_zone [ g ] , m . GenCapacity [ g , p ] , m . StorageEnergyCapacity [ g , p ] ) ) reporting . write_table ( instance , instance . STORAGE_GEN_TPS , output_file = os . path . join ( outdir , "storage_dispatch.csv" ) , headings = ( "generation_project" , "timepoint" , "load_zone" , "ChargeMW" , "DischargeMW" , "StateOfCharge" ) , values = lambda m , g , t : ( g , m . tp_timestamp [ t ] , m . gen_load_zone [ g ] , m . ChargeStorage [ g , t ] , m . DispatchGen [ g , t ] , m . StateOfCharge [ g , t ] ) )
Export storage build information to storage_builds.csv,
storage capacity to storage_capacity.csv, and storage
dispatch info to storage_dispatch.csv
Export storage build information to storage_builds . csv storage capacity to storage_capacity . csv and storage dispatch info to storage_dispatch . csv
"""
    Export storage build information to storage_builds.csv,
    storage capacity to storage_capacity.csv, and storage
    dispatch info to storage_dispatch.csv
    """ # Write how much is built each build year for each project to storage_builds.csv # Write the total capacity for each project at each period to storage_capacity.csv # Write how much is dispatched by each project at each time point to storage_dispatch.csv # TODO renaming heading to timestamp (and update graphing accordingly)
instance
outdir