← Back to community index
# contributor·Active

astrimid - I'd like to extract the new proposed...

I'd like to extract the new proposed API here from the previous thread on dual package mosfet chip representation. The phase 1 of the proposal includes: 1. New ChipProps extensions to add: schDisplay?: "expanded" "collapsed" "hidden" Support for <internalcircuit as a child pinMap

Started by astrimidJul 17, 202628 messages

Discussion

Last active last month · plain text
astrimidoriginal post
I'd like to extract the new proposed API here from the previous thread on dual package mosfet chip representation. The phase 1 of the proposal includes: 1. **New `ChipProps` extensions** to add: - `schDisplay?: "expanded" | "collapsed" | "hidden"` - Support for `<internalcircuit>` as a child - `pinMapping` functionality 2. **New `<internalcircuit>` component type** with its own props interface. This is added to `<chip>` but may potentially be extended to other components (maybe even user defined elements, like custom/simplifed schematic view for `<group>` or `<subcircuit>` while keeping pcb/bom representation intact) 3. **Reference designator composition logic** to combine chip name with child names (e.g., "Q203" + "A" = "Q203A") 4. **Pin mapping reconciliation** to validate that internal primitive terminals map correctly to footprint pins Phase 2 makes the approach more generic, by introducing `schOnly` and `pcbOnly` attributes or some other way that extends beyond `<chip>`. The `schOnly` and `pcbOnly` attributes already defined in `ConstrainedLayoutProps`, so `<constainedlayout pcbOnly><chip></constrainedlayout>` should already work, but `constainedlayout` element isn't registered in core and doesn't have any influence so causes compilation error.
astrimid
the naive representation would be: ``` <chip name="Q203" pcbOnly> <mosfet name="Q203A" schOnly> <mosfet name="Q203A" schOnly> ``` But that loses references between those, e.g. if I want to display physical pin numbering on logical schematic elements
astrimid
tagging <@1079361271687807026> as he was the one proposing `<internalcircuit>`
Mustafa7
We cannot make any decisions without seve. So cc <@757706909351411845>
Seve
Hello
astrimid
FWIW, `<schematicbox chipRef="Q1"/>` + `noSchematicRepresentation` for `<chip name="Q1">` seems to do the trick. But I still feel API could be more intuitive.
Mustafa7
Yea we are thinking about this
Mustafa7
We were talking about this yesterday
Mustafa7
<@757706909351411845> ```<board width="40mm" height="25mm"> <chip name="Q1" footprint="soic8" pinLabels={{ pin1: "G1", pin2: "S1", pin3: "G2", pin4: "S2", pin5: "D2", pin6: "D2", pin7: "D1", pin8: "D1", }} internallyConnectedPins={[ ["pin5", "pin6"], ["pin7", "pin8"], ]} noSchematicRepresentation /> <schematicbox name="A" chipRef=".Q1" width={2} height={1.5} pinLabels={{ pin1: "G", pin2: "S", pin3: "D", }} connections={{ pin1: "Q1.pin1", pin2: "Q1.pin2", pin3: "Q1.pin7", }} schPinArrangement={{ leftSide: ["pin1"], rightSide: ["pin3"], bottomSide: ["pin2"], }} schX={-3} /> <schematicbox name="B" chipRef=".Q1" width={2} height={1.5} pinLabels={{ pin1: "G", pin2: "S", pin3: "D", }} connections={{ pin1: "Q1.pin3", pin2: "Q1.pin4", pin3: "Q1.pin5", }} schPinArrangement={{ leftSide: ["pin1"], rightSide: ["pin3"], bottomSide: ["pin2"], }} schX={3} /> <resistor name="R1" resistance="10k" footprint="0402" /> <resistor name="R2" resistance="10k" footprint="0402" /> <trace from=".R1 > .pin1" to="net.INPUT_A" /> <trace from=".R1 > .pin2" to=".Q1 > .pin1" /> <trace from=".R2 > .pin1" to="net.INPUT_B" /> <trace from=".R2 > .pin2" to=".Q1 > .pin3" /> <trace from=".Q1 > .pin2" to="net.GND" /> <trace from=".Q1 > .pin4" to="net.GND" /> <trace from=".Q1 > .pin7" to="net.OUTPUT_A" /> <trace from=".Q1 > .pin5" to="net.OUTPUT_B" /> </board>``` Hows this tsx instead of internalcircuit wrapper? One issue with schematicbox is that you will lose sch symbols, that is fine right?
Mustafa7
should i revert what we did till now for internalcircuit?(its almost done, just the displayName for internal components has to be set in core)
Seve
<@1079361271687807026> you should do `<schematicsymbol chipRef=".U1" symbolName="mosfet..." />` for the mosfet symbols i think
Seve
<@1079361271687807026> yea i mean i think if we do the revert in one big PR- it might be easier for us to come back to it later (especially if the title is pretty explicit)
Seve
i think we'll maybe bring back internalcircuit when we do advance spice modeling (maybe- there are also other ways to do that)
Mustafa7
So should I revert it and then we should implement the above style with schematicsymbol?
Seve
yea i agree with that
astrimid
the current blocker is `noschemaicrepresentation` leaves orphan traces behind. Does using `<schematicbox` approach mean the mosfet flipping logic should be reimplemented?
astrimid
https://tscircuit.com/editor?&snippet_type=board#data:application/gzip;base64,H4sIADxmYmoAA8VVW0/bMBT+K1a0B0AjvcJQR5gK7QBpKiilbNMyQZq4xCK1K8cVlaL+9x3f4hSKmHghT8l37t+5pPQITfHKF8XK63kJo4VASUYWo3iOUYAib9KKvIg6wRjnOBGMg/Def2L8MeZsSVPkfyqt3fr+q7VYsCfMxxnGouYQXUvUuSXshcZl4+p52EQQRn+SVGSg1Pbb3YMt8gtMHjIBCq2IOvfXhP6IpzgvQFBGFKEFoa0eRBo0I++zAdoKgGot0FFA2wFdBXQccKCArgMOFXCggLXLQLGwLYkvUv/27Mx5OJLI+Wjw3EWc5x9SxX+niVcLxgVK8Sxe5gLt7KLgBO1I9eMpi3l6Il/ho1hOE8KTJRGIQsODyHNDFHlGC/RkU+0HQjPGxIITKkC/YCQ5ktNhhUWS/QrKJqRRQ34HZbuGmFh6mi0IhWhGg7LOb92MjZMMz2NBkhAvOC4wFfDBoGCt0LB1NVxhANlirfGUrayFzvawCvI81yrTvktVkhHiWaBWzG5gZfEkl8LK3JpU8kwtxYaC3pNKo0bE5qzWswSwz3lMH/AcWAhKNYP6yfFMjEmKe+iPHQs7MX/VyOiHy6BGz+FrE0RS+SZvrsuat/3WS+JOP4S42pl5D2tqie3umpV9jTuzv3ZtzbZuZ1TxSXG1bao7Na7Lxh6ajAbD75ej4QCdDi/6t5dXk7CHxhlb5ikSGUZgnsvCENwiCjwgwRAcafgJwJR+Q3sNE0/G0Yq6WZ11Nd3SRxXduClumOqX73KSXlxe/dHVzcUwROObsD86H6LTybkLBgomKqwlKaCvm5PSeXNSwtox0D5imkhB69EJ6pen2W1CV6rZ0lXAUED3y+oab/wUgSVf98reZuDB1LutS1vZ24e3V+kLW750XePvWPA4gabpItPOHcjvBLt7kAcWzTibA+zSENu9GJ6PG/Z670bUW/8D7Yzdhy8IAAA=
astrimid
Also, using `Q` name for `<chip` as it's a mosfet creates a warning that I should name it `U`. Ignorable but annoying, leaky abstraction
astrimid
I guess, it also means I can't use mosfet simulations either, as it's opaque chip
astrimid
OTOH, separating schematic box out of `chip` means we can compose new functionality on top of `<schematicbox` as it's a cleaner representation of underlying `circuitjson` concept?
astrimid
I quess now we need some `<electicalbox` counterpart that could cleanly represent any of mosfet, resistor, capacitor, diode, etc? and possibly extend `<chip` and `chipRef` into any pcb component that might have different schematic representation, or even multiple pcb components or subcircuit mapped to a single `schematicbox`?
astrimid
or maybe the `<schematicbox` should have some internal model projerty that represents `<mosfet` and display it both as a symbol on schematic and simulated on electrical model, but doesn't have any schematic nor pcb nor bom domain.
astrimid
I'm still dreaming of some `<circuitjson>` component or API, from which I could layer my own primitive components and props when tscirciuit falls short. But maybe even `circuitjson` has its limitations?
Seve
<subcircuit circuitJson={circuitJson} /> should work for that
Seve
subcircuit also has showAsSchematicBox
astrimid
> <subcircuit circuitJson={circuitJson} /> should work for that It has some key limitation: it's an isolated namespace
Seve
right yea
Seve
you can do `exposedNets` etc. to explicitly expose stuff tho

Want to add to the conversation?

Reply in Discord so your notes stay connected to the source.
Continue in Discord ↗