CT Clamp Emulation

Hi guys,

I know there is at least one thread with a similar topic, but a few things might be different to my problem. In addition, I've made a few tests and would like to get your help with the interpretation ... :slight_smile:

Introduction:
I have a solar power plant with a battery and a hybrid inverter (Sofar Solar).
In addition I have a Zappi wallbox from myenergi.

To achieve surplus charging Zappi ships three CT clamps, that have to be installed after the electricity meter. So far so good.
The inverter has already installed a smart meter at the exact same position.

Problem:
With the basic installation, I can manage to surplus charging, but the house battery will be always prioritized.
I've managed to attach an ESP32 to the Modbus of the inverter and receive all values, including the ones from the smart meter.

Unfortunately, the wallbox does not have an API to transmit the reading from the inverter directly to the wallbox. I think the only available solution to control the charging behavior is to use the ct clamps.
Now, I want to emulate the CT clamps to let the wallbox think there is a surplus of energy.
The inverter will see this as load and reduces the charging of the house battery.

In the first step, I just want to measure and understand the clamp's output.

CT clamp:
I am currently trying to understand the CT clamp to get the requirements for the emulation.
This is the used CT clamp: https://www.myenergi.com/wp-content/uploads/2022/12/CT-Datasheet-Rev-1.4-ENGLISH.pdf
I think the most important information is the current ratio: 100A/40mA
40mA will be induced in the secondary circuit, if the primary circuit has 100A load.

Experimental setup:
To verify this assumption, I've built an experimental setup.
I placed the CT clamp on the hot wire of an extension cable. The load is a spotlight.
I've measured the voltage of the primary circuit with a multimeter and the power with an energy meter.
Primary Voltage: 232.7V
Primary Power: 189.6W
Calculated Current: 189.6/232.7 = 0.814782982380748000A

The induced current is quite small.
I would expect a current of 0.814782982 * 100/0,04 = 0.000325913192952299A

Measurement:
I used a PoKit Pro for measurements. I used the data logger mode with a 1s interval. I captured ~96 measurements and the mean value is 0.000353158236976014A

I can now calculated the primary circuit:
Current: 0.000353158236976014 * 100/0,04 = 0.882895592440036000 A
Power: 232.7 * 0.882895592440036000 = 205,449 W

Results:
I think the difference between the measurements are quite big.
Current diff: 0.068112610059287800A
Power diff: 15.84980436079630000
Error: 6,81%

Question:
Thanks for reading all this and let's finally come to my question :slight_smile:
Do you see any mistake in my thoughts?
Can you imagine, why the error is ~7%? The clamp's data sheet says 0,5%.
Is the current of the load too small to get reasonable results?

Outlook:
In the next step, I would like to use an ESP32 to generate an output current (AC, if I am not wrong) based on the readings from the inverter to pretend to be a ct clamp for the wallbox.
If this is working, I can start building some more or less smart algorithms ... :wink:

1 Like

W ≠ VA (unless Power Factor = 1.0)

You're comparing watts from the electricity meter with volt-amps from the CT and volts from the multimeter. This could easily explain the -7% difference.

Also, the electricity meter would use True RMS voltage, so you should use a True RMS responding volts setting on your multimeter. This will give a higher reading than AVG response and it will also account for any distortion in the signal.

Also, don't forget to use True RMS Voltage for the voltage measurement from your CT.

I would suggest comparing VA from the electricity meter with True RMS CT current X True RMS Primary Voltage.

There might be good reason that the battery is priority and you need to know why .

Thanks for your explanations.
I understand that I made a mistake when comparing different units as I have not taken the power factor into account.

I measured watts of the load with a quite old energy meter. This energy meter only outputs watts and no additional information like voltage or current.
Here is a picture of it: Energiemesser | Kinderleicht den tatsächlichen Energieverbrauch von Elektrogeräten ermitteln! | hoftechnik.com

The voltage of the primary circuits was measured with a multimeter and I am pretty sure, that this is true rms.
Also pokit measures true rms values for the current of the secondary circuit.

I do have a multimeter with a built in ct clamp. Do you think this is more accurate?

I have not measured the voltage of the secondary circuit, yet. Do you think I need this information?
I was thinking that the ct clamp has a current based signal, and the voltage is not important.

I think there is no particular reason for that.
The battery and inverter are one system, and the wallbox is another system. There is unfortunately no interface between both systems and that’s why the inverter prioritizes the battery as the inverter is the manager of production and battery.
The wallbox is just another consumer from the perspective of the inverter.

I try to bring both systems together.
No technical reason why I would charge the battery before charging the EV.

I guess that current transformer has a built in burden resistor so actually you would be not be measuring current at its output, only the voltage across the burden resistor which should be proportional to the current.
Here is an Arduino project using a current transformer. This may mirror what your meter device does to determine current based on the output of a current transformer and may give a clue as to how to trick it into believing a particular current is flowing. You must consider the risks of doing this though.

From the energy meter manual here it mentions that the tolerance is: max. ±2% and ±2 W for measurements up to 2500 W.

The main parameter that's missing (in your measurements) is knowing the phase shift (degrees) of the current measurement signal from the line voltage measurement signal.

Then you could use W = V x A x cosθ

What brings you to this guess?
I've read about the burden resistor and I think I understand why it's necessary.

Though, I haven't found any hint in the data sheet or the manual of the wallbox/CT clamp about the border resistor.
It would be possible, that the burden resistor is built in the PCB of the wallbox.
The only instruction I am aware of, is to wire the CT clamp to the screw terminal, shown on the attached picture.

