From ee201fccd2ac4572cce6b7f92f0510c6d744e4a2 Mon Sep 17 00:00:00 2001
From: AHaumer
Date: Mon, 21 Oct 2024 13:45:10 +0200
Subject: [PATCH 1/5] MSL 4.1.0 Regressions:
Modelica/Electrical/Analog/Examples/OpAmps/SignalGenerator.mo set {opAmp1,
opAmp2}.strict=true
---
Modelica/Electrical/Analog/Examples/OpAmps/SignalGenerator.mo | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/SignalGenerator.mo b/Modelica/Electrical/Analog/Examples/OpAmps/SignalGenerator.mo
index 758dae6781..d9ec5095e9 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/SignalGenerator.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/SignalGenerator.mo
@@ -13,7 +13,7 @@ model SignalGenerator "Rectangle-Triangle generator"
Modelica.Electrical.Analog.Ideal.IdealizedOpAmpLimited opAmp1(
Vps=Vps,
Vns=Vns,
- strict=false,
+ strict=true,
homotopyType=Modelica.Blocks.Types.LimiterHomotopy.LowerLimit)
annotation (Placement(transformation(extent={{-60,10},{-40,-10}})));
Modelica.Electrical.Analog.Basic.Resistor r2(R=R2, i(start=Vps/R2))
@@ -31,7 +31,7 @@ model SignalGenerator "Rectangle-Triangle generator"
Vps=Vps,
Vns=Vns,
v_in(start=0),
- strict=false)
+ strict=true)
annotation (Placement(transformation(extent={{30,-10},{50,10}})));
Modelica.Electrical.Analog.Basic.Capacitor c(C=C, v(fixed=true, start=0))
annotation (Placement(transformation(extent={{50,20},{30,40}})));
From 163b01c67540a19ec48832fbddb4236646ceb952 Mon Sep 17 00:00:00 2001
From: AHaumer
Date: Tue, 22 Oct 2024 15:31:25 +0200
Subject: [PATCH 2/5] added analytic solution to
Modelica/Electrical/Analog/Examples/OpAmps/SignalGenerator.mo
---
.../Analog/Examples/OpAmps/SignalGenerator.mo | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/SignalGenerator.mo b/Modelica/Electrical/Analog/Examples/OpAmps/SignalGenerator.mo
index d9ec5095e9..d334913e8c 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/SignalGenerator.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/SignalGenerator.mo
@@ -13,8 +13,7 @@ model SignalGenerator "Rectangle-Triangle generator"
Modelica.Electrical.Analog.Ideal.IdealizedOpAmpLimited opAmp1(
Vps=Vps,
Vns=Vns,
- strict=true,
- homotopyType=Modelica.Blocks.Types.LimiterHomotopy.LowerLimit)
+ strict=true)
annotation (Placement(transformation(extent={{-60,10},{-40,-10}})));
Modelica.Electrical.Analog.Basic.Resistor r2(R=R2, i(start=Vps/R2))
annotation (Placement(transformation(
@@ -31,7 +30,7 @@ model SignalGenerator "Rectangle-Triangle generator"
Vps=Vps,
Vns=Vns,
v_in(start=0),
- strict=true)
+ strict=false)
annotation (Placement(transformation(extent={{30,-10},{50,10}})));
Modelica.Electrical.Analog.Basic.Capacitor c(C=C, v(fixed=true, start=0))
annotation (Placement(transformation(extent={{50,20},{30,40}})));
@@ -47,6 +46,14 @@ 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}));
@@ -76,6 +83,8 @@ equation
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}));
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.
From 22c732743e747d8ee5ee3473da165d8faa895615 Mon Sep 17 00:00:00 2001
From: AHaumer
Date: Fri, 10 Jan 2025 12:14:37 +0100
Subject: [PATCH 3/5] My suggestion according to discussions in #4333 and #4485
(this PR)
---
.../Analog/Examples/OpAmps/Adder.mo | 24 ++--
.../Analog/Examples/OpAmps/Comparator.mo | 53 +++++----
.../Analog/Examples/OpAmps/ControlCircuit.mo | 33 +++---
.../Examples/OpAmps/DifferentialAmplifier.mo | 14 ++-
.../Analog/Examples/OpAmps/Differentiator.mo | 9 +-
.../Analog/Examples/OpAmps/HighPass.mo | 11 +-
.../Analog/Examples/OpAmps/Integrator.mo | 9 +-
.../Examples/OpAmps/InvertingAmplifier.mo | 11 +-
.../OpAmps/InvertingSchmittTrigger.mo | 50 ++++----
.../Analog/Examples/OpAmps/LCOscillator.mo | 31 +++--
.../Analog/Examples/OpAmps/LowPass.mo | 11 +-
.../Analog/Examples/OpAmps/Multivibrator.mo | 59 ++++++----
.../Examples/OpAmps/NonInvertingAmplifier.mo | 4 +-
.../Examples/OpAmps/OpAmpCircuits/Add.mo | 37 +++---
.../Examples/OpAmps/OpAmpCircuits/Buffer.mo | 18 ++-
.../Examples/OpAmps/OpAmpCircuits/Der.mo | 14 ++-
.../OpAmps/OpAmpCircuits/Derivative.mo | 19 ++--
.../DifferentialAmplifierData.mo | 41 +++----
.../Examples/OpAmps/OpAmpCircuits/Feedback.mo | 39 ++++---
.../OpAmps/OpAmpCircuits/FirstOrder.mo | 19 ++--
.../Examples/OpAmps/OpAmpCircuits/Gain.mo | 10 +-
.../OpAmps/OpAmpCircuits/Integrator.mo | 16 +--
.../Examples/OpAmps/OpAmpCircuits/PI.mo | 17 +--
.../OpAmps/OpAmpCircuits/PartialOpAmp.mo | 16 +--
.../Analog/Examples/OpAmps/SchmittTrigger.mo | 46 ++++----
.../Analog/Examples/OpAmps/SignalGenerator.mo | 107 +++++++++---------
.../Analog/Examples/OpAmps/Subtracter.mo | 20 ++--
.../Analog/Examples/OpAmps/VoltageFollower.mo | 19 ++--
.../Analog/Examples/OpAmps/package.order | 2 +-
.../Analog/Ideal/IdealizedOpAmpLimited.mo | 100 ++++++++++++----
30 files changed, 507 insertions(+), 352 deletions(-)
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.
diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/Comparator.mo b/Modelica/Electrical/Analog/Examples/OpAmps/Comparator.mo
index a6f8e97807..57be00d24f 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/Comparator.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/Comparator.mo
@@ -1,17 +1,25 @@
within Modelica.Electrical.Analog.Examples.OpAmps;
model Comparator "Comparator"
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 Vref=0 "Reference 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 Vref=0 "Reference voltage";
parameter Real k=(Vref - Vns)/(Vps - Vns) "Calculated potentiometer ratio to reach Vref";
- parameter SI.Resistance R=1000 "Resistance of potentiometer";
- Modelica.Electrical.Analog.Ideal.IdealizedOpAmpLimited opAmp(Vps=Vps, Vns=
- Vns) annotation (Placement(transformation(extent={{0,10},{20,-10}})));
+ parameter Modelica.Units.SI.Resistance R=1000 "Resistance of potentiometer";
+ Modelica.Electrical.Analog.Ideal.IdealizedOpAmpLimited opAmp(
+ V0=V0,
+ useSupply=false,
+ Vps=Vps,
+ Vns=Vns,
+ 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,
@@ -23,37 +31,40 @@ model Comparator "Comparator"
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.Potentiometer potentiometer(R=R, rConstant=
k) annotation (Placement(transformation(
extent={{-10,10},{10,-10}},
- origin={-10,-30})));
+ origin={-20,-30})));
Modelica.Electrical.Analog.Sources.SupplyVoltage supplyVoltage(Vps=Vps, Vns=
Vns) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
- origin={-10,-50})));
+ origin={-20,-50})));
equation
connect(vIn.p, opAmp.in_p) annotation (Line(
- points={{-80,10},{-10,10},{-10,6},{0,6}}, color={0,0,255}));
+ points={{-40,10},{-10,10},{-10,6}}, 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, 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(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(potentiometer.contact, opAmp.in_n) annotation (Line(
- points={{0,-20},{0,-6}}, color={0,0,255}));
+ points={{-10,-20},{-10,-6}},
+ color={0,0,255}));
connect(potentiometer.pin_p, supplyVoltage.pin_p) annotation (Line(
- points={{-20,-30},{-20,-50}}, color={0,0,255}));
+ points={{-30,-30},{-30,-50}}, color={0,0,255}));
connect(potentiometer.pin_n, supplyVoltage.pin_n) annotation (Line(
- points={{0,-30},{0,-50}}, color={0,0,255}));
+ points={{-10,-30},{-10,-50}},
+ color={0,0,255}));
connect(ground.p, supplyVoltage.ground) annotation (Line(
- points={{-10,-80},{-10,-50}}, color={0,0,255}));
+ points={{0,-80},{-20,-80},{-20,-50}},
+ color={0,0,255}));
annotation (Documentation(info="
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.
"),
experiment(
StartTime=0,
diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/InvertingSchmittTrigger.mo b/Modelica/Electrical/Analog/Examples/OpAmps/InvertingSchmittTrigger.mo
index c0a6a7d99e..0fec204895 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/InvertingSchmittTrigger.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/InvertingSchmittTrigger.mo
@@ -1,21 +1,27 @@
within Modelica.Electrical.Analog.Examples.OpAmps;
model InvertingSchmittTrigger "Inverting 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=(1 - k)/k*R1 "Calculated resistance to reach hysteresis voltage";
+ parameter Modelica.Units.SI.Resistance R1=1000 "Arbitrary resistance";
+ parameter Modelica.Units.SI.Resistance R2=(1 - k)/k*R1
+ "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,39 +33,39 @@ model InvertingSchmittTrigger "Inverting 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}},
rotation=270,
- origin={30,-60})));
+ origin={10,-60})));
Modelica.Electrical.Analog.Basic.Resistor r2(R=R2) annotation (Placement(
transformation(
extent={{10,10},{-10,-10}},
rotation=90,
- origin={30,-20})));
+ origin={10,-20})));
equation
connect(r2.n, r1.p) annotation (Line(
- points={{30,-30},{30,-50}}, color={0,0,255}));
+ points={{10,-30},{10,-50}}, color={0,0,255}));
connect(ground.p, r1.n) annotation (Line(
- points={{-10,-80},{30,-80},{30,-80},{30,-80},{30,-70},{30,-70}}, color={0,0,255}));
+ points={{0,-80},{10,-80},{10,-70}}, color={0,0,255}));
connect(opAmp.out, r2.p) annotation (Line(
- points={{20,0},{30,0},{30,-10}}, color={0,0,255}));
+ points={{10,0},{10,-10}}, color={0,0,255}));
connect(r2.n, opAmp.in_p) annotation (Line(
- points={{30,-30},{30,-40},{-10,-40},{-10,-6},{0,-6}}, color={0,0,255}));
+ points={{10,-30},{10,-40},{-10,-40},{-10,-6}}, color={0,0,255}));
connect(vIn.p, opAmp.in_n) annotation (Line(
- points={{-80,10},{-20,10},{-20,6},{0,6}}, color={0,0,255}));
+ points={{-40,10},{-10,10},{-10,6}}, color={0,0,255}));
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}));
+ points={{10,0},{40,0}}, color={0,0,255}));
annotation (Documentation(info="
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 also
U. 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_in0 then vps else -vns)*(2/(1 + Modelica.Math.exp(-v_in/(0.01*(if v_in>0 then vps else -vns)/V0)))-1);
else
- v_out = homotopy(actual = smooth(0, noEvent(if V0*v_in>vps then vps else if V0*v_in0 then vps else -vns)*(2/(1 + Modelica.Math.exp(-v_in/(0.01*(if v_in>0 then vps else -vns)/V0)))-1), simplified=simplifiedExpr);
end if;
else
- if homotopyType == Modelica.Blocks.Types.LimiterHomotopy.NoHomotopy then
- v_out = smooth(0, if V0*v_in>vps then vps else if V0*v_invps then vps else if V0*v_invps then vps else if V0*v_invps then vps else if V0*v_invps then vps else if V0*v_invps then vps else if V0*v_invps then vps else if V0*v_invps then vps else if V0*v_invps then vps else if V0*v_invps then vps else if V0*v_in
Supply 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 |
+
+
+Recommendation:
+Use of the opAmp in the linear range: regularized = false, smoothed = false, strict = false.
+Use of the opAmp as switching device: regularized = true, smoothed = false, strict = false.
+
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.
From 5a45f2933f233f51c45fe879bed98f55c00ef274 Mon Sep 17 00:00:00 2001
From: AHaumer
Date: Fri, 10 Jan 2025 12:32:33 +0100
Subject: [PATCH 4/5] resolved html
---
Modelica/Electrical/Analog/Ideal/IdealizedOpAmpLimited.mo | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Modelica/Electrical/Analog/Ideal/IdealizedOpAmpLimited.mo b/Modelica/Electrical/Analog/Ideal/IdealizedOpAmpLimited.mo
index bdcfe00e6e..2012a1a70e 100644
--- a/Modelica/Electrical/Analog/Ideal/IdealizedOpAmpLimited.mo
+++ b/Modelica/Electrical/Analog/Ideal/IdealizedOpAmpLimited.mo
@@ -122,8 +122,7 @@ equation
Supply 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:
+
You may choose between different implementations for calculating output voltage from input voltage:
regularized | smoothed | strict |
@@ -150,8 +149,9 @@ You may choose between different implementations for calculating output voltage
uses a linear relationship and saturates at positive resp. negative supply using both smooth and noEvent |
-Recommendation:
-Use of the opAmp in the linear range: regularized = false, smoothed = false, strict = false.
+
+Recommendation:
+Use of the opAmp in the linear range: regularized = false, smoothed = false, strict = false.
Use of the opAmp as switching device: regularized = true, smoothed = false, strict = false.
If initialization is problematic for a model containing this as a component you can set the homotopyType parameter.
From b2bb0950b3ea8715c63fb71604d1c7ed07f5733a Mon Sep 17 00:00:00 2001
From: AHaumer
Date: Fri, 10 Jan 2025 19:00:21 +0100
Subject: [PATCH 5/5] cleaned up
---
.../Analog/Examples/OpAmps/Adder.mo | 22 ++--
.../Analog/Examples/OpAmps/Comparator.mo | 53 ++++------
.../Analog/Examples/OpAmps/ControlCircuit.mo | 50 ++++-----
.../Examples/OpAmps/DifferentialAmplifier.mo | 20 ++--
.../Analog/Examples/OpAmps/Differentiator.mo | 9 +-
.../Analog/Examples/OpAmps/HighPass.mo | 15 +--
.../Analog/Examples/OpAmps/Integrator.mo | 9 +-
.../Examples/OpAmps/InvertingAmplifier.mo | 11 +-
.../OpAmps/InvertingSchmittTrigger.mo | 50 ++++-----
.../Analog/Examples/OpAmps/LCOscillator.mo | 33 ++----
.../Analog/Examples/OpAmps/LowPass.mo | 11 +-
.../Analog/Examples/OpAmps/Multivibrator.mo | 64 +++++------
.../Examples/OpAmps/NonInvertingAmplifier.mo | 4 +-
.../Examples/OpAmps/OpAmpCircuits/Add.mo | 37 +++----
.../Examples/OpAmps/OpAmpCircuits/Buffer.mo | 18 ++--
.../Examples/OpAmps/OpAmpCircuits/Der.mo | 14 ++-
.../OpAmps/OpAmpCircuits/Derivative.mo | 19 ++--
.../DifferentialAmplifierData.mo | 41 ++++---
.../Examples/OpAmps/OpAmpCircuits/Feedback.mo | 39 +++----
.../OpAmps/OpAmpCircuits/FirstOrder.mo | 21 ++--
.../Examples/OpAmps/OpAmpCircuits/Gain.mo | 10 +-
.../OpAmps/OpAmpCircuits/Integrator.mo | 18 ++--
.../Examples/OpAmps/OpAmpCircuits/PI.mo | 20 ++--
.../OpAmps/OpAmpCircuits/PartialOpAmp.mo | 15 ++-
.../Analog/Examples/OpAmps/SchmittTrigger.mo | 53 +++++-----
.../Analog/Examples/OpAmps/SignalGenerator.mo | 100 ++++++++----------
.../Analog/Examples/OpAmps/Subtracter.mo | 22 ++--
.../Analog/Examples/OpAmps/VoltageFollower.mo | 20 ++--
.../Analog/Examples/OpAmps/package.order | 2 +-
.../Analog/Ideal/IdealizedOpAmpLimited.mo | 83 +++++++--------
30 files changed, 385 insertions(+), 498 deletions(-)
diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/Adder.mo b/Modelica/Electrical/Analog/Examples/OpAmps/Adder.mo
index 3df6846a19..b95cf5b06a 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/Adder.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/Adder.mo
@@ -1,23 +1,23 @@
within Modelica.Electrical.Analog.Examples.OpAmps;
model Adder "Inverting adder"
extends Modelica.Icons.Example;
- parameter Modelica.Units.SI.Voltage Vin=5 "Amplitude of input voltage";
- parameter Modelica.Units.SI.Frequency f=10 "Frequency of input voltage";
+ parameter SI.Voltage Vin=5 "Amplitude of input voltage";
+ parameter 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.SineVoltage vIn1(V=Vin, f=f) annotation (
- Placement(transformation(
+ Sources.SineVoltage vIn1(V=Vin, f=f) annotation (Placement(
+ transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={-60,0})));
- Modelica.Electrical.Analog.Sources.ConstantVoltage vIn2(V=Vin) annotation (
- Placement(transformation(
+ 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
@@ -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(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}));
+ 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}));
annotation (Documentation(info="
This is an inverting adder.
Note: vOut
measure the negative output voltage.
diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/Comparator.mo b/Modelica/Electrical/Analog/Examples/OpAmps/Comparator.mo
index 57be00d24f..a6f8e97807 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/Comparator.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/Comparator.mo
@@ -1,25 +1,17 @@
within Modelica.Electrical.Analog.Examples.OpAmps;
model Comparator "Comparator"
extends Modelica.Icons.Example;
- 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 Vref=0 "Reference voltage";
+ 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 Vref=0 "Reference voltage";
parameter Real k=(Vref - Vns)/(Vps - Vns) "Calculated potentiometer ratio to reach Vref";
- parameter Modelica.Units.SI.Resistance R=1000 "Resistance of potentiometer";
- Modelica.Electrical.Analog.Ideal.IdealizedOpAmpLimited opAmp(
- V0=V0,
- useSupply=false,
- Vps=Vps,
- Vns=Vns,
- regularized=true,
- smoothed=false,
- strict=false)
- annotation (Placement(transformation(extent={{-10,10},{10,-10}})));
+ parameter SI.Resistance R=1000 "Resistance of potentiometer";
+ Modelica.Electrical.Analog.Ideal.IdealizedOpAmpLimited opAmp(Vps=Vps, Vns=
+ Vns) annotation (Placement(transformation(extent={{0,10},{20,-10}})));
Modelica.Electrical.Analog.Basic.Ground ground
- annotation (Placement(transformation(extent={{-10,-100},{10,-80}})));
+ annotation (Placement(transformation(extent={{-20,-100},{0,-80}})));
Modelica.Electrical.Analog.Sources.TrapezoidVoltage vIn(
rising=0.2/f,
width=0.3/f,
@@ -31,40 +23,37 @@ model Comparator "Comparator"
offset=-Vin) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
- origin={-40,0})));
+ origin={-80,0})));
Modelica.Electrical.Analog.Sensors.VoltageSensor vOut annotation (Placement(
transformation(
extent={{-10,10},{10,-10}},
rotation=270,
- origin={40,-10})));
+ origin={50,-20})));
Modelica.Electrical.Analog.Basic.Potentiometer potentiometer(R=R, rConstant=
k) annotation (Placement(transformation(
extent={{-10,10},{10,-10}},
- origin={-20,-30})));
+ origin={-10,-30})));
Modelica.Electrical.Analog.Sources.SupplyVoltage supplyVoltage(Vps=Vps, Vns=
Vns) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
- origin={-20,-50})));
+ origin={-10,-50})));
equation
connect(vIn.p, opAmp.in_p) annotation (Line(
- points={{-40,10},{-10,10},{-10,6}}, color={0,0,255}));
+ points={{-80,10},{-10,10},{-10,6},{0,6}}, color={0,0,255}));
connect(opAmp.out, vOut.p) annotation (Line(
- points={{10,0},{40,0}}, color={0,0,255}));
+ points={{20,0},{50,0},{50,-10}}, color={0,0,255}));
connect(ground.p, vOut.n) annotation (Line(
- points={{0,-80},{40,-80},{40,-20}}, color={0,0,255}));
+ points={{-10,-80},{50,-80},{50,-30}}, color={0,0,255}));
connect(ground.p, vIn.n) annotation (Line(
- points={{0,-80},{-40,-80},{-40,-10}}, color={0,0,255}));
+ points={{-10,-80},{-80,-80},{-80,-10}}, color={0,0,255}));
connect(potentiometer.contact, opAmp.in_n) annotation (Line(
- points={{-10,-20},{-10,-6}},
- color={0,0,255}));
+ points={{0,-20},{0,-6}}, color={0,0,255}));
connect(potentiometer.pin_p, supplyVoltage.pin_p) annotation (Line(
- points={{-30,-30},{-30,-50}}, color={0,0,255}));
+ points={{-20,-30},{-20,-50}}, color={0,0,255}));
connect(potentiometer.pin_n, supplyVoltage.pin_n) annotation (Line(
- points={{-10,-30},{-10,-50}},
- color={0,0,255}));
+ points={{0,-30},{0,-50}}, color={0,0,255}));
connect(ground.p, supplyVoltage.ground) annotation (Line(
- points={{0,-80},{-20,-80},{-20,-50}},
- color={0,0,255}));
+ points={{-10,-80},{-10,-50}}, color={0,0,255}));
annotation (Documentation(info="
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 9ba6ff7078..1e28ba8047 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/ControlCircuit.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/ControlCircuit.mo
@@ -1,63 +1,53 @@
within Modelica.Electrical.Analog.Examples.OpAmps;
model ControlCircuit "Control circuit"
extends Modelica.Icons.Example;
- 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 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 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}})));
- Modelica.Electrical.Analog.Sources.StepVoltage stepA(V=10, startTime=0.1)
- annotation (Placement(transformation(
+ Sources.StepVoltage stepA(V=10, startTime=0.1) annotation (Placement(
+ transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={-90,-62})));
- OpAmpCircuits.Feedback feedbackA(p1(i(start=0)))
+ OpAmpCircuits.Feedback feedbackA
annotation (Placement(transformation(extent={{-70,-40},{-50,-20}})));
OpAmpCircuits.PI PIA(
- v2(fixed=true),
k=kp,
T=Ti,
- opAmp(v_in(start=0)))
+ v(fixed=true))
annotation (Placement(transformation(extent={{-40,-40},{-20,-20}})));
- OpAmpCircuits.FirstOrder firstOrder1A(
- v2(fixed=true),
- T=T1,
- opAmp(v_in(start=0)))
+ OpAmpCircuits.FirstOrder firstOrder1A(T=T1, v(fixed=true))
annotation (Placement(transformation(extent={{-10,-40},{10,-20}})));
- OpAmpCircuits.Add addA(i1_2(start=0), r(i(start=0)))
+ OpAmpCircuits.Add addA
annotation (Placement(transformation(extent={{30,-40},{50,-20}})));
- Modelica.Electrical.Analog.Sources.StepVoltage step1A(V=1, startTime=0.5)
- annotation (Placement(transformation(
+ Sources.StepVoltage step1A(V=1, startTime=0.5) annotation (Placement(
+ transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={20,-60})));
- OpAmpCircuits.FirstOrder firstOrder2A(
- v2(fixed=true),
- T=T2,
- opAmp(v_in(start=0)))
+ OpAmpCircuits.FirstOrder firstOrder2A(T=T2, v(fixed=true))
annotation (Placement(transformation(extent={{60,-40},{80,-20}})));
- Modelica.Blocks.Sources.Step stepB(height=10, startTime=0.1)
+ Blocks.Sources.Step stepB(height=10, startTime=0.1)
annotation (Placement(transformation(extent={{-100,60},{-80,80}})));
- Modelica.Blocks.Math.Feedback feedbackB
+ Blocks.Math.Feedback feedbackB
annotation (Placement(transformation(extent={{-70,60},{-50,80}})));
- Modelica.Blocks.Continuous.PI PIB(
+ Blocks.Continuous.PI PIB(
k=kp,
T=Ti,
initType=Modelica.Blocks.Types.Init.InitialOutput)
annotation (Placement(transformation(extent={{-40,60},{-20,80}})));
- Modelica.Blocks.Continuous.FirstOrder firstOrder1B(T=T1, initType=Modelica.Blocks.Types.Init.InitialOutput)
+ Blocks.Continuous.FirstOrder firstOrder1B(T=T1, initType=Modelica.Blocks.Types.Init.InitialOutput)
annotation (Placement(transformation(extent={{-10,60},{10,80}})));
- Modelica.Blocks.Math.Add addB
+ Blocks.Math.Add addB
annotation (Placement(transformation(extent={{30,60},{50,80}})));
- Modelica.Blocks.Sources.Step step1B(height=1, startTime=0.5) annotation (
- Placement(transformation(
- extent={{-10,-10},{10,10}},
+ Blocks.Sources.Step step1B(height=1, startTime=0.5)
+ annotation (Placement(transformation(extent={{-10,-10},{10,10}},
rotation=90,
origin={20,30})));
- Modelica.Blocks.Continuous.FirstOrder firstOrder2B(T=T2, initType=Modelica.Blocks.Types.Init.InitialOutput)
+ 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 47abb8b04e..3e24c6cfe8 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/DifferentialAmplifier.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/DifferentialAmplifier.mo
@@ -1,9 +1,10 @@
within Modelica.Electrical.Analog.Examples.OpAmps;
model DifferentialAmplifier "Differential amplifier"
extends Modelica.Icons.Example;
- parameter OpAmps.OpAmpCircuits.DifferentialAmplifierData data
- "Parameters for source, OpAmp and measurement"
- annotation (Placement(transformation(extent={{50,10},{70,30}})));
+ parameter
+ Modelica.Electrical.Analog.Examples.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,
@@ -36,18 +37,11 @@ model DifferentialAmplifier "Differential amplifier"
V0=data.V0,
useSupply=true,
Vps=+data.VSupply,
- Vns=-data.VSupply,
- regularized=false,
- smoothed=false,
- strict=false,
- vps(start=+data.VSupply),
- vns(start=-data.VSupply))
+ Vns=-data.VSupply)
annotation (Placement(transformation(extent={{-20,-10},{0,10}})));
- Modelica.Electrical.Analog.Basic.Resistor resistor1(R=data.R1,
- i(start=0, fixed=false))
+ Modelica.Electrical.Analog.Basic.Resistor resistor1(R=data.R1)
annotation (Placement(transformation(extent={{-60,20},{-40,40}})));
- Modelica.Electrical.Analog.Basic.Resistor resistor2(R=data.R2,
- i(start=0, fixed=false))
+ Modelica.Electrical.Analog.Basic.Resistor resistor2(R=data.R2)
annotation (Placement(transformation(extent={{-60,-40},{-40,-20}})));
Modelica.Electrical.Analog.Basic.Resistor resistor3(R=data.R3)
annotation (Placement(transformation(extent={{-20,20},{0,40}})));
diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/Differentiator.mo b/Modelica/Electrical/Analog/Examples/OpAmps/Differentiator.mo
index df1955c325..cfab26a2ef 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 Modelica.Units.SI.Voltage Vin=5 "Amplitude of input voltage";
- parameter Modelica.Units.SI.Frequency f=10 "Frequency of input voltage";
+ parameter SI.Voltage Vin=5 "Amplitude of input voltage";
+ parameter 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(
+ Sources.TrapezoidVoltage vIn(
V=2*Vin,
rising=0.2/f,
width=0.3/f,
@@ -13,7 +13,8 @@ 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 0d2cb7fdd6..7c0837f45e 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 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";
+ 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";
Modelica.Electrical.Analog.Basic.Ground ground
annotation (Placement(transformation(extent={{-20,-40},{0,-20}})));
Modelica.Electrical.Analog.Sensors.VoltageSensor vOut annotation (Placement(
@@ -12,10 +12,10 @@ model HighPass "High-pass filter"
extent={{-10,10},{10,-10}},
rotation=270,
origin={40,0})));
- OpAmpCircuits.Derivative derivative(T=1/(2*pi*fG),
- v(fixed=true))
+ OpAmpCircuits.Derivative derivative(
+ T=1/(2*pi*fG), v(fixed=true))
annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
- Modelica.Electrical.Analog.Sources.TrapezoidVoltage vIn(
+ Sources.TrapezoidVoltage vIn(
V=Vin,
rising=0.2/f,
width=0.3/f,
@@ -23,7 +23,8 @@ 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 97bc76c935..e257dbd1ee 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 Modelica.Units.SI.Voltage Vin=5 "Amplitude of input voltage";
- parameter Modelica.Units.SI.Frequency f=10 "Frequency of input voltage";
+ parameter SI.Voltage Vin=5 "Amplitude of input voltage";
+ parameter 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}})));
- Modelica.Electrical.Analog.Sources.TrapezoidVoltage vIn(
+ Sources.TrapezoidVoltage vIn(
V=2*Vin,
rising=0.2/f,
width=0.3/f,
@@ -23,7 +23,8 @@ 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 b7fe522b5e..2e0175930f 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 Modelica.Units.SI.Voltage Vin=5 "Amplitude of input voltage";
- parameter Modelica.Units.SI.Frequency f=10 "Frequency of input voltage";
+ parameter SI.Voltage Vin=5 "Amplitude of input voltage";
+ parameter 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,13 +32,14 @@ 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.p)
+ connect(gain.p2, vOut.n)
annotation (Line(points={{10,10},{40,10}}, color={0,0,255}));
- connect(gain.n2, vOut.n)
+ connect(gain.n2, vOut.p)
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.
"),
experiment(
StartTime=0,
diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/InvertingSchmittTrigger.mo b/Modelica/Electrical/Analog/Examples/OpAmps/InvertingSchmittTrigger.mo
index 0fec204895..38d8fd1628 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/InvertingSchmittTrigger.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/InvertingSchmittTrigger.mo
@@ -1,27 +1,23 @@
within Modelica.Electrical.Analog.Examples.OpAmps;
model InvertingSchmittTrigger "Inverting Schmitt trigger with hysteresis"
extends Modelica.Icons.Example;
- 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 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 k=vHys/Vps "Auxiliary calculated parameter to be used in R2 calculation";
- parameter Modelica.Units.SI.Resistance R1=1000 "Arbitrary resistance";
- parameter Modelica.Units.SI.Resistance R2=(1 - k)/k*R1
- "Calculated resistance to reach hysteresis voltage";
+ parameter SI.Resistance R1=1000 "Arbitrary resistance";
+ parameter SI.Resistance R2=(1 - k)/k*R1 "Calculated resistance to reach hysteresis voltage";
Modelica.Electrical.Analog.Ideal.IdealizedOpAmpLimited opAmp(
- V0=V0,
- useSupply=false,
Vps=Vps,
Vns=Vns,
- regularized=true,
+ strict=false,
smoothed=false,
- strict=false)
- annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
+ regularized=true)
+ annotation (Placement(transformation(extent={{0,-10},{20,10}})));
Modelica.Electrical.Analog.Basic.Ground ground
- annotation (Placement(transformation(extent={{-10,-100},{10,-80}})));
+ annotation (Placement(transformation(extent={{-20,-100},{0,-80}})));
Modelica.Electrical.Analog.Sources.TrapezoidVoltage vIn(
rising=0.2/f,
width=0.3/f,
@@ -33,39 +29,39 @@ model InvertingSchmittTrigger "Inverting Schmitt trigger with hysteresis"
offset=-Vin) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
- origin={-40,0})));
+ origin={-80,0})));
Modelica.Electrical.Analog.Sensors.VoltageSensor vOut annotation (Placement(
transformation(
extent={{-10,10},{10,-10}},
rotation=270,
- origin={40,-10})));
+ origin={50,-20})));
Modelica.Electrical.Analog.Basic.Resistor r1(R=R1) annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
rotation=270,
- origin={10,-60})));
+ origin={30,-60})));
Modelica.Electrical.Analog.Basic.Resistor r2(R=R2) annotation (Placement(
transformation(
extent={{10,10},{-10,-10}},
rotation=90,
- origin={10,-20})));
+ origin={30,-20})));
equation
connect(r2.n, r1.p) annotation (Line(
- points={{10,-30},{10,-50}}, color={0,0,255}));
+ points={{30,-30},{30,-50}}, color={0,0,255}));
connect(ground.p, r1.n) annotation (Line(
- points={{0,-80},{10,-80},{10,-70}}, color={0,0,255}));
+ points={{-10,-80},{30,-80},{30,-80},{30,-80},{30,-70},{30,-70}}, color={0,0,255}));
connect(opAmp.out, r2.p) annotation (Line(
- points={{10,0},{10,-10}}, color={0,0,255}));
+ points={{20,0},{30,0},{30,-10}}, color={0,0,255}));
connect(r2.n, opAmp.in_p) annotation (Line(
- points={{10,-30},{10,-40},{-10,-40},{-10,-6}}, color={0,0,255}));
+ points={{30,-30},{30,-40},{-10,-40},{-10,-6},{0,-6}}, color={0,0,255}));
connect(vIn.p, opAmp.in_n) annotation (Line(
- points={{-40,10},{-10,10},{-10,6}}, color={0,0,255}));
+ points={{-80,10},{-20,10},{-20,6},{0,6}}, color={0,0,255}));
connect(ground.p, vIn.n) annotation (Line(
- points={{0,-80},{-40,-80},{-40,-10}}, color={0,0,255}));
+ points={{-10,-80},{-80,-80},{-80,-10}}, color={0,0,255}));
connect(ground.p, vOut.n) annotation (Line(
- points={{0,-80},{40,-80},{40,-20}}, color={0,0,255}));
+ points={{-10,-80},{50,-80},{50,-30}}, color={0,0,255}));
connect(opAmp.out, vOut.p) annotation (Line(
- points={{10,0},{40,0}}, color={0,0,255}));
+ points={{20,0},{50,0},{50,-10}}, color={0,0,255}));
annotation (Documentation(info="
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 e790761e13..92c0de64fa 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/LCOscillator.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/LCOscillator.mo
@@ -2,37 +2,24 @@ within Modelica.Electrical.Analog.Examples.OpAmps;
model LCOscillator "LC oscillator"
extends Modelica.Icons.Example;
import Modelica.Constants.pi;
- 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 SI.Voltage VAmp=10 "Amplitude of output";
+ parameter 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 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 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 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(
- V0=V0,
- useSupply=false,
- Vps=Vps,
- Vns=Vns,
- regularized=false,
- smoothed=false,
- strict=false)
+ Modelica.Electrical.Analog.Ideal.IdealizedOpAmpLimited opAmp
annotation (Placement(transformation(extent={{-50,10},{-30,-10}})));
Modelica.Electrical.Analog.Basic.Resistor r(R=R)
annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
- Modelica.Electrical.Analog.Basic.Resistor r2(R=R2, i(start=0)) annotation (
+ Modelica.Electrical.Analog.Basic.Resistor r2(R=R2) annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
@@ -56,8 +43,6 @@ 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 2b6dcd68c6..85e64d3adf 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 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";
+ 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";
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}})));
- Modelica.Electrical.Analog.Sources.TrapezoidVoltage vIn(
+ Sources.TrapezoidVoltage vIn(
V=Vin,
rising=0.2/f,
width=0.3/f,
@@ -23,7 +23,8 @@ 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 d4a5fad314..5292feeb6a 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/Multivibrator.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/Multivibrator.mo
@@ -1,34 +1,27 @@
within Modelica.Electrical.Analog.Examples.OpAmps;
model Multivibrator "Multivibrator with Schmitt trigger"
extends Modelica.Icons.Example;
- 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";
+ 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";
Modelica.Electrical.Analog.Ideal.IdealizedOpAmpLimited opAmp(
- V0=V0,
- useSupply=false,
Vps=Vps,
Vns=Vns,
- regularized=true,
- smoothed=false,
- strict=false)
- annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
+ strict=false,
+ regularized=true)
+ annotation (Placement(transformation(extent={{0,-10},{20,10}})));
Modelica.Electrical.Analog.Basic.Ground ground
- annotation (Placement(transformation(extent={{-10,-80},{10,-60}})));
+ annotation (Placement(transformation(extent={{-20,-80},{0,-60}})));
Modelica.Electrical.Analog.Sensors.VoltageSensor vOut annotation (Placement(
transformation(
extent={{-10,10},{10,-10}},
rotation=270,
- origin={40,-10})));
- Modelica.Electrical.Analog.Basic.Resistor r1(R=R1, i(start=0)) annotation (
+ origin={50,-20})));
+ Modelica.Electrical.Analog.Basic.Resistor r1(R=R1, p(i(start=0))) annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
@@ -39,39 +32,32 @@ model Multivibrator "Multivibrator with Schmitt trigger"
origin={10,-20})));
Modelica.Electrical.Analog.Basic.Resistor r(R=R)
annotation (Placement(transformation(extent={{20,20},{0,40}})));
- Modelica.Electrical.Analog.Basic.Capacitor c(C=C, v(start=1, fixed=true))
+ Modelica.Electrical.Analog.Basic.Capacitor c(C=C, v(start=0.1, fixed=true))
annotation (Placement(transformation(
extent={{10,-10},{-10,10}},
rotation=90,
- 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}})));
+ origin={-30,-40})));
equation
connect(ground.p, r1.n) annotation (Line(
- points={{0,-60},{-10,-60},{-10,-50}},
- color={0,0,255}));
+ points={{-10,-60},{-10,-50}}, color={0,0,255}));
connect(ground.p, vOut.n) annotation (Line(
- points={{0,-60},{40,-60},{40,-20}}, color={0,0,255}));
+ points={{-10,-60},{50,-60},{50,-30}}, color={0,0,255}));
connect(opAmp.out, vOut.p) annotation (Line(
- points={{10,0},{40,0}}, color={0,0,255}));
+ points={{20,0},{50,0},{50,-10}}, color={0,0,255}));
connect(ground.p, c.n) annotation (Line(
- points={{0,-60},{-40,-60},{-40,-50}}, color={0,0,255}));
+ points={{-10,-60},{-30,-60},{-30,-50}}, color={0,0,255}));
connect(opAmp.out, r.p) annotation (Line(
- points={{10,0},{20,0},{20,30}}, color={0,0,255}));
+ points={{20,0},{30,0},{30,30},{20,30}}, color={0,0,255}));
connect(r.n, opAmp.in_n) annotation (Line(
- points={{0,30},{-10,30},{-10,6}}, color={0,0,255}));
+ points={{0,30},{-10,30},{-10,6},{0,6}}, color={0,0,255}));
connect(opAmp.out, r2.p) annotation (Line(
- points={{10,0},{20,0},{20,-20}}, color={0,0,255}));
+ points={{20,0},{30,0},{30,-20},{20,-20}}, color={0,0,255}));
connect(r2.n, opAmp.in_p) annotation (Line(
- points={{0,-20},{-10,-20},{-10,-6}}, color={0,0,255}));
+ points={{0,-20},{-10,-20},{-10,-6},{0,-6}}, color={0,0,255}));
connect(opAmp.in_p, r1.p) annotation (Line(
- points={{-10,-6},{-10,-30}}, color={0,0,255}));
+ points={{0,-6},{-10,-6},{-10,-30}}, color={0,0,255}));
connect(r.n, c.p) annotation (Line(
- points={{0,30},{-40,30},{-40,-30}}, color={0,0,255}));
+ points={{0,30},{-30,30},{-30,-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 fe9d228846..92c242e056 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 Modelica.Units.SI.Voltage Vin=5 "Amplitude of input voltage";
- parameter Modelica.Units.SI.Frequency f=10 "Frequency of input voltage";
+ parameter SI.Voltage Vin=5 "Amplitude of input voltage";
+ parameter 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 f58d97d2d6..79866faeed 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Add.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Add.mo
@@ -1,31 +1,26 @@
within Modelica.Electrical.Analog.Examples.OpAmps.OpAmpCircuits;
model Add "Adding operational amplifier circuit"
extends PartialOpAmp;
- 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";
+ 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";
parameter Real k1(final min=0)=1 "Weight of input 1";
parameter Real k2(final min=0)=1 "Weight of input 2";
- 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}},
+ 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}},
rotation=180,
origin={-40,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})));
+ 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})));
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 d30bd6c759..e7664b1ed1 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Buffer.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Buffer.mo
@@ -2,18 +2,14 @@ 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 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}},
+ 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}},
rotation=270,
origin={10,-70})));
- Modelica.Electrical.Analog.Basic.Resistor r2(final R=R2) annotation (
- Placement(transformation(
- extent={{10,-10},{-10,10}},
+ Basic.Resistor r2(final R=R2)
+ annotation (Placement(transformation(extent={{10,-10},{-10,10}},
rotation=90,
origin={10,-30})));
equation
@@ -52,7 +48,5 @@ 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 816750ba70..6258362db1 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Der.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Der.mo
@@ -3,15 +3,13 @@ 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 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)
+ 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)
annotation (Placement(transformation(extent={{-50,20},{-30,40}})));
- Modelica.Electrical.Analog.Basic.Resistor r(final R=R)
+ 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 e1d4497eae..428d93225e 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Derivative.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Derivative.mo
@@ -3,19 +3,16 @@ model Derivative "Lowpass filter operational amplifier circuit"
extends PartialOpAmp;
import Modelica.Constants.pi;
parameter Real k(final min=0)=1 "Desired amplification";
- 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)
+ 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)
annotation (Placement(transformation(extent={{-50,20},{-30,40}})));
- Modelica.Electrical.Analog.Basic.Resistor r2(R=R2)
+ Basic.Resistor r2(R=R2)
annotation (Placement(transformation(extent={{30,20},{10,40}})));
- Modelica.Electrical.Analog.Basic.Capacitor c(C=C)
+ 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 4d010bdda2..ea5d5f90cf 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/DifferentialAmplifierData.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/DifferentialAmplifierData.mo
@@ -1,31 +1,30 @@
within Modelica.Electrical.Analog.Examples.OpAmps.OpAmpCircuits;
record DifferentialAmplifierData "Data record for differential amplifier"
extends Modelica.Icons.Record;
- 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 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 Real V0=10e3 "No-load differential amplification"
annotation(Dialog(group="OpAmp"));
- parameter Modelica.Units.SI.Voltage VSupply=15 "Supply voltage"
- annotation (Dialog(group="OpAmp"));
+ parameter SI.Voltage VSupply=15 "Supply voltage"
+ annotation(Dialog(group="OpAmp"));
parameter Real k=100 "Attenuation factor"
annotation(Dialog(group="OpAmp"));
- 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"));
+ 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"));
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 8e0d018568..aec0ed4a27 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Feedback.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Feedback.mo
@@ -1,31 +1,26 @@
within Modelica.Electrical.Analog.Examples.OpAmps.OpAmpCircuits;
model Feedback "Subtracting operational amplifier circuit"
extends PartialOpAmp;
- 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";
+ 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";
parameter Real k(final min=0)=1 "Desired amplification";
- 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}},
+ 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}},
rotation=180,
origin={-40,-70})));
- 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}},
+ 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}},
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 2739714216..6be87b23a1 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/FirstOrder.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/FirstOrder.mo
@@ -1,21 +1,18 @@
within Modelica.Electrical.Analog.Examples.OpAmps.OpAmpCircuits;
model FirstOrder "Lowpass filter operational amplifier circuit"
- extends PartialOpAmp(v2(start=0));
+ extends PartialOpAmp;
import Modelica.Constants.pi;
parameter Real k(final min=0)=1 "Desired amplification";
- 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)
+ 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)
annotation (Placement(transformation(extent={{-50,20},{-30,40}})));
- Modelica.Electrical.Analog.Basic.Resistor r2(R=R2)
+ Basic.Resistor r2(R=R2)
annotation (Placement(transformation(extent={{30,20},{10,40}})));
- Modelica.Electrical.Analog.Basic.Capacitor c(C=C)
+ 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 2340581f83..90b5ad295e 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Gain.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Gain.mo
@@ -2,13 +2,11 @@ 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 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)
+ 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)
annotation (Placement(transformation(extent={{-50,20},{-30,40}})));
- Modelica.Electrical.Analog.Basic.Resistor r2(final R=R2)
+ 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 6ba8232853..cb04b70b28 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Integrator.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/Integrator.mo
@@ -1,17 +1,15 @@
within Modelica.Electrical.Analog.Examples.OpAmps.OpAmpCircuits;
model Integrator "Integrating operational amplifier circuit"
- extends PartialOpAmp(v2(start=0));
+ extends PartialOpAmp;
import Modelica.Constants.pi;
parameter Real k(final min=0)=1 "Desired amplification at frequency f";
- 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)
+ 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)
annotation (Placement(transformation(extent={{30,20},{10,40}})));
- Modelica.Electrical.Analog.Basic.Resistor r(final R=R)
+ Basic.Resistor r(final R=R)
annotation (Placement(transformation(extent={{-50,20},{-30,40}})));
equation
connect(n1, n2)
@@ -42,7 +40,7 @@ equation
points={{-80.0,78.0},{-80.0,-90.0}},
color={192,192,192}),
Line(
- 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}}),
+ points={{-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 f77a10479b..9357d017d5 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/PI.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/PI.mo
@@ -1,21 +1,19 @@
within Modelica.Electrical.Analog.Examples.OpAmps.OpAmpCircuits;
model PI "PI controller operational amplifier circuit"
- extends PartialOpAmp(v2(start=0));
+ extends PartialOpAmp;
import Modelica.Constants.pi;
parameter Real k(final min=0)=1 "Desired amplification";
- 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)
+ 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)
annotation (Placement(transformation(extent={{-50,20},{-30,40}})));
- Modelica.Electrical.Analog.Basic.Resistor r2(R=R2)
+ Basic.Resistor r2(R=R2)
annotation (Placement(transformation(extent={{30,20},{10,40}})));
- Modelica.Electrical.Analog.Basic.Capacitor c(C=C)
+ Basic.Capacitor c(C=C)
annotation (Placement(transformation(extent={{60,20},{40,40}})));
+ SI.Voltage v(start=0)=c.v "Capacitor voltage = state";
equation
connect(n1, n2)
annotation (Line(points={{-100,-100},{100,-100}}, color={0,0,255}));
diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/PartialOpAmp.mo b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/PartialOpAmp.mo
index c80f0e2d2b..3d10243efa 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/PartialOpAmp.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/OpAmpCircuits/PartialOpAmp.mo
@@ -2,17 +2,14 @@ within Modelica.Electrical.Analog.Examples.OpAmps.OpAmpCircuits;
partial model PartialOpAmp
"Partial circuit of operational amplifiers"
extends Modelica.Electrical.Analog.Interfaces.FourPin;
- parameter Modelica.Units.SI.Voltage Vps=+15 "Positive supply";
- parameter Modelica.Units.SI.Voltage Vns=-15 "Negative supply";
+ parameter SI.Voltage Vps=+15 "Positive supply";
+ parameter SI.Voltage Vns=-15 "Negative supply";
parameter Real V0=15000.0 "No-load amplification";
- Modelica.Electrical.Analog.Ideal.IdealizedOpAmpLimited opAmp(
+ Ideal.IdealizedOpAmpLimited opAmp(
V0=V0,
- useSupply=false,
- Vps=Vps,
- Vns=Vns,
- regularized=false,
- smoothed=false,
- strict=false)
+ final useSupply=false,
+ final Vps=Vps,
+ final Vns=Vns)
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 88b1b3f09a..f6b9878f47 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/SchmittTrigger.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/SchmittTrigger.mo
@@ -1,27 +1,23 @@
within Modelica.Electrical.Analog.Examples.OpAmps;
model SchmittTrigger "Schmitt trigger with hysteresis"
extends Modelica.Icons.Example;
- 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 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 k=vHys/Vps "Auxiliary calculated parameter to be used in R2 calculation";
- parameter Modelica.Units.SI.Resistance R1=1000 "Arbitrary resistance";
- parameter Modelica.Units.SI.Resistance R2=R1/k
- "Calculated resistance to reach hysteresis voltage";
+ parameter SI.Resistance R1=1000 "Arbitrary resistance";
+ parameter 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,
- regularized=true,
+ strict=false,
smoothed=false,
- strict=false)
- annotation (Placement(transformation(extent={{-10,10},{10,-10}})));
+ regularized=true)
+ annotation (Placement(transformation(extent={{0,10},{20,-10}})));
Modelica.Electrical.Analog.Basic.Ground ground
- annotation (Placement(transformation(extent={{-10,-100},{10,-80}})));
+ annotation (Placement(transformation(extent={{-20,-100},{0,-80}})));
Modelica.Electrical.Analog.Sources.TrapezoidVoltage vIn(
rising=0.2/f,
width=0.3/f,
@@ -33,12 +29,12 @@ model SchmittTrigger "Schmitt trigger with hysteresis"
offset=-Vin) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
- origin={-40,0})));
+ origin={-80,0})));
Modelica.Electrical.Analog.Sensors.VoltageSensor vOut annotation (Placement(
transformation(
extent={{-10,10},{10,-10}},
rotation=270,
- origin={40,-10})));
+ origin={50,-20})));
Modelica.Electrical.Analog.Basic.Resistor r1(R=R1) annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
@@ -50,28 +46,27 @@ model SchmittTrigger "Schmitt trigger with hysteresis"
origin={10,20})));
equation
connect(ground.p, vIn.n) annotation (Line(
- points={{0,-80},{-40,-80},{-40,-10}}, color={0,0,255}));
+ points={{-10,-80},{-80,-80},{-80,-10}}, color={0,0,255}));
connect(ground.p, vOut.n) annotation (Line(
- points={{0,-80},{40,-80},{40,-20}}, color={0,0,255}));
+ points={{-10,-80},{50,-80},{50,-30}}, color={0,0,255}));
connect(opAmp.out, vOut.p) annotation (Line(
- points={{10,0},{40,0}}, color={0,0,255}));
+ 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}));
connect(opAmp.out, r2.n) annotation (Line(
- points={{10,0},{20,0},{20,20}}, color={0,0,255}));
+ points={{20,0},{30,0},{30,20},{20,20}}, color={0,0,255}));
connect(r2.p, opAmp.in_p) annotation (Line(
- points={{0,20},{-10,20},{-10,6}}, color={0,0,255}));
+ points={{0,20},{-10,20},{-10,6},{0,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},{-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}));
+ points={{-40,20},{-80,20},{-80,10}}, 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
"),
experiment(
- StartTime=0,
- StopTime=1,
- Tolerance=1e-006,
- Interval=0.001));
+ Interval=0.001,
+ Tolerance=1e-06,
+ __Dymola_Algorithm="Dassl"));
end SchmittTrigger;
diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/SignalGenerator.mo b/Modelica/Electrical/Analog/Examples/OpAmps/SignalGenerator.mo
index 2dee151d3d..8043276fb8 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/SignalGenerator.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/SignalGenerator.mo
@@ -2,29 +2,21 @@ within Modelica.Electrical.Analog.Examples.OpAmps;
model SignalGenerator "Rectangle-Triangle generator"
extends Modelica.Icons.Example;
import Modelica.Constants.pi;
- 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";
+ 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";
Modelica.Electrical.Analog.Ideal.IdealizedOpAmpLimited opAmp1(
- V0=V0,
- useSupply=false,
Vps=Vps,
Vns=Vns,
- regularized=true,
- smoothed=false,
- strict=false)
+ strict=false,
+ regularized=true)
annotation (Placement(transformation(extent={{-60,10},{-40,-10}})));
- Modelica.Electrical.Analog.Basic.Resistor r2(R=R2, i(start=Vps/R2))
+ Modelica.Electrical.Analog.Basic.Resistor r2(R=R2, p(i(start=0)))
annotation (Placement(transformation(
extent={{10,10},{-10,-10}},
rotation=180,
@@ -36,13 +28,8 @@ 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,
- regularized=false,
- smoothed=false,
- strict=false)
+ Vns=Vns)
annotation (Placement(transformation(extent={{30,-10},{50,10}})));
Modelica.Electrical.Analog.Basic.Capacitor c(C=C, v(fixed=true, start=10))
annotation (Placement(transformation(extent={{50,20},{30,40}})));
@@ -59,34 +46,34 @@ model SignalGenerator "Rectangle-Triangle generator"
rotation=270,
origin={60,-18})));
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(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.
@@ -94,7 +81,8 @@ The output of the integrator part opamp (opAmp2) is a triangular signal of also
U. Tietze and C. Schenk, Halbleiter-Schaltungstechnik (German), 11th edition, Springer 1999, Chapter 14.5.2
"),
experiment(
- Interval=0.001,
- Tolerance=1e-07,
- __Dymola_Algorithm="Dassl"));
+ StartTime=0,
+ StopTime=1,
+ Tolerance=1e-006,
+ Interval=0.001));
end SignalGenerator;
diff --git a/Modelica/Electrical/Analog/Examples/OpAmps/Subtracter.mo b/Modelica/Electrical/Analog/Examples/OpAmps/Subtracter.mo
index 5a7caa9a05..cd0ae24e0e 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/Subtracter.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/Subtracter.mo
@@ -1,26 +1,26 @@
within Modelica.Electrical.Analog.Examples.OpAmps;
model Subtracter "Inverting subtracter"
extends Modelica.Icons.Example;
- parameter Modelica.Units.SI.Voltage Vin=5 "Amplitude of input voltage";
- parameter Modelica.Units.SI.Frequency f=10 "Frequency of input voltage";
+ parameter SI.Voltage Vin=5 "Amplitude of input voltage";
+ parameter 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.SineVoltage vIn1(V=Vin, f=f) annotation (
- Placement(transformation(
+ Sources.SineVoltage vIn1(V=Vin, f=f) annotation (Placement(
+ transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={-60,0})));
- Modelica.Electrical.Analog.Sources.ConstantVoltage vIn2(V=Vin) annotation (
- Placement(transformation(
+ 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)))
+ OpAmpCircuits.Feedback feedback
annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
equation
connect(feedback.n1, ground.p)
@@ -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(vOut.p, feedback.p2)
- annotation (Line(points={{40,10},{10,10}}, color={0,0,255}));
- connect(feedback.n2, vOut.n)
+ connect(feedback.p2, vOut.n)
+ annotation (Line(points={{10,10},{40,10}}, color={0,0,255}));
+ connect(feedback.n2, vOut.p)
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 4f82fa41c0..a39b3562d9 100644
--- a/Modelica/Electrical/Analog/Examples/OpAmps/VoltageFollower.mo
+++ b/Modelica/Electrical/Analog/Examples/OpAmps/VoltageFollower.mo
@@ -1,22 +1,16 @@
within Modelica.Electrical.Analog.Examples.OpAmps;
model VoltageFollower "Reproduce input voltage"
extends Modelica.Icons.Example;
- 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
+ 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
"Inner resistance of input voltage source";
- parameter Modelica.Units.SI.Resistance Rl=1 "Load resistance";
+ parameter SI.Resistance Rl=1 "Load resistance";
Modelica.Electrical.Analog.Ideal.IdealizedOpAmpLimited opAmp(
- V0=V0,
- useSupply=false,
Vps=Vps,
- Vns=Vns,
- regularized=false,
- smoothed=false,
- strict=false)
+ Vns=Vns)
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 932a16089b..359c907cc1 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
+LCOscillator
SignalGenerator
OpAmpCircuits
diff --git a/Modelica/Electrical/Analog/Ideal/IdealizedOpAmpLimited.mo b/Modelica/Electrical/Analog/Ideal/IdealizedOpAmpLimited.mo
index 2012a1a70e..1bea35a7c0 100644
--- a/Modelica/Electrical/Analog/Ideal/IdealizedOpAmpLimited.mo
+++ b/Modelica/Electrical/Analog/Ideal/IdealizedOpAmpLimited.mo
@@ -3,27 +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 Modelica.Units.SI.Voltage Vps=+15 "Positive supply voltage"
+ parameter SI.Voltage Vps=+15 "Positive supply voltage"
annotation (Dialog(enable=not useSupply));
- parameter Modelica.Units.SI.Voltage Vns=-15 "Negative supply voltage"
+ parameter SI.Voltage Vns=-15 "Negative supply voltage"
annotation (Dialog(enable=not useSupply));
- 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"));
+ annotation (Evaluate=true, choices(checkBox=true), Dialog(tab="Advanced"));
+ parameter Boolean smoothed=false "= true, if usage of smooth(0, ..)"
+ annotation (Evaluate=true, choices(checkBox=true), Dialog(tab="Advanced"));
+ parameter Boolean regularized=false "= true, if regularization instead of strict / smoothed"
+ annotation (Evaluate=true, choices(checkBox=true), Dialog(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"));
- 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";
+ SI.Voltage vps(start=Vps) "Positive supply voltage";
+ SI.Voltage vns(start=Vns) "Negative supply voltage";
+ SI.Voltage v_in(start=0)=in_p.v - in_n.v "Input voltage difference";
+ SI.Voltage v_out=out.v "Output voltage to ground";
+ SI.Current i_out(start=0)=-out.i "Output current";
+ 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.Electrical.Analog.Interfaces.PositivePin in_p
"Positive pin of the input port" annotation (Placement(transformation(
extent={{-90,-70},{-110,-50}})));
@@ -42,8 +42,7 @@ model IdealizedOpAmpLimited "Idealized operational amplifier with limitation"
vns) if useSupply "Optional negative supply pin" annotation (Placement(
transformation(extent={{-10,-110},{10,-90}})));
protected
- Modelica.Units.SI.Voltage simplifiedExpr
- "Simplified expression for homotopy-based initialization";
+ SI.Voltage simplifiedExpr "Simplified expression for homotopy-based initialization";
equation
if not useSupply then
vps = Vps;
@@ -62,33 +61,33 @@ equation
v_out = homotopy(actual = (if v_in>0 then vps else -vns)*(2/(1 + Modelica.Math.exp(-v_in/(0.01*(if v_in>0 then vps else -vns)/V0)))-1), simplified=simplifiedExpr);
end if;
else
- if smoothed then
- if strict 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_invps then vps else if V0*v_invps then vps else if V0*v_invps then vps else if V0*v_invps then vps else if V0*v_invps then vps else if V0*v_invps then vps else if V0*v_invps then vps else if V0*v_invps then vps else if V0*v_invps then vps else if V0*v_invps then vps else if V0*v_invps then vps else if V0*v_invps then vps else if V0*v_invps then vps else if V0*v_invps then vps else if V0*v_invps then vps else if V0*v_in