Tag Archives: algorithm

Powerline load balancing

Nowadays there are a lot of posts and articles about renewable energies, smart grids, electric vehicles, energy efficient products and other environmental friendly solutions.
Their usage are increasing day-by-day in everyday life.
Starting from a simpler example, a flat’s electric distribution panel.


There is a main circuit breaker near the power consumption meter (20A rating in the picture), which protects the whole flat.
The power infeed in then divided into 3 lines, each protected with its own circuit breaker.
As more and more electrical appliance in used, there can be certain intervals when the instantenous power need is more than the circuit breakers’s ratings.
Let’s assume that the mians is nominally 230V, there’s a waching machine operating in the bathroom, an electric oven in the kitchen and one want to do some hoovering in the living room.
Normally the waching machine is rated at 2200W (~9.6Amps @ 230V) but this much power is only needed in the water heating phase, otherwise the power need is only 150-200W.
The electric oven has a pure resistive heating element which is connected in series with a bimetal temperature switch. It switches on and off when it reaches the desired temperature.
If this happens at the same time, the 20A breaker trips.


To avoid these situations the current consumption must be measured. The voltage also could be measured but the breaker only senses current, so basically only current measurement is needed.
There are quite a few techniques to measure current, the simplest of them is using AC current transformers (CT). These provide AC current output which is in direct relation to the measured primary current.


The idea is to provide information about the available current on a certain line.
In case of a washing machine, the available current information could be used to decide if the water heating phase can be started or not. If there is not enough power, then the waching machine (so called smart device) waits until the desired available power level comes.
The breaker’s rating is known, from which the measured current must be substracted, the result is the available current.
The smart device gets this information and since it knows its own power need, the decision on switch ON can be done.


Looking back to the starting situation: having a 10 Amps breaker supplying the bathroom is enough for the washing machine, but the rest of the flat uses power as well, so the overall power usage trips the main breaker at the infeed line.
This problem can be solved if there is information about the “parental” supply line’s available current.
If there is less available current from the infeed line, this must be taken into account.


Staying with the flat example, the infeed line and the flat’s individual supply lines’ current consumption must be measured, and a calculation unit is to be used to generate the available current outputs for each line.
Practically this is a microcontroller based unit, which measures the instantenous current usage, calculates the RMS current consumption and computes the available current output.


As stated above there must be an additional input for measuring the available current from the supplying line. In case of a block of flats, this comes from the main distribution box.


The example can be ridiculous, but looking from bigger perspective, this method is very useful in urban environment, where the power need is concentrated, and the power consupmtion is to be controlled.
Electric vehicles need much power for charging, but this power need can be delayed or reduced (resulting in longer charging time) in peak power usage intervals.


On the other hand, if there are a lot of solar panels installed and electric vehicles are charging at the same time, the charging power can be dinamically adjusted depending of the solar irradiation, thus some kind of grid power peak shaving can be obtained (besides the narrower grid voltage regulation).


Universal, 4-20 mA, two wire industrial transmitter

This post unifies together the following posts:

Industrial, 4-20 mA current loop, measuring basics I.

Industrial, 4-20 mA current loop, measuring basics II.

Industrial, 4-20 mA current loop, measuring basics III.

Industrial, 4-20 mA current loop, measuring basics IV.

Internal workings of process controllers I

. Internal workings of process controllers II.

There are a lot of types of transmitters nowadays. Usually a separate one (a specific type) is needed for thermocouple measurement, an other one (an other type) is needed for level measurement…

The basic concept of this post is to present a way for a universally usable transmitter, which can accept almost any type of input (Pt100, pH probe, rotation, level, light…) and produce a configurable, standard 4-20 mA output.

Continue reading Universal, 4-20 mA, two wire industrial transmitter

Internal workings of process controllers II.

Continued from the previous post

In practice, all these process controllers incorporate a microcontroller.

But microcontrollers are programmed in assembly or in C language, so to create a function block programmable process controller from a C programmable microcontroller, an intermediate firmware must be written.

Continue reading Internal workings of process controllers II.

Internal workings of process controllers I.

This time the internal workings of a process controller will be shown.

I’ll show it through a Siemens SIPART DR24 process controller.

Its user manual can be found on the Siemens’ website:

Siemens SIPART DR24 manual

Although it is almost obsolete, the operational principles can easily be demonstrated with it.

Continue reading Internal workings of process controllers I.

Predictive digital filtering for first order systems

Today measurements must be fast, cheap and accurate at the same time.
These requirements are not easy to achieve.

This post describes a simple but very efficient software method to make a slow measurement faster.

Let’s look at a simple temperature measurement example.

The temperature sensor sits in a protective metal cover.

This sensor is at room tempeature, and we would like to measure the temperature of boiling water.

The example is very simple but it will clearly show the operation of the computing method.

When we put the sensor into the boiling water, we know that the measured value jumps from 20 °C to 100 °C.

but the sensor’s output rises slowly since the protective cover needs time to heat up.

This heat up phenomena acts as a first order filter function.

The first order filter function is described as:

where T(t) is the measured temperature at a given t time, T(final) is the final value (100 °C in this example), T(0) is the starting temperature (20 °C in this example) and Tau is the time constant of the filter.

It may seems a little complicated, but plotting a graph gives a very clear demonstration of how it works.


The problem here is that we know that the measured temperature momentarily rises as the sensor goes into the boiling water, but the measurement shows a slow rising to the final value.

Continue reading Predictive digital filtering for first order systems