This is English version of the my publication, originally was publicated here.
I continue to make progress in developing my own runtime for a motor protection and control device. The beginning of this journey can be found here (english version).
To proceed further with the development of protection functions, I needed signals for three-phase current and voltage. I didn’t have equipment like the Omicron-356 or Retom 51-61 for generating such signals. But even if I did, I would still need a properly configured and debugged ADC (Analog-to-Digital Converter) hardware. Yet, the signals were urgently needed.
*RETOM - is Russian maker testing equipment, same like Omicron
No problem! Let’s create a software-based virtual Retom-Omicron!
So, I decided to develop a real-time signal generator, currently for 8 analog channels, which simulates the sampling of a real ADC. Here’s what I came up with.
The generator operates at a frequency of 1000 Hz, with 20 samples per cycle. Amplitudes, phases, and frequencies can be changed in real time, just like on a real Omicron.
This is already quite good, but the generator is only part of the solution for generating and processing digital signals.
Next, I needed a digital signal processing module, namely a digital filter. I implemented two processing methods to choose from: RMS and DFT. These digital filters have a minimum delay time of 20 milliseconds.
Initially, I planned to implement disturbance recorder in my runtime. Especially since the Schneider Tesys T device lacked this feature! Here’s how it turned out.
The disturbance recorder now records waveforms for 5 seconds. One second is pre-fault mode, and 4 seconds is the main waveform. I made it work according to the COMTRADE 1999 standard, with binary-type recording into .dat files. The oscilloscope records 8 analog channels (currents and voltages) and 32 digital inputs/outputs. The sampling rate is the same as the signal generator—20 samples per cycle at 1000 Hz—and all parameters are adjustable. You can add or remove analog or digital channels, just like in the signal generator. The oscilloscope can be triggered by an external signal, which I’ll explain in more detail below.
The next task was to integrate all three modules into the main runtime.
It turned out to be very convenient to use Modbus server registers to input parameters for the generator, output measurement values from the digital filter, and issue external commands—in this case, starting the disturbance recorder.
Setting three-phase currents and voltages:
- HOLDING REGISTERS with addresses 1000 to 1007—current and voltage magnitudes.
- Addresses 1008-1009—current frequency and voltage frequency.
Measurements:
- INPUT REGISTERS with addresses 1000-1007—currents and voltages.
External command—starting the oscilloscope:
- HOLDING REGISTER, address 1100, function 0x06, writing 1 starts the oscilloscope.
After 4 seconds, the waveform appears.
Watch the video to see how it works:
I apologize that the subtitles in the video are in Russian, as I didn’t have time to prepare them in English. In short, the essence is that I use Modbus registers to set values for currents and voltages, and I also use a Modbus command to start the disturbance recorder.
In the video, the runtime is running under Linux. In real-time mode, the runtime includes a three-phase current and voltage signal generator. I set the signal parameters via a Modbus client and Modbus registers specifically assigned for this purpose. Some registers are for inputting parameters and starting the oscilloscope, while others display the measured values.
Here are a few more examples where the runtime generates waveforms with specified parameters.
- Current at 50 Hz, voltage at 25 Hz.
- Voltage at 100 Hz, current at 50 Hz.
- Harmonic generation up to the 7th harmonic on the current channel. It doesn’t look great at 1000 Hz. Setting a higher frequency should make it look better.
- Freeform generation, done using a Python script (read below).
I later found it very convenient to write a Python script, using Modbus libraries, to change current and voltage parameters through the runtime’s Modbus registers, set fault conditions, start the oscilloscope, and change digital values.
The accuracy with this approach is very high, down to the cycle.
The result is no worse than an Omicron-356 or Retom-61!
All the waveforms shown in the screenshots can be downloaded from here.
Feel free to leave comments, like the article if you enjoyed it, or simply message me at the same Telegram address @antonovgp