-
Notifications
You must be signed in to change notification settings - Fork 128
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
FEAT: VSin, ISin Sources added to Maxwell Circuit Primitives #5283
base: main
Are you sure you want to change the base?
Changes from all commits
5aac760
f8699a5
8552947
93375bd
955bcf7
cf6153e
eb4c79e
a07645f
84e4f7a
d7945da
a3a2340
46152e2
bf84832
0c4d246
d180ad8
5a95e4e
4b7d09f
f00f682
359f752
fdf3786
4ef9e9f
d44fd5d
0a98ed1
a4dd34f
7aa718d
bd322c4
44827f3
29eeb97
3f56946
e053aab
8cefb93
44c9258
8b94bd1
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 |
---|---|---|
|
@@ -1262,6 +1262,57 @@ | |
except Exception: | ||
return False | ||
|
||
def create_page(self, name): | ||
"""Add a new circuit schematic page. | ||
|
||
Parameters | ||
---------- | ||
name : str, int or float | ||
Name to be used when creating the new circuit schematic. | ||
|
||
Returns | ||
------- | ||
bool | ||
``True`` when successful, ``False`` when failed. | ||
|
||
References | ||
---------- | ||
>>> oEditor.CreatePage() | ||
|
||
Examples | ||
-------- | ||
>>>from ansys.aedt.core import MaxwellCircuit | ||
>>>app=MaxwellCircuit () | ||
>>>component=app.modeler.schematic.create_page(name=page_name) | ||
|
||
""" | ||
if not isinstance(name, (str, int, float)): | ||
self.logger.error("Wrong type for argument ``name``.") | ||
return False | ||
self.oeditor.CreatePage(name) | ||
return True | ||
|
||
def get_num_pages(self): | ||
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. I think it would be better to add |
||
"""Gets the number of circuit schematic pages. | ||
|
||
Returns | ||
DaveTwyman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
------- | ||
int | ||
The number of pages in the circuit schematic. | ||
References | ||
---------- | ||
>>> oeditor.GetNumPages () | ||
Examples | ||
-------- | ||
>>>from ansys.aedt.core import MaxwellCircuit | ||
>>>app=MaxwellCircuit () | ||
DaveTwyman marked this conversation as resolved.
Show resolved
Hide resolved
|
||
>>>schematic=app.modeler.schematic | ||
>>>schematic.get_num_pages () | ||
|
||
""" | ||
pages = self.oeditor.GetNumPages() | ||
return pages | ||
|
||
|
||
class ComponentInfo(object): | ||
"""Manages Circuit Catalog info.""" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -115,3 +115,27 @@ def test_08_import_netlist(self): | |
self.aedtapp.insert_design("SchematicImport") | ||
self.aedtapp.modeler.schematic.limits_mils = 5000 | ||
assert self.aedtapp.create_schematic_from_netlist(self.netlist_file1) | ||
|
||
def test_09_create_voltage_source(self): | ||
name_type = ["voltage_source", 123, 1.23] | ||
for item in name_type: | ||
self.component = self.aedtapp.modeler.schematic.create_v_sin(name=item, value=3.14, angle=90) | ||
assert self.component.parameters["Name"] == item | ||
assert self.component.parameters["Va"] == 3.14 | ||
|
||
def test_10_create_current_source(self): | ||
name_type = ["current_source", 456, 4.56] | ||
for item in name_type: | ||
self.component = self.aedtapp.modeler.schematic.create_i_sin(name=item, value=2.72, angle=90) | ||
assert self.component.parameters["Name"] == item | ||
assert self.component.parameters["Ia"] == 2.72 | ||
|
||
def test_11_create_page(self): | ||
assert self.aedtapp.create_page("string_test") == True | ||
assert self.aedtapp.create_page(123) == True | ||
assert self.aedtapp.create_page(3.14) == True | ||
assert not self.aedtapp.create_page(["create_page_test"]) | ||
|
||
def test_12_get_num_pages(self): | ||
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. Could you please add a test on the return value and not only on the value type ? |
||
assert type(self.aedtapp.get_num_pages()) == int | ||
assert not type(self.aedtapp.get_num_pages()) == str, float |
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.
I think it would be better to add
nb_pages
as a property instead of adding this feature as a method.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.
@SMoraisAnsys , That would be a better implementation. I'll make that switch to a parameter
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.
Hello @SMoraisAnsys
Can I double check my planned implementation is the same as your suggestion.
This change would mean 'get_num_pages' would be accessed as an attribute of the MaxwellCircuit class?