Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve modeler tests #2626

Merged
merged 5 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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/solver/modeler/loadFiles/readLibraries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ static Study::SystemModel::Library loadSingleLibrary(const fs::path& filePath)
}
catch (const std::runtime_error& e)
{
logs.error() << "Error while converting this library yaml: " << filePath;
logs.error() << "Error while converting this library yaml: " << filePath << ": "
<< e.what();
throw ErrorLoadingYaml(e.what());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,11 @@ Feature: 2.5 - Pure modeler simple studies, with no ports and no timeseries
And the optimal value of variable node2.gen1_p_0 is 500
And the optimal value of variable node2.gen1_up_0 is 1
And the optimal value of variable node2.gen2_p_0 is 500
And the optimal value of variable node2.gen2_up_0 is 1
And the optimal value of variable node2.gen2_up_0 is 1

Scenario: 2.5.4: Test with integer variable
Given the study path is "modeler/epic2/us2.5/study_2.5.4"
When I run antares modeler
Then the simulation succeeds
And the optimal value of variable node1.gen_total_p is 1000
And the optimal value of variable node1.gen_n_on is 4
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
library:
id: lib_example3
description: test model library

models:
- id: node_genCluster_oneLoad
description: A simple node with a generator cluster and one load, to test integer variables
parameters:
- id: load
time-dependent: false
scenario-dependent: false
- id: gen_max_p
time-dependent: false
scenario-dependent: false
- id: gen_min_p
time-dependent: false
scenario-dependent: false
- id: gen_cluster_size
time-dependent: false
scenario-dependent: false
- id: gen_prop_cost
time-dependent: false
scenario-dependent: false
- id: gen_fixed_cost
time-dependent: false
scenario-dependent: false
variables:
- id: gen_total_p
lower-bound: 0
upper-bound: gen_max_p * gen_cluster_size
variable-type: continuous
- id: gen_n_on
lower-bound: 0
upper-bound: gen_cluster_size
variable-type: integer
constraints:
- id: respect_min_p
expression: gen_total_p >= gen_n_on * gen_min_p
- id: respect_max_p
expression: gen_total_p <= gen_n_on * gen_max_p
- id: balance
expression: gen_total_p = load
objective: gen_total_p * gen_prop_cost + gen_n_on * gen_fixed_cost
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
system:
id: sys_example4
description: test system
model-libraries: lib_example3

components:
- id: node1
model: lib_example3.node_genCluster_oneLoad
scenario-group: sg
parameters:
- id: load
type: constant
value: 1000
- id: gen_min_p
type: constant
value: 150
- id: gen_max_p
type: constant
value: 300
- id: gen_cluster_size
type: constant
value: 10
- id: gen_prop_cost
type: constant
value: 0.5
- id: gen_fixed_cost
type: constant
value: 10
flomnes marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
\ Generated by MPModelProtoExporter
\ Name :
\ Format : Free
\ Constraints : 3
\ Variables : 2
\ Binary : 0
\ Integer : 1
\ Continuous : 1
Minimize
Obj: +10 node1.gen_n_on_0 +0.5 node1.gen_total_p_0
Subject to
node1.balance_0: +1 node1.gen_total_p_0 = 1000
node1.respect_max_p_0: -300 node1.gen_n_on_0 +1 node1.gen_total_p_0 <= -0
node1.respect_min_p_0: -150 node1.gen_n_on_0 +1 node1.gen_total_p_0 >= -0
Bounds
0 <= node1.gen_n_on_0 <= 10
0 <= node1.gen_total_p_0 <= 3000
Generals
node1.gen_n_on_0
End
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
solver: sirius
flomnes marked this conversation as resolved.
Show resolved Hide resolved
solver-logs: false
solver-parameters:
no-output: false
first-time-step: 0
last-time-step: 0
Loading