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

Create a function to handle RLC components with pore than two pins #906

Open
amichel0205 opened this issue Nov 21, 2024 · 0 comments
Open
Assignees
Labels
enhancement New features or code improvements

Comments

@amichel0205
Copy link
Collaborator

amichel0205 commented Nov 21, 2024

Description of the feature

Create a function to handle RLC components with pore than two pins thsi will be a complement of anstranslator.
After translating a brd, IPC2581, ODB++... file the aedb we get could have RLC components with more than 2 pins with not relevant pin connection.
Using the power of PyEDB to have moer inteligence in managing these components would be valuable.
I suggest to first create relative simple function which will identified when pins of the same component are connectiong to re

Steps for implementing the feature

I suggest to first create relative simple function which will identified when pins of the same component are connecting to reference net.
The input of the fonction will be reference_net as a string (like GND). A lot these components like 4 pins RLC components have two pins connected to GND for EMI purpose and tow connected to signal or power nets. So I suggest to start with a simple implementation that will cover 80% of the case with the below workflow:
Image
below is a draft of the code to be implemented that would add an inductor of 1nh to tow of the 4 pins not connected to GND.

from pyedb import Edb
import os


path = "path_to_aedb"
reference_net = "GND"

version = "2024.2"

edbapp = Edb(edbpath=path, edbversion=version)

comps = []
data = {}
for refdes, obj in edbapp.components.components.items():
    comp = {}
    if obj.type.lower() not in ["capacitor", "inductor", "resistor"]:
        continue
    elif (obj.numpins < 3 and obj.numpins > 4):
        continue
    comp["refdes"] = refdes
    comp["part_number"] = obj.part_name
    comp["number_of_pins"] = obj.numpins
    comp["type"] = obj.type
    pin_map = []
    connect_pin = []
    for _, p in obj.pins.items():
        pin_map.append([p.component_pin, p.net_name, p.position])
        if p.net_name != reference_net:
            connect_pin.append(p.component_pin)
    comp["pin_map"] = pin_map
    comp["connect_pin"] = connect_pin
    data[refdes] = comp

    if len(connect_pin) == 2:
        comps.append(
            {
                "reference_designator": refdes,
                "enabled": True,
                "pin_pair_model": [
                    {
                        "first_pin": str(connect_pin[0]),
                        "second_pin": str(connect_pin[1]),
                        "is_parallel": False,
                        "resistance": "0",
                        "resistance_enabled": False,
                        "inductance": "1nH",
                        "inductance_enabled": True,
                        "capacitance": "0",
                        "capacitance_enabled": False,
                    }
                ],
            }
        )
    else:
        continue

cfg = dict()
cfg["components"] = comps
edbapp.configuration.load(cfg, apply_file=True)
edbapp.save()
edbapp.close()

Useful links and references

No response

@amichel0205 amichel0205 added the enhancement New features or code improvements label Nov 21, 2024
@amichel0205 amichel0205 self-assigned this Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features or code improvements
Projects
None yet
Development

No branches or pull requests

1 participant