Piecewise Linear (and Piecewise Step) Sources

Apr 13 2012, 6:30 PM PDT · 0 comments »

As another facet of our Arbitrary Behavioral Sources release, we've now added support for voltage and current sources to generate piecewise linear or piecewise step signals inside the simulator. This allows you to inject the specific signals you need to test your circuit.

The PWL, PWS, PWLREPEAT, and PWSREPEAT expressions (described in the documentation) take lists of time/value pairs, so you can describe any function you want, and let the simulator interpolate between control points if desired.

Take a look at this Capacitively Loaded Emitter Follower demo which uses a PWL voltage source:

The PWLREPEAT function used to define V2 sets up a pulse that has both postive-going and negative-going parts, with defined edge slopes between the two and the off-state. Open the circuit and run the time-domain simulation to see the piecewise-linear source in action, summed with the +2.5V static bias to produce the voltage waveform V(in). Then, take a look at the V(out) trace, and you'll see that an emitter follower isn't always great at following signals with large, quick changes!

Piecewise sources, plus our new behavioral sources, expose the power of the CircuitLab simulation engine and make it easier to apply CircuitLab to your specific engineering design problems.


Arbitrary Behavioral Sources (Experimental)

Apr 13 2012, 1:45 PM PDT · 1 comment »

We're happy to announce a major upgrade to our simulation backend: voltage and current sources can now become arbitrary behavioral sources. For those not familiar with the tech lingo, it means that voltage and current sources are now "programmable". This feature is currently experimental within CircuitLab, but we wanted to provide you with the power you need to go beyond our included device models.

Let's take a look at a simple modeling example: a TL431 programmable shunt voltage regulator. It's sort of like a Zener diode in that it's a shunt-type device where the incremental resistance becomes tiny past the "on" voltage. However, the TL431 has a third terminal which allows it to be adjustable, and it basically draws as much current from the "cathode" terminal as needed to keep the "reference" terminal at 2.5 volts above the "anode" terminal. The user can then build a simple feedback network, like a resistor divider, to have a programmable shunt voltage reference. Beyond the programmability, the TL431 has another advantage over Zener diodes, which is that its incremental "on" resistance is quite low, so its voltage stays quite steady over varying load currents.

Here's a very simple model built in CircuitLab (from a bigger test circuit we'll link below):

You can see that I2 is a normal current source, drawing 2uA into the reference terminal. But I1 is a current source that's defined by an expression, "MAX(0, (V(REF)-V(ANODE)-2.5)/1m)". That expression means that the current flowing through I2 is the maximum of 0 and the quantity on the right side -- meaning that if the right side is less than 0, the current is just zero, so the current is never negative. The other piece of the expression is "(V(REF)-V(ANODE)-2.5)/1m", which means to take the voltage difference between REF and ANODE nodes, subtract 2.5 volts (which is the built-in reference voltage of the TL431), and then divide by 0.001. That 0.001 is almost like a resistance, where the current varies by 1000 amps for every volt of difference. But here, it's really a transconductance, because the terminals that the current flow through aren't the same terminals whose voltages are being measured.

This is part of a test circuit:

We can run a DC sweep, and demo the parameter sweep options as well to adjust the resistors connected in the external circuit:

Here, we can see that the output voltage is adjustable by the feedback resistors R2 and R3.

Behavioral sources are experimental, but feel free to go ahead and give them a try! Read more about allowed expressions and behavioral sources. Beware that behavioral sources make it very easy to cause convergence problems. We work hard to make sure that CircuitLab-defined built-in models converge in most cases, but arbitrary behavioral sources means that you're on your own. If you're having trouble, feel free to ask for help on the forums and see if another user can help re-structure your equations to achieve the desired effect.


Power User Shortcuts

Apr 13 2012, 1:30 PM PDT · 0 comments »

Available now in the CircuitLab editor are new features that should make the CircuitLab experience much smoother for power users of our tool. We have added a Run menu to the top toolbar that will let you jump straight to running a simulation from build mode. On the menu you will also notice that the F5 key will now run the currently active simulation tab you have open. So, if you have to hop over to build mode to make a quick change in your circuit, you can just hit F5 to run the simulation again.

Run Simulation Screenshot

To complement the ability to quickly jump into a simulation, we've also added the ability to quickly jump into build mode from simulation mode. Just double click anywhere on the grid and it will send you back to build mode so you can edit the schematic.