<reponame>apalomES/plug<gh_stars>0
from uuid import uuid4

from powersimdata import Scenario

scenario = Scenario()
print(scenario.state.name)

scenario.set_grid(interconnect="Texas")

scenario.set_name("test", "comp_" + str(uuid4()))
scenario.set_time("2016-01-01 00:00:00", "2016-01-01 03:00:00", "1H")

scenario.set_base_profile("demand", "vJan2021")
scenario.set_base_profile("hydro", "vJan2021")
scenario.set_base_profile("solar", "vJan2021")
scenario.set_base_profile("wind", "vJan2021")


scenario.change_table.ct = {
    "ng": {
        "zone_id": {
            301: 0.9335236224644795,
            302: 1.0333898171154643,
            303: 0.8571428571428572,
            304: 0.9147922682213607,
            305: 1.0875509750330794,
            306: 0.7056654770933735,
            307: 0.8070167506838167,
            308: 1.2989804301171135,
        },
        "plant_id": {13033: 0, 13266: 0, 13271: 0, 13272: 0},
    },
    "wind": {
        "zone_id": {
            301: 1.1293320940114195,
            302: 2.2996731828360466,
            303: 1.1460693669609412,
            304: 1.5378918905751389,
            305: 1.6606575751914816,
        },
        "plant_id": {12912: 0},
    },
    "solar": {
        "zone_id": {
            301: 1.6497354497354497,
            303: 9.965517241379311,
            306: 1.4309500489715965,
            307: 0.6303534303534303,
            308: 0.37341772151898733,
        }
    },
    "coal": {
        "zone_id": {
            302: 0.0,
            304: 0.8484061967718387,
            305: 0.9102977061981454,
            306: 2.260960124024402,
            307: 5.486687036228721,
            308: 1.244369937993577,
        },
        "plant_id": {
            13170: 0,
            13171: 0,
            13395: 0,
            13396: 0,
            13409: 0,
            13410: 0,
            13411: 0,
        },
    },
    "hydro": {
        "zone_id": {
            302: 1.125,
            303: 0.4949567723342939,
            304: 2.0723684210526314,
            305: 0.8779069767441859,
            306: 1.0100376411543288,
        }
    },
    "nuclear": {"zone_id": {305: 1.0123456790123457, 307: 0.9451377095178322}},
    "new_plant": [
        {
            "bus_id": 3007104,
            "Pmax": 277,
            "type": "ng",
            "c0": 1365,
            "c1": 24,
            "c2": 0.00124,
            "Pmin": 0,
        },
        {
            "bus_id": 3004056,
            "Pmax": 150,
            "type": "ng",
            "c0": 1365,
            "c1": 24,
            "c2": 0.00124,
            "Pmin": 0,
        },
        {
            "bus_id": 3008097,
            "Pmax": 100,
            "type": "other",
            "c0": 0,
            "c1": 0,
            "c2": 0,
            "Pmin": 0,
        },
        {
            "bus_id": 3002079,
            "type": "solar",
            "Pmax": 454,
            "Pmin": 0,
            "plant_id_neighbor": 14000,
        },
        {
            "bus_id": 3002130,
            "type": "solar",
            "Pmax": 189,
            "Pmin": 0,
            "plant_id_neighbor": 14006,
        },
        {
            "bus_id": 3004197,
            "type": "solar",
            "Pmax": 17.3,
            "Pmin": 0,
            "plant_id_neighbor": 13237,
        },
        {
            "bus_id": 3005377,
            "type": "solar",
            "Pmax": 81.8,
            "Pmin": 0,
            "plant_id_neighbor": 13161,
        },
        {
            "bus_id": 3007261,
            "type": "wind",
            "Pmax": 220,
            "Pmin": 0,
            "plant_id_neighbor": 13042,
        },
    ],
    "branch": {
        "branch_id": {
            101015: 1.4632275132275132,
            101388: 2.77443536296368,
            102720: 1.0714268651011682,
            102724: 1.2878188476770431,
            101061: 1.1221224283420168,
            101073: 1.1064509996877934,
            101115: 1.614508643453941,
            101135: 1.8684227740089265,
            101139: 1.4007881119103172,
            101147: 1.3893613551221164,
            101152: 1.0935968044543969,
            101157: 1.3741440903124618,
            101166: 1.8625941328537707,
            101169: 1.1208781587528398,
            101274: 1.2044964191072227,
            101312: 1.0845454872992843,
            101313: 1.2817355758991542,
            101320: 1.23111915644994,
            101352: 1.1292883444424753,
            101353: 1.0476530424345853,
            103717: 1.2,
            103534: 2,
            103896: 1.1,
            103897: 1.1,
            103898: 1.1,
            103827: 2,
            100916: 2,
            100918: 2,
            100923: 2,
            100926: 2,
            100928: 2,
            100947: 2,
            100949: 3,
            100952: 2,
            100954: 2,
            100957: 2,
            100972: 2,
            100973: 2,
            100979: 2,
            101000: 2,
            101003: 2,
            101004: 2,
            101018: 2,
            101363: 2,
        }
    },
    "demand": {
        "zone_id": {
            301: 1.0867,
            302: 1.0867,
            303: 1.0867,
            304: 1.0867,
            305: 1.0867,
            306: 1.0867,
            307: 1.0867,
            308: 1.0867,
        }
    },
}

grid = scenario.get_grid()
ct = scenario.get_ct()

scenario.print_scenario_info()
scenario.create_scenario()

scenario.prepare_simulation_input()

resp = scenario.launch_simulation(solver="glpk")
scenario.check_progress()

