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

Network Bounday nodes fix #3584

Merged
merged 2 commits into from
Sep 19, 2023
Merged
Changes from all commits
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
22 changes: 13 additions & 9 deletions pyaedt/modules/Boundary.py
Original file line number Diff line number Diff line change
Expand Up @@ -3955,22 +3955,26 @@
>>> "Function": "Piecewise Linear",
>>> "Values": "Test_DataSet"})
"""
if assignment_type not in ["Power", "Temperature"]: # pragma: no cover
if assignment_type not in ["Power", "Temperature", "PowerValue", "TemperatureValue"]: # pragma: no cover
raise AttributeError('``type`` can be only ``"Power"`` or ``"Temperature"``.')
if isinstance(value, (float, int)):
if assignment_type == "Power":
if assignment_type == "Power" or assignment_type == "PowerValue":
value = str(value) + "W"
else:
value = str(value) + "cel"
if isinstance(value, dict) and assignment_type == "Temperature": # pragma: no cover
if isinstance(value, dict) and (
assignment_type == "Temperature" or assignment_type == "TemperatureValue"
): # pragma: no cover
raise AttributeError(
"Temperature-dependent or transient assignment is not supported in a temperature boundary node."
)
if not assignment_type.endswith("Value"):
assignment_type += "Value"
new_node = self._Node(
name,
self._app,
node_type="BoundaryNode",
props={"ValueType": assignment_type + "Value", assignment_type: value},
props={"ValueType": assignment_type, assignment_type.removesuffix("Value"): value},
network=self,
)
self._nodes.append(new_node)
Expand Down Expand Up @@ -4164,11 +4168,11 @@
resistance=node_dict.get("Resistance", None),
)
elif "ValueType" in node_dict.keys():
self.add_boundary_node(
name=node_dict["Name"],
assignment_type=node_dict["ValueType"],
value=node_dict[node_dict["ValueType"]],
)
if node_dict["ValueType"].endswith("Value"):
value = node_dict[node_dict["ValueType"].removesuffix("Value")]

Check warning on line 4172 in pyaedt/modules/Boundary.py

View check run for this annotation

Codecov / codecov/patch

pyaedt/modules/Boundary.py#L4172

Added line #L4172 was not covered by tests
else:
value = node_dict[node_dict["ValueType"]]
self.add_boundary_node(name=node_dict["Name"], assignment_type=node_dict["ValueType"], value=value)
else:
self.add_internal_node(
name=node_dict["Name"],
Expand Down
Loading