Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions doc/changelog.d/1947.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Issue #1063 fixed source to ground
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
# SOFTWARE.

from pyedb.dotnet.database.general import (
convert_netdict_to_pydict,
convert_pydict_to_netdict,
)
from pyedb.misc.decorators import deprecated_property
Expand Down Expand Up @@ -241,8 +240,9 @@ def source_terms_to_ground(self):
str: source name,
int: node to ground pairs, 0 (unspecified), 1 (negative), 2 (positive) .
"""
temp = self._parent.get_sim_setup_info.simulation_settings.DCIRSettings.SourceTermsToGround
return convert_netdict_to_pydict(temp)
temp = dict(self._parent.get_sim_setup_info.simulation_settings.DCIRSettings.SourceTermsToGround)
temp = {name.strip("'"): node for name, node in temp.items()} # strip single quotes from the source names
return temp

@source_terms_to_ground.setter
def source_terms_to_ground(self, value):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import warnings

from pyedb.dotnet.database.general import (
convert_netdict_to_pydict,
convert_pydict_to_netdict,
)
from pyedb.dotnet.database.sim_setup_data.data.sim_setup_info import SimSetupInfo
Expand Down Expand Up @@ -245,7 +244,7 @@ def via_report_path(self) -> str:
def via_report_path(self, value: str):
self.dc_ir.via_report_path = value

def add_source_terminal_to_ground(self, source_name, terminal=0):
def add_source_terminal_to_ground(self, source_name, terminal=0) -> None:
"""Add a source terminal to ground.

Parameters
Expand All @@ -261,13 +260,11 @@ def add_source_terminal_to_ground(self, source_name, terminal=0):

Returns
-------
bool

None
"""
terminals = self.dc_ir.source_terms_to_ground
terminals[source_name] = terminal
self._sim_setup_info.simulation_settings.DCIRSettings.SourceTermsToGround = convert_pydict_to_netdict(terminals)
return self._update_setup()
self.dc_ir.source_terms_to_ground = terminals


class SIwaveSimulationSetup(SimulationSetup):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,20 @@ def per_pin_use_pin_format(self) -> bool:
def per_pin_use_pin_format(self, value):
self.core.per_pin_use_pin_format = value

def add_source_terminal_to_ground(self, source_name: str, terminal: int = 1) -> None:
"""Add source terminal to ground mapping.

Parameters
----------
source_name : str
Source terminal name.
terminal : int
The terminal number to reference. `0` set the positive terminal `1` set the negative terminal as reference.
Default is `1`
"""
temp = {source_name: terminal}
self.source_terms_to_ground = {**self.source_terms_to_ground, **temp}

@property
def source_terms_to_ground(self) -> dict[str, int]:
"""Source terms to ground mapping.
Expand Down
7 changes: 7 additions & 0 deletions tests/system/test_edb.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ def test_siwave_create_voltage_source(self):
term2 = u6.pins["F1"].get_terminal(create_new_terminal=True)
voltage_source = edbapp.create_voltage_source(terminal=term1, ref_terminal=term2)
assert not voltage_source.is_null
# testing source to ground assignment
setup = edbapp.siwave.add_siwave_dc_analysis(name="Test_dc")
setup.settings.add_source_terminal_to_ground("Vsource_U1_USB3_D_P_U1_GND", 1)
if edbapp.grpc:
assert "Vsource_U1_USB3_D_P_U1_GND" in setup.settings.dc.source_terms_to_ground
else:
assert "Vsource_U1_USB3_D_P_U1_GND" in setup.settings.dc_ir.source_terms_to_ground
edbapp.close(terminate_rpc_session=False)

def test_siwave_create_current_source(self):
Expand Down
Loading