modelIntegratingCircuit

Integrating circuit vs GSL integration

Extends from Modelica.Icons.Example (Icon for runnable examples).

Information

Integrator circuit vs QAG integration routine.

input voltage:  V0 (1 - e-t/τ1) e-t/τ2 

The recalculation of the integral via QAG for each time t is a bit of overkill, but the agreement with the output voltage from the integrator circuit is thereby made clear. The slight difference is due to a combination of the finite timestep for the circuit simulation, the op-amp's behavior, and the relative error in the QAG integrator.

IMPORTANT!!!: The integrand-setup model 'CircuitIntegrand' (or a duplicate) must be run before using GSL integration routines within a larger Modelica model (like this one). (Alternatively, one could edit integrand.c directly and then compile "by hand" in a command window:
gcc -fPIC -c integrand.c integration_mi.c
gcc -shared integration.o integration_mi.o -o libgsl_integration_MI.so  [.dll for windows])

Parameters

TypeNameDefaultDescription
Integern_par3

Components

TypeNameDefaultDescription
Blocks.integration.Integrandintegrand
Modelica.Electrical.Analog.Ideal.IdealizedOpAmpLimitedopAmp
Modelica.Electrical.Analog.Basic.Groundground
Modelica.Electrical.Analog.Basic.Resistorresistor
Modelica.Electrical.Analog.Basic.Capacitorcapacitor
Modelica.Electrical.Analog.Sources.SignalVoltagesignalVoltage
Modelica.Electrical.Analog.Sensors.VoltageSensorvoltageSensor
Blocks.integration.QAG_quadratureqAG_quad
Modelica.Blocks.Sources.Rampx_ramp
Modelica.Blocks.Sources.Constant[n_par]params
Modelica.Blocks.Sources.Constanta_const
Modelica.Blocks.Math.Adddiff
CircuitParamscircuitParams
Modelica.Blocks.Math.Gain[n_par]RCgain

Contents

NameDescription
CircuitParams