from uuid import uuid4

from powersimdata import Scenario

scenario = Scenario()
print(scenario.state.name)

scenario.set_grid(interconnect="Texas")

scenario.set_name("test", "comp_" + str(uuid4()))
scenario.set_time("2016-01-01 00:00:00", "2016-01-01 03:00:00", "1H")

scenario.set_base_profile("demand", "vJan2021")
scenario.set_base_profile("hydro", "vJan2021")
scenario.set_base_profile("solar", "vJan2021")
scenario.set_base_profile("wind", "vJan2021")


scenario.change_table.ct = {
    "ng": {
        "zone_id": {
            301: 0.9335236224644795,
            302: 1.0333898171154643,
            303: 0.8571428571428572,
            304: 0.9147922682213607,
            305: 1.0875509750330794,
            306: 0.7056654770933735,
            307: 0.8070167506838167,
            308: 1.2989804301171135,
        },
        "plant_id": {13033: 0, 13266: 0, 13271: 0, 13272: 0},
    },
    "wind": {
        "zone_id": {
            301: 1.1293320940114195,
            302: 2.2996731828360466,
            303: 1.1460693669609412,
            304: 1.5378918905751389,
            305: 1.6606575751914816,
        },
        "plant_id": {12912: 0},
    },
    "solar": {
        "zone_id": {
            301: 1.6497354497354497,
            303: 9.965517241379311,
            306: 1.4309500489715965,
            307: 0.6303534303534303,
            308: 0.37341772151898733,
        }
    },
    "coal": {
        "zone_id": {
            302: 0.0,
            304: 0.8484061967718387,
            305: 0.9102977061981454,
            306: 2.260960124024402,
            307: 5.486687036228721,
            308: 1.244369937993577,
        },
        "plant_id": {
            13170: 0,
            13171: 0,
            13395: 0,
            13396: 0,
            13409: 0,
            13410: 0,
            13411: 0,
        },
    },
    "hydro": {
        "zone_id": {
            302: 1.125,
            303: 0.4949567723342939,
            304: 2.0723684210526314,
            305: 0.8779069767441859,
            306: 1.0100376411543288,
        }
    },
    "nuclear": {"zone_id": {305: 1.0123456790123457, 307: 0.9451377095178322}},
    "new_plant": [
        {
            "bus_id": 3007104,
            "Pmax": 277,
            "type": "ng",
            "c0": 1365,
            "c1": 24,
            "c2": 0.00124,
            "Pmin": 0,
        },
        {
            "bus_id": 3004056,
            "Pmax": 150,
            "type": "ng",
            "c0": 1365,
            "c1": 24,
            "c2": 0.00124,
            "Pmin": 0,
        },
        {
            "bus_id": 3008097,
            "Pmax": 100,
            "type": "other",
            "c0": 0,
            "c1": 0,
            "c2": 0,
            "Pmin": 0,
        },
        {
            "bus_id": 3002079,
            "type": "solar",
            "Pmax": 454,
            "Pmin": 0,
            "plant_id_neighbor": 14000,
        },
        {
            "bus_id": 3002130,
            "type": "solar",
            "Pmax": 189,
            "Pmin": 0,
            "plant_id_neighbor": 14006,
        },
        {
            "bus_id": 3004197,
            "type": "solar",
            "Pmax": 17.3,
            "Pmin": 0,
            "plant_id_neighbor": 13237,
        },
        {
            "bus_id": 3005377,
            "type": "solar",
            "Pmax": 81.8,
            "Pmin": 0,
            "plant_id_neighbor": 13161,
        },
        {
            "bus_id": 3007261,
            "type": "wind",
            "Pmax": 220,
            "Pmin": 0,
            "plant_id_neighbor": 13042,
        },
    ],
    "branch": {
        "branch_id": {
            101015: 1.4632275132275132,
            101388: 2.77443536296368,
            102720: 1.0714268651011682,
            102724: 1.2878188476770431,
            101061: 1.1221224283420168,
            101073: 1.1064509996877934,
            101115: 1.614508643453941,
            101135: 1.8684227740089265,
            101139: 1.4007881119103172,
            101147: 1.3893613551221164,
            101152: 1.0935968044543969,
            101157: 1.3741440903124618,
            101166: 1.8625941328537707,
            101169: 1.1208781587528398,
            101274: 1.2044964191072227,
            101312: 1.0845454872992843,
            101313: 1.2817355758991542,
            101320: 1.23111915644994,
            101352: 1.1292883444424753,
            101353: 1.0476530424345853,
            103717: 1.2,
            103534: 2,
            103896: 1.1,
            103897: 1.1,
            103898: 1.1,
            103827: 2,
            100916: 2,
            100918: 2,
            100923: 2,
            100926: 2,
            100928: 2,
            100947: 2,
            100949: 3,
            100952: 2,
            100954: 2,
            100957: 2,
            100972: 2,
            100973: 2,
            100979: 2,
            101000: 2,
            101003: 2,
            101004: 2,
            101018: 2,
            101363: 2,
        }
    },
    "demand": {
        "zone_id": {
            301: 1.0867,
            302: 1.0867,
            303: 1.0867,
            304: 1.0867,
            305: 1.0867,
            306: 1.0867,
            307: 1.0867,
            308: 1.0867,
        }
    },
}

grid = scenario.get_grid()
ct = scenario.get_ct()

scenario.print_scenario_info()
scenario.create_scenario()

scenario.prepare_simulation_input()

resp = scenario.launch_simulation(solver="glpk")
scenario.check_progress()