emonCMS absolute value for feed

Hi,

I'm getting strange results from my CTs on emonCMS giving positive and negative values for a PV single phase system. I was wondering if theres a way to make the feed only show an absolute (always postive, flip sign if negative) value?

http://54.243.157.143/emoncms/vis/auto?feedid=83

Try the link above to visualize the feed.

Robert Wall's picture

Re: emonCMS absolute value for feed

That looks to me as if your values are overflowing. Remember, you can only send signed integers and the range is -32768 to +32767 Watts. So you are generating nearly 65 kW? If that's really the case, I think it means you must scale the value you are sending by 0.5 in the emonTx, and in emonCMS multiply that input by 2 before passing it on to the feed.

virosoft's picture

Re: emonCMS absolute value for feed

Thanks Robert !
I don't have access to the emonTx it's out on a remote location, what is the best option? I'm thinking I could perhaps change the data type on the database from a signed 16 bit to an unsigned (The PV sites are rated for 50kW). I also have a 200kW site so I might need to go as far as 32bit integer without changing the emontx code!...

Or could I take the input and multiply it by 0.5 before storing it as a feed? I'll try this first.

"On the Arduino Uno (and other ATMega based boards) an int stores a 16-bit (2-byte) value. This yields a range of -32,768 to 32,767 (minimum value of -2^15 and a maximum value of (2^15) - 1)." - http://arduino.cc/en/Reference/int
typedef struct {
      int power1;
      int power2;
      int power3;
      int Vrms;
      int temperature;
} PayloadTX;

The code on the emonTx will NEED to be changed, I think the best method for me is to send the current for ct's along with the voltage instead of the power.

Robert Wall's picture

Re: emonCMS absolute value for feed

But you won't then be recording real power, only apparent power. In the UK (and most places, I believe) you pay for watts, not VA.

You divide your power by 10 (to give you 327 kW max - or any suitable number!) before you fill that struct with the value, then as I wrote restore it at the other end. You will then have your power in increments of decawatts!

If you have your own emoncms, you might be able to change the code to use signed longs, but I don't know emoncms so I can't tell you how hard that would be. It probably still needs to be signed if you go down that route.

virosoft's picture

Re: emonCMS absolute value for feed

These solar PV sites should have a power factor pretty much at unity (KVAh=KWh), but good point. I could also send the power factor within the payload, or to save on data just use your divide by 10. Note that they are directly tied into the grid from the PV inverters.

Changing the emonCMS data type won't matter since it's the emonTx's code data type that is the root cause of the problem! Unless I changed both the emonTx and emonCMS data type together.

It's interesting to see that a value greater than 32,767 will become negative where generating 50kW will display:
-1 * ( -32,767 + 50,000 )= -17,233

Robert Wall's picture

Re: emonCMS absolute value for feed

Changing the emonCMS data type won't matter since it's the emonTx's code data type that is the root cause of the problem! Unless I changed both the emonTx and emonCMS data type together.

Yes, well, they are designed for each other!

It's interesting to see that a value greater than 32,767 will become negative where generating 50kW will display:
-1 * ( -32,767 + 50,000 )= -17,233

That's how signed binary arithmetic works!

Comment viewing options

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