-
Notifications
You must be signed in to change notification settings - Fork 1
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
Models with stock #33
base: main
Are you sure you want to change the base?
Changes from 35 commits
5b72beb
7465997
8b687c6
966b4de
927cc47
18a4b1f
d0e8e26
82efdad
4400c46
51de9e4
ffcc3de
dc08c71
f6218bd
25b567f
f5a0eec
d7ce092
fccf367
006131b
cddd635
25d4b79
7739a77
ed4f8a0
4b949d6
f912f0d
b3ed8e7
b4a1bd1
eb30fbc
564d10f
7b9fb16
651ca02
14bc1e5
e668672
24d0c06
6e16230
8fba186
5bfdfcc
3765536
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -211,3 +211,56 @@ | |||||
) | ||||||
], | ||||||
) | ||||||
|
||||||
LINK_WITH_STORAGE = model( | ||||||
id="Link with storage model", | ||||||
parameters=[ | ||||||
float_parameter("f_from_max", CONSTANT), | ||||||
float_parameter("f_to_max", CONSTANT), | ||||||
float_parameter("capacity", CONSTANT), | ||||||
float_parameter("initial_level", CONSTANT), | ||||||
], | ||||||
variables=[ | ||||||
float_variable("r", lower_bound=literal(0), upper_bound=param("capacity")), | ||||||
float_variable( | ||||||
"f_from", lower_bound=-param("f_from_max"), upper_bound=param("f_from_max") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
), | ||||||
float_variable( | ||||||
"f_to", lower_bound=-param("f_to_max"), upper_bound=param("f_to_max") | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
), | ||||||
float_variable("f_from+", lower_bound=literal(0)), | ||||||
float_variable("f_from-", lower_bound=literal(0)), | ||||||
float_variable("f_to+", lower_bound=literal(0)), | ||||||
float_variable("f_to-", lower_bound=literal(0)), | ||||||
], | ||||||
ports=[ | ||||||
ModelPort(port_type=BALANCE_PORT_TYPE, port_name="flow_from"), | ||||||
ModelPort(port_type=BALANCE_PORT_TYPE, port_name="flow_to"), | ||||||
ModelPort(port_type=BALANCE_PORT_TYPE, port_name="flow_from_pos"), | ||||||
ModelPort(port_type=BALANCE_PORT_TYPE, port_name="flow_to_pos"), | ||||||
], | ||||||
port_fields_definitions=[ | ||||||
PortFieldDefinition( | ||||||
port_field=PortFieldId("flow_from", "flow"), | ||||||
definition=-var("f_from"), | ||||||
), | ||||||
PortFieldDefinition( | ||||||
port_field=PortFieldId("flow_to", "flow"), | ||||||
definition=var("f_to"), | ||||||
), | ||||||
PortFieldDefinition( | ||||||
port_field=PortFieldId("flow_from_pos", "flow"), | ||||||
definition=var("f_from+"), | ||||||
), | ||||||
PortFieldDefinition( | ||||||
port_field=PortFieldId("flow_to_pos", "flow"), | ||||||
definition=var("f_to+"), | ||||||
), | ||||||
], | ||||||
constraints=[ | ||||||
Constraint( | ||||||
name="Level", | ||||||
expression=var("f_from") == (var("f_from+") - var("f_from-")), | ||||||
), | ||||||
], | ||||||
Comment on lines
+260
to
+265
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This model is incomplete (missing shift operators at least). Was it superseded by the yml ? If so, I suggest removing standard_sc.py completely. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes it seems to be superseeded by the model in the yml |
||||||
) |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Some models are defined in local libraries for tests, delete the incomplete, unsed ones from here ( |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,226 @@ library: | |
- name: emission | ||
|
||
models: | ||
- id: link_with_storage | ||
description: A link with energy storage | ||
parameters: | ||
- name: f_from_max | ||
time-dependent: false | ||
scenario-dependent: false | ||
- name: f_to_max | ||
time-dependent: false | ||
scenario-dependent: false | ||
- name: capacity | ||
time-dependent: false | ||
scenario-dependent: false | ||
- name: initial_level | ||
time-dependent: false | ||
scenario-dependent: false | ||
variables: | ||
- name: r | ||
lower-bound: 0 | ||
upper-bound: capacity | ||
- name: f_from | ||
lower-bound: -f_from_max | ||
upper-bound: f_from_max | ||
- name: f_to | ||
lower-bound: -f_to_max | ||
upper-bound: f_to_max | ||
- name: f_from_p | ||
lower-bound: 0 | ||
- name: f_from_m | ||
lower-bound: 0 | ||
- name: f_to_p | ||
lower-bound: 0 | ||
- name: f_to_m | ||
lower-bound: 0 | ||
ports: | ||
- name: flow_from | ||
type: flow | ||
- name: flow_to | ||
type: flow | ||
- name: flow_from_pos | ||
type: flow | ||
- name: flow_to_pos | ||
type: flow | ||
port-field-definitions: | ||
- port: flow_from | ||
field: flow | ||
definition: -f_from | ||
- port: flow_to | ||
field: flow | ||
definition: f_to | ||
constraints: | ||
- name: max0_from | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More explicit name : |
||
expression: f_from = f_from_p - f_from_m | ||
- name: max0_to | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same |
||
expression: f_to = f_to_p - f_to_m | ||
- name: r_t1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More explicit name : |
||
expression: r[t+1] = r[t] + f_from - f_to | ||
- name: r0 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
expression: r[0] = initial_level | ||
- name: rt | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There is a problem here ! How to specify the level of final time of the block in the yaml and even in our lower-level expressions @sylvlecl, I think it is not possible for now ? |
||
expression: r[t] = initial_level | ||
binding-constraints: | ||
- name: FlowFromPos | ||
expression: sum_connections(flow_from_pos.flow) = f_from_p | ||
- name: FlowToPos | ||
expression: sum_connections(flow_to_pos.flow) = f_to_p | ||
|
||
- id: link_with_storage_2 | ||
description: A link with energy storage without flow_from/to_pos | ||
parameters: | ||
- name: f_from_max | ||
time-dependent: false | ||
scenario-dependent: false | ||
- name: f_to_max | ||
time-dependent: false | ||
scenario-dependent: false | ||
- name: capacity | ||
time-dependent: false | ||
scenario-dependent: false | ||
- name: initial_level | ||
time-dependent: false | ||
scenario-dependent: false | ||
variables: | ||
- name: r | ||
lower-bound: 0 | ||
upper-bound: capacity | ||
- name: f_from | ||
lower-bound: -f_from_max | ||
upper-bound: f_from_max | ||
- name: f_to | ||
lower-bound: -f_to_max | ||
upper-bound: f_to_max | ||
- name: f_from_p | ||
lower-bound: 0 | ||
- name: f_from_m | ||
lower-bound: 0 | ||
- name: f_to_p | ||
lower-bound: 0 | ||
- name: f_to_m | ||
lower-bound: 0 | ||
ports: | ||
- name: flow_from | ||
type: flow | ||
- name: flow_to | ||
type: flow | ||
port-field-definitions: | ||
- port: flow_from | ||
field: flow | ||
definition: -f_from | ||
- port: flow_to | ||
field: flow | ||
definition: f_to | ||
constraints: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. same remarks on constraints name |
||
- name: r_t1 | ||
expression: r[t+1] = r[t] + f_from - f_to | ||
- name: r0 | ||
expression: r[0] = initial_level | ||
- name: rt | ||
expression: r[t] = initial_level | ||
|
||
- id: stock_final_level_input | ||
description: A stock model with multiple input | ||
parameters: | ||
- name: p_max_in | ||
time-dependent: false | ||
scenario-dependent: false | ||
- name: p_max_out | ||
time-dependent: false | ||
scenario-dependent: false | ||
- name: capacity | ||
time-dependent: false | ||
scenario-dependent: false | ||
- name: initial_level | ||
time-dependent: false | ||
scenario-dependent: false | ||
- name: final_level | ||
time-dependent: false | ||
scenario-dependent: false | ||
variables: | ||
- name: r | ||
lower-bound: 0 | ||
upper-bound: capacity | ||
- name: u_in | ||
lower-bound: 0 | ||
upper-bound: p_max_in | ||
- name: u_out | ||
lower-bound: 0 | ||
upper-bound: p_max_out | ||
ports: | ||
- name: flow_s | ||
type: flow | ||
- name: flow_c | ||
type: flow | ||
port-field-definitions: | ||
- port: flow_s | ||
field: flow | ||
definition: u_out - u_in | ||
constraints: | ||
- name: r_h | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Storage dynamics |
||
expression: r[t+1] = r[t] + u_in[t] - u_out[t] | ||
binding-constraints: | ||
- name: flow_in | ||
expression: sum_connections(flow_c.flow) = u_in | ||
|
||
- id: stock_final_level | ||
description: A stock model | ||
parameters: | ||
- name: p_max_in | ||
time-dependent: false | ||
scenario-dependent: false | ||
- name: p_max_out | ||
time-dependent: false | ||
scenario-dependent: false | ||
- name: capacity | ||
time-dependent: false | ||
scenario-dependent: false | ||
- name: initial_level | ||
time-dependent: false | ||
scenario-dependent: false | ||
- name: final_level | ||
time-dependent: false | ||
scenario-dependent: false | ||
variables: | ||
- name: r | ||
lower-bound: 0 | ||
upper-bound: capacity | ||
- name: u_in | ||
lower-bound: 0 | ||
upper-bound: p_max_in | ||
- name: u_out | ||
lower-bound: 0 | ||
upper-bound: p_max_out | ||
ports: | ||
- name: flow_s | ||
type: flow | ||
- name: flow_c | ||
type: flow | ||
port-field-definitions: | ||
- port: flow_s | ||
field: flow | ||
definition: u_out - u_in | ||
constraints: | ||
- name: r_h | ||
expression: r[t+1] = r[t] + u_in[t] - u_out[t] | ||
binding-constraints: | ||
- name: flow_in | ||
expression: sum_connections(flow_c.flow) = u_in | ||
|
||
- id: repartition_key | ||
description: A repartition key | ||
parameters: | ||
- name: alpha | ||
time-dependent: false | ||
scenario-dependent: false | ||
ports: | ||
- name: flow_k | ||
type: flow | ||
binding-constraints: | ||
- name: sum | ||
expression: sum_connections(flow_k.flow) = 0 | ||
|
||
- id: convertor | ||
description: A basic convertor model | ||
parameters: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.