Skip to content

Conversation

@chaffra
Copy link

@chaffra chaffra commented Nov 26, 2018

Hello,

This PR allows the user to visualize to circuit with SchemDraw while building it. Example

circuit = Circuit('Diode Characteristic Curve')
circuit.include(spice_library['1N4148'])
circuit.schematic.add(schem.elements.GND)
V =circuit.V('input', 'Vin', circuit.gnd, 10@u_V,
            schematic_kwargs={'show_plus': True}
            )
R = circuit.R('1', 'Vin', 'Vout', 1@u_Ω,
              schematic_kwargs={'d':'right', 'show_minus': True}
             ) # not required for simulation
X = circuit.X('D1', '1N4148', 'Vout', circuit.gnd,
             schematic_kwargs={'schematic': schem.elements.DIODE, 'd':'down'},
             )
circuit.schematic.add(schem.elements.GND)
circuit.schematic.draw()

Not all electrical components diagrams are implemented yet but this is a start.

@FabriceSalvaire
Copy link
Collaborator

Thanks I didn't know SchemDraw !

SchemDraw looks cool as an alternative to circuit_macros which is hard to use and require a lot of dependencies ...

Some references on SchemDraw:

I wonder how it compares ? I was thinking to such feature, even for basic circuits.

Now the question is on the API. We could give a look to Modelica annotation.

The approach using an optional kwarg seems interesting. Maybe we could improve a bit the syntax.

Note: I don't have so much time to work on PySpice actually ...

@Kreijstal
Copy link

@chaffra can you update this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants