Skip to content

Commit 1c777ad

Browse files
authored
Merge branch 'main' into ability_to_connect_components
2 parents e091650 + a8f6fd3 commit 1c777ad

File tree

5 files changed

+30
-75
lines changed

5 files changed

+30
-75
lines changed

src/ansys/aedt/core/emit_core/nodes/emit_node.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ def _string_to_value_units(value) -> tuple[float, str]:
272272
dec_val = float(value[:i])
273273
units = value[i:]
274274
return dec_val, units
275-
raise ValueError(f"{value} are not valid units for this property.")
275+
raise ValueError(f"{value} is not valid for this property.")
276276

277277
def _convert_to_internal_units(self, value: float | str, unit_system: str) -> float:
278278
"""Takes a value and converts to internal EMIT units used for storing values.
@@ -365,8 +365,7 @@ def _rename(self, requested_name: str) -> str:
365365
return new_name
366366

367367
def _duplicate(self, new_name):
368-
# TODO (maybe needs to be custom?)
369-
pass
368+
raise NotImplementedError("This method is not implemented yet.")
370369

371370
def _import(self, file_path: str, import_type: str):
372371
"""Imports a file into an Emit node.

src/ansys/aedt/core/emit_core/nodes/generated/__init__.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,17 @@
4949
from .profile_trace_node import ProfileTraceNode
5050
from .propagation_loss_coupling_node import PropagationLossCouplingNode
5151
from .radio_node import RadioNode
52+
from .result_plot_node import ResultPlotNode
53+
from .rx_meas_node import RxMeasNode
54+
from .rx_mixer_product_node import RxMixerProductNode
55+
from .rx_saturation_node import RxSaturationNode
56+
from .rx_selectivity_node import RxSelectivityNode
57+
from .rx_spur_node import RxSpurNode
58+
from .rx_susceptibility_prof_node import RxSusceptibilityProfNode
59+
from .sampling_node import SamplingNode
60+
from .scene_group_node import SceneGroupNode
61+
from .solution_coupling_node import SolutionCouplingNode
62+
from .solutions_node import SolutionsNode
5263
from .terminator import Terminator
5364
from .top_level_simulation import TopLevelSimulation
5465
from .touchstone_coupling_node import TouchstoneCouplingNode

src/ansys/aedt/core/emit_core/results/results.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,14 @@ def _add_revision(self, name=None):
8181
"""
8282
self.aedt_version = int(self.emit_project.aedt_version_id[-3:])
8383
if self.aedt_version > 251 and name is None:
84-
# Return the current revision. Only create it if it isn't already there.
8584
current_revision = None
8685
current_revisions = [revision for revision in self.revisions if revision.name == "Current"]
87-
# Do we need to delete the existing Current revisions? Or can we just return it?
86+
87+
# Remove existing Current revisions
8888
for revision in current_revisions:
8989
self.delete_revision("Current")
90-
# if len(current_revisions) > 0:
91-
# current_revision = current_revisions[0]
92-
# current_revision._load_revision()
93-
# # current_revision.revision_loaded = True
90+
91+
# Create and return an updated Current revision
9492
current_revision = Revision(self, self.emit_project, name)
9593
self.revisions.append(current_revision)
9694
return current_revision

src/ansys/aedt/core/emit_core/results/revision.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,6 @@ def __init__(self, parent_results, emit_obj, name=None):
113113

114114
self.name = name
115115
"""Name of the revision."""
116-
117-
# Get the SimulationNodeID for the specified result
118-
# self._sim_node_id = self._emit_com.GetTopLevelNodeID(self.results_index, "Simulation")
119116
else:
120117
if not name:
121118
name = emit_obj.odesign.GetCurrentResult()

src/ansys/aedt/core/modeler/circuits/primitives_emit.py

Lines changed: 13 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -447,9 +447,6 @@ def __init__(self, components, component_name):
447447
self.root_prop_node = None
448448
"""Root node of the component."""
449449

450-
self.units = components._parent.get_units()
451-
"""Units for the component."""
452-
453450
@property
454451
def composed_name(self):
455452
"""Component name. Needed for compatibility."""
@@ -745,7 +742,7 @@ def get_position(self, units=""):
745742

746743
# Check the units specified are a valid EMIT length
747744
if not units or units not in emit_consts.EMIT_VALID_UNITS["Length"]:
748-
units = self.units["Length"]
745+
units = "meter"
749746
position = (
750747
consts.unit_converter(float(parts[0]), "Length", "meter", units),
751748
consts.unit_converter(float(parts[1]), "Length", "meter", units),
@@ -817,14 +814,14 @@ def band_start_frequency(self, band_node, units=""):
817814
----------
818815
band_node : Instance of the band node.
819816
units : str, optional
820-
If ``None`` specified, global units are used.
817+
If ``None`` specified, SI units (Hz) are used.
821818
822819
Returns
823820
-------
824821
Float
825822
Start frequency of the band node."""
826823
if not units or units not in emit_consts.EMIT_VALID_UNITS["Frequency"]:
827-
units = self.units["Frequency"]
824+
units = "Hz"
828825
return consts.unit_converter(float(band_node.props["StartFrequency"]), "Freq", "Hz", units)
829826

