Simulating Electrical Circuits: Adding A Circuit In Comsol

how to add electrical circuit in comsol

COMSOL Multiphysics® software is a powerful tool for simulating and analyzing various physical phenomena, including electrical circuits. When adding an electrical circuit to a coil in COMSOL, users can utilize the Circuit Extractor add-in to convert electromagnetics simulation results into an Electrical Circuit physics interface. This interface allows for the modeling of currents and voltages in circuits, including voltage and current sources, resistors, capacitors, inductors, and semiconductor devices. The Circuit Extractor also supports automated import and export of circuits as SPICE .cir files, making it convenient for users to modify and customize their circuits. Additionally, COMSOL provides a comprehensive Support Center and discussion forums where users can seek assistance and share insights on specific use cases, such as adding electrical circuits to coils or coupling electromechanics and electrical circuits.

shunzap

Using the Circuit Extractor add-in

The Circuit Extractor add-in is a tool in COMSOL that allows users to extract lumped quantities for electric circuit simulations. It is available for all licenses that offer the AC/DC Module and is automatically installed if the default preferences are set.

The Circuit Extractor add-in offers an easy way to directly convert the results of electromagnetics simulations into an Electrical Circuit physics interface and subsequently into a SPICE file. The supported physics interfaces for performing such an extraction are Magnetic Fields, Currents Only, and Magnetic and Electric Fields for resistances, inductances, or impedances. Multiple physics interfaces and solutions can contribute to the same extracted circuit.

To use the Circuit Extractor add-in, a Stationary Source Sweep or a Frequency Domain Source Sweep must first be solved for the physics of interest. Matrices that are generated when solving such studies are then used for generating the equivalent circuit. After solving, in the user interface of the Circuit Extractor add-in, the user selects the type of Equivalent Circuit and the Evaluation Group corresponding to the desired solution, and presses the Extract Circuit button.

The Circuit Extractor interface offers a few options for modifying the circuit, such as choosing the feeding element type. The user can also decide not to close the conductors in case other circuit elements need to be added manually.

shunzap

Automated extraction of R, L, and C

The Circuit Extractor add-in feature in COMSOL® offers an easy way to convert the results of electromagnetics simulations into an Electrical Circuit physics interface and subsequently into a SPICE file. The Circuit Extractor is automatically installed if you have the default preferences set, but it can also be manually installed by following the instructions provided by COMSOL.

The Circuit Extractor interface offers options for modifying your circuit, such as choosing the feeding element type. You can also decide to keep the conductors open in case other circuit elements need to be added manually. Before running the Circuit Extractor add-in, a Stationary Source Sweep or a Frequency Domain Source Sweep study must be solved. Matrices generated from these studies are then used for generating the equivalent circuit.

To use the Circuit Extractor, select the type of Equivalent Circuit and the Evaluation Group corresponding to the desired solution, and then press the Extract Circuit button. This will open a window for saving the extracted SPICE file. The text that was saved to the .cir file is added to the SPICE File Preview section, and a second component of the model is created, which stores the extracted Electrical Circuit physics.

The Circuit Extractor can be used to extract lumped quantities for electric circuit simulations, including the automated extraction of resistance R, inductance L, and capacitance C. This is done using the Stationary Source Sweep and Frequency Domain Source Sweep study steps. Predefined variables are used to store the extracted lumped R, L, and C matrices, including automated evaluation and display in post-processing.

shunzap

Using the Electrical Circuit interface

The Electrical Circuit (cir) interface, found under the AC/DC branch when adding a physics interface, is used to model currents and voltages in circuits. This includes voltage and current sources, resistors, capacitors, inductors, and semiconductor devices. The interface supports stationary, frequency-domain, and time-domain modelling and solves Kirchhoff's conservation laws for voltages, currents, and charges associated with the circuit elements.

When using the Electrical Circuit interface, a default Ground Node feature is added and associated with node zero in the electrical circuit. Each circuit component has a Device name, constructed from a prefix identifying the device type and a string specified in the feature's Settings window. For numerical stability, a large resistance is added automatically in parallel to the pn junctions in diodes and BJT devices. The default value for this resistance is 1·1012 Ω.

