BondLib.Examples.ModelicaSpice.HifiOperationalAmplifier.Experiment

# .BondLib.Examples.ModelicaSpice.HifiOperationalAmplifier.Experiment

Experiment description for Hifi operational amplifier circuit

## Information

This models shows an inverter circuit built from a high-gain operational amplifier. Such circuits used to be standard modeling elements of analog computers [1].

Three device parameters were pulled out all the way to the top level:

1. Level allows the user to choose between a full-fledged Gummel-Poon transistor model (Level=2) and a simplified Ebers-Moll transistor model (Level=1).
2. rampTime enables the user to change the initial ramping period centrally with a single parameter assignment.
3. settleTime enables the user to change the initial settling period centrally with a single parameter assignment.

Usually, we prefer the voltages across capacitors to be used as state variables. However by default, Dymola will use the effort variables of the underlying bond graph C elements as state variables. Since these variables are inside the wrapper models and therefore protected, the state derivatives can then not be displayed.

For this reason, we usually make use of Dymola's StateSelect algorithm to force Dymola to use the (external) capacitive voltages as state variables instead of the corresponding (internal) bond graph effort variables.

Unfortunately, Dymola's StateSelect algorithm fails on this example. For this reason, the Boolean switch enforceStates must be set to false, so that Dymola can use its natural state variables.

Experimentation:

1. Transient Analysis:

Simulate the model during 0.0001 seconds. Store only the output variables. Plot the input voltage, vin, together with the output voltage, vout, on a single plot.

We expect the following results:

Here, the ramping trapezoidal input is clearly visible. In order to reach a true DC OP-point, both the rampTime and the settleTime would have to be chosen considerably longer, but since the circuit converged with the given values, it wasn't necessary to do so.

2. DC Analysis:

Before we can attempt an AC analysis, we need to compute a DC OP point. In ModelicaSpice, we would usually enhance the settling time to the full length of the simulation and repeat the transient analysis with the initial ramping and settling periods only.

However in the given case, as clearly visible from the simulation results of the transient analysis, the final value of the transient analysis above represents a perfectly good DC OP point.

The DC OP point, i.e., the final state of the last simulation performed, is automatically saved by Dymola onto the file dsfinal.txt.

3. AC Analysis:

In order to perform an AC analysis, we need to return quickly to the Modeling window and select the Inverter model, instead of the previously selected Experiment model. The Inverter model has been designed as a SISO model. We then return to the Simulation window.

Now, we need to use the final DC OP point that we saved before as new initial conditions. To this end, we choose from the Simulation pull-down menu the command Continue/ImportInitial... and point at the previously stored file dsfinal.txt.

We have now set the correct initial conditions and are ready to linearize the model around these initial conditions. The Linearize command can also be found in the Simulation pull-down menu.

The linearized model is stored by Dymola in the file dslin.mat.

The AC analysis is actually performed in Matlab rather than in Dymola. We enter Matlab, set the default directory to the current working directory (using the cd command), then run the file OpAmp.m:

This file loads the linearized model into Matlab, and extracts the four system matrices from the combined system matrix stored by Dymola. Each BJT represents a 3rd order model. There are 12 BJTs in the Inverter circuit, plus one extra capacitor. Thus the overall model is of order 37.

The m-file then makes a Matlab system definition out of the four individual system matrices (this requires the Controls toolbox of Matlab). The file then draws a Bode diagram:

Evidently, the Hifi operational amplifier has a band width of roughly 1 MHz.

References:

1. Cellier, F.E. (1991), Continuous System Modeling, Springer-Verlag, New York, ISBN: 0-387-97502-0, 755 p.

Generated at 2026-05-09T18:18:56Z by OpenModelicaOpenModelica 1.26.7 using GenerateDoc.mos