diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/Adder.mo b/Modelica/Electrical/Analog/Examples/OpAmps/Adder.mo index 4ca9262c83..3df6846a19 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/Adder.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/Adder.mo @@ -1,26 +1,26 @@ within Modelica.Electrical.Analog.Examples.OpAmps; model Adder "Inverting adder" extends Modelica.Icons.Example; - parameter SI.Voltage Vin=5 "Amplitude of input voltage"; - parameter SI.Frequency f=10 "Frequency of input voltage"; + parameter Modelica.Units.SI.Voltage Vin=5 "Amplitude of input voltage"; + parameter Modelica.Units.SI.Frequency f=10 "Frequency of input voltage"; Modelica.Electrical.Analog.Basic.Ground ground annotation (Placement(transformation(extent={{-20,-40},{0,-20}}))); - Sources.SineVoltage vIn1(V=Vin, f=f) annotation (Placement( - transformation( + Modelica.Electrical.Analog.Sources.SineVoltage vIn1(V=Vin, f=f) annotation ( + Placement(transformation( extent={{-10,-10},{10,10}}, rotation=270, origin={-60,0}))); - Sources.ConstantVoltage vIn2(V=Vin) annotation (Placement( - transformation( + Modelica.Electrical.Analog.Sources.ConstantVoltage vIn2(V=Vin) annotation ( + Placement(transformation( extent={{-10,-10},{10,10}}, rotation=270, origin={-40,-10}))); Modelica.Electrical.Analog.Sensors.VoltageSensor vOut annotation (Placement( transformation( - extent={{10,10},{-10,-10}}, + extent={{-10,10},{10,-10}}, rotation=270, origin={40,0}))); - OpAmpCircuits.Add add(p1_2(i(start=0))) + OpAmpCircuits.Add add annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); equation connect(add.n1, ground.p) @@ -33,10 +33,10 @@ equation annotation (Line(points={{-10,-20},{-40,-20}}, color={0,0,255})); connect(ground.p, vIn1.n) annotation (Line(points={{-10,-20},{-60,-20},{-60,-10}}, color={0,0,255})); - connect(add.p2, vOut.n) - annotation (Line(points={{10,10},{40,10}}, color={0,0,255})); - connect(add.n2, vOut.p) - annotation (Line(points={{10,-10},{40,-10}}, color={0,0,255})); + connect(vOut.p, add.p2) + annotation (Line(points={{40,10},{10,10}}, color={0,0,255})); + connect(vOut.n, add.n2) + annotation (Line(points={{40,-10},{10,-10}}, color={0,0,255})); annotation (Documentation(info="
This is an inverting adder.
Note: vOut
measure the negative output voltage.
This is a comparator. Resistance R1 can be chosen, resistance R2 is defined by the desired reference voltage Vref (between Vn and Vp). The output switches between Vn for input voltage < Vref and Vp for input voltage > Vref.
"), diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/ControlCircuit.mo b/Modelica/Electrical/Analog/Examples/OpAmps/ControlCircuit.mo index 2193b8d5f1..9ba6ff7078 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/ControlCircuit.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/ControlCircuit.mo @@ -1,14 +1,16 @@ within Modelica.Electrical.Analog.Examples.OpAmps; model ControlCircuit "Control circuit" extends Modelica.Icons.Example; - parameter SI.Time T1=0.01 "Small time constant"; - parameter SI.Time T2=0.01 "Large time constant"; - parameter SI.Time Ti=T2 "Integral time constant"; + parameter Modelica.Units.SI.Time T1=0.01 "Small time constant"; + parameter Modelica.Units.SI.Time T2=0.01 "Large time constant"; + parameter Modelica.Units.SI.Time Ti=T2 "Integral time constant"; parameter Real kp=T2/(2*T1) "Proportional gain"; + Modelica.Units.SI.Voltage yA=firstOrder2A.v2 "Result obtained with opAmps"; + output Real yB=firstOrder2B.y "Exact result"; Modelica.Electrical.Analog.Basic.Ground ground annotation (Placement(transformation(extent={{-100,-100},{-80,-80}}))); - Sources.StepVoltage stepA(V=10, startTime=0.1) annotation (Placement( - transformation( + Modelica.Electrical.Analog.Sources.StepVoltage stepA(V=10, startTime=0.1) + annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=270, origin={-90,-62}))); @@ -27,8 +29,8 @@ model ControlCircuit "Control circuit" annotation (Placement(transformation(extent={{-10,-40},{10,-20}}))); OpAmpCircuits.Add addA(i1_2(start=0), r(i(start=0))) annotation (Placement(transformation(extent={{30,-40},{50,-20}}))); - Sources.StepVoltage step1A(V=1, startTime=0.5) annotation (Placement( - transformation( + Modelica.Electrical.Analog.Sources.StepVoltage step1A(V=1, startTime=0.5) + annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=270, origin={20,-60}))); @@ -37,24 +39,25 @@ model ControlCircuit "Control circuit" T=T2, opAmp(v_in(start=0))) annotation (Placement(transformation(extent={{60,-40},{80,-20}}))); - Blocks.Sources.Step stepB(height=10, startTime=0.1) + Modelica.Blocks.Sources.Step stepB(height=10, startTime=0.1) annotation (Placement(transformation(extent={{-100,60},{-80,80}}))); - Blocks.Math.Feedback feedbackB + Modelica.Blocks.Math.Feedback feedbackB annotation (Placement(transformation(extent={{-70,60},{-50,80}}))); - Blocks.Continuous.PI PIB( + Modelica.Blocks.Continuous.PI PIB( k=kp, T=Ti, initType=Modelica.Blocks.Types.Init.InitialOutput) annotation (Placement(transformation(extent={{-40,60},{-20,80}}))); - Blocks.Continuous.FirstOrder firstOrder1B(T=T1, initType=Modelica.Blocks.Types.Init.InitialOutput) + Modelica.Blocks.Continuous.FirstOrder firstOrder1B(T=T1, initType=Modelica.Blocks.Types.Init.InitialOutput) annotation (Placement(transformation(extent={{-10,60},{10,80}}))); - Blocks.Math.Add addB + Modelica.Blocks.Math.Add addB annotation (Placement(transformation(extent={{30,60},{50,80}}))); - Blocks.Sources.Step step1B(height=1, startTime=0.5) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + Modelica.Blocks.Sources.Step step1B(height=1, startTime=0.5) annotation ( + Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=90, origin={20,30}))); - Blocks.Continuous.FirstOrder firstOrder2B(T=T2, initType=Modelica.Blocks.Types.Init.InitialOutput) + Modelica.Blocks.Continuous.FirstOrder firstOrder2B(T=T2, initType=Modelica.Blocks.Types.Init.InitialOutput) annotation (Placement(transformation(extent={{60,60},{80,80}}))); equation connect(stepA.n, ground.p) diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/DifferentialAmplifier.mo b/Modelica/Electrical/Analog/Examples/OpAmps/DifferentialAmplifier.mo index 695827c4c8..47abb8b04e 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/DifferentialAmplifier.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/DifferentialAmplifier.mo @@ -1,10 +1,9 @@ within Modelica.Electrical.Analog.Examples.OpAmps; model DifferentialAmplifier "Differential amplifier" extends Modelica.Icons.Example; - parameter - Modelica.Electrical.Analog.Examples.OpAmps.OpAmpCircuits.DifferentialAmplifierData - data "Parameters for source, OpAmp and measurement" - annotation (Placement(transformation(extent={{50,10},{70,30}}))); + parameter OpAmps.OpAmpCircuits.DifferentialAmplifierData data + "Parameters for source, OpAmp and measurement" + annotation (Placement(transformation(extent={{50,10},{70,30}}))); Modelica.Electrical.Analog.Sources.SineVoltage sourceVoltage1( V=sqrt(2/3)*data.VSource, phase=1.0471975511966, @@ -37,7 +36,12 @@ model DifferentialAmplifier "Differential amplifier" V0=data.V0, useSupply=true, Vps=+data.VSupply, - Vns=-data.VSupply) + Vns=-data.VSupply, + regularized=false, + smoothed=false, + strict=false, + vps(start=+data.VSupply), + vns(start=-data.VSupply)) annotation (Placement(transformation(extent={{-20,-10},{0,10}}))); Modelica.Electrical.Analog.Basic.Resistor resistor1(R=data.R1, i(start=0, fixed=false)) diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/Differentiator.mo b/Modelica/Electrical/Analog/Examples/OpAmps/Differentiator.mo index cfab26a2ef..df1955c325 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/Differentiator.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/Differentiator.mo @@ -1,11 +1,11 @@ within Modelica.Electrical.Analog.Examples.OpAmps; model Differentiator "Differentiating amplifier" extends Modelica.Icons.Example; - parameter SI.Voltage Vin=5 "Amplitude of input voltage"; - parameter SI.Frequency f=10 "Frequency of input voltage"; + parameter Modelica.Units.SI.Voltage Vin=5 "Amplitude of input voltage"; + parameter Modelica.Units.SI.Frequency f=10 "Frequency of input voltage"; Modelica.Electrical.Analog.Basic.Ground ground annotation (Placement(transformation(extent={{-20,-40},{0,-20}}))); - Sources.TrapezoidVoltage vIn( + Modelica.Electrical.Analog.Sources.TrapezoidVoltage vIn( V=2*Vin, rising=0.2/f, width=0.3/f, @@ -13,8 +13,7 @@ model Differentiator "Differentiating amplifier" period=1/f, nperiod=-1, offset=-Vin, - startTime=-(vIn.rising + vIn.width/2)) - annotation (Placement( + startTime=-(vIn.rising + vIn.width/2)) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=270, diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/HighPass.mo b/Modelica/Electrical/Analog/Examples/OpAmps/HighPass.mo index 4ac11ef920..0d2cb7fdd6 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/HighPass.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/HighPass.mo @@ -2,9 +2,9 @@ within Modelica.Electrical.Analog.Examples.OpAmps; model HighPass "High-pass filter" extends Modelica.Icons.Example; import Modelica.Constants.pi; - parameter SI.Voltage Vin=5 "Amplitude of input voltage"; - parameter SI.Frequency f=10 "Frequency of input voltage"; - parameter SI.Frequency fG=f/10 "Limiting frequency"; + parameter Modelica.Units.SI.Voltage Vin=5 "Amplitude of input voltage"; + parameter Modelica.Units.SI.Frequency f=10 "Frequency of input voltage"; + parameter Modelica.Units.SI.Frequency fG=f/10 "Limiting frequency"; Modelica.Electrical.Analog.Basic.Ground ground annotation (Placement(transformation(extent={{-20,-40},{0,-20}}))); Modelica.Electrical.Analog.Sensors.VoltageSensor vOut annotation (Placement( @@ -15,7 +15,7 @@ model HighPass "High-pass filter" OpAmpCircuits.Derivative derivative(T=1/(2*pi*fG), v(fixed=true)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - Sources.TrapezoidVoltage vIn( + Modelica.Electrical.Analog.Sources.TrapezoidVoltage vIn( V=Vin, rising=0.2/f, width=0.3/f, @@ -23,8 +23,7 @@ model HighPass "High-pass filter" period=1/f, nperiod=-1, offset=0, - startTime=-(vIn.rising + vIn.width/2)) - annotation (Placement( + startTime=-(vIn.rising + vIn.width/2)) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=270, diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/Integrator.mo b/Modelica/Electrical/Analog/Examples/OpAmps/Integrator.mo index e257dbd1ee..97bc76c935 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/Integrator.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/Integrator.mo @@ -1,8 +1,8 @@ within Modelica.Electrical.Analog.Examples.OpAmps; model Integrator "Integrating amplifier" extends Modelica.Icons.Example; - parameter SI.Voltage Vin=5 "Amplitude of input voltage"; - parameter SI.Frequency f=10 "Frequency of input voltage"; + parameter Modelica.Units.SI.Voltage Vin=5 "Amplitude of input voltage"; + parameter Modelica.Units.SI.Frequency f=10 "Frequency of input voltage"; Modelica.Electrical.Analog.Basic.Ground ground annotation (Placement(transformation(extent={{-20,-40},{0,-20}}))); Modelica.Electrical.Analog.Sensors.VoltageSensor vOut annotation (Placement( @@ -15,7 +15,7 @@ model Integrator "Integrating amplifier" f=f, v(fixed=true)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - Sources.TrapezoidVoltage vIn( + Modelica.Electrical.Analog.Sources.TrapezoidVoltage vIn( V=2*Vin, rising=0.2/f, width=0.3/f, @@ -23,8 +23,7 @@ model Integrator "Integrating amplifier" period=1/f, nperiod=-1, offset=-Vin, - startTime=-(vIn.rising + vIn.width/2)) - annotation (Placement( + startTime=-(vIn.rising + vIn.width/2)) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=270, diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/InvertingAmplifier.mo b/Modelica/Electrical/Analog/Examples/OpAmps/InvertingAmplifier.mo index 2e0175930f..b7fe522b5e 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/InvertingAmplifier.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/InvertingAmplifier.mo @@ -1,8 +1,8 @@ within Modelica.Electrical.Analog.Examples.OpAmps; model InvertingAmplifier "Inverting amplifier" extends Modelica.Icons.Example; - parameter SI.Voltage Vin=5 "Amplitude of input voltage"; - parameter SI.Frequency f=10 "Frequency of input voltage"; + parameter Modelica.Units.SI.Voltage Vin=5 "Amplitude of input voltage"; + parameter Modelica.Units.SI.Frequency f=10 "Frequency of input voltage"; Modelica.Electrical.Analog.Basic.Ground ground annotation (Placement(transformation(extent={{-20,-40},{0,-20}}))); Modelica.Electrical.Analog.Sources.TrapezoidVoltage vIn( @@ -20,7 +20,7 @@ model InvertingAmplifier "Inverting amplifier" origin={-40,0}))); Modelica.Electrical.Analog.Sensors.VoltageSensor vOut annotation (Placement( transformation( - extent={{10,10},{-10,-10}}, + extent={{-10,10},{10,-10}}, rotation=270, origin={40,0}))); OpAmpCircuits.Gain gain(k=2) @@ -32,14 +32,13 @@ equation annotation (Line(points={{-10,-10},{-10,-20}}, color={0,0,255})); connect(gain.n1, vIn.n) annotation (Line(points={{-10,-10},{-40,-10}}, color={0,0,255})); - connect(gain.p2, vOut.n) + connect(gain.p2, vOut.p) annotation (Line(points={{10,10},{40,10}}, color={0,0,255})); - connect(gain.n2, vOut.p) + connect(gain.n2, vOut.n) annotation (Line(points={{10,-10},{40,-10}}, color={0,0,255})); annotation ( Documentation(info="This is an inverting amplifier.
-Note: vOut
measure the negative output voltage.
This is a (inverting) Schmitt trigger. Resistance R1 can be chosen, resistance R2 is defined by the desired hysteresis. The output gets Vn for input voltage > 0 + vHys and Vp for input voltage < vHys*Vns/Vps.
The example is taken from: U. Tietze and C. Schenk, Halbleiter-Schaltungstechnik (German), 11th edition, Springer 1999, Chapter 6.5.2
diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/LCOscillator.mo b/Modelica/Electrical/Analog/Examples/OpAmps/LCOscillator.mo index a6ff2407cd..e790761e13 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/LCOscillator.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/LCOscillator.mo @@ -2,20 +2,33 @@ within Modelica.Electrical.Analog.Examples.OpAmps; model LCOscillator "LC oscillator" extends Modelica.Icons.Example; import Modelica.Constants.pi; - parameter SI.Voltage VAmp=10 "Amplitude of output"; - parameter SI.Frequency f=1000 "Desired frequency"; + parameter Real V0=15000.0 "No-load amplification"; + parameter Modelica.Units.SI.Voltage Vps=+15 "Positive supply"; + parameter Modelica.Units.SI.Voltage Vns=-15 "Negative supply"; + parameter Modelica.Units.SI.Voltage VAmp=10 "Amplitude of output"; + parameter Modelica.Units.SI.Frequency f=1000 "Desired frequency"; parameter Real A=1.001 "Amplification constant: A > 1 amplification, A = 1 pure sinusoidal oscillation, A < 0 damping"; - parameter SI.Inductance L=0.001 "Arbitrary inductance > 0"; - parameter SI.Capacitance C=1/((2*pi*f)^2*L) "Calculated capacitance to reach frequency f"; - parameter SI.Resistance R=10000.0 "Damping resistance"; - parameter SI.Resistance R1=10000.0 "Arbitrary high resistance"; - parameter SI.Resistance R2=(A - 1)*R1 "Calculated resistance to reach amplification A"; + parameter Modelica.Units.SI.Inductance L=0.001 "Arbitrary inductance > 0"; + parameter Modelica.Units.SI.Capacitance C=1/((2*pi*f)^2*L) + "Calculated capacitance to reach frequency f"; + parameter Modelica.Units.SI.Resistance R=10000.0 "Damping resistance"; + parameter Modelica.Units.SI.Resistance R1=10000.0 + "Arbitrary high resistance"; + parameter Modelica.Units.SI.Resistance R2=(A - 1)*R1 + "Calculated resistance to reach amplification A"; parameter Real gamma=(1 - A)/(2*R*C) "Calculated characteristical parameter"; Modelica.Electrical.Analog.Basic.Ground ground annotation (Placement( transformation( origin={20,-50}, extent={{-10,-10},{10,10}}))); - Modelica.Electrical.Analog.Ideal.IdealizedOpAmpLimited opAmp + Modelica.Electrical.Analog.Ideal.IdealizedOpAmpLimited opAmp( + V0=V0, + useSupply=false, + Vps=Vps, + Vns=Vns, + regularized=false, + smoothed=false, + strict=false) annotation (Placement(transformation(extent={{-50,10},{-30,-10}}))); Modelica.Electrical.Analog.Basic.Resistor r(R=R) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); @@ -43,6 +56,8 @@ model LCOscillator "LC oscillator" extent={{-10,10},{10,-10}}, rotation=270, origin={60,-20}))); + Modelica.Blocks.Sources.Cosine cosine(amplitude=VAmp, f=f) + annotation (Placement(transformation(extent={{50,40},{70,60}}))); equation connect(opAmp.out, r.p) annotation (Line( points={{-30,0},{-10,0}}, color={0,0,255})); diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/LowPass.mo b/Modelica/Electrical/Analog/Examples/OpAmps/LowPass.mo index 85e64d3adf..2b6dcd68c6 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/LowPass.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/LowPass.mo @@ -2,9 +2,9 @@ within Modelica.Electrical.Analog.Examples.OpAmps; model LowPass "Low-pass filter" extends Modelica.Icons.Example; import Modelica.Constants.pi; - parameter SI.Voltage Vin=5 "Amplitude of input voltage"; - parameter SI.Frequency f=10 "Frequency of input voltage"; - parameter SI.Frequency fG=f/10 "Limiting frequency"; + parameter Modelica.Units.SI.Voltage Vin=5 "Amplitude of input voltage"; + parameter Modelica.Units.SI.Frequency f=10 "Frequency of input voltage"; + parameter Modelica.Units.SI.Frequency fG=f/10 "Limiting frequency"; Modelica.Electrical.Analog.Basic.Ground ground annotation (Placement(transformation(extent={{-20,-40},{0,-20}}))); Modelica.Electrical.Analog.Sensors.VoltageSensor vOut annotation (Placement( @@ -15,7 +15,7 @@ model LowPass "Low-pass filter" OpAmpCircuits.FirstOrder firstOrder( T=1/(2*pi*fG), v(fixed=true)) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); - Sources.TrapezoidVoltage vIn( + Modelica.Electrical.Analog.Sources.TrapezoidVoltage vIn( V=Vin, rising=0.2/f, width=0.3/f, @@ -23,8 +23,7 @@ model LowPass "Low-pass filter" period=1/f, nperiod=-1, offset=0, - startTime=-(vIn.rising + vIn.width/2)) - annotation (Placement( + startTime=-(vIn.rising + vIn.width/2)) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, rotation=270, diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/Multivibrator.mo b/Modelica/Electrical/Analog/Examples/OpAmps/Multivibrator.mo index 6d4ec8857b..d4a5fad314 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/Multivibrator.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/Multivibrator.mo @@ -1,25 +1,33 @@ within Modelica.Electrical.Analog.Examples.OpAmps; model Multivibrator "Multivibrator with Schmitt trigger" extends Modelica.Icons.Example; - parameter SI.Voltage Vps=+15 "Positive supply"; - parameter SI.Voltage Vns=-15 "Negative supply"; - parameter SI.Frequency f=10 "Desired frequency"; - parameter SI.Resistance R1=1000 "Resistance 1 for adjusting the Schmitt trigger voltage level"; - parameter SI.Resistance R2=1000 "Resistance 2 for adjusting the Schmitt trigger voltage level"; - parameter SI.Resistance R=1000 "Arbitrary resistance"; - parameter SI.Capacitance C=1/f/(2*R*log(1 + 2*R1/R2)) "Calculated capacitance to reach the desired frequency f"; + parameter Real V0=15000.0 "No-load amplification"; + parameter Modelica.Units.SI.Voltage Vps=+15 "Positive supply"; + parameter Modelica.Units.SI.Voltage Vns=-15 "Negative supply"; + parameter Modelica.Units.SI.Frequency f=10 "Desired frequency"; + parameter Modelica.Units.SI.Resistance R1=1000 + "Resistance 1 for adjusting the Schmitt trigger voltage level"; + parameter Modelica.Units.SI.Resistance R2=1000 + "Resistance 2 for adjusting the Schmitt trigger voltage level"; + parameter Modelica.Units.SI.Resistance R=1000 "Arbitrary resistance"; + parameter Modelica.Units.SI.Capacitance C=1/f/(2*R*log(1 + 2*R1/R2)) + "Calculated capacitance to reach the desired frequency f"; Modelica.Electrical.Analog.Ideal.IdealizedOpAmpLimited opAmp( + V0=V0, + useSupply=false, Vps=Vps, Vns=Vns, - homotopyType = Modelica.Blocks.Types.LimiterHomotopy.LowerLimit, - strict = true) annotation (Placement(transformation(extent={{0,-10},{20,10}}))); + regularized=true, + smoothed=false, + strict=false) + annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); Modelica.Electrical.Analog.Basic.Ground ground - annotation (Placement(transformation(extent={{-20,-80},{0,-60}}))); + annotation (Placement(transformation(extent={{-10,-80},{10,-60}}))); Modelica.Electrical.Analog.Sensors.VoltageSensor vOut annotation (Placement( transformation( extent={{-10,10},{10,-10}}, rotation=270, - origin={50,-20}))); + origin={40,-10}))); Modelica.Electrical.Analog.Basic.Resistor r1(R=R1, i(start=0)) annotation ( Placement(transformation( extent={{-10,-10},{10,10}}, @@ -35,28 +43,35 @@ model Multivibrator "Multivibrator with Schmitt trigger" annotation (Placement(transformation( extent={{10,-10},{-10,10}}, rotation=90, - origin={-30,-40}))); + origin={-40,-40}))); + Modelica.Blocks.Sources.Pulse pulse( + amplitude=Vps - Vns, + period=1/f, + offset=Vns, + startTime=0.35/f) + annotation (Placement(transformation(extent={{30,60},{50,80}}))); equation connect(ground.p, r1.n) annotation (Line( - points={{-10,-60},{-10,-50}}, color={0,0,255})); + points={{0,-60},{-10,-60},{-10,-50}}, + color={0,0,255})); connect(ground.p, vOut.n) annotation (Line( - points={{-10,-60},{50,-60},{50,-30}}, color={0,0,255})); + points={{0,-60},{40,-60},{40,-20}}, color={0,0,255})); connect(opAmp.out, vOut.p) annotation (Line( - points={{20,0},{50,0},{50,-10}}, color={0,0,255})); + points={{10,0},{40,0}}, color={0,0,255})); connect(ground.p, c.n) annotation (Line( - points={{-10,-60},{-30,-60},{-30,-50}}, color={0,0,255})); + points={{0,-60},{-40,-60},{-40,-50}}, color={0,0,255})); connect(opAmp.out, r.p) annotation (Line( - points={{20,0},{30,0},{30,30},{20,30}}, color={0,0,255})); + points={{10,0},{20,0},{20,30}}, color={0,0,255})); connect(r.n, opAmp.in_n) annotation (Line( - points={{0,30},{-10,30},{-10,6},{0,6}}, color={0,0,255})); + points={{0,30},{-10,30},{-10,6}}, color={0,0,255})); connect(opAmp.out, r2.p) annotation (Line( - points={{20,0},{30,0},{30,-20},{20,-20}}, color={0,0,255})); + points={{10,0},{20,0},{20,-20}}, color={0,0,255})); connect(r2.n, opAmp.in_p) annotation (Line( - points={{0,-20},{-10,-20},{-10,-6},{0,-6}}, color={0,0,255})); + points={{0,-20},{-10,-20},{-10,-6}}, color={0,0,255})); connect(opAmp.in_p, r1.p) annotation (Line( - points={{0,-6},{-10,-6},{-10,-30}}, color={0,0,255})); + points={{-10,-6},{-10,-30}}, color={0,0,255})); connect(r.n, c.p) annotation (Line( - points={{0,30},{-30,30},{-30,-30}}, color={0,0,255})); + points={{0,30},{-40,30},{-40,-30}}, color={0,0,255})); annotation (Documentation(info="This is a Multivibrator with Schmitt trigger according to:
U. Tietze and C. Schenk, Halbleiter-Schaltungstechnik (German), 11th edition, Springer 1999, Chapter 6.5.3
diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/NonInvertingAmplifier.mo b/Modelica/Electrical/Analog/Examples/OpAmps/NonInvertingAmplifier.mo index 92c242e056..fe9d228846 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/NonInvertingAmplifier.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/NonInvertingAmplifier.mo @@ -1,8 +1,8 @@ within Modelica.Electrical.Analog.Examples.OpAmps; model NonInvertingAmplifier "Non-inverting amplifier" extends Modelica.Icons.Example; - parameter SI.Voltage Vin=5 "Amplitude of input voltage"; - parameter SI.Frequency f=10 "Frequency of input voltage"; + parameter Modelica.Units.SI.Voltage Vin=5 "Amplitude of input voltage"; + parameter Modelica.Units.SI.Frequency f=10 "Frequency of input voltage"; Modelica.Electrical.Analog.Basic.Ground ground annotation (Placement(transformation(extent={{-20,-40},{0,-20}}))); Modelica.Electrical.Analog.Sources.TrapezoidVoltage vIn( diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Add.mo b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Add.mo index 79866faeed..f58d97d2d6 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Add.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Add.mo @@ -1,26 +1,31 @@ within Modelica.Electrical.Analog.Examples.OpAmps.OpAmpCircuits; model Add "Adding operational amplifier circuit" extends PartialOpAmp; - SI.Voltage v1_2=p1_2.v - n1.v "Voltage drop of port 1_2 (= p1_2.v - n1.v)"; - SI.Current i1_2=p1_2.i "Current flowing from pos. to neg. pin of port 1_2"; + Modelica.Units.SI.Voltage v1_2=p1_2.v - n1.v + "Voltage drop of port 1_2 (= p1_2.v - n1.v)"; + Modelica.Units.SI.Current i1_2=p1_2.i + "Current flowing from pos. to neg. pin of port 1_2"; parameter Real k1(final min=0)=1 "Weight of input 1"; parameter Real k2(final min=0)=1 "Weight of input 2"; - parameter SI.Resistance R=1000 "Resistance at output of OpAmp"; - parameter SI.Resistance R1=R/k1 "Calculated resistance to reach desired weight 1"; - parameter SI.Resistance R2=R/k2 "Calculated resistance to reach desired weight 2"; - Basic.Resistor r1(final R=R1) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}, - origin={-40,70}))); - Basic.Resistor r2(final R=R2) - annotation (Placement(transformation(extent={{10,-10},{-10,10}}, + parameter Modelica.Units.SI.Resistance R=1000 + "Resistance at output of OpAmp"; + parameter Modelica.Units.SI.Resistance R1=R/k1 + "Calculated resistance to reach desired weight 1"; + parameter Modelica.Units.SI.Resistance R2=R/k2 + "Calculated resistance to reach desired weight 2"; + Modelica.Electrical.Analog.Basic.Resistor r1(final R=R1) annotation ( + Placement(transformation(extent={{-10,-10},{10,10}}, origin={-40,70}))); + Modelica.Electrical.Analog.Basic.Resistor r2(final R=R2) annotation ( + Placement(transformation( + extent={{10,-10},{-10,10}}, rotation=180, origin={-40,30}))); - Interfaces.PositivePin p1_2 "Positive electrical pin 1.2" annotation ( - Placement(transformation(extent={{-110,-10},{-90,10}}), - iconTransformation(extent={{-110,-10},{-90,10}}))); - Basic.Resistor r(final R=R) annotation (Placement(transformation( - extent={{10,-10},{-10,10}}, - origin={20,30}))); + Modelica.Electrical.Analog.Interfaces.PositivePin p1_2 + "Positive electrical pin 1.2" annotation (Placement(transformation( + extent={{-110,-10},{-90,10}}), iconTransformation(extent={{-110,-10}, + {-90,10}}))); + Modelica.Electrical.Analog.Basic.Resistor r(final R=R) annotation ( + Placement(transformation(extent={{10,-10},{-10,10}}, origin={20,30}))); equation connect(n1, n2) annotation (Line(points={{-100,-100},{100,-100}}, color={0,0,255})); diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Buffer.mo b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Buffer.mo index e7664b1ed1..d30bd6c759 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Buffer.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Buffer.mo @@ -2,14 +2,18 @@ within Modelica.Electrical.Analog.Examples.OpAmps.OpAmpCircuits; model Buffer "Non inverting operational amplifier circuit" extends PartialOpAmp; parameter Real k(final min=0)=1 "Desired amplification"; - parameter SI.Resistance R1=1000 "Resistance at negative pin(s)"; - parameter SI.Resistance R2=(k - 1)*R1 "Calculated resistance to reach desired amplification k"; - Basic.Resistor r1(final R=R1) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}, + parameter Modelica.Units.SI.Resistance R1=1000 + "Resistance at negative pin(s)"; + parameter Modelica.Units.SI.Resistance R2=(k - 1)*R1 + "Calculated resistance to reach desired amplification k"; + Modelica.Electrical.Analog.Basic.Resistor r1(final R=R1) annotation ( + Placement(transformation( + extent={{-10,-10},{10,10}}, rotation=270, origin={10,-70}))); - Basic.Resistor r2(final R=R2) - annotation (Placement(transformation(extent={{10,-10},{-10,10}}, + Modelica.Electrical.Analog.Basic.Resistor r2(final R=R2) annotation ( + Placement(transformation( + extent={{10,-10},{-10,10}}, rotation=90, origin={10,-30}))); equation @@ -48,5 +52,7 @@ equation Text( extent={{-100,10},{100,-10}}, textColor={0,0,255}, + fillColor={255,255,255}, + fillPattern=FillPattern.None, textString="non-inverting")})); end Buffer; diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Der.mo b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Der.mo index 6258362db1..816750ba70 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Der.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Der.mo @@ -3,13 +3,15 @@ model Der "Differentiating operational amplifier circuit" extends PartialOpAmp; import Modelica.Constants.pi; parameter Real k(final min=0)=1 "Desired amplification at frequency f"; - parameter SI.Frequency f "Frequency"; - parameter SI.Resistance R=1000 "Resistance at output of OpAmp"; - parameter SI.Capacitance C=k/(2*pi*f*R) "Calculated capacitance to reach desired amplification k"; - SI.Voltage v(start=0)=c.v "Capacitor voltage = state"; - Basic.Capacitor c(final C=C) + parameter Modelica.Units.SI.Frequency f "Frequency"; + parameter Modelica.Units.SI.Resistance R=1000 + "Resistance at output of OpAmp"; + parameter Modelica.Units.SI.Capacitance C=k/(2*pi*f*R) + "Calculated capacitance to reach desired amplification k"; + Modelica.Units.SI.Voltage v(start=0)=c.v "Capacitor voltage = state"; + Modelica.Electrical.Analog.Basic.Capacitor c(final C=C) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); - Basic.Resistor r(final R=R) + Modelica.Electrical.Analog.Basic.Resistor r(final R=R) annotation (Placement(transformation(extent={{30,20},{10,40}}))); equation connect(n1, n2) diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Derivative.mo b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Derivative.mo index 428d93225e..e1d4497eae 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Derivative.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Derivative.mo @@ -3,16 +3,19 @@ model Derivative "Lowpass filter operational amplifier circuit" extends PartialOpAmp; import Modelica.Constants.pi; parameter Real k(final min=0)=1 "Desired amplification"; - parameter SI.Resistance R1=1000 "Resistance at negative input of OpAmp"; - parameter SI.Resistance R2=k*R1 "Calculated resistance to reach k"; - parameter SI.Time T "Time constant"; - parameter SI.Capacitance C=T/R1 "Calculated capacitance to reach T"; - SI.Voltage v(start=0)=c.v "Capacitor voltage = state"; - Basic.Resistor r1(R=R1) + parameter Modelica.Units.SI.Resistance R1=1000 + "Resistance at negative input of OpAmp"; + parameter Modelica.Units.SI.Resistance R2=k*R1 + "Calculated resistance to reach k"; + parameter Modelica.Units.SI.Time T "Time constant"; + parameter Modelica.Units.SI.Capacitance C=T/R1 + "Calculated capacitance to reach T"; + Modelica.Units.SI.Voltage v(start=0)=c.v "Capacitor voltage = state"; + Modelica.Electrical.Analog.Basic.Resistor r1(R=R1) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); - Basic.Resistor r2(R=R2) + Modelica.Electrical.Analog.Basic.Resistor r2(R=R2) annotation (Placement(transformation(extent={{30,20},{10,40}}))); - Basic.Capacitor c(C=C) + Modelica.Electrical.Analog.Basic.Capacitor c(C=C) annotation (Placement(transformation(extent={{-80,20},{-60,40}}))); equation connect(n1, n2) diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/DifferentialAmplifierData.mo b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/DifferentialAmplifierData.mo index ea5d5f90cf..4d010bdda2 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/DifferentialAmplifierData.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/DifferentialAmplifierData.mo @@ -1,30 +1,31 @@ within Modelica.Electrical.Analog.Examples.OpAmps.OpAmpCircuits; record DifferentialAmplifierData "Data record for differential amplifier" extends Modelica.Icons.Record; - parameter SI.Voltage VSource=400 "Source RMS voltage line-to-line" - annotation(Dialog(group="Source")); - parameter SI.Frequency fSource=50 "Source frequency" - annotation(Dialog(group="Source")); - parameter SI.Resistance RLoad=10 "Load resistance of source" - annotation(Dialog(group="Source")); - parameter SI.Resistance RGround=100e3 "Resistance of ground connection" - annotation(Dialog(group="Source")); + parameter Modelica.Units.SI.Voltage VSource=400 + "Source RMS voltage line-to-line" annotation (Dialog(group="Source")); + parameter Modelica.Units.SI.Frequency fSource=50 "Source frequency" + annotation (Dialog(group="Source")); + parameter Modelica.Units.SI.Resistance RLoad=10 + "Load resistance of source" annotation (Dialog(group="Source")); + parameter Modelica.Units.SI.Resistance RGround=100e3 + "Resistance of ground connection" annotation (Dialog(group="Source")); parameter Real V0=10e3 "No-load differential amplification" annotation(Dialog(group="OpAmp")); - parameter SI.Voltage VSupply=15 "Supply voltage" - annotation(Dialog(group="OpAmp")); + parameter Modelica.Units.SI.Voltage VSupply=15 "Supply voltage" + annotation (Dialog(group="OpAmp")); parameter Real k=100 "Attenuation factor" annotation(Dialog(group="OpAmp")); - parameter SI.Resistance R1=100e3 "Resistor 1" - annotation(Dialog(group="OpAmp")); - parameter SI.Resistance R2=R1 "Resistor 2" - annotation(Dialog(group="OpAmp")); - parameter SI.Resistance R3=R1/k "Resistor 3" - annotation(Dialog(group="OpAmp")); - parameter SI.Resistance R4=R3 "Resistor 4" - annotation(Dialog(group="OpAmp")); - parameter SI.Resistance RInstrument=100e3 "Input resistance of instrument" - annotation(Dialog(group="Measurement")); + parameter Modelica.Units.SI.Resistance R1=100e3 "Resistor 1" + annotation (Dialog(group="OpAmp")); + parameter Modelica.Units.SI.Resistance R2=R1 "Resistor 2" + annotation (Dialog(group="OpAmp")); + parameter Modelica.Units.SI.Resistance R3=R1/k "Resistor 3" + annotation (Dialog(group="OpAmp")); + parameter Modelica.Units.SI.Resistance R4=R3 "Resistor 4" + annotation (Dialog(group="OpAmp")); + parameter Modelica.Units.SI.Resistance RInstrument=100e3 + "Input resistance of instrument" + annotation (Dialog(group="Measurement")); annotation (defaultComponentPrefixes="parameter", defaultComponentName="data", Documentation(info="diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Feedback.mo b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Feedback.mo index aec0ed4a27..8e0d018568 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Feedback.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Feedback.mo @@ -1,26 +1,31 @@ within Modelica.Electrical.Analog.Examples.OpAmps.OpAmpCircuits; model Feedback "Subtracting operational amplifier circuit" extends PartialOpAmp; - SI.Voltage v1_2=p1_2.v - n1.v "Voltage drop of port 1_2 (= p1_2.v - n1.v)"; - SI.Current i1_2=p1_2.i "Current flowing from pos. to neg. pin of port 1_2"; + Modelica.Units.SI.Voltage v1_2=p1_2.v - n1.v + "Voltage drop of port 1_2 (= p1_2.v - n1.v)"; + Modelica.Units.SI.Current i1_2=p1_2.i + "Current flowing from pos. to neg. pin of port 1_2"; parameter Real k(final min=0)=1 "Desired amplification"; - parameter SI.Resistance R1=1000 "Resistance at inputs of OpAmp"; - parameter SI.Resistance R3=R1/k "Calculated resistance to reach desired amplification k"; - Basic.Resistor r1(final R=R1) - annotation (Placement(transformation(extent={{-10,-10},{10,10}}, - origin={-40,70}))); - Basic.Resistor r2(final R=R1) - annotation (Placement(transformation(extent={{10,-10},{-10,10}}, + parameter Modelica.Units.SI.Resistance R1=1000 + "Resistance at inputs of OpAmp"; + parameter Modelica.Units.SI.Resistance R3=R1/k + "Calculated resistance to reach desired amplification k"; + Modelica.Electrical.Analog.Basic.Resistor r1(final R=R1) annotation ( + Placement(transformation(extent={{-10,-10},{10,10}}, origin={-40,70}))); + Modelica.Electrical.Analog.Basic.Resistor r2(final R=R1) annotation ( + Placement(transformation( + extent={{10,-10},{-10,10}}, rotation=180, origin={-40,-70}))); - Interfaces.PositivePin p1_2 "Positive electrical pin 1.2" annotation ( - Placement(transformation(extent={{-110,-10},{-90,10}}), - iconTransformation(extent={{-110,-10},{-90,10}}))); - Basic.Resistor r3(final R=R3) - annotation (Placement(transformation(extent={{10,-10},{-10,10}}, - origin={20,70}))); - Basic.Resistor r4(final R=R3) - annotation (Placement(transformation(extent={{10,-10},{-10,10}}, + Modelica.Electrical.Analog.Interfaces.PositivePin p1_2 + "Positive electrical pin 1.2" annotation (Placement(transformation( + extent={{-110,-10},{-90,10}}), iconTransformation(extent={{-110,-10}, + {-90,10}}))); + Modelica.Electrical.Analog.Basic.Resistor r3(final R=R3) annotation ( + Placement(transformation(extent={{10,-10},{-10,10}}, origin={20,70}))); + Modelica.Electrical.Analog.Basic.Resistor r4(final R=R3) annotation ( + Placement(transformation( + extent={{10,-10},{-10,10}}, rotation=180, origin={20,-70}))); equation diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/FirstOrder.mo b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/FirstOrder.mo index 4a6b17fb98..2739714216 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/FirstOrder.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/FirstOrder.mo @@ -3,16 +3,19 @@ model FirstOrder "Lowpass filter operational amplifier circuit" extends PartialOpAmp(v2(start=0)); import Modelica.Constants.pi; parameter Real k(final min=0)=1 "Desired amplification"; - parameter SI.Resistance R1=1000 "Resistance at negative input of OpAmp"; - parameter SI.Resistance R2=k*R1 "Calculated resistance to reach k"; - parameter SI.Time T "Time constant"; - parameter SI.Capacitance C=T/R2 "Calculated capacitance to reach T"; - SI.Voltage v(start=0)=c.v "Capacitor voltage = state"; - Basic.Resistor r1(R=R1) + parameter Modelica.Units.SI.Resistance R1=1000 + "Resistance at negative input of OpAmp"; + parameter Modelica.Units.SI.Resistance R2=k*R1 + "Calculated resistance to reach k"; + parameter Modelica.Units.SI.Time T "Time constant"; + parameter Modelica.Units.SI.Capacitance C=T/R2 + "Calculated capacitance to reach T"; + Modelica.Units.SI.Voltage v(start=0)=c.v "Capacitor voltage = state"; + Modelica.Electrical.Analog.Basic.Resistor r1(R=R1) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); - Basic.Resistor r2(R=R2) + Modelica.Electrical.Analog.Basic.Resistor r2(R=R2) annotation (Placement(transformation(extent={{30,20},{10,40}}))); - Basic.Capacitor c(C=C) + Modelica.Electrical.Analog.Basic.Capacitor c(C=C) annotation (Placement(transformation(extent={{30,40},{10,60}}))); equation connect(n1, n2) diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Gain.mo b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Gain.mo index 90b5ad295e..2340581f83 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Gain.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Gain.mo @@ -2,11 +2,13 @@ within Modelica.Electrical.Analog.Examples.OpAmps.OpAmpCircuits; model Gain "Inverting operational amplifier circuit" extends PartialOpAmp; parameter Real k(final min=0)=1 "Desired amplification"; - parameter SI.Resistance R1=1000 "Resistance at negative input of OpAmp"; - parameter SI.Resistance R2=k*R1 "Calculated resistance to reach desired amplification k"; - Basic.Resistor r1(final R=R1) + parameter Modelica.Units.SI.Resistance R1=1000 + "Resistance at negative input of OpAmp"; + parameter Modelica.Units.SI.Resistance R2=k*R1 + "Calculated resistance to reach desired amplification k"; + Modelica.Electrical.Analog.Basic.Resistor r1(final R=R1) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); - Basic.Resistor r2(final R=R2) + Modelica.Electrical.Analog.Basic.Resistor r2(final R=R2) annotation (Placement(transformation(extent={{30,20},{10,40}}))); equation connect(opAmp.out, r2.p) diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Integrator.mo b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Integrator.mo index ec70dd2148..6ba8232853 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Integrator.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Integrator.mo @@ -3,13 +3,15 @@ model Integrator "Integrating operational amplifier circuit" extends PartialOpAmp(v2(start=0)); import Modelica.Constants.pi; parameter Real k(final min=0)=1 "Desired amplification at frequency f"; - parameter SI.Frequency f "Frequency"; - parameter SI.Resistance R=1000 "Resistance at negative input of OpAmp"; - parameter SI.Capacitance C=1/k/(2*pi*f*R) "Calculated capacitance to reach desired amplification k"; - SI.Voltage v(start=0)=c.v "Capacitor voltage = state"; - Basic.Capacitor c(final C=C) + parameter Modelica.Units.SI.Frequency f "Frequency"; + parameter Modelica.Units.SI.Resistance R=1000 + "Resistance at negative input of OpAmp"; + parameter Modelica.Units.SI.Capacitance C=1/k/(2*pi*f*R) + "Calculated capacitance to reach desired amplification k"; + Modelica.Units.SI.Voltage v(start=0)=c.v "Capacitor voltage = state"; + Modelica.Electrical.Analog.Basic.Capacitor c(final C=C) annotation (Placement(transformation(extent={{30,20},{10,40}}))); - Basic.Resistor r(final R=R) + Modelica.Electrical.Analog.Basic.Resistor r(final R=R) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); equation connect(n1, n2) @@ -40,7 +42,7 @@ equation points={{-80.0,78.0},{-80.0,-90.0}}, color={192,192,192}), Line( - points={{-80.0,-80.0},{80.0,80.0}}, + points=DynamicSelect({{-80.0,-80.0},{80.0,80.0}}, if use_reset then {{-80.0,-80.0},{60.0,60.0},{60.0,-80.0},{80.0,-60.0}} else {{-80.0,-80.0},{80.0,80.0}}), color={0,0,127}), Line( points={{-90.0,-80.0},{82.0,-80.0}}, diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/PI.mo b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/PI.mo index 22b7778ea4..f77a10479b 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/PI.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/PI.mo @@ -3,15 +3,18 @@ model PI "PI controller operational amplifier circuit" extends PartialOpAmp(v2(start=0)); import Modelica.Constants.pi; parameter Real k(final min=0)=1 "Desired amplification"; - parameter SI.Resistance R1=1000 "Resistance at negative input of OpAmp"; - parameter SI.Resistance R2=k*R1 "Calculated resistance to reach k"; - parameter SI.Time T "Time constant"; - parameter SI.Capacitance C=T/k/R1 "Calculated capacitance to reach T"; - Basic.Resistor r1(R=R1) + parameter Modelica.Units.SI.Resistance R1=1000 + "Resistance at negative input of OpAmp"; + parameter Modelica.Units.SI.Resistance R2=k*R1 + "Calculated resistance to reach k"; + parameter Modelica.Units.SI.Time T "Time constant"; + parameter Modelica.Units.SI.Capacitance C=T/k/R1 + "Calculated capacitance to reach T"; + Modelica.Electrical.Analog.Basic.Resistor r1(R=R1) annotation (Placement(transformation(extent={{-50,20},{-30,40}}))); - Basic.Resistor r2(R=R2) + Modelica.Electrical.Analog.Basic.Resistor r2(R=R2) annotation (Placement(transformation(extent={{30,20},{10,40}}))); - Basic.Capacitor c(C=C) + Modelica.Electrical.Analog.Basic.Capacitor c(C=C) annotation (Placement(transformation(extent={{60,20},{40,40}}))); equation connect(n1, n2) diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/PartialOpAmp.mo b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/PartialOpAmp.mo index 6ffb3ad7cc..c80f0e2d2b 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/PartialOpAmp.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/PartialOpAmp.mo @@ -2,15 +2,17 @@ within Modelica.Electrical.Analog.Examples.OpAmps.OpAmpCircuits; partial model PartialOpAmp "Partial circuit of operational amplifiers" extends Modelica.Electrical.Analog.Interfaces.FourPin; - parameter SI.Voltage Vps=+15 "Positive supply"; - parameter SI.Voltage Vns=-15 "Negative supply"; + parameter Modelica.Units.SI.Voltage Vps=+15 "Positive supply"; + parameter Modelica.Units.SI.Voltage Vns=-15 "Negative supply"; parameter Real V0=15000.0 "No-load amplification"; - Ideal.IdealizedOpAmpLimited opAmp( + Modelica.Electrical.Analog.Ideal.IdealizedOpAmpLimited opAmp( V0=V0, - final useSupply=false, - final Vps=Vps, - final Vns=Vns, - out(i(start=0, fixed=false))) + useSupply=false, + Vps=Vps, + Vns=Vns, + regularized=false, + smoothed=false, + strict=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ Text( diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/SchmittTrigger.mo b/Modelica/Electrical/Analog/Examples/OpAmps/SchmittTrigger.mo index f56e8fa332..88b1b3f09a 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/SchmittTrigger.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/SchmittTrigger.mo @@ -1,21 +1,27 @@ within Modelica.Electrical.Analog.Examples.OpAmps; model SchmittTrigger "Schmitt trigger with hysteresis" extends Modelica.Icons.Example; - parameter SI.Voltage Vps=+15 "Positive supply"; - parameter SI.Voltage Vns=-15 "Negative supply"; - parameter SI.Voltage Vin=5 "Amplitude of input voltage"; - parameter SI.Frequency f=10 "Frequency of input voltage"; - parameter SI.Voltage vHys=1 "(Positive) hysteresis voltage"; + parameter Real V0=15000.0 "No-load amplification"; + parameter Modelica.Units.SI.Voltage Vps=+15 "Positive supply"; + parameter Modelica.Units.SI.Voltage Vns=-15 "Negative supply"; + parameter Modelica.Units.SI.Voltage Vin=5 "Amplitude of input voltage"; + parameter Modelica.Units.SI.Frequency f=10 "Frequency of input voltage"; + parameter Modelica.Units.SI.Voltage vHys=1 "(Positive) hysteresis voltage"; parameter Real k=vHys/Vps "Auxiliary calculated parameter to be used in R2 calculation"; - parameter SI.Resistance R1=1000 "Arbitrary resistance"; - parameter SI.Resistance R2=R1/k "Calculated resistance to reach hysteresis voltage"; + parameter Modelica.Units.SI.Resistance R1=1000 "Arbitrary resistance"; + parameter Modelica.Units.SI.Resistance R2=R1/k + "Calculated resistance to reach hysteresis voltage"; Modelica.Electrical.Analog.Ideal.IdealizedOpAmpLimited opAmp( + V0=V0, + useSupply=false, Vps=Vps, Vns=Vns, - out(i(start=0))) - annotation (Placement(transformation(extent={{0,10},{20,-10}}))); + regularized=true, + smoothed=false, + strict=false) + annotation (Placement(transformation(extent={{-10,10},{10,-10}}))); Modelica.Electrical.Analog.Basic.Ground ground - annotation (Placement(transformation(extent={{-20,-100},{0,-80}}))); + annotation (Placement(transformation(extent={{-10,-100},{10,-80}}))); Modelica.Electrical.Analog.Sources.TrapezoidVoltage vIn( rising=0.2/f, width=0.3/f, @@ -27,12 +33,12 @@ model SchmittTrigger "Schmitt trigger with hysteresis" offset=-Vin) annotation (Placement(transformation( extent={{-10,-10},{10,10}}, rotation=270, - origin={-80,0}))); + origin={-40,0}))); Modelica.Electrical.Analog.Sensors.VoltageSensor vOut annotation (Placement( transformation( extent={{-10,10},{10,-10}}, rotation=270, - origin={50,-20}))); + origin={40,-10}))); Modelica.Electrical.Analog.Basic.Resistor r1(R=R1) annotation (Placement( transformation( extent={{-10,-10},{10,10}}, @@ -44,21 +50,21 @@ model SchmittTrigger "Schmitt trigger with hysteresis" origin={10,20}))); equation connect(ground.p, vIn.n) annotation (Line( - points={{-10,-80},{-80,-80},{-80,-10}}, color={0,0,255})); + points={{0,-80},{-40,-80},{-40,-10}}, color={0,0,255})); connect(ground.p, vOut.n) annotation (Line( - points={{-10,-80},{50,-80},{50,-30}}, color={0,0,255})); + points={{0,-80},{40,-80},{40,-20}}, color={0,0,255})); connect(opAmp.out, vOut.p) annotation (Line( - points={{20,0},{50,0},{50,-10}}, color={0,0,255})); - connect(opAmp.in_n, ground.p) annotation (Line( - points={{0,-6},{-10,-6},{-10,-80}}, color={0,0,255})); + points={{10,0},{40,0}}, color={0,0,255})); connect(opAmp.out, r2.n) annotation (Line( - points={{20,0},{30,0},{30,20},{20,20}}, color={0,0,255})); + points={{10,0},{20,0},{20,20}}, color={0,0,255})); connect(r2.p, opAmp.in_p) annotation (Line( - points={{0,20},{-10,20},{-10,6},{0,6}}, color={0,0,255})); + points={{0,20},{-10,20},{-10,6}}, color={0,0,255})); connect(r2.p, r1.n) annotation (Line( points={{0,20},{-20,20}}, color={0,0,255})); connect(r1.p, vIn.p) annotation (Line( - points={{-40,20},{-80,20},{-80,10}}, color={0,0,255})); + points={{-40,20},{-40,10}}, color={0,0,255})); + connect(opAmp.in_n, ground.p) annotation (Line(points={{-10,-6},{-10,-20},{0,-20}, + {0,-80}}, color={0,0,255})); annotation (Documentation(info="
This is a (non-inverting) Schmitt trigger. Resistance R1 can be chosen, resistance R2 is defined by the desired hysteresis. The output gets Vp for input voltage > vHys and Vn for input voltage < vHys*Vns/Vps.
The example is taken from: U. Tietze and C. Schenk, Halbleiter-Schaltungstechnik (German), 11th edition, Springer 1999, Chapter 6.5.2
diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/SignalGenerator.mo b/Modelica/Electrical/Analog/Examples/OpAmps/SignalGenerator.mo index d334913e8c..2dee151d3d 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/SignalGenerator.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/SignalGenerator.mo @@ -2,18 +2,27 @@ within Modelica.Electrical.Analog.Examples.OpAmps; model SignalGenerator "Rectangle-Triangle generator" extends Modelica.Icons.Example; import Modelica.Constants.pi; - parameter SI.Voltage Vps=+15 "Positive supply"; - parameter SI.Voltage Vns=-Vps "Negative supply"; - parameter SI.Voltage VAmp=10 "Desired amplitude of output"; - parameter SI.Resistance R1=1000 "Arbitrary resistance for Schmitt trigger part"; - parameter SI.Resistance R2=R1*Vps/VAmp "Calculated resistance for Schmitt trigger to reach VAmp"; - parameter SI.Frequency f=10 "Desired frequency"; - parameter SI.Resistance R=1000 "Arbitrary resistance of integrator part"; - parameter SI.Capacitance C=Vps/VAmp/(4*f*R) "Calculated capacitance of integrator part to reach f"; + parameter Real V0=15000.0 "No-load amplification"; + parameter Modelica.Units.SI.Voltage Vps=+15 "Positive supply"; + parameter Modelica.Units.SI.Voltage Vns=-Vps "Negative supply"; + parameter Modelica.Units.SI.Voltage VAmp=10 "Desired amplitude of output"; + parameter Modelica.Units.SI.Resistance R1=1000 + "Arbitrary resistance for Schmitt trigger part"; + parameter Modelica.Units.SI.Resistance R2=R1*Vps/VAmp + "Calculated resistance for Schmitt trigger to reach VAmp"; + parameter Modelica.Units.SI.Frequency f=10 "Desired frequency"; + parameter Modelica.Units.SI.Resistance R=1000 + "Arbitrary resistance of integrator part"; + parameter Modelica.Units.SI.Capacitance C=Vps/VAmp/(4*f*R) + "Calculated capacitance of integrator part to reach f"; Modelica.Electrical.Analog.Ideal.IdealizedOpAmpLimited opAmp1( + V0=V0, + useSupply=false, Vps=Vps, Vns=Vns, - strict=true) + regularized=true, + smoothed=false, + strict=false) annotation (Placement(transformation(extent={{-60,10},{-40,-10}}))); Modelica.Electrical.Analog.Basic.Resistor r2(R=R2, i(start=Vps/R2)) annotation (Placement(transformation( @@ -27,12 +36,15 @@ model SignalGenerator "Rectangle-Triangle generator" Modelica.Electrical.Analog.Basic.Ground ground annotation (Placement(transformation(extent={{-10,-60},{10,-40}}))); Modelica.Electrical.Analog.Ideal.IdealizedOpAmpLimited opAmp2( + V0=V0, + useSupply=false, Vps=Vps, Vns=Vns, - v_in(start=0), + regularized=false, + smoothed=false, strict=false) annotation (Placement(transformation(extent={{30,-10},{50,10}}))); - Modelica.Electrical.Analog.Basic.Capacitor c(C=C, v(fixed=true, start=0)) + Modelica.Electrical.Analog.Basic.Capacitor c(C=C, v(fixed=true, start=10)) annotation (Placement(transformation(extent={{50,20},{30,40}}))); Modelica.Electrical.Analog.Basic.Resistor r(R=R) annotation (Placement(transformation(extent={{-10,20},{10,40}}))); @@ -46,45 +58,35 @@ model SignalGenerator "Rectangle-Triangle generator" extent={{-10,10},{10,-10}}, rotation=270, origin={60,-18}))); - Blocks.Sources.Pulse pulse( - amplitude=Vps - Vns, - period=1/f, - offset=Vns, - startTime=0.025) - annotation (Placement(transformation(extent={{-40,-80},{-20,-60}}))); - Blocks.Continuous.Integrator integrator(k=-4*f*VAmp/Vps) - annotation (Placement(transformation(extent={{50,-80},{70,-60}}))); equation - connect(opAmp1.out, r2.n) annotation (Line( - points={{-40,0},{-30,0},{-30,30},{-40,30}}, color={0,0,255})); - connect(opAmp1.in_p, r2.p) annotation (Line( - points={{-60,6},{-70,6},{-70,30},{-60,30}}, color={0,0,255})); - connect(opAmp1.in_n, ground.p) annotation (Line( - points={{-60,-6},{-70,-6},{-70,-40},{0,-40}}, color={0,0,255})); - connect(opAmp1.out, r.p) annotation (Line( - points={{-40,0},{-30,0},{-30,30},{-10,30}}, color={0,0,255})); - connect(r.n, c.n) annotation (Line( - points={{10,30},{30,30}}, color={0,0,255})); - connect(c.p, opAmp2.out) annotation (Line( - points={{50,30},{60,30},{60,0},{50,0}}, color={0,0,255})); - connect(ground.p, opAmp2.in_p) annotation (Line( - points={{0,-40},{20,-40},{20,-6},{30,-6}}, color={0,0,255})); - connect(c.n, opAmp2.in_n) annotation (Line( - points={{30,30},{20,30},{20,6},{30,6}}, color={0,0,255})); - connect(r2.p, r1.p) annotation (Line( - points={{-60,30},{-70,30},{-70,50},{-60,50}}, color={0,0,255})); - connect(opAmp2.out, r1.n) annotation (Line( - points={{50,0},{60,0},{60,50},{-40,50}}, color={0,0,255})); - connect(opAmp1.out, vOutRectangle.p) annotation (Line( - points={{-40,0},{-30,0},{-30,-10}}, color={0,0,255})); - connect(ground.p, vOutRectangle.n) annotation (Line( - points={{0,-40},{-30,-40},{-30,-30}}, color={0,0,255})); - connect(opAmp2.out, vOutTriangle.p) annotation (Line( - points={{50,0},{60,0},{60,-8}}, color={0,0,255})); - connect(ground.p, vOutTriangle.n) annotation (Line( - points={{0,-40},{60,-40},{60,-28}}, color={0,0,255})); - connect(pulse.y,integrator. u) - annotation (Line(points={{-19,-70},{48,-70}}, color={0,0,127})); + connect(opAmp1.out, r2.n) annotation ( + Line(points = {{-40, 0}, {-30, 0}, {-30, 30}, {-40, 30}}, color = {0, 0, 255})); + connect(opAmp1.in_p, r2.p) annotation ( + Line(points = {{-60, 6}, {-70, 6}, {-70, 30}, {-60, 30}}, color = {0, 0, 255})); + connect(opAmp1.in_n, ground.p) annotation ( + Line(points = {{-60, -6}, {-70, -6}, {-70, -40}, {0, -40}}, color = {0, 0, 255})); + connect(opAmp1.out, r.p) annotation ( + Line(points = {{-40, 0}, {-30, 0}, {-30, 30}, {-10, 30}}, color = {0, 0, 255})); + connect(r.n, c.n) annotation ( + Line(points = {{10, 30}, {30, 30}}, color = {0, 0, 255})); + connect(c.p, opAmp2.out) annotation ( + Line(points = {{50, 30}, {60, 30}, {60, 0}, {50, 0}}, color = {0, 0, 255})); + connect(ground.p, opAmp2.in_p) annotation ( + Line(points = {{0, -40}, {20, -40}, {20, -6}, {30, -6}}, color = {0, 0, 255})); + connect(c.n, opAmp2.in_n) annotation ( + Line(points = {{30, 30}, {20, 30}, {20, 6}, {30, 6}}, color = {0, 0, 255})); + connect(r2.p, r1.p) annotation ( + Line(points = {{-60, 30}, {-70, 30}, {-70, 50}, {-60, 50}}, color = {0, 0, 255})); + connect(opAmp2.out, r1.n) annotation ( + Line(points = {{50, 0}, {60, 0}, {60, 50}, {-40, 50}}, color = {0, 0, 255})); + connect(opAmp1.out, vOutRectangle.p) annotation ( + Line(points = {{-40, 0}, {-30, 0}, {-30, -10}}, color = {0, 0, 255})); + connect(ground.p, vOutRectangle.n) annotation ( + Line(points = {{0, -40}, {-30, -40}, {-30, -30}}, color = {0, 0, 255})); + connect(opAmp2.out, vOutTriangle.p) annotation ( + Line(points = {{50, 0}, {60, 0}, {60, -8}}, color = {0, 0, 255})); + connect(ground.p, vOutTriangle.n) annotation ( + Line(points = {{0, -40}, {60, -40}, {60, -28}}, color = {0, 0, 255})); annotation (Documentation(info="This signal generator consists of a Schmitt trigger and an integrator. The output of the Schmitt trigger part opamp (opAmp1) is a rectangular signal with the amplitude VAmp and the frequency f. The output of the integrator part opamp (opAmp2) is a triangular signal of also the amplitude Vamp and the frequency f.
@@ -92,8 +94,7 @@ The output of the integrator part opamp (opAmp2) is a triangular signal of alsoU. Tietze and C. Schenk, Halbleiter-Schaltungstechnik (German), 11th edition, Springer 1999, Chapter 14.5.2
"), experiment( - StartTime=0, - StopTime=1, - Tolerance=1e-006, - Interval=0.001)); + Interval=0.001, + Tolerance=1e-07, + __Dymola_Algorithm="Dassl")); end SignalGenerator; diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/Subtracter.mo b/Modelica/Electrical/Analog/Examples/OpAmps/Subtracter.mo index a9b3196d9e..5a7caa9a05 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/Subtracter.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/Subtracter.mo @@ -1,23 +1,23 @@ within Modelica.Electrical.Analog.Examples.OpAmps; model Subtracter "Inverting subtracter" extends Modelica.Icons.Example; - parameter SI.Voltage Vin=5 "Amplitude of input voltage"; - parameter SI.Frequency f=10 "Frequency of input voltage"; + parameter Modelica.Units.SI.Voltage Vin=5 "Amplitude of input voltage"; + parameter Modelica.Units.SI.Frequency f=10 "Frequency of input voltage"; Modelica.Electrical.Analog.Basic.Ground ground annotation (Placement(transformation(extent={{-20,-40},{0,-20}}))); - Sources.SineVoltage vIn1(V=Vin, f=f) annotation (Placement( - transformation( + Modelica.Electrical.Analog.Sources.SineVoltage vIn1(V=Vin, f=f) annotation ( + Placement(transformation( extent={{-10,-10},{10,10}}, rotation=270, origin={-60,0}))); - Sources.ConstantVoltage vIn2(V=Vin) annotation (Placement( - transformation( + Modelica.Electrical.Analog.Sources.ConstantVoltage vIn2(V=Vin) annotation ( + Placement(transformation( extent={{-10,-10},{10,10}}, rotation=270, origin={-40,-10}))); Modelica.Electrical.Analog.Sensors.VoltageSensor vOut annotation (Placement( transformation( - extent={{10,10},{-10,-10}}, + extent={{-10,10},{10,-10}}, rotation=270, origin={40,0}))); OpAmpCircuits.Feedback feedback(p1_2(i(start=0))) @@ -33,9 +33,9 @@ equation annotation (Line(points={{-10,-20},{-40,-20}}, color={0,0,255})); connect(ground.p, vIn1.n) annotation (Line(points={{-10,-20},{-60,-20},{-60,-10}}, color={0,0,255})); - connect(feedback.p2, vOut.n) - annotation (Line(points={{10,10},{40,10}}, color={0,0,255})); - connect(feedback.n2, vOut.p) + connect(vOut.p, feedback.p2) + annotation (Line(points={{40,10},{10,10}}, color={0,0,255})); + connect(feedback.n2, vOut.n) annotation (Line(points={{10,-10},{40,-10}}, color={0,0,255})); annotation (Documentation(info="This is an inverting subtracter.
diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/VoltageFollower.mo b/Modelica/Electrical/Analog/Examples/OpAmps/VoltageFollower.mo index b5e84476d8..4f82fa41c0 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/VoltageFollower.mo +++ b/Modelica/Electrical/Analog/Examples/OpAmps/VoltageFollower.mo @@ -1,17 +1,22 @@ within Modelica.Electrical.Analog.Examples.OpAmps; model VoltageFollower "Reproduce input voltage" extends Modelica.Icons.Example; - parameter SI.Voltage Vps=+15 "Positive supply"; - parameter SI.Voltage Vns=-15 "Negative supply"; - parameter SI.Voltage Vin=5 "Amplitude of input voltage"; - parameter SI.Frequency f=10 "Frequency of input voltage"; - parameter SI.Resistance Ri=1 + parameter Real V0=15000.0 "No-load amplification"; + parameter Modelica.Units.SI.Voltage Vps=+15 "Positive supply"; + parameter Modelica.Units.SI.Voltage Vns=-15 "Negative supply"; + parameter Modelica.Units.SI.Voltage Vin=5 "Amplitude of input voltage"; + parameter Modelica.Units.SI.Frequency f=10 "Frequency of input voltage"; + parameter Modelica.Units.SI.Resistance Ri=1 "Inner resistance of input voltage source"; - parameter SI.Resistance Rl=1 "Load resistance"; + parameter Modelica.Units.SI.Resistance Rl=1 "Load resistance"; Modelica.Electrical.Analog.Ideal.IdealizedOpAmpLimited opAmp( + V0=V0, + useSupply=false, Vps=Vps, Vns=Vns, - v_in(start=0)) + regularized=false, + smoothed=false, + strict=false) annotation (Placement(transformation(extent={{0,-10},{20,10}}))); Modelica.Electrical.Analog.Basic.Ground ground annotation (Placement(transformation(extent={{-20,-100},{0,-80}}))); diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/package.order b/Modelica/Electrical/Analog/Examples/OpAmps/package.order index e898c26d8d..932a16089b 100644 --- a/Modelica/Electrical/Analog/Examples/OpAmps/package.order +++ b/Modelica/Electrical/Analog/Examples/OpAmps/package.order @@ -9,10 +9,10 @@ LowPass HighPass ControlCircuit VoltageFollower +LCOscillator Comparator InvertingSchmittTrigger SchmittTrigger Multivibrator SignalGenerator -LCOscillator OpAmpCircuits diff --git a/Modelica/Electrical/Analog/Ideal/IdealizedOpAmpLimited.mo b/Modelica/Electrical/Analog/Ideal/IdealizedOpAmpLimited.mo index c495ebc903..bdcfe00e6e 100644 --- a/Modelica/Electrical/Analog/Ideal/IdealizedOpAmpLimited.mo +++ b/Modelica/Electrical/Analog/Ideal/IdealizedOpAmpLimited.mo @@ -3,22 +3,27 @@ model IdealizedOpAmpLimited "Idealized operational amplifier with limitation" parameter Real V0=15000.0 "No-load amplification"; parameter Boolean useSupply=false "Use supply pins (otherwise constant supply)" annotation (Evaluate=true); - parameter SI.Voltage Vps=+15 "Positive supply voltage" + parameter Modelica.Units.SI.Voltage Vps=+15 "Positive supply voltage" annotation (Dialog(enable=not useSupply)); - parameter SI.Voltage Vns=-15 "Negative supply voltage" + parameter Modelica.Units.SI.Voltage Vns=-15 "Negative supply voltage" annotation (Dialog(enable=not useSupply)); - parameter Boolean strict=true "= true, if strict limits with noEvent(..)" + parameter Boolean regularized=false "= true, if regularization instead of smoothed / strict" annotation (Evaluate=true, choices(checkBox=true), Dialog(tab="Advanced")); + parameter Boolean smoothed=false "= true, if output is limited with smooth(0, ..)" + annotation (Evaluate=true, choices(checkBox=true), Dialog(enable=not regularized, tab="Advanced")); + parameter Boolean strict=false "= true, if strict limits with noEvent(..)" + annotation (Evaluate=true, choices(checkBox=true), Dialog(enable=not regularized, tab="Advanced")); parameter Modelica.Blocks.Types.LimiterHomotopy homotopyType = Modelica.Blocks.Types.LimiterHomotopy.NoHomotopy "Simplified model for homotopy-based initialization" annotation (Evaluate=true, Dialog(group="Initialization")); - SI.Voltage vps "Positive supply voltage"; - SI.Voltage vns "Negative supply voltage"; - SI.Voltage v_in=in_p.v - in_n.v "Input voltage difference"; - SI.Voltage v_out=out.v "Output voltage to ground"; - SI.Power p_in=in_p.v*in_p.i + in_n.v*in_n.i "Input power"; - SI.Power p_out=out.v*out.i "Output power"; - SI.Power p_s=-(p_in + p_out) "Supply power"; - SI.Current i_s=p_s/(vps - vns) "Supply current"; + Modelica.Units.SI.Voltage vps "Positive supply voltage"; + Modelica.Units.SI.Voltage vns "Negative supply voltage"; + Modelica.Units.SI.Voltage v_in(start=0)=in_p.v - in_n.v "Input voltage difference"; + Modelica.Units.SI.Voltage v_out=out.v "Output voltage to ground"; + Modelica.Units.SI.Current i_out(start=0)=-out.i "Output current"; + Modelica.Units.SI.Power p_in=in_p.v*in_p.i + in_n.v*in_n.i "Input power"; + Modelica.Units.SI.Power p_out=out.v*out.i "Output power"; + Modelica.Units.SI.Power p_s=-(p_in + p_out) "Supply power"; + Modelica.Units.SI.Current i_s=p_s/(vps - vns) "Supply current"; Modelica.Electrical.Analog.Interfaces.PositivePin in_p "Positive pin of the input port" annotation (Placement(transformation( extent={{-90,-70},{-110,-50}}))); @@ -37,7 +42,8 @@ model IdealizedOpAmpLimited "Idealized operational amplifier with limitation" vns) if useSupply "Optional negative supply pin" annotation (Placement( transformation(extent={{-10,-110},{10,-90}}))); protected - SI.Voltage simplifiedExpr "Simplified expression for homotopy-based initialization"; + Modelica.Units.SI.Voltage simplifiedExpr + "Simplified expression for homotopy-based initialization"; equation if not useSupply then vps = Vps; @@ -49,19 +55,41 @@ equation else if homotopyType == Modelica.Blocks.Types.LimiterHomotopy.UpperLimit then vps else if homotopyType == Modelica.Blocks.Types.LimiterHomotopy.LowerLimit then vns else 0); - if strict then + if regularized then if homotopyType == Modelica.Blocks.Types.LimiterHomotopy.NoHomotopy then - v_out = smooth(0, noEvent(if V0*v_in>vps then vps else if V0*v_inSupply voltage is either defined by parameter Vps and Vns or by (optional) pins s_p and s_n.
In the first case the necessary power is drawn from an implicit internal supply, in the second case from the external supply.
++You may choose between different implementations for calculating output voltage from input voltage: +
regularized | smoothed | strict | +explanation | +
---|---|---|---|
true | + | uses a regularization formula which is nearly linear around 0 and saturates at positive resp. negative supply | +|
false | false | false | +uses a linear relationship and saturates at positive resp. negative supply without using smooth and/or noEvent | +
false | true | false | +uses a linear relationship and saturates at positive resp. negative supply using smooth but without noEvent | +
false | false | true | +uses a linear relationship and saturates at positive resp. negative supply without using smooth but using noEvent | +
false | true | true | +uses a linear relationship and saturates at positive resp. negative supply using both smooth and noEvent | +
If initialization is problematic for a model containing this as a component you can set the homotopyType parameter. Using Linear ignores the saturation initially which simplifies the initialization, and may help if the component is connected with negative feedback; but generally fails if the feedback is positive.