Users can choose to have newly added devices assigned unused node names and remain disconnected from the rest of the circuit, or they can be connected to the lowest-numbered nodes starting from 0. The Electrical Circuit interface also offers automated import and export of circuits as SPICE .cir files. This feature is particularly useful when needing to connect an FE model with an external circuit. For example, you can make an FE coil and couple it with other circuit elements like resistors or capacitors.

The Circuit Extractor add-in is another useful tool for users, allowing for the direct conversion of electromagnetics simulations into an Electrical Circuit physics interface and subsequently into a SPICE file. To use the Circuit Extractor, a Stationary Source Sweep or a Frequency Domain Source Sweep must first be solved for the physics of interest. The generated matrices are then used for the equivalent circuit generation. After solving, users select the type of Equivalent Circuit and the corresponding Evaluation Group in the Circuit Extractor add-in user interface before pressing the Extract Circuit button.

shunzap

Connecting resistance and capacitance

The COMSOL Multiphysics® software offers a range of functionalities for modelling resistive and capacitive devices and connecting resistance and capacitance. One of the key features is the Circuit Extractor add-in, which allows for the direct conversion of electromagnetics simulation results into an Electrical Circuit physics interface and subsequently into a SPICE file. This add-in is particularly useful for extracting lumped quantities for electric circuit simulations, including resistance, inductance, and capacitance.

To utilise the Circuit Extractor add-in effectively, users need to perform a Stationary Source Sweep or a Frequency Domain Source Sweep for the relevant physics, such as magnetic fields or electric and magnetic fields for resistances, inductances, or impedances. After solving these sweeps, users can access the Circuit Extractor interface, select the desired Equivalent Circuit type, and press the Extract Circuit button. This process generates an equivalent circuit representation, which can be further modified within the interface.

For scenarios involving electrochemical systems, COMSOL Multiphysics provides the flexibility to connect any of the electrochemical physics interfaces to the Electrical Circuit interface. This capability enables users to model electrochemical resistance and capacitance, facilitating a better understanding of their systems. By applying voltage and measuring current or vice versa, users can analyse the resistances and capacitances within an electrochemical cell. Additionally, AC impedance analysis allows for the differentiation between resistive and capacitive currents.

COMSOL also offers a range of video lectures and tutorials that provide step-by-step demonstrations and insights into modelling resistive and capacitive devices. These resources cover topics such as transient and frequency-domain analyses, Joule heating, frequency-domain currents, and modelling considerations for various types of feedback and moving parts. By leveraging these tools and functionalities, users can effectively connect resistance and capacitance within the COMSOL Multiphysics® software.

shunzap

Using the Frequency Domain solver

When using the Frequency Domain solver in COMSOL, you are limited to solving for pure harmonic excitations, which are defined by a frequency and a complex amplitude. If your waveform is harmonic, you can simply apply its frequency and amplitude. However, if your waveform is non-harmonic, you will need to use the time domain.

The Frequency Domain solver can be used in conjunction with the Circuit Extractor add-in. This is automatically installed if you have the default preferences set, but you can also manually access it. The Circuit Extractor allows you to convert the results of electromagnetics simulations into an Electrical Circuit physics interface.

Before running the Circuit Extractor, you need to solve a Stationary Source Sweep or a Frequency Domain Source Sweep study. This generates the lumped matrices of the model, which are then used to generate the equivalent circuit. After solving, you select the type of Equivalent Circuit and the corresponding Evaluation Group in the Circuit Extractor user interface, before pressing the Extract Circuit button.

The AC/DC Module in COMSOL provides built-in user interfaces for various electromagnetics areas, including voltage and current sources, resistors, capacitors, inductors, and semiconductor devices. It also offers features for connecting different interfaces, which is useful for inductors, coils, and motors.

The Frequency Domain solver can be used for piezoelectric frequency domain modal analysis, as well as for analyzing capacitive devices and electrical insulators using electrostatics computations.

Frequently asked questions

Written by
Reviewed by
Share this post
Print
Did this article help you?

Leave a comment