@@ 1435-1470 (lines=36) @@ | ||
1432 | log.info("Profile share exported to DB!") |
|
1433 | ||
1434 | ||
1435 | def cts_heat(): |
|
1436 | """ |
|
1437 | Calculate cts electricity demand share of hvmv substation profile |
|
1438 | for buildings. |
|
1439 | """ |
|
1440 | log.info("Start logging!") |
|
1441 | with db.session_scope() as session: |
|
1442 | cells_query = session.query(CtsBuildings) |
|
1443 | ||
1444 | df_cts_buildings = pd.read_sql( |
|
1445 | cells_query.statement, cells_query.session.bind, index_col=None |
|
1446 | ) |
|
1447 | log.info("CTS buildings from DB imported!") |
|
1448 | ||
1449 | df_demand_share = pd.DataFrame() |
|
1450 | ||
1451 | for scenario in config.settings()["egon-data"]["--scenarios"]: |
|
1452 | df_demand_share_per_scenario = calc_building_demand_profile_share( |
|
1453 | df_cts_buildings, scenario=scenario, sector="heat" |
|
1454 | ) |
|
1455 | log.info(f"Profile share for {scenario} calculated!") |
|
1456 | ||
1457 | df_demand_share = pd.concat( |
|
1458 | [df_demand_share, df_demand_share_per_scenario], |
|
1459 | axis=0, |
|
1460 | ignore_index=True, |
|
1461 | ) |
|
1462 | ||
1463 | df_demand_share.rename(columns={"id": "building_id"}, inplace=True) |
|
1464 | ||
1465 | write_table_to_postgres( |
|
1466 | df_demand_share, |
|
1467 | EgonCtsHeatDemandBuildingShare, |
|
1468 | drop=True, |
|
1469 | ) |
|
1470 | log.info("Profile share exported to DB!") |
|
1471 | ||
1472 | ||
1473 | def get_cts_electricity_peak_load(): |
|
@@ 1397-1432 (lines=36) @@ | ||
1394 | log.info("CTS buildings exported to DB!") |
|
1395 | ||
1396 | ||
1397 | def cts_electricity(): |
|
1398 | """ |
|
1399 | Calculate cts electricity demand share of hvmv substation profile |
|
1400 | for buildings. |
|
1401 | """ |
|
1402 | log.info("Start logging!") |
|
1403 | with db.session_scope() as session: |
|
1404 | cells_query = session.query(CtsBuildings) |
|
1405 | ||
1406 | df_cts_buildings = pd.read_sql( |
|
1407 | cells_query.statement, cells_query.session.bind, index_col=None |
|
1408 | ) |
|
1409 | log.info("CTS buildings from DB imported!") |
|
1410 | ||
1411 | df_demand_share = pd.DataFrame() |
|
1412 | ||
1413 | for scenario in config.settings()["egon-data"]["--scenarios"]: |
|
1414 | df_demand_share_per_scenario = calc_building_demand_profile_share( |
|
1415 | df_cts_buildings, scenario=scenario, sector="electricity" |
|
1416 | ) |
|
1417 | log.info(f"Profile share for {scenario} calculated!") |
|
1418 | ||
1419 | df_demand_share = pd.concat( |
|
1420 | [df_demand_share, df_demand_share_per_scenario], |
|
1421 | axis=0, |
|
1422 | ignore_index=True, |
|
1423 | ) |
|
1424 | ||
1425 | df_demand_share.rename(columns={"id": "building_id"}, inplace=True) |
|
1426 | ||
1427 | write_table_to_postgres( |
|
1428 | df_demand_share, |
|
1429 | EgonCtsElectricityDemandBuildingShare, |
|
1430 | drop=True, |
|
1431 | ) |
|
1432 | log.info("Profile share exported to DB!") |
|
1433 | ||
1434 | ||
1435 | def cts_heat(): |