Engee documentation
Notebook

AC voltage voltmeter

In this example, we will show how to make a model of a voltmeter for measuring alternating voltage from an instantaneous voltage value sensor.

Model description

Standard AC voltage voltmeters can rely on a wide variety of principles to convert an instantaneous signal (variable) into a stable reading.

The most common output value of such a voltmeter, when a sinusoidal signal is applied at the input, is expected to be a valid signal value equal to $U_д = U_m / \sqrt 2$ (where $U_m$ is the amplitude of the sinusoid). When measuring a different waveform, correction factors must be introduced.

Suppose we have a voltmeter whose reading is proportional to the amplitude of the input signal (this is not always the case, sometimes the reading is proportional to its power). The voltage generator ControlledVoltage receives some variable control signal, and the sensor Voltage returns us the instantaneous value measured at the moments of time set by the model step settings.

image.png

The model takes as input a variable waveform signal (sine wave by default) multiplied by a step signal that determines its amplitude. The step momentarily increases the amplitude of the signal generator from 1 V to 5 V.

image.png

Block Цифровой вольтметр is also represented by a masked subsystem. In its settings you can specify the size of the smoothing window, which will affect the smoothness of the voltmeter readings.

image.png

The design of this voltmeter, in simplistic terms, is to find the amplitude of the signal and display a value equal to the amplitude divided by $\sqrt 2$.

Running the model

Before running the model, we specifically set the oscillator to sinusoidal mode by addressing one of the components inside the block Генератор сигналов.

In [ ]:
# Если модель еще не открыта, загрузим из файла
if "ac_voltmeter_simple"  getfield.(engee.get_all_models(), :name)
    engee.load( "$(@__DIR__)/ac_voltmeter_simple.engee");
end;

engee.set_param!( "ac_voltmeter_simple/Генератор сигналов/Signal Generator", "WaveForm"=>"sine" )
data = engee.run( "ac_voltmeter_simple" )
Out[0]:
Dict{String, DataFrame} with 2 entries:
  "u" => 2001×2 DataFrame…
  "y" => 2001×2 DataFrame
In [ ]:
plot(
    plot( data["u"].time, data["u"].value, label="Мгновенные значения сигнала" ),
    plot( data["y"].time, data["y"].value, label="Показания вольтметра" ),
    layout  = (2,1)
)
Out[0]:

As we can see, when we measured a sine wave of amplitude 1, the voltmeter returned a value approximately equal to 0.707 or $1 / \sqrt 2$.

Let's see what happens if we apply a sawtooth value (sawtooth) or rectangular pulses (square) to the input of the circuit.

In [ ]:
engee.set_param!( "ac_voltmeter_simple/Генератор сигналов/Signal Generator", "WaveForm"=>"sawtooth" )
data = engee.run( "ac_voltmeter_simple" )
Out[0]:
Dict{String, DataFrame} with 2 entries:
  "u" => 2001×2 DataFrame…
  "y" => 2001×2 DataFrame
In [ ]:
plot(
    plot( data["u"].time, data["u"].value, label="Мгновенные значения сигнала" ),
    plot( data["y"].time, data["y"].value, label="Показания вольтметра" ),
    layout  = (2,1)
)
Out[0]:

The effective value of the sawtooth signal is equal to $U_m/1.73$, i.e. a sawtooth signal with amplitude 1 has an effective value of 0.578.

But on the graph we see that the voltmeter still returns us 0.707. This value is due to its principle of operation, which causes a methodological error in the measurements.

Knowing the shape of the input signal, the effect of this error can be easily compensated by multiplying it by the appropriate coefficient.

Conclusion

If desired, in Engee you can create a voltmeter model with accuracy to the inertia of the arrow or to the segment indicators. The rectifier, DC device and other elements can be realised separately.

But if the purpose of modelling is to demonstrate well-known methodological errors, they can be introduced using the blocks of the basic library, which is what we did.