Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
962f526
Ajout test_thermal_reserve_hausse
leosonvico Oct 14, 2024
6ebebe0
New test for reserves_heuristique
leosonvico Oct 15, 2024
72b56a6
Nouveau test_thermal_reserve_hausse
leosonvico Oct 15, 2024
d2a1f89
ajout fonction changemetn heuristique et réserves
leosonvico Oct 21, 2024
25c1455
Ajout heuristic pour contenir les nouvelles
leosonvico Oct 22, 2024
fdb2ab1
Heuristiques version opti sans vrai cout spillages
leosonvico Oct 22, 2024
ac2f3b5
Création heuristic.py avec plusieurs heuristiques possibles
leosonvico Oct 23, 2024
e75336d
creation du cas deux clusters
leosonvico Oct 23, 2024
0210801
ajout d'un nouveau test avec valeur BP
leosonvico Oct 29, 2024
b0c6f8b
ajout thermique éteint sans changement heuristiques
leosonvico Nov 4, 2024
7b53437
Changement equation eteint et ajout spill reserve
leosonvico Nov 6, 2024
f1c9844
changement equation eteint reserves
leosonvico Nov 7, 2024
b493974
ajout problème plexos et reecriture sortie heuristiques
leosonvico Nov 12, 2024
aa262bd
Changement heuristique optimisations
leosonvico Nov 13, 2024
f2844b3
reecriture heuristiques et ajout 1cluster
leosonvico Nov 27, 2024
0947b42
Ajout data 2cluster3res et restructuration des heuristiques
leosonvico Dec 6, 2024
91828d4
ajout code pour tests BP
leosonvico Jan 16, 2025
6743c93
nouveau_push
leosonvico Jan 22, 2025
5e283bb
changement_structure_tests_bp
leosonvico Feb 3, 2025
00f9cc9
Dernier ajout stage
leosonvico Mar 12, 2025
baa447e
commit avant nettoyage
leosonvico Mar 14, 2025
ed613c7
nettoyage code
leosonvico Mar 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/andromede/simulation/optimization.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,12 +836,13 @@ def build_problem(
*,
problem_name: str = "optimization_problem",
border_management: BlockBorderManagement = BlockBorderManagement.CYCLE,
solver_id: str = "SCIP",
solver_id: str = "XPRESS_LP",
problem_strategy: ModelSelectionStrategy = MergedProblemStrategy(),
) -> OptimizationProblem:
"""
Entry point to build the optimization problem for a time period.
"""

solver: lp.Solver = lp.Solver.CreateSolver(solver_id)

database.requirements_consistency(network)
Expand Down
6 changes: 5 additions & 1 deletion src/andromede/thermal_heuristic/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,11 @@ def __init__(self, initial_model: Model) -> None:
class HeuristicAccurateModelBuilder(ModelEditor):
def __init__(self, initial_model: Model) -> None:
super().__init__(initial_model)
generation_variable = ["generation"]
generation_variable = ["energy_generation","generation_reserve_up_primary_on","generation_reserve_up_primary_off",
"generation_reserve_down_primary","generation_reserve_up_secondary_on","generation_reserve_up_secondary_off",
"generation_reserve_down_secondary","generation_reserve_up_tertiary1_on","generation_reserve_up_tertiary1_off",
"generation_reserve_down_tertiary1","generation_reserve_up_tertiary2_on","generation_reserve_up_tertiary2_off",
"generation_reserve_down_tertiary2","nb_off_primary","nb_off_secondary","nb_off_tertiary1","nb_off_tertiary2"]

THERMAL_CLUSTER_MODEL_ACCURATE_HEURISTIC = model(
id=self.initial_model.id,
Expand Down
82 changes: 60 additions & 22 deletions src/andromede/thermal_heuristic/problem.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,45 +71,83 @@ def update_database_heuristic(
output: OutputValues,
index: BlockScenarioIndex,
list_cluster_id: List[str],
param_to_update: str,
var_to_read: str,
param_to_update: List[List[str]],
var_to_read: List[str],
fn_to_apply: Callable,
param_needed_to_compute: Optional[List[str]] = None,
param_node_needed_to_compute : Optional[List[str]] = None,
version: Optional[str] = None,
option: Optional[str] = None,
bonus: Optional[str] = None,
) -> None:
for cluster in list_cluster_id:
if (
ComponentParameterIndex(cluster, param_to_update)
not in self.database.__dict__.keys()
):
self.database.add_data(cluster, param_to_update, ConstantData(0))
self.database.convert_to_time_scenario_series_data(
ComponentParameterIndex(cluster, param_to_update),
self.time_scenario_hour_parameter.hour
* self.time_scenario_hour_parameter.week,
self.time_scenario_hour_parameter.scenario,
)

sol = output.component(cluster).var(var_to_read).value[0] # type:ignore
for list_param_update in param_to_update:
for param_update in list_param_update:
if (
ComponentParameterIndex(cluster, param_update)
not in self.database.__dict__.keys()
):
self.database.add_data(cluster, param_update, ConstantData(0))
self.database.convert_to_time_scenario_series_data(
ComponentParameterIndex(cluster, param_update),
self.time_scenario_hour_parameter.hour
* self.time_scenario_hour_parameter.week,
self.time_scenario_hour_parameter.scenario,
)
sol = {}
for variable in var_to_read:
sol[variable] = output.component(cluster).var(variable).value[0] # type:ignore

param = {}
if param_needed_to_compute is not None:
for p in param_needed_to_compute:
param[p] = [
sol[p] = [
self.database.get_value(
ComponentParameterIndex(cluster, p),
t,
index.scenario,
)
for t in timesteps(index, self.time_scenario_hour_parameter)
]
if param_node_needed_to_compute is not None:
list_connections = self.network._connections
print(list_connections)
node = None
for connection in list_connections:
if connection.port1.component.id == cluster:
node = connection.port2.component.id
if connection.port2.component.id == cluster:
node = connection.port1.component.id
for p in param_node_needed_to_compute:
sol[p] = [self.database.get_data(node,p).value
for t in timesteps(index, self.time_scenario_hour_parameter)]

if version is not None:
if option is not None:
result_heuristic = fn_to_apply([i for i, t in enumerate(timesteps(index, self.time_scenario_hour_parameter))],
sol,version,option,bonus)
else:
result_heuristic = fn_to_apply([i for i, t in enumerate(timesteps(index, self.time_scenario_hour_parameter))],
sol,version)
elif option is not None:
result_heuristic = fn_to_apply([i for i, t in enumerate(timesteps(index, self.time_scenario_hour_parameter))],
sol,option,bonus)
else:
result_heuristic = fn_to_apply( [i for i, t in enumerate(timesteps(index, self.time_scenario_hour_parameter))],
sol)

for i, t in enumerate(timesteps(index, self.time_scenario_hour_parameter)):
self.database.set_value(
ComponentParameterIndex(cluster, param_to_update),
fn_to_apply(sol[i], *[p[i] for p in param.values()]), # type:ignore
t,
index.scenario,
)
results_heuristic = result_heuristic[i]
for p,list_param_update in enumerate(param_to_update):
for param_update in list_param_update:
self.database.set_value(
ComponentParameterIndex(cluster, param_update),
results_heuristic[p], # type:ignore
t,
index.scenario,
)



def heuristic_resolution_step(
self,
Expand Down
Loading
Loading