Pls Help 3phase emonglcd code

Hi i have the hardware all working but im pretty sure the code is not right as i have 3 phase power here in Australia and i would like to know what i need to do to correctly read the 3 phases and combine this into one output for my emonglcd.  I also have solar which does not appear to be reporting correctly.

I assume i need to change the following code in my emonglcd to add the 3 phases:

 if (SolarPV_type==1){
    usekwh += (emontx.power1 * 0.2) / 3600000;
    genkwh += (emontx.power2 * 0.2) / 3600000;

and also this:

if (SolarPV_type==1){
    cval_use = cval_use + (emontx.power1 - cval_use)*0.50;
    cval_gen = cval_gen + (emontx.power2 - cval_gen)*0.50;

 

I have the 3 phases connected to CT1 through to CT3 and then the solar connected to CT4 on the emonTx is this correct?  Do i need to change any code in the emonTx as well?

 

thanks.

Robert Wall's picture

Re: Pls Help 3phase emonglcd code

Sorry, I have crystal ball malfunction. I need more information than that. What are you doing in the emonTx, because that's where the information that the GLCD displays comes from?

nihonjin's picture

Re: Pls Help 3phase emonglcd code

Sorry I want clear.

I wish to monitor my power usage and solar pv generation. So I have bought the emonTx receiver and emonglcd display kit to do this. I have 3 phase power at home and 5kw of solar pv.

I've recently (since my first post) uploaded this sketch to the emonTx but still im not getting correct readings on my emonglcd.

https://github.com/openenergymonitor/emonTxFirmware/blob/master/emonTxV3...

I've tried various different changes to the solarpv sketch to suit 3 phase power but again the readings in getting don't match what my inverter says my solar is generating.

as mentioned above I have phase 1 ct clips connected to ct1 and phase 2 and 3 to ct2 and ct3 respectively. My solar pv is then connected to ct4. I'm also powering it via the 9v ac-ac adaptor.

I hope this clarifies of not please let me know what else I can say to help solve my issues.

Thanks.

Robert Wall's picture

Re: Pls Help 3phase emonglcd code

The 3-phase emonTx sketch reports the data for each of the 3 phases separately. Your emonGLCD sketch was designed for a single phase installation (because 3-phase is almost unheard-of for domestic installations in the UK). Therefore, because memory in the GLCD is limited, the easiest and best thing to do is to add the powers for the three phases in the emonTx, then change the PayloadTX structure to send the values you want in the format that the GLCD expects. You'll find help on interpreting the structure of the transmissions in RFM12B - Part 2, in Building Blocks.

By default CT4 is also on phase 1, but you can change that if necessary (line 395) - what you need to do should be relatively obvious from the lines above.

burner's picture

Re: Pls Help 3phase emonglcd code

The content of this post has been deemed offensive by the moderators, and has been deleted. - RW

nihonjin's picture

Re: Pls Help 3phase emonglcd code

thank you for your post and pointing me in the right direction.  Unfortunately this is all very new to me and im still lost as to what i should do.

I have read the document on interpreting the structure of the transmission in RFM12B but cant quite work out where to start.  I assume i need to add the 3 phases power readings and combine these into power1 and assign the solar pv reading and send this as power2 as this is what the emonglcd solar  pv sketch is looking for 2 numbers power1 and power2 where power1 is the house power and power2 is the solar pv power.

 

How i do this i still do not know and would appreciate any ideas and or sample code to play with.  Thanks.

***update****

So i have changed the code as follows in the emonTx:

emontx.power1 = realPower1 + realPower2 + realPower3;                      // Copy the desired variables ready for transmision
emontx.power2 = realPower4;
//emontx.power3 = realPower3;
//emontx.power4 = realPower4;
emontx.Vrms   = Vrms;

and loaded the standard solar PV sketch for the emonglcd.  It appears to be working more like it should now but my solar readings are not exactly as what my inverter says its out by about 500watts ie the emonglcd is reporting 3.4kw when it should be 3.9kw.  Is this an exceptable error margin or is there something i can do  to fix this.

Robert Wall's picture

Re: Pls Help 3phase emonglcd code

I would start, as you suggest, with the GLCD. You haven't said where your CTs are connected in relation to where the PV infeed is, so you'll need to bear that in mind when you're changing the code. I'm guessing your 3 'main' CTs are on the grid connection and see the nett import/export, i.e. a 'Type 2' installation.

For a 'Type 2' it's expecting the nett grid power to be in emontx.power1, and the generated PV power in emontx.power2. Therefore the consumed power is the sum of these two. emontx.power3 is not used. We'll leave the code in the emonGLCD as it is - unless of course you want to see the individual phase powers at some point - except of course you'll need to set it as a Type 2.

So look now at the 3-phase sketch in the emonTx.
All the powers are available towards the end of loop( ) just before the data packet is sent to the RFM12B with send_rf_data(), so that's where we need to jump in. But first, we need to make the struct emontx the same as the one in the GLCD. So copy it from there and paste it into line 144 where it's defined, replacing what's there.
Now go back to the bottom of loop( ) where the powers are loaded into the emontx struct. You want
emontx.power1 = realPower1 + realPower2 + realPower3 (this is the total nett grid power)
and emontx.power2 = realPower4 (this is the PV infeed).
You can forget emontx.power3 or set it to zero as you wish, as it's unused.
emontx.Vrms is fine.

And with a bit of luck, I've got that right and you should get sensible numbers (assuming what I guessed above is correct). (I'm also assuming that PV power is positive in daylight, and each phase is positive when importing from the grid. That's our convention. Flip the CT if one is wrong.)

Robert Wall's picture

Re: Pls Help 3phase emonglcd code

"So i have changed the code as follows in the emonTx:

emontx.power1 = realPower1 + realPower2 + realPower3; // Copy the desired variables ready for transmision
emontx.power2 = realPower4;
//emontx.power3 = realPower3;
//emontx.power4 = realPower4;
emontx.Vrms = Vrms;

and loaded the standard solar PV sketch for the emonglcd. It appears to be working more like it should now but my solar readings are not exactly as what my inverter says its out by about 500watts ie the emonglcd is reporting 3.4kw when it should be 3.9kw. Is this an exceptable error margin or is there something i can do to fix this."

Did you go through the full calibration procedure for your emonTx? That is the starting point. There are notes about installation and calibration in Building Blocks, but the overriding calibration process for that 3-phase sketch is in the comments at the top of the sketch. It's perfectly acceptable to tweak the constants (Ical4 in the case of your PV) to make the numbers agree with your meters.

calypso_rae's picture

Re: Pls Help 3phase emonglcd code

The emonGLCD can only display data that it receives from the emonTx.  The data that the emonTx is generating can be inspected at its Serial Monitor, so it may simplify the operation to check the numbers there.

I thought I'd posted a message to this effect yesterday but can't see it here now.  Maybe I clicked 'Preview' rather than 'Save'.

 

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.