modelComparator

Comparator

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

Information

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.

Parameters

TypeNameDefaultDescription
SI.VoltageVps+15Positive supply
SI.VoltageVns-15Negative supply
SI.VoltageVin5Amplitude of input voltage
SI.Frequencyf10Frequency of input voltage
SI.VoltageVref0Reference voltage
Realk(Vref - Vns)/(Vps - Vns)Calculated potentiometer ratio to reach Vref
SI.ResistanceR1000Resistance of potentiometer

Components

TypeNameDefaultDescription
Modelica.Electrical.Analog.Ideal.OpAmpLimitedopAmp
Modelica.Electrical.Analog.Basic.Groundground
Modelica.Electrical.Analog.Sources.TrapezoidVoltagevIn
Modelica.Electrical.Analog.Sensors.VoltageSensorvOut
Modelica.Electrical.Analog.Basic.Potentiometerpotentiometer
Modelica.Electrical.Analog.Sources.SupplyVoltagesupplyVoltage