I've the same multimeter with CT clamp shown on the picture on the link shared by 6v6gt.
I will re-try my experimental setup by measuring the amps of the load for comparison.

Is there a way to determine the phase shift?

I did a measurement again and compared the amps:
I used a multimeter (true rms) with ct clamp to measure the amps of the primary circuit (photo attached).

Primary circuit amps: 0.835 A

I still used Pokit for measurement of the secondary circuit, but used the multimeter mode (with true rms) and not the data logger mode.
I've measured 0.333 mA.

To calculate the primary amps I do:
0.333 / 1000 * 100/0.04 = 0.8325 A

The error would be abs(0.8325-0.835)*100 = 0.25 %

This sounds much better and is in the provided range of precision.
What do you think?

Hi,
I think you will find that there is NO BURDEN resistor fitted to that CT, hence the spec 100A/40mA.

You add the burden resistor to customise the voltage output you need.
In this case the resistor, I assume, is installed in the "Zappy".
Zappy;

Tom... :smiley: :+1: :coffee: :australia:

That was my guess, too :slight_smile:
Thanks for your thoughts ...

Of course there is. The time difference between the zero crossing of the voltage and the zero crossing of the current.

Thanks, I understand.
But if I got this right, the phase shift is only necessary when I cannot measure the amps of the primary circuit. It's just to calculate the amps in respect of the power factor to make a valid comparison?!

As I've now, measured the amps with a ct clamp of a multimeter, it's comparable .... isn't it?

Power factor is ONLY important if you are getting charged for it. A residential power cannot include a power factor charge, only industrial, if there is a PF problem.

Power factor = W / VA
cos (degrees) = Power Factor
cos(phase shift in degrees) = Power Factor

The phase shift would be needed if the load is non-resistive. Its the degrees difference of the zero-crossing of the low voltage signal from the zero crossing of the high line voltage.

For instance, if this difference was 21.5 degrees, then your power (W) calculation would be 7% lower than the VA calculation. In this case, If you compare the VA calculated from the Pokit (its not Watts) with the W from the energy meter, then the Pokit's VA results will be 7% higher than the W from the energy meter.

Great results!
Note that now you're comparing VA with VA. Previously you were comparing VA with W.

I don't think the energy meter is really suited for this application. It probably doesn't measure True RMS ... therefore harmonics would affect its accuracy.

I think that's remarkably accurate! There are a couple of projects linked to from this forum somewhere describing solar energy controllers and going into how phase shift can be measured - and a couple of suppliers sell kits to make your own, at least one of which is Arduino based I think.

One point to note is that when it comes to measuring high currents it is important to make sure you fit a burden resistor. That data sheet you link to gives an accuracy figure for <100 ohms which would be a good choice. The action of the current transformer is to try to make the secondary current equal the primary current divided by the turns ratio - if there's no resistor connected you can get rather a high voltage! 100 ohms and 100A primary current would give 4V rms which is safe. If it was 1000 ohms then 40V and Arduino don't mix happily. Your rms current meter should be very low impedance so very safe.

Thanks for your explanations.
I am pretty happy, that we figured it out quite fast :slight_smile:

I think we can ignore the power factor and phase shift, as the wallbox would also only be capable of measuring the amps, right?
I just did a wrong comparison to validate what I was measuring in the secondary circuit.

The next step is to reproduce the CT's output.
I need to generate an ac current with my ESP32 that is equal to the one of the clamp for the same load.
I've read, that I can use the DAC to generate a sinus.
If I remember correctly, the ESP32 outputs can withstand 40mA. That should be sufficient.

I cannot directly output current, but I can define the output voltage.
I need to find a good scale for the output current.
I've three 35A main distribution fuses. So the max current I ever can measure at the main distribution is 35A.
If 100A are 0,04A, then 35A are 0.04/100*35=0.014A

I want to draw 0.014A when 3V3 is applied.
U = RI
3.3 * 0.014 = 0,0462 ohm

I would connect the GND with - of the CT clamp screw terminal of the zappi and GPIO with DAC to the + of the zappi, but add the 0,0462 ohm resistor in-between.
Now, I should be able to emulate the CT clamp's output, right?

Then I just need to get the right values from the inverter and convert them by the 100/0.04 factor to the clamp current Level.
I've attached the inofficial data sheet of the inverter's modus interface.
I am not sure, which values are the right one.
211116_SOFAR HYD-3PH and SOFAR -G3 Modbus Protocol 2021-10-14_Client.xlsx.zip (190.7 KB)

I think I need these:

  • R phase PCC current
  • S phase PCC current
  • T phase PCC current

I think the values with PCC (point of common coupling) are the values from the smart meter.
Not sure what R, S and T means.

What are your thoughts :slight_smile:?

Thanks for your thoughts!
As I do not want to use the CT clamp, but emulate it, I think the burden resistor must be built-in in the wallbox. So I think it's not crucial here ... I just want to find out, what the CT clamp output is, and generate the same signal ... :slight_smile:

Re R, S, T

The DAC of the ESP32 is only 8-bit, but using PWM to control a switching transistor/filter circuit, you could achieve much higher resolution and higher current. This Low-pass Filter Design for PWM is a handy tool to check the resulting waveform for a given PWM frequency and R and C values.

Could also use this method generate higher voltage (i.e. could use a 12V power supply for the PWM and filter circuit).