830827
def band_stop_frequency(self, band_node, units=""):
@@ -834,14 +831,14 @@ def band_stop_frequency(self, band_node, units=""):
834831
----------
835832
band_node : Instance of the band node.
836833
units : str, optional
837-
If ``None`` specified, global units are used.
834+
If ``None`` specified, SI units (Hz) are used.
838835
839836
Returns
840837
-------
841838
Float
842839
Stop frequency of the band node."""
843840
if not units or units not in emit_consts.EMIT_VALID_UNITS["Frequency"]:
844-
units = self.units["Frequency"]
841+
units = "Hz"
845842
return consts.unit_converter(float(band_node.props["StopFrequency"]), "Freq", "Hz", units)
846843

847844
def set_band_start_frequency(self, band_node, band_start_freq, units=""):
@@ -934,69 +931,21 @@ def set_band_stop_frequency(self, band_node, band_stop_freq, units=""):
934931
prop_list = {"StopFrequency": freq_string}
935932
band_node._set_prop_value(prop_list)
936933

937-
# def duplicate_band(self, band_node_to_duplicate):
938-
# """
939-
# [Incomplete 10/19/2023]
940-
# Parameters
941-
# ----------
942-
# band_node_to_duplicate
943-
#
944-
# Returns
945-
# -------
946-
#
947-
# """
948-
# # append number to the name of the band to duplicate.
949-
# print('Duplicating...')
950-
#
951-
#
952-
# # return band node
953-
# def convert_channels_to_multi_bands(self, band_node):
954-
# """
955-
# [Incomplete 10/19/2023]
956-
# Parameters
957-
# ----------
958-
# band_node
959-
#
960-
# Returns
961-
# -------
962-
#
963-
# """
964-
# # get the channels. Say returns 10 channels in the band_node
965-
# # Name = r.bands()[0].children[0].props['Name']
966-
# # band_node.props['Name']
967-
# # Start = r.bands()[0].props['StartFrequency']
968-
# band_start_frequency = float(band_node.props['StartFrequency'])
969-
# # Stop = r.bands()[0].props['StopFrequency']
970-
# band_stop_frequency = float(band_node.props['StopFrequency'])
971-
# # Spacing = r.bands()[0].props['ChannelSpacing']
972-
# channel_spacing = float(band_node.props['ChannelSpacing'])
973-
# # for each channel
974-
# # 1) create a band (duplicate original one)
975-
# # 2) set band start and stop frequencies
976-
# for channel in list(range(int(band_start_frequency), int(band_stop_frequency), int(channel_spacing))):
977-
# baby_band_start = channel
978-
# baby_band_stop = channel+channel_spacing
979-
# baby_band_node = self.duplicate_band(band_node) # return band name or some handle to it
980-
# self.set_band_start_frequency(baby_band_node, baby_band_start)
981-
# self.set_band_stop_frequency(baby_band_node, baby_band_stop)
982-
# # set start and stop freq for that band name
983-
# # to be
984-
985934
def band_channel_bandwidth(self, band_node, units=""):
986935
"""Get the channel bandwidth of the band node.
987936
988937
Parameters
989938
----------
990939
band_node : Instance of the band node.
991940
units : str, optional
992-
If ``None`` specified, global units are used.
941+
If ``None`` specified, SI units (Hz) are used.
993942
994943
Returns
995944
-------
996945
Float
997946
Channel bandwidth of the band node."""
998947
if not units or units not in emit_consts.EMIT_VALID_UNITS["Frequency"]:
999-
units = self.units["Frequency"]
948+
units = "Hz"
1000949
return consts.unit_converter(float(band_node.props["ChannelBandwidth"]), "Freq", "Hz", units)
1001950

1002951
def band_tx_power(self, band_node, units=""):
@@ -1006,14 +955,15 @@ def band_tx_power(self, band_node, units=""):
1006955
----------
1007956
band_node : Instance of the band node.
1008957
units : str
1009-
Units to use for the tx power.
958+
Units to use for the tx power. If none specified,
959+
SI units (W) are used
1010960
1011961
Returns
1012962
-------
1013963
Float
1014964
Transmit power of the band node."""
1015965
if not units or units not in emit_consts.EMIT_VALID_UNITS["Power"]:
1016-
units = self.units["Power"]
966+
units = "W"
1017967
for child in band_node.children:
1018968
if child.props["Type"] == "TxSpectralProfNode":
1019969
return consts.unit_converter(float(child.props["FundamentalAmplitude"]), "Power", "dBm", units)
@@ -1142,7 +1092,7 @@ def set_band_power_level(self, power, units=""):
11421092
power : float
11431093
Peak amplitude of the fundamental [dBm].
11441094
units : str, optional
1145-
Units of the input power. If None specified, global units are used.
1095+
Units of the input power. If None specified, SI units (W) are used.
11461096
11471097
Return
11481098
------
@@ -1170,7 +1120,7 @@ def get_band_power_level(self, units=""):
11701120
Parameters
11711121
----------
11721122
units : str, optional
1173-
Units to use for the power. If None specified, global units are used.
1123+
Units to use for the power. If None specified, SI units (W) are used.
11741124
11751125
Return
11761126
------
@@ -1181,7 +1131,7 @@ def get_band_power_level(self, units=""):
11811131
raise TypeError(f"{self.node_name} must be a band.")
11821132
# Power is stored in dBm, convert to desired units
11831133
if not units or units not in emit_consts.EMIT_VALID_UNITS["Power"]:
1184-
units = self.parent_component.units["Power"]
1134+
units = "W"
11851135
for child in self.children:
11861136
if child.props["Type"] == "TxSpectralProfNode":
11871137
power = child.props["FundamentalAmplitude"]

0 commit comments

Comments
 (0)