Skip to content

Commit

Permalink
Fix 908974 and 871079 (#3638)
Browse files Browse the repository at this point in the history
* Fix 908974 and 871079

Check for projects with 0 designs, before trying to access any designs (fixes 908974)

Check for valid interaction after a domain is run. Could be invalid due to disabled Radio pairs. (fixes 871079)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update interference_gui.py

update close msg

* Update revision.py

update scripts to check for and handle amp saturation

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update revision.py

fix parsing of largest problem string

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
jsalant22 and pre-commit-ci[bot] authored Sep 29, 2023
1 parent a530e36 commit 5770c7b
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 15 deletions.
23 changes: 19 additions & 4 deletions examples/07-EMIT/interference_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def install(package):

# Add emitapi to system path
emit_path = os.path.join(desktop.install_path, "Delcross")
sys.path.append(emit_path)
sys.path.insert(0,emit_path)
import EmitApiPython
api = EmitApiPython.EmitApi()

Expand Down Expand Up @@ -244,8 +244,20 @@ def open_file_dialog(self):
# Close previous project and open specified one
if self.emitapp is not None:
self.emitapp.close_project()
self.emitapp = None
desktop_proj = desktop.load_project(self.file_path_box.text())

# check for an empty project (i.e. no designs)
if isinstance(desktop_proj, bool):
self.file_path_box.setText("")
msg = QtWidgets.QMessageBox()
msg.setWindowTitle("Error: Project missing designs.")
msg.setText(
"The selected project has no designs. Projects must have at least "
"one EMIT design. See AEDT log for more information.")
x = msg.exec()
return

# Check if project is already open
if desktop_proj.lock_file == None:
msg = QtWidgets.QMessageBox()
Expand Down Expand Up @@ -564,10 +576,13 @@ def populate_table(self):
def closeEvent(self, event):
msg = QtWidgets.QMessageBox()
msg.setWindowTitle("Closing GUI")
msg.setText("Closing AEDT, please wait for GUI to close on its own.")
msg.setText("Closing AEDT. Wait for the GUI to close on its own.")
x = msg.exec()
self.emitapp.close_project()
self.emitapp.close_desktop()
if self.emitapp:
self.emitapp.close_project()
self.emitapp.close_desktop()
else:
desktop.release_desktop(True, True)

###############################################################################
# Run GUI
Expand Down
50 changes: 39 additions & 11 deletions pyaedt/emit_core/results/revision.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,12 +477,30 @@ def interference_type_classification(self, domain, use_filter=False, filter_list
domain.set_receiver(rx_radio, rx_band)
domain.set_interferer(tx_radio, tx_band)
interaction = self.run(domain)
# check for valid interaction, this would catch any disabled radio pairs
if not interaction.is_valid():
continue

domain.set_receiver(rx_radio, rx_band, rx_freq)
tx_freqs = self.get_active_frequencies(tx_radio, tx_band, modeTx)
for tx_freq in tx_freqs:
domain.set_interferer(tx_radio, tx_band, tx_freq)
instance = interaction.get_instance(domain)
tx_prob = instance.get_largest_problem_type(ResultType.EMI).replace(" ", "").split(":")[1]
if not instance.has_valid_values():
# check for saturation somewhere in the chain
# set power so its flagged as strong interference
if instance.get_result_warning() == "An amplifier was saturated.":
max_power = 200
else:
# other warnings (e.g. no path from Tx to Rx,
# no power received, error in configuration, etc)
# should just be skipped
continue
else:
tx_prob = (
instance.get_largest_problem_type(ResultType.EMI).replace(" ", "").split(":")[1]
)
power = instance.get_value(ResultType.EMI)
if (
rx_start_freq - rx_channel_bandwidth / 2
<= tx_freq
Expand All @@ -500,14 +518,10 @@ def interference_type_classification(self, domain, use_filter=False, filter_list
in_filters = True

# Save the worst case interference values
if (
instance.has_valid_values()
and instance.get_value(ResultType.EMI) > max_power
and in_filters
):
prob = instance.get_largest_problem_type(ResultType.EMI)
max_power = instance.get_value(ResultType.EMI)
if power > max_power and in_filters:
max_power = power
largest_rx_prob = rx_prob
prob = instance.get_largest_problem_type(ResultType.EMI)
largest_tx_prob = prob.replace(" ", "").split(":")

if max_power > -200:
Expand Down Expand Up @@ -622,6 +636,9 @@ def protection_level_classification(
domain.set_receiver(rx_radio, rx_band)
domain.set_interferer(tx_radio, tx_band)
interaction = self.run(domain)
# check for valid interaction, this would catch any disabled radio pairs
if not interaction.is_valid():
continue
domain.set_receiver(rx_radio, rx_band, rx_freq)
tx_freqs = self.get_active_frequencies(tx_radio, tx_band, modeTx)

Expand All @@ -630,7 +647,18 @@ def protection_level_classification(
for tx_freq in tx_freqs:
domain.set_interferer(tx_radio, tx_band, tx_freq)
instance = interaction.get_instance(domain)
power = instance.get_value(mode_power)
if not instance.has_valid_values():
# check for saturation somewhere in the chain
# set power so its flagged as "damage threshold"
if instance.get_result_warning() == "An amplifier was saturated.":
max_power = 200
else:
# other warnings (e.g. no path from Tx to Rx,
# no power received, error in configuration, etc)
# should just be skipped
continue
else:
power = instance.get_value(mode_power)

if power > damage_threshold:
classification = "damage"
Expand All @@ -648,8 +676,8 @@ def protection_level_classification(
else:
filtering = True

if instance.get_value(mode_power) > max_power and filtering:
max_power = instance.get_value(mode_power)
if power > max_power and filtering:
max_power = power

# If the worst case for the band-pair is below the power thresholds, then
# there are no interference issues and no offset is required.
Expand Down

0 comments on commit 5770c7b

Please sign in to comment.