MEOS/main.py
Lucas Tan 8125583313 wip load profile engine
generating reasonably realistic load profiles
2025-07-15 16:56:39 +01:00

39 lines
1.2 KiB
Python

import yaml
from Utilities.Time import get_start_time
from Utilities.LoadProfile import get_load_profiles
import matplotlib.pyplot as pl
import pandas as pd
# read config file
c = yaml.safe_load(open("YAMLs/config.yml"))
## simulation time setup
# get current time
c["sim_start_time"] = get_start_time()
# get time step in minutes, then convert to seconds
dt = c["sim_time"]["time_step_minutes"] * 60
# compute end time based on duration in days
duration = c["sim_time"]["duration_days"] * 24 * 60 * 60
c["sim_end_time"] = c["sim_start_time"] + duration
# batch process hours in seconds
c["sim_time"]["batch_process_seconds"] = c["sim_time"]["batch_process_hours"] * 60 * 60
# load site info
c["site_info"] = yaml.safe_load(open(c["paths"]["site_info"]))
cumulative_load_profiles = pd.DataFrame()
# loop through timesteps
for i in range(
c["sim_start_time"], c["sim_end_time"], c["sim_time"]["batch_process_seconds"]
):
# generate load profiles
load_profiles = get_load_profiles(
c, dt, c["sim_start_time"], c["sim_time"]["batch_process_seconds"]
)
# add to cumulative load profiles
cumulative_load_profiles = pd.concat([cumulative_load_profiles, load_profiles], axis=1