Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Model Library
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FOCUS
Model Library
Commits
6bb636ea
Commit
6bb636ea
authored
Jun 24, 2024
by
Christoph von Oy
Browse files
Options
Downloads
Patches
Plain Diff
Enable logics use boolean profiles now
parent
1aabf395
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
dynamics.py
+3
-1
3 additions, 1 deletion
dynamics.py
topology.py
+4
-4
4 additions, 4 deletions
topology.py
with
7 additions
and
5 deletions
dynamics.py
+
3
−
1
View file @
6bb636ea
...
@@ -1611,7 +1611,9 @@ class Profile:
...
@@ -1611,7 +1611,9 @@ class Profile:
if
dynamic
==
self
.
dynamic
:
if
dynamic
==
self
.
dynamic
:
return
self
return
self
if
self
.
is_bool
and
not
is_view_resample
(
self
.
dynamic
,
dynamic
):
if
self
.
is_bool
and
not
is_view_resample
(
self
.
dynamic
,
dynamic
):
raise
ValueError
(
f
"
A bool profile can only be resampled with a view resampling!
"
)
raise
ValueError
(
f
"
A bool profile can only be resampled with a view resampling!
"
)
return
Profile
(
return
Profile
(
resample
(
np
.
expand_dims
(
self
.
values
,
axis
=
0
),
self
.
dynamic
,
dynamic
)[
0
],
resample
(
np
.
expand_dims
(
self
.
values
,
axis
=
0
),
self
.
dynamic
,
dynamic
)[
0
],
dynamic
,
dynamic
,
...
...
This diff is collapsed.
Click to expand it.
topology.py
+
4
−
4
View file @
6bb636ea
...
@@ -441,12 +441,12 @@ class Topology:
...
@@ -441,12 +441,12 @@ class Topology:
for
logic_name
,
logic
in
self
.
_additional_model_logic
.
items
():
for
logic_name
,
logic
in
self
.
_additional_model_logic
.
items
():
if
logic
[
"
type
"
]
==
"
ConnectorEnable
"
:
if
logic
[
"
type
"
]
==
"
ConnectorEnable
"
:
enable
=
logic
[
"
enable
"
]
enable
=
logic
[
"
enable
"
]
.
resample
(
o_block
.
dynamic
).
values
for
i
,
connector
in
enumerate
(
logic
[
"
connectors
"
]):
for
i
,
connector
in
enumerate
(
logic
[
"
connectors
"
]):
connector_var
=
o_block
.
component_dict
[
connector
]
connector_var
=
o_block
.
component_dict
[
connector
]
def
rule
(
m
,
t
):
def
rule
(
m
,
t
):
if
enable
[
t
]
==
0
:
if
not
enable
[
t
]:
return
connector_var
[
t
]
==
0
return
connector_var
[
t
]
==
0
else
:
else
:
return
pyo
.
Constraint
.
Skip
return
pyo
.
Constraint
.
Skip
...
@@ -457,7 +457,7 @@ class Topology:
...
@@ -457,7 +457,7 @@ class Topology:
)
)
if
logic
[
"
type
"
]
==
"
ConnectionEnable
"
:
if
logic
[
"
type
"
]
==
"
ConnectionEnable
"
:
enable
=
logic
[
"
enable
"
]
enable
=
logic
[
"
enable
"
]
.
resample
(
o_block
.
dynamic
).
values
for
i
,
connection
in
enumerate
(
logic
[
"
connections
"
]):
for
i
,
connection
in
enumerate
(
logic
[
"
connections
"
]):
flow_from
=
connection
[
"
from
"
]
flow_from
=
connection
[
"
from
"
]
flow_to
=
connection
[
"
to
"
]
flow_to
=
connection
[
"
to
"
]
...
@@ -470,7 +470,7 @@ class Topology:
...
@@ -470,7 +470,7 @@ class Topology:
flow_var
=
o_block
.
component_dict
[
connection
.
in_flows
[
0
]]
flow_var
=
o_block
.
component_dict
[
connection
.
in_flows
[
0
]]
def
rule
(
m
,
t
):
def
rule
(
m
,
t
):
if
enable
[
t
]
==
0
:
if
not
enable
[
t
]:
return
flow_var
[
t
]
==
0
return
flow_var
[
t
]
==
0
else
:
else
:
return
pyo
.
Constraint
.
Skip
return
pyo
.
Constraint
.
Skip
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment