Skip to content
Snippets Groups Projects
Commit 6d587371 authored by Zizhe Wang's avatar Zizhe Wang
Browse files

refactor configuration

parent d0ba7175
No related branches found
No related tags found
No related merge requests found
# (c) Zizhe Wang
# Copyright (c) 2024 - Zizhe Wang
# https://zizhe.wang
######################################
......@@ -7,47 +7,37 @@
# #
######################################
# Be sure to only edit your setups in global settings!!!
# Don't modify the code outside of it !!!
import os
# Basic settings
MODEL_NAME = "SimpleHeatingSystem"
MODEL_FILE = f"{MODEL_NAME}.mo"
import json
# Load configuration from JSON file
CONFIG_FILE = 'config.json'
with open(CONFIG_FILE, 'r') as f:
config = json.load(f)
# Assign configuration variables
MODEL_NAME = config['MODEL_NAME']
MODEL_FILE = config['MODEL_FILE']
SIMULATION_STOP_TIME = config['SIMULATION_STOP_TIME']
PARAMETERS = config['PARAMETERS']
OBJECTIVES = config['OBJECTIVES']
MAXIMIZE = config['MAXIMIZE']
PARAM_BOUNDS = config['PARAM_BOUNDS']
PRECISION = config['PRECISION']
OPTIMIZATION_CONFIG = config['OPTIMIZATION_CONFIG']
PLOT_CONFIG = config['PLOT_CONFIG']
N_JOBS = config['N_JOBS']
# Derived configuration
MODEL_PATH = os.path.join(os.getcwd(), MODEL_FILE)
SIMULATION_STOP_TIME = 3000 # in seconds
# Parameters to be varied and objectives to be optimized
PARAMETERS = ["Q_max", "T_set"]
OBJECTIVES = ["energy", "comfort"]
MAXIMIZE = ["comfort"] # List of objectives to maximize
# Parameter range
PARAM_BOUNDS = {
"Q_max": (1000, 5000),
"T_set": (280, 310),
}
# Results precision
PRECISION = 2 # decimal places
# Optimization settings
OPTIMIZATION_CONFIG = {
"ALGORITHM_NAME": 'NSGA2', # Algorithm selection
"POP_SIZE": 100, # Population size for algorithm
"N_GEN": 50 # Number of generations
}
# Plot configurations
PLOT_CONFIG = {
"PLOT_X": "Energy Consumption",
"PLOT_Y": "Comfort",
"PLOT_TITLE": "Pareto Front of Energy Consumption vs Comfort"
}
# Parallel processing
N_JOBS = -1 # Options: '-1', '1', 'n', 'None'
# "PARAMETERS": Parameters to be varied
# "OBJECTIVES": Objectives to be optimized
# "MAXIMIZE": Objectives to be maximized
# "PARAM_BOUNDS": Parameter range
# "PRECISION": Results precision (decimal places)
# "N_JOBS": Parallel processing
# Options: '-1', '1', 'n', 'None'
# ====================================================================
# -1 = use all available CPU cores
# 1 = disables parallel processing and runs the tasks sequentially
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment