Modelica.Electrical.Analog.Basic

Basic electrical components

Information


This package contains very basic analog electrical components such as resistor, conductor, condensator, inductor, and the ground (which is needed in each electrical circuit description. Furthermore, controled sources, coupling components, and some improved (but newertheless basic) are in this package.

Extends from Modelica.Icons.Package (Icon for standard packages).

Package Content

NameDescription
Modelica.Electrical.Analog.Basic.Ground Ground Ground node
Modelica.Electrical.Analog.Basic.Resistor Resistor Ideal linear electrical resistor
Modelica.Electrical.Analog.Basic.HeatingResistor HeatingResistor Temperature dependent electrical resistor
Modelica.Electrical.Analog.Basic.Conductor Conductor Ideal linear electrical conductor
Modelica.Electrical.Analog.Basic.Capacitor Capacitor Ideal linear electrical capacitor
Modelica.Electrical.Analog.Basic.Inductor Inductor Ideal linear electrical inductor
Modelica.Electrical.Analog.Basic.SaturatingInductor SaturatingInductor Simple model of an inductor with saturation
Modelica.Electrical.Analog.Basic.Transformer Transformer Transformer with two ports
Modelica.Electrical.Analog.Basic.M_Transformer M_Transformer Generic transformer with free number of inductors
Modelica.Electrical.Analog.Basic.Gyrator Gyrator Gyrator
Modelica.Electrical.Analog.Basic.EMF EMF Electromotoric force (electric/mechanic transformer)
Modelica.Electrical.Analog.Basic.TranslationalEMF TranslationalEMF Electromotoric force (electric/mechanic transformer)
Modelica.Electrical.Analog.Basic.VCV VCV Linear voltage-controlled voltage source
Modelica.Electrical.Analog.Basic.VCC VCC Linear voltage-controlled current source
Modelica.Electrical.Analog.Basic.CCV CCV Linear current-controlled voltage source
Modelica.Electrical.Analog.Basic.CCC CCC Linear current-controlled current source
Modelica.Electrical.Analog.Basic.OpAmp OpAmp Simple nonideal model of an OpAmp with limitation
Modelica.Electrical.Analog.Basic.OpAmpDetailed OpAmpDetailed Detailed model of an operational amplifier
Modelica.Electrical.Analog.Basic.VariableResistor VariableResistor Ideal linear electrical resistor with variable resistance
Modelica.Electrical.Analog.Basic.VariableConductor VariableConductor Ideal linear electrical conductor with variable conductance
Modelica.Electrical.Analog.Basic.VariableCapacitor VariableCapacitor Ideal linear electrical capacitor with variable capacitance
Modelica.Electrical.Analog.Basic.VariableInductor VariableInductor Ideal linear electrical inductor with variable inductance


Modelica.Electrical.Analog.Basic.Ground Modelica.Electrical.Analog.Basic.Ground

Ground node

Modelica.Electrical.Analog.Basic.Ground

Information


Ground of an electrical circuit. The potential at the ground node is zero. Every electrical circuit has to contain at least one ground object.

Connectors

TypeNameDescription
Pinp 

Modelica definition

model Ground "Ground node"

  Interfaces.Pin p;
equation 
  p.v = 0;
end Ground;

Modelica.Electrical.Analog.Basic.Resistor Modelica.Electrical.Analog.Basic.Resistor

Ideal linear electrical resistor

Modelica.Electrical.Analog.Basic.Resistor

Information


The linear resistor connects the branch voltage v with the branch current i by i*R = v. The Resistance R is allowed to be positive, zero, or negative.

Extends from Modelica.Electrical.Analog.Interfaces.OnePort (Component with two electrical pins p and n and current i from p to n), Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort (Partial model to include a conditional HeatPort in order to describe the power loss via a thermal network).

Parameters

TypeNameDefaultDescription
ResistanceR Resistance at temperature T_ref [Ohm]
TemperatureT_ref300.15Reference temperature [K]
LinearTemperatureCoefficientalpha0Temperature coefficient of resistance (R_actual = R*(1 + alpha*(T_heatPort - T_ref)) [1/K]
BooleanuseHeatPortfalse=true, if HeatPort is enabled
TemperatureTT_refFixed device temperature if useHeatPort = false [K]

Connectors

TypeNameDescription
PositivePinpPositive pin (potential p.v > n.v for positive voltage drop v)
NegativePinnNegative pin
HeatPort_aheatPort 

Modelica definition

model Resistor "Ideal linear electrical resistor"
  parameter Modelica.SIunits.Resistance R(start=1) 
    "Resistance at temperature T_ref";
  parameter Modelica.SIunits.Temperature T_ref=300.15 "Reference temperature";
  parameter Modelica.SIunits.LinearTemperatureCoefficient alpha=0 
    "Temperature coefficient of resistance (R_actual = R*(1 + alpha*(T_heatPort - T_ref))";

  extends Modelica.Electrical.Analog.Interfaces.OnePort;
  extends Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort(                    T = T_ref);
  Modelica.SIunits.Resistance R_actual 
    "Actual resistance = R*(1 + alpha*(T_heatPort - T_ref))";

equation 
  assert((1 + alpha*(T_heatPort - T_ref)) >= Modelica.Constants.eps, "Temperature outside scope of model!");
  R_actual = R*(1 + alpha*(T_heatPort - T_ref));
  v = R_actual*i;
  LossPower = v*i;
end Resistor;

Modelica.Electrical.Analog.Basic.HeatingResistor Modelica.Electrical.Analog.Basic.HeatingResistor

Temperature dependent electrical resistor

Modelica.Electrical.Analog.Basic.HeatingResistor

Information


This is a model for an electrical resistor where the generated heat is dissipated to the environment via connector heatPort and where the resistance R is temperature dependent according to the following equation:

    R = R_ref*(1 + alpha*(heatPort.T - T_ref))

alpha is the temperature coefficient of resistance, which is often abbreviated as TCR. In resistor catalogues, it is usually defined as X [ppm/K] (parts per million, similarly to per centage) meaning X*1.e-6 [1/K]. Resistors are available for 1 .. 7000 ppm/K, i.e., alpha = 1e-6 .. 7e-3 1/K;

Via parameter useHeatPort the heatPort connector can be enabled and disabled (default = enabled). If it is disabled, the generated heat is transported implicitly to an internal temperature source with a fixed temperature of T_ref.

If the heatPort connector is enabled, it must be connected.

Extends from Modelica.Electrical.Analog.Interfaces.OnePort (Component with two electrical pins p and n and current i from p to n), Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort (Partial model to include a conditional HeatPort in order to describe the power loss via a thermal network).

Parameters

TypeNameDefaultDescription
ResistanceR_ref Resistance at temperature T_ref [Ohm]
TemperatureT_ref300.15Reference temperature [K]
LinearTemperatureCoefficientalpha0Temperature coefficient of resistance (R = R_ref*(1 + alpha*(heatPort.T - T_ref)) [1/K]
BooleanuseHeatPorttrue=true, if HeatPort is enabled
TemperatureTT_refFixed device temperature if useHeatPort = false [K]

Connectors

TypeNameDescription
PositivePinpPositive pin (potential p.v > n.v for positive voltage drop v)
NegativePinnNegative pin
HeatPort_aheatPort 

Modelica definition

model HeatingResistor "Temperature dependent electrical resistor"
  parameter Modelica.SIunits.Resistance R_ref(start=1) 
    "Resistance at temperature T_ref";
  parameter Modelica.SIunits.Temperature T_ref=300.15 "Reference temperature";
  parameter Modelica.SIunits.LinearTemperatureCoefficient alpha=0 
    "Temperature coefficient of resistance (R = R_ref*(1 + alpha*(heatPort.T - T_ref))";
  extends Modelica.Electrical.Analog.Interfaces.OnePort;
  extends Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort(                    T = T_ref, useHeatPort=true);
  Modelica.SIunits.Resistance R 
    "Resistance = R_ref*(1 + alpha*(T_heatPort - T_ref))";
equation 
  assert((1 + alpha*(T_heatPort - T_ref)) >= Modelica.Constants.eps, "Temperature outside scope of model!");
  R = R_ref*(1 + alpha*(T_heatPort - T_ref));
  v = R*i;
  LossPower = v*i;
end HeatingResistor;

Modelica.Electrical.Analog.Basic.Conductor Modelica.Electrical.Analog.Basic.Conductor

Ideal linear electrical conductor

Modelica.Electrical.Analog.Basic.Conductor

Information


The linear conductor connects the branch voltage v with the branch current i by i = v*G. The Conductance G is allowed to be positive, zero, or negative.

Extends from Modelica.Electrical.Analog.Interfaces.OnePort (Component with two electrical pins p and n and current i from p to n), Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort (Partial model to include a conditional HeatPort in order to describe the power loss via a thermal network).

Parameters

TypeNameDefaultDescription
ConductanceG Conductance at temperature T_ref [S]
TemperatureT_ref300.15Reference temperature [K]
LinearTemperatureCoefficientalpha0Temperature coefficient of conductance (G_actual = G_ref/(1 + alpha*(T_heatPort - T_ref)) [1/K]
BooleanuseHeatPortfalse=true, if HeatPort is enabled
TemperatureTT_refFixed device temperature if useHeatPort = false [K]

Connectors

TypeNameDescription
PositivePinpPositive pin (potential p.v > n.v for positive voltage drop v)
NegativePinnNegative pin
HeatPort_aheatPort 

Modelica definition

model Conductor "Ideal linear electrical conductor"
  parameter Modelica.SIunits.Conductance G(start=1) 
    "Conductance at temperature T_ref";
  parameter Modelica.SIunits.Temperature T_ref=300.15 "Reference temperature";
  parameter Modelica.SIunits.LinearTemperatureCoefficient alpha=0 
    "Temperature coefficient of conductance (G_actual = G_ref/(1 + alpha*(T_heatPort - T_ref))";
  extends Modelica.Electrical.Analog.Interfaces.OnePort;
  extends Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort(
                                                               T = T_ref);
  Modelica.SIunits.Conductance G_actual 
    "Actual conductance = G_ref/(1 + alpha*(T_heatPort - T_ref))";

equation 
  assert((1 + alpha*(T_heatPort - T_ref)) >= Modelica.Constants.eps, "Temperature outside scope of model!");
  G_actual = G/(1 + alpha*(T_heatPort - T_ref));
  i = G_actual*v;
  LossPower = v*i;
end Conductor;

Modelica.Electrical.Analog.Basic.Capacitor Modelica.Electrical.Analog.Basic.Capacitor

Ideal linear electrical capacitor

Modelica.Electrical.Analog.Basic.Capacitor

Information


The linear capacitor connects the branch voltage v with the branch current i by i = C * dv/dt. The Capacitance C is allowed to be positive, zero, or negative.

Extends from Interfaces.OnePort (Component with two electrical pins p and n and current i from p to n).

Parameters

TypeNameDefaultDescription
CapacitanceC Capacitance [F]

Connectors

TypeNameDescription
PositivePinpPositive pin (potential p.v > n.v for positive voltage drop v)
NegativePinnNegative pin

Modelica definition

model Capacitor "Ideal linear electrical capacitor"
  extends Interfaces.OnePort;
  parameter SI.Capacitance C(start=1) "Capacitance";

equation 
  i = C*der(v);
end Capacitor;

Modelica.Electrical.Analog.Basic.Inductor Modelica.Electrical.Analog.Basic.Inductor

Ideal linear electrical inductor

Modelica.Electrical.Analog.Basic.Inductor

Information


The linear inductor connects the branch voltage v with the branch current i by v = L * di/dt. The Inductance L is allowed to be positive, zero, or negative.

Extends from Interfaces.OnePort (Component with two electrical pins p and n and current i from p to n).

Parameters

TypeNameDefaultDescription
InductanceL Inductance [H]

Connectors

TypeNameDescription
PositivePinpPositive pin (potential p.v > n.v for positive voltage drop v)
NegativePinnNegative pin

Modelica definition

model Inductor "Ideal linear electrical inductor"
  extends Interfaces.OnePort;
  parameter SI.Inductance L(start=1) "Inductance";
equation 
  L*der(i) = v;
end Inductor;

Modelica.Electrical.Analog.Basic.SaturatingInductor Modelica.Electrical.Analog.Basic.SaturatingInductor

Simple model of an inductor with saturation

Modelica.Electrical.Analog.Basic.SaturatingInductor

Information


This model approximates the behaviour of an inductor with the influence of saturation, i.e., the value of the inductance depends on the current flowing through the inductor. The inductance decreases as current increases.

The parameters are:

Extends from Modelica.Electrical.Analog.Interfaces.OnePort (Component with two electrical pins p and n and current i from p to n).

Parameters

TypeNameDefaultDescription
CurrentInom Nominal current [A]
InductanceLnom Nominal inductance at Nominal current [H]
InductanceLzer Inductance near current=0 [H]
InductanceLinf Inductance at large currents [H]

Connectors

TypeNameDescription
PositivePinpPositive pin (potential p.v > n.v for positive voltage drop v)
NegativePinnNegative pin

Modelica definition

model SaturatingInductor 
  "Simple model of an inductor with saturation"
  extends Modelica.Electrical.Analog.Interfaces.OnePort;
  parameter Modelica.SIunits.Current Inom(start=1) "Nominal current";
  parameter Modelica.SIunits.Inductance Lnom(start=1) 
    "Nominal inductance at Nominal current";
  parameter Modelica.SIunits.Inductance Lzer(start=2*Lnom) 
    "Inductance near current=0";
  parameter Modelica.SIunits.Inductance Linf(start=Lnom/2) 
    "Inductance at large currents";
  Modelica.SIunits.Inductance Lact(start=Lzer);
  Modelica.SIunits.MagneticFlux Psi;
protected 
  parameter Modelica.SIunits.Current Ipar(start=Inom/10, fixed=false);
initial equation 
  (Lnom - Linf) = (Lzer - Linf)*Ipar/Inom*(Modelica.Constants.pi/2-Modelica.Math.atan(Ipar/Inom));
equation 
  assert(Lzer > Lnom+Modelica.Constants.eps,
         "Lzer (= " + String(Lzer) + ") has to be > Lnom (= " + String(Lnom) + ")");
  assert(Linf < Lnom-Modelica.Constants.eps,
         "Linf (= " + String(Linf) + ") has to be < Lnom (= " + String(Lnom) + ")");
  (Lact - Linf)*i/Ipar = (Lzer - Linf)*noEvent(Modelica.Math.atan(i/Ipar));
  Psi = Lact*i;
  v = der(Psi);
end SaturatingInductor;

Modelica.Electrical.Analog.Basic.Transformer Modelica.Electrical.Analog.Basic.Transformer

Transformer with two ports

Modelica.Electrical.Analog.Basic.Transformer

Information


The transformer is a two port. The left port voltage v1, left port current i1, right port voltage v2 and right port current i2 are connected by the following relation:

         | v1 |         | L1   M  |  | i1'; |
         |    |    =    |         |  |     |
         | v2 |         | M    L2 |  | i2'; |

L1, L2, and M are the primary, secondary, and coupling inductances respectively.

Extends from Interfaces.TwoPort (Component with two electrical ports, including current).

Parameters

TypeNameDefaultDescription
InductanceL1 Primary inductance [H]
InductanceL2 Secondary inductance [H]
InductanceM Coupling inductance [H]

Connectors

TypeNameDescription
PositivePinp1Positive pin of the left port (potential p1.v > n1.v for positive voltage drop v1)
NegativePinn1Negative pin of the left port
PositivePinp2Positive pin of the right port (potential p2.v > n2.v for positive voltage drop v2)
NegativePinn2Negative pin of the right port

Modelica definition

model Transformer "Transformer with two ports"
  extends Interfaces.TwoPort;
  parameter SI.Inductance L1(start=1) "Primary inductance";
  parameter SI.Inductance L2(start=1) "Secondary inductance";
  parameter SI.Inductance M(start=1) "Coupling inductance";
equation 
  v1 = L1*der(i1) + M*der(i2);
  v2 = M*der(i1) + L2*der(i2);
end Transformer;

Modelica.Electrical.Analog.Basic.M_Transformer Modelica.Electrical.Analog.Basic.M_Transformer

Generic transformer with free number of inductors

Modelica.Electrical.Analog.Basic.M_Transformer

Information


The model M_Transformer is a model of a transformer with the posibility to choose the number of inductors. Inside the model, an inductance matrix is built based on the inductance of the inductors and the coupling inductances between the inductors given as a parameter vector from the user of the model.

An example shows that approach:
The user chooses a model with three inductors, that means the parameter N has to be 3. Then he has to specify the inductances of the three inductors and the three coupling inductances. The coupling inductances are no real existing devices, but effects that occur between two inductors. The inductivities (main diagonal of the inductance matrix) and the coupling inductivities have to be specified in the parameter vector L. The length dimL of the parameter vector is calculated as follows: dimL=(N*(N+1))/2

The following example shows how the parameter vector is used to fill in the inductance matrix. To specify the inductance matrix of a three inductances transformer (N=3):
L_m
the user has to allocate the parameter vector L[6] , since Nv=(N*(N+1))/2=(3*(3+1))/2=6. The parameter vector must be filled like this: L=[1,0.1,0.2,2,0.3,3] .

Inside the model, two loops are used to fill the inductance matrix to guarantee that it is filled in a symmetric way.

Parameters

TypeNameDefaultDescription
IntegerN3number of inductors
InductanceL[dimL]{1,0.1,0.2,2,0.3,3}inductances and coupling inductances [H]

Connectors

TypeNameDescription
PositivePinp[N]Positive pin
NegativePinn[N]Negative pin

Modelica definition

model M_Transformer 
  "Generic transformer with free number of inductors"

  parameter Integer N(final min=1)=3 "number of inductors";
protected 
  parameter Integer dimL=div(N*(N+1),2);
public 
  parameter Modelica.SIunits.Inductance L[dimL]={1,0.1,0.2,2,0.3,3} 
    "inductances and coupling inductances";
  Modelica.Electrical.Analog.Interfaces.PositivePin p[N] "Positive pin";
  Modelica.Electrical.Analog.Interfaces.NegativePin n[N] "Negative pin";

  Modelica.SIunits.Voltage v[N];
  Modelica.SIunits.Current i[N];
  Modelica.SIunits.Inductance Lm[N,N];
algorithm 
  for s in 1:N loop
     for z in 1:N loop
       Lm[z,s]:= if (z>=s) then L[(s-1)*N+z-div((s-1)*s,2)] else 
                 Lm[s,z];
     end for;
  end for;

equation 
  for j in 1:N loop
    v[j] = p[j].v - n[j].v;
    0 = p[j].i + n[j].i;
    i[j] = p[j].i;
  end for;

  v =Lm*der(i);

end M_Transformer;

Modelica.Electrical.Analog.Basic.Gyrator Modelica.Electrical.Analog.Basic.Gyrator

Gyrator

Modelica.Electrical.Analog.Basic.Gyrator

Information


A gyrator is a two-port element defined by the following equations:

    i1 =  G2 * v2
    i2 = -G1 * v1

where the constants G1, G2 are called the gyration conductance.

Extends from Interfaces.TwoPort (Component with two electrical ports, including current).

Parameters

TypeNameDefaultDescription
ConductanceG1 Gyration conductance [S]
ConductanceG2 Gyration conductance [S]

Connectors

TypeNameDescription
PositivePinp1Positive pin of the left port (potential p1.v > n1.v for positive voltage drop v1)
NegativePinn1Negative pin of the left port
PositivePinp2Positive pin of the right port (potential p2.v > n2.v for positive voltage drop v2)
NegativePinn2Negative pin of the right port

Modelica definition

model Gyrator "Gyrator"
  extends Interfaces.TwoPort;
  parameter SI.Conductance G1(start=1) "Gyration conductance";
  parameter SI.Conductance G2(start=1) "Gyration conductance";
equation 
  i1 = G2*v2;
  i2 = -G1*v1;
end Gyrator;

Modelica.Electrical.Analog.Basic.EMF Modelica.Electrical.Analog.Basic.EMF

Electromotoric force (electric/mechanic transformer)

Modelica.Electrical.Analog.Basic.EMF

Information


EMF transforms electrical energy into rotational mechanical energy. It is used as basic building block of an electrical motor. The mechanical connector flange can be connected to elements of the Modelica.Mechanics.Rotational library. flange.tau is the cut-torque, flange.phi is the angle at the rotational connection.

Parameters

TypeNameDefaultDescription
BooleanuseSupportfalse= true, if support flange enabled, otherwise implicitly grounded
ElectricalTorqueConstantk Transformation coefficient [N.m/A]

Connectors

TypeNameDescription
PositivePinp 
NegativePinn 
Flange_bflange 
SupportsupportSupport/housing of emf shaft

Modelica definition

model EMF "Electromotoric force (electric/mechanic transformer)"
  parameter Boolean useSupport=false 
    "= true, if support flange enabled, otherwise implicitly grounded";
  parameter SI.ElectricalTorqueConstant k(start=1) "Transformation coefficient";
  SI.Voltage v "Voltage drop between the two pins";
  SI.Current i "Current flowing from positive to negative pin";
  SI.Angle phi 
    "Angle of shaft flange with respect to support (= flange.phi - support.phi)";
  SI.AngularVelocity w "Angular velocity of flange relative to support";
  Interfaces.PositivePin p;
  Interfaces.NegativePin n;
  Modelica.Mechanics.Rotational.Interfaces.Flange_b flange;
  Mechanics.Rotational.Interfaces.Support support if useSupport 
    "Support/housing of emf shaft";
protected 
  Mechanics.Rotational.Components.Fixed fixed if not useSupport;
  Mechanics.Rotational.Interfaces.InternalSupport internalSupport(tau=-flange.tau);
equation 
  v = p.v - n.v;
  0 = p.i + n.i;
  i = p.i;

  phi = flange.phi - internalSupport.phi;
  w = der(phi);
  k*w = v;
  flange.tau = -k*i;
  connect(internalSupport.flange, support);
  connect(internalSupport.flange,fixed. flange);
end EMF;

Modelica.Electrical.Analog.Basic.TranslationalEMF Modelica.Electrical.Analog.Basic.TranslationalEMF

Electromotoric force (electric/mechanic transformer)

Modelica.Electrical.Analog.Basic.TranslationalEMF

Information


EMF transforms electrical energy into translational mechanical energy. It is used as basic building block of an electrical linear motor. The mechanical connector flange can be connected to elements of the Modelica.Mechanics.Translational library. flange.f is the cut-force, flange.s is the distance at the translational connection.

Parameters

TypeNameDefaultDescription
BooleanuseSupportfalse= true, if support flange enabled, otherwise implicitly grounded
ElectricalForceConstantk Transformation coefficient [N/A]

Connectors

TypeNameDescription
PositivePinp 
NegativePinn 
Flange_bflange 
SupportsupportSupport/housing

Modelica definition

model TranslationalEMF 
  "Electromotoric force (electric/mechanic transformer)"
  parameter Boolean useSupport=false 
    "= true, if support flange enabled, otherwise implicitly grounded";
  parameter Modelica.SIunits.ElectricalForceConstant k(start=1) 
    "Transformation coefficient";

  Modelica.SIunits.Voltage v "Voltage drop between the two pins";
  Modelica.SIunits.Current i "Current flowing from positive to negative pin";
  Modelica.SIunits.Position s "Position of flange relative to support";
  Modelica.SIunits.Velocity vel "Velocity of flange relative to support";

  Modelica.Electrical.Analog.Interfaces.PositivePin p;
  Modelica.Electrical.Analog.Interfaces.NegativePin n;
  Modelica.Mechanics.Translational.Interfaces.Flange_b flange;
  Modelica.Mechanics.Translational.Interfaces.Support support if useSupport 
    "Support/housing";
protected 
  Modelica.Mechanics.Translational.Components.Fixed fixed if not useSupport;
  Modelica.Mechanics.Translational.Interfaces.InternalSupport internalSupport(f=-flange.f);
equation 
  v = p.v - n.v;
  0 = p.i + n.i;
  i = p.i;

  s = flange.s - internalSupport.s;
  vel = der(s);
  k*vel = v;
  flange.f = -k*i;
  connect(internalSupport.flange, support);
  connect(internalSupport.flange, fixed.flange);
end TranslationalEMF;

Modelica.Electrical.Analog.Basic.VCV Modelica.Electrical.Analog.Basic.VCV

Linear voltage-controlled voltage source

Modelica.Electrical.Analog.Basic.VCV

Information


The linear voltage-controlled voltage source is a TwoPort. The right port voltage v2 is controlled by the left port voltage v1 via

    v2 = v1 * gain. 

The left port current is zero. Any voltage gain can be chosen.

Extends from Interfaces.TwoPort (Component with two electrical ports, including current).

Parameters

TypeNameDefaultDescription
Realgain Voltage gain

Connectors

TypeNameDescription
PositivePinp1Positive pin of the left port (potential p1.v > n1.v for positive voltage drop v1)
NegativePinn1Negative pin of the left port
PositivePinp2Positive pin of the right port (potential p2.v > n2.v for positive voltage drop v2)
NegativePinn2Negative pin of the right port

Modelica definition

model VCV "Linear voltage-controlled voltage source"
  extends Interfaces.TwoPort;
  parameter Real gain(start=1) "Voltage gain";

equation 
  v2 = v1*gain;
  i1 = 0;
end VCV;

Modelica.Electrical.Analog.Basic.VCC Modelica.Electrical.Analog.Basic.VCC

Linear voltage-controlled current source

Modelica.Electrical.Analog.Basic.VCC

Information


The linear voltage-controlled current source is a TwoPort. The right port current i2 is controlled by the left port voltage v1 via

    i2 = v1 * transConductance. 

The left port current is zero. Any transConductance can be chosen.

Extends from Interfaces.TwoPort (Component with two electrical ports, including current).

Parameters

TypeNameDefaultDescription
ConductancetransConductance Transconductance [S]

Connectors

TypeNameDescription
PositivePinp1Positive pin of the left port (potential p1.v > n1.v for positive voltage drop v1)
NegativePinn1Negative pin of the left port
PositivePinp2Positive pin of the right port (potential p2.v > n2.v for positive voltage drop v2)
NegativePinn2Negative pin of the right port

Modelica definition

model VCC "Linear voltage-controlled current source"
  extends Interfaces.TwoPort;
  parameter SI.Conductance transConductance(start=1) "Transconductance";
equation 
  i2 = v1*transConductance;
  i1 = 0;
end VCC;

Modelica.Electrical.Analog.Basic.CCV Modelica.Electrical.Analog.Basic.CCV

Linear current-controlled voltage source

Modelica.Electrical.Analog.Basic.CCV

Information


The linear current-controlled voltage source is a TwoPort. The right port voltage v2 is controlled by the left port current i1 via

    v2 = i1 * transResistance. 

The left port voltage is zero. Any transResistance can be chosen.

Extends from Interfaces.TwoPort (Component with two electrical ports, including current).

Parameters

TypeNameDefaultDescription
ResistancetransResistance Transresistance [Ohm]

Connectors

TypeNameDescription
PositivePinp1Positive pin of the left port (potential p1.v > n1.v for positive voltage drop v1)
NegativePinn1Negative pin of the left port
PositivePinp2Positive pin of the right port (potential p2.v > n2.v for positive voltage drop v2)
NegativePinn2Negative pin of the right port

Modelica definition

model CCV "Linear current-controlled voltage source"
  extends Interfaces.TwoPort;

  parameter SI.Resistance transResistance(start=1) "Transresistance";

equation 
  v2 = i1*transResistance;
  v1 = 0;
end CCV;

Modelica.Electrical.Analog.Basic.CCC Modelica.Electrical.Analog.Basic.CCC

Linear current-controlled current source

Modelica.Electrical.Analog.Basic.CCC

Information


The linear current-controlled current source is a TwoPort. The right port current i2 is controlled by the left port current i1 via

    i2 = i1 * gain. 

The left port voltage is zero. Any current gain can be chosen.

Extends from Interfaces.TwoPort (Component with two electrical ports, including current).

Parameters

TypeNameDefaultDescription
Realgain Current gain

Connectors

TypeNameDescription
PositivePinp1Positive pin of the left port (potential p1.v > n1.v for positive voltage drop v1)
NegativePinn1Negative pin of the left port
PositivePinp2Positive pin of the right port (potential p2.v > n2.v for positive voltage drop v2)
NegativePinn2Negative pin of the right port

Modelica definition

model CCC "Linear current-controlled current source"
  extends Interfaces.TwoPort;
  parameter Real gain(start=1) "Current gain";

equation 
  i2 = i1*gain;
  v1 = 0;
end CCC;

Modelica.Electrical.Analog.Basic.OpAmp Modelica.Electrical.Analog.Basic.OpAmp

Simple nonideal model of an OpAmp with limitation

Modelica.Electrical.Analog.Basic.OpAmp

Information


The OpAmp is a simle nonideal model with a smooth out.v = f(vin) characteristic, where "vin = in_p.v - in_n.v". The characteristic is limited by VMax.v and VMin.v. Its slope at vin=0 is the parameter Slope, which must be positive. (Therefore, the absolute value of Slope is taken into calculation.)

Parameters

TypeNameDefaultDescription
RealSlope Slope of the out.v/vin characteristic at vin=0

Connectors

TypeNameDescription
PositivePinin_pPositive pin of the input port
NegativePinin_nNegative pin of the input port
PositivePinoutOutput pin
PositivePinVMaxPositive output voltage limitation
NegativePinVMinNegative output voltage limitation

Modelica definition

model OpAmp "Simple nonideal model of an OpAmp with limitation"
  parameter Real Slope(start=1) 
    "Slope of the out.v/vin characteristic at vin=0";
  Modelica.Electrical.Analog.Interfaces.PositivePin in_p 
    "Positive pin of the input port";
  Modelica.Electrical.Analog.Interfaces.NegativePin in_n 
    "Negative pin of the input port";
  Modelica.Electrical.Analog.Interfaces.PositivePin out "Output pin";
  Modelica.Electrical.Analog.Interfaces.PositivePin VMax 
    "Positive output voltage limitation";
  Modelica.Electrical.Analog.Interfaces.NegativePin VMin 
    "Negative output voltage limitation";
  SI.Voltage vin "input voltagae";
protected 
  Real f "auxiliary variable";
  Real absSlope;
equation 
  in_p.i = 0;
  in_n.i = 0;
  VMax.i = 0;
  VMin.i = 0;
  vin = in_p.v - in_n.v;
  f = 2/(VMax.v - VMin.v);
  absSlope = smooth(0,(if (Slope < 0) then -Slope else Slope));
  out.v = (VMax.v + VMin.v)/2 + absSlope*vin/(1 + absSlope*smooth(0,(if (f*vin
     < 0) then -f*vin else f*vin)));
end OpAmp;

Modelica.Electrical.Analog.Basic.OpAmpDetailed Modelica.Electrical.Analog.Basic.OpAmpDetailed

Detailed model of an operational amplifier

Modelica.Electrical.Analog.Basic.OpAmpDetailed

Information


The OpAmpDetailed model is a general operational amplifier model. The emphasis is on separating each important data sheet parameter into a sub-circuit independent of the other parameters. The model is broken down into five functional stages input, frequency response, gain, slew rate and an output stage. Each stage contains data sheet parameters to be modeled. This partitioning and the modelling of the separate submodels are based on the description in [CP92].

Using [CP92] Joachim Haase (Fraunhofer Institute for Integrated Circuits, Design Automation Division) transfered 2001 operational amplifier models into VHDL-AMS. Now one of these models, the model "amp(macro)" was transferred into Modelica.

Reference:
[CP92] Conelly, J.A.; Choi, P.: Macromodelling with SPICE. Englewood Cliffs: Prentice-Hall, 1992

Parameters

TypeNameDefaultDescription
ResistanceRdm2.0e6Input resistance (differential input mode) [Ohm]
ResistanceRcm2.0e9Input resistance (common mode) [Ohm]
CapacitanceCin1.4e-12Input capacitance [F]
VoltageVos1.0e-3Input offset voltage [V]
CurrentIb80.0e-9Input bias current [A]
CurrentIos20.0e-9Input offset current [A]
Voltagevcp0.0Correction value for limiting by p_supply [V]
Voltagevcm0.0Correction value for limiting by msupply [V]
RealAvd0106.0Differential amplifier [dB]
RealCMRR90.0Common-mode rejection [dB]
Frequencyfp15.0Dominant pole [Hz]
Frequencyfp22.0e6Pole frequency [Hz]
Frequencyfp320.0e6Pole frequency [Hz]
Frequencyfp4100.0e6Pole frequency [Hz]
Frequencyfz5.0e6Zero frequency [Hz]
VoltageSlopesr_p0.5e6Slew rate for increase [V/s]
VoltageSlopesr_m0.5e6Slew rate for decrease [V/s]
ResistanceRout75.0Output resistance [Ohm]
CurrentImaxso25.0e-3Maximal output current (source current) [A]
CurrentImaxsi25.0e-3Maximal output current (sink current) [A]
TimeTs0.0000012sampling time [s]

Connectors

TypeNameDescription
PositivePinpPositive pin of the input port
NegativePinmNegative pin of the input port
PositivePinoutpOutput pin
PositivePinp_supplyPositive output voltage limitation
NegativePinm_supplyNegative output voltage limitation

Modelica definition

model OpAmpDetailed "Detailed model of an operational amplifier"
// literature: Conelly, J.A.; Choi, P.: Macromodelling with SPICE. Englewood Cliffs: Prentice-Hall, 1992
  import SI = Modelica.SIunits;
  parameter SI.Resistance Rdm=2.0e6 
    "Input resistance (differential input mode)";
  parameter SI.Resistance Rcm=2.0e9 "Input resistance (common mode)";
  parameter SI.Capacitance Cin=1.4e-12 "Input capacitance";
  parameter SI.Voltage Vos=1.0e-3 "Input offset voltage";
  parameter SI.Current Ib=80.0e-9 "Input bias current";
  parameter SI.Current Ios=20.0e-9 "Input offset current";
  parameter SI.Voltage vcp=0.0 "Correction value for limiting by p_supply";
  parameter SI.Voltage vcm=0.0 "Correction value for limiting by msupply";
  parameter Real Avd0=106.0 "Differential amplifier [dB]";
  parameter Real CMRR=90.0 "Common-mode rejection [dB]";
  parameter SI.Frequency fp1=5.0 "Dominant pole";
  parameter SI.Frequency fp2=2.0e6 "Pole frequency";
  parameter SI.Frequency fp3=20.0e6 "Pole frequency";
  parameter SI.Frequency fp4=100.0e6 "Pole frequency";
  parameter SI.Frequency fz=5.0e6 "Zero frequency";
  parameter SI.VoltageSlope sr_p=0.5e6 "Slew rate for increase";
  parameter SI.VoltageSlope sr_m=0.5e6 "Slew rate for decrease";
  parameter SI.Resistance Rout=75.0 "Output resistance";
  parameter SI.Current Imaxso=25.0e-3 "Maximal output current (source current)";
  parameter SI.Current Imaxsi=25.0e-3 "Maximal output current (sink current)";

// number of intervalls: 2500, stop time: 0.003
  parameter SI.Time Ts=0.0000012 "sampling time";

// constant expressions
  constant Real Pi=3.141592654;

 // power supply
  final parameter SI.Voltage vcp_abs = abs(vcp) 
    "Positive correction value for limiting by p_supply";
  final parameter SI.Voltage vcm_abs = abs(vcm) 
    "Positive correction value for limiting by msupply";

// input stage
//  Ib = 0.5*(I1 + I2);
//  Ios = I1 - I2;
  final parameter SI.Current I1 =  Ib + Ios/2.0 "Current of internal source I1";
  final parameter SI.Current I2 =  Ib - Ios/2.0 "Current of internal source I2";

// gain stage (difference and common mode)
  final parameter Real Avd0_val = 10.0^(Avd0/20.0) "differential mode gain";
  final parameter Real Avcm_val = (Avd0_val/(10.0^(CMRR/20.0)))/2.0 
    "common mode gain";

// slew rate stage
  final parameter SI.VoltageSlope sr_p_val =  abs(sr_p) 
    "Value of slew rate for increase";
  final parameter SI.VoltageSlope sr_m_val = -abs(sr_m) 
    "Negative alue of slew rate for increase";

// output stage
  final parameter SI.Current Imaxso_val = abs(Imaxso) "Orientation out outp";
  final parameter SI.Current Imaxsi_val = abs(Imaxsi) "Orientation into outp";

  Modelica.Electrical.Analog.Interfaces.PositivePin p 
    "Positive pin of the input port";
  Modelica.Electrical.Analog.Interfaces.NegativePin m 
    "Negative pin of the input port";
  Modelica.Electrical.Analog.Interfaces.PositivePin outp "Output pin";
  Modelica.Electrical.Analog.Interfaces.PositivePin p_supply 
    "Positive output voltage limitation";
  Modelica.Electrical.Analog.Interfaces.NegativePin m_supply 
    "Negative output voltage limitation";

// power supply
  SI.Voltage v_pos;
  SI.Voltage v_neg;

// input stage
  Modelica.SIunits.Voltage v_vos;
  Modelica.SIunits.Voltage v_3;
  Modelica.SIunits.Voltage v_in;
  Modelica.SIunits.Voltage v_4;

  Modelica.SIunits.Current i_vos;
  Modelica.SIunits.Current i_3;
  Modelica.SIunits.Current i_r2;
  Modelica.SIunits.Current i_c3;
  Modelica.SIunits.Current i_4;

// frequency response
  Real q_fr1;
  Real q_fr2;
  Real q_fr3;

// gain stage
  SI.Voltage q_sum;
  SI.Voltage q_sum_help;
  SI.Voltage q_fp1;

// slew rate stage
  SI.Voltage v_source;

  SI.Voltage x "auxiliary variable for slew rate";

// output stage
  Modelica.SIunits.Voltage v_out;

  Modelica.SIunits.Current i_out;

// functions
  function FCNiout_limit "Internal limitation function"
    input SI.Voltage v_source;
    input SI.Voltage v_out;
    input SI.Resistance Rout;
    input SI.Current Imaxsi_val;
    input SI.Current Imaxso_val;
    output SI.Current result;

  algorithm 
      if  v_out > v_source + Rout*Imaxsi_val then
          result := Imaxsi_val;
      elseif v_out < v_source - Rout*Imaxso_val then
          result := -Imaxso_val;
      else
          result := (v_out - v_source)/Rout;
      end if;
      return;
  end FCNiout_limit;

  function FCNq_sum_limit "Internal limitation function"
    input SI.Voltage q_sum;
    input SI.Voltage q_sum_ltf;
    input SI.Voltage v_pos;
    input SI.Voltage v_neg;
    input SI.Voltage vcp;
    input SI.Voltage vcm;
    output SI.Voltage result;

  algorithm 
      if  q_sum > v_pos - vcp and q_sum_ltf >= v_pos - vcp then
        result := v_pos - vcp;
      elseif q_sum < v_neg + vcm and q_sum_ltf <= v_neg + vcm then
        result := v_neg + vcm;
      else
        result := q_sum;
      end if;
    return;
  end FCNq_sum_limit;

initial equation 
  v_source = q_fp1;
  x = 0;
equation 
assert(Rout > 0.0, "Rout must be > 0.0.");

// power supply
  v_pos = p_supply.v;
  v_neg = m_supply.v;

// input stage
  p.i = i_vos;
  m.i = i_4 - i_r2 - i_c3;
  0 = i_3 + i_r2 + i_c3 - i_vos;
  p.v - m.v = v_vos + v_in;
  v_4 = m.v;
  v_3 = p.v - v_vos;
  v_vos = Vos;
  i_3 = I1 + v_3/Rcm;
  v_in = Rdm*i_r2;
  i_c3 = Cin*der(v_in);
  i_4 = I2 + v_4/Rcm;

// frequency response
// Laplace transformation
    der(q_fr1) = 2.0*Pi*fp2*(v_in - q_fr1);
    q_fr2 + (1.0/(2.0*Pi*fp3))*der(q_fr2) = q_fr1 + (1.0/(2.0*Pi*fz))*der(q_fr1);
    der(q_fr3) = 2.0*Pi*fp4*(q_fr2 - q_fr3);

// gain stage
// Laplace transformation
  q_sum = Avd0_val*q_fr3 + Avcm_val*(v_3 + v_4);
  q_sum_help = FCNq_sum_limit(
    q_sum,
    q_fp1,
    v_pos,
    v_neg,
    vcp_abs,
    vcm_abs);
  der(q_fp1) = 2.0*Pi*fp1*(q_sum_help - q_fp1);

// slew rate stage
   der(x) = (q_fp1 - v_source)/Ts;
   der(v_source) = smooth(0,noEvent(
   if der(x) > sr_p_val then sr_p_val else 
   if der(x) < sr_m_val then sr_m_val else 
      der(x)));

// output stage
  v_out = outp.v;
  i_out = outp.i;
  i_out = FCNiout_limit(
    v_source,
    v_out,
    Rout,
    Imaxsi_val,
    Imaxso_val);

  p_supply.i = 0;
  m_supply.i = 0;

end OpAmpDetailed;

Modelica.Electrical.Analog.Basic.VariableResistor Modelica.Electrical.Analog.Basic.VariableResistor

Ideal linear electrical resistor with variable resistance

Modelica.Electrical.Analog.Basic.VariableResistor

Information


The linear resistor connects the branch voltage v with the branch current i by
i*R = v
The Resistance R is given as input signal.

Attention!!!
It is recommended that the R signal should not cross the zero value. Otherwise depending on the surrounding circuit the probability of singularities is high.

Extends from Modelica.Electrical.Analog.Interfaces.OnePort (Component with two electrical pins p and n and current i from p to n), Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort (Partial model to include a conditional HeatPort in order to describe the power loss via a thermal network).

Parameters

TypeNameDefaultDescription
TemperatureT_ref300.15Reference temperature [K]
LinearTemperatureCoefficientalpha0Temperature coefficient of resistance (R_actual = R*(1 + alpha*(T_heatPort - T_ref)) [1/K]
BooleanuseHeatPortfalse=true, if HeatPort is enabled
TemperatureTT_refFixed device temperature if useHeatPort = false [K]

Connectors

TypeNameDescription
PositivePinpPositive pin (potential p.v > n.v for positive voltage drop v)
NegativePinnNegative pin
HeatPort_aheatPort 
input RealInputR 

Modelica definition

model VariableResistor 
  "Ideal linear electrical resistor with variable resistance"
  parameter Modelica.SIunits.Temperature T_ref=300.15 "Reference temperature";
  parameter Modelica.SIunits.LinearTemperatureCoefficient alpha=0 
    "Temperature coefficient of resistance (R_actual = R*(1 + alpha*(T_heatPort - T_ref))";
  extends Modelica.Electrical.Analog.Interfaces.OnePort;
  extends Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort(                    T = T_ref);
  Modelica.SIunits.Resistance R_actual 
    "Actual resistance = R*(1 + alpha*(T_heatPort - T_ref))";
  Modelica.Blocks.Interfaces.RealInput R;
equation 
  assert((1 + alpha*(T_heatPort - T_ref)) >= Modelica.Constants.eps, "Temperature outside scope of model!");
  R_actual = R*(1 + alpha*(T_heatPort - T_ref));
  v = R_actual*i;
  LossPower = v*i;
end VariableResistor;

Modelica.Electrical.Analog.Basic.VariableConductor Modelica.Electrical.Analog.Basic.VariableConductor

Ideal linear electrical conductor with variable conductance

Modelica.Electrical.Analog.Basic.VariableConductor

Information


The linear conductor connects the branch voltage v with the branch current i by
i = G*v
The Conductance G is given as input signal.

Attention!!!
It is recommended that the G signal should not cross the zero value. Otherwise depending on the surrounding circuit the probability of singularities is high.

Extends from Modelica.Electrical.Analog.Interfaces.OnePort (Component with two electrical pins p and n and current i from p to n), Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort (Partial model to include a conditional HeatPort in order to describe the power loss via a thermal network).

Parameters

TypeNameDefaultDescription
TemperatureT_ref300.15Reference temperature [K]
LinearTemperatureCoefficientalpha0Temperature coefficient of conductance (G_actual = G/(1 + alpha*(T_heatPort - T_ref)) [1/K]
BooleanuseHeatPortfalse=true, if HeatPort is enabled
TemperatureTT_refFixed device temperature if useHeatPort = false [K]

Connectors

TypeNameDescription
PositivePinpPositive pin (potential p.v > n.v for positive voltage drop v)
NegativePinnNegative pin
HeatPort_aheatPort 
input RealInputG 

Modelica definition

model VariableConductor 
  "Ideal linear electrical conductor with variable conductance"
  parameter Modelica.SIunits.Temperature T_ref=300.15 "Reference temperature";
  parameter Modelica.SIunits.LinearTemperatureCoefficient alpha=0 
    "Temperature coefficient of conductance (G_actual = G/(1 + alpha*(T_heatPort - T_ref))";
  extends Modelica.Electrical.Analog.Interfaces.OnePort;
  extends Modelica.Electrical.Analog.Interfaces.ConditionalHeatPort(                    T = T_ref);
  Modelica.SIunits.Conductance G_actual 
    "Actual conductance = G/(1 + alpha*(T_heatPort - T_ref))";
  Modelica.Blocks.Interfaces.RealInput G;
equation 
  assert((1 + alpha*(T_heatPort - T_ref)) >= Modelica.Constants.eps, "Temperature outside scope of model!");
  G_actual = G/(1 + alpha*(T_heatPort - T_ref));
  i = G_actual*v;
  LossPower = v*i;
end VariableConductor;

Modelica.Electrical.Analog.Basic.VariableCapacitor Modelica.Electrical.Analog.Basic.VariableCapacitor

Ideal linear electrical capacitor with variable capacitance

Modelica.Electrical.Analog.Basic.VariableCapacitor

Information


The linear capacitor connects the branch voltage v with the branch current i by
i = dQ/dt with Q = C * v .
The capacitance C is given as input signal. It is required that C ≥ 0, otherwise an assertion is raised. To avoid a variable index system, C = Cmin, if 0 ≤ C < Cmin, where Cmin is a parameter with default value Modelica.Constants.eps.

Extends from Modelica.Electrical.Analog.Interfaces.OnePort (Component with two electrical pins p and n and current i from p to n).

Parameters

TypeNameDefaultDescription
CapacitanceCminModelica.Constants.epslower bound for variable capacitance [F]

Connectors

TypeNameDescription
PositivePinpPositive pin (potential p.v > n.v for positive voltage drop v)
NegativePinnNegative pin
input RealInputC 

Modelica definition

model VariableCapacitor 
  "Ideal linear electrical capacitor with variable capacitance"
  extends Modelica.Electrical.Analog.Interfaces.OnePort;
  Modelica.Blocks.Interfaces.RealInput C;
  parameter Modelica.SIunits.Capacitance Cmin=Modelica.Constants.eps 
    "lower bound for variable capacitance";
  Modelica.SIunits.ElectricCharge Q;
equation 
  assert(C>=0,"Capacitance C (= " +
         String(C) + ") has to be >= 0!");
  // protect solver from index change
  Q = noEvent(max(C,Cmin))*v;
  i = der(Q);
end VariableCapacitor;

Modelica.Electrical.Analog.Basic.VariableInductor Modelica.Electrical.Analog.Basic.VariableInductor

Ideal linear electrical inductor with variable inductance

Modelica.Electrical.Analog.Basic.VariableInductor

Information


The linear inductor connects the branch voltage v with the branch current i by
v = d Psi/dt with Psi = L * i .
The inductance L is as input signal. It is required that L ≥ 0, otherwise an assertion is raised. To avoid a variable index system, L = Lmin, if 0 ≤ L < Lmin, where Lmin is a parameter with default value Modelica.Constants.eps.

Extends from Modelica.Electrical.Analog.Interfaces.OnePort (Component with two electrical pins p and n and current i from p to n).

Parameters

TypeNameDefaultDescription
InductanceLminModelica.Constants.epslower bound for variable inductance [H]

Connectors

TypeNameDescription
PositivePinpPositive pin (potential p.v > n.v for positive voltage drop v)
NegativePinnNegative pin
input RealInputL 

Modelica definition

model VariableInductor 
  "Ideal linear electrical inductor with variable inductance"

  extends Modelica.Electrical.Analog.Interfaces.OnePort;
  Modelica.Blocks.Interfaces.RealInput L;
  Modelica.SIunits.MagneticFlux Psi;
  parameter Modelica.SIunits.Inductance Lmin=Modelica.Constants.eps 
    "lower bound for variable inductance";
equation 
  assert(L>=0,"Inductance L_ (= " +
         String(L) + ") has to be >= 0!");
  // protect solver from index change
  Psi = noEvent(max(L,Lmin))*i;
  v = der(Psi);
end VariableInductor;

Automatically generated Fri Nov 12 16:28:07 2010.