displaying fractional data on emoncms website

I have a data feed data which I send via a jephson string to the emoncms.org website and I want to display some of the items as integer and some as non integer.

If I look at how the emoncms takes my data (all sent as integers) it seems like some of it is converted to non integer data and some of it is not. I cannot see any obvious rule which is being applied which decides how it gets formatted. However, the one thing that I want to see as fractional always comes out as a rounded integer.

I have tried sending the data as with a decimal and several significant digits after the decimal point but it still comes out as in integer. If I try manipulating the feed by multiplying by, say, 1.00000001, it still comes out as integer. 

 

How can I make something like 1234.567 display on the cms website as 1234.567 and not as 1235 ?

thanks

 

Ian

 

 

MartinR's picture

Re: displaying fractional data on emoncms website

You have to send the data as 1234567 and then multiply the input by 0.001 before logging it to a feed.

EDITED to say that probably won't work as the value is greater than will fit in a 16-bit integer.

Series530's picture

Re: displaying fractional data on emoncms website

Hi Martin,

Thanks for your reply.

I tried that before but I think you have hit the issue square on: the data comes from my generation meter. The data reaching my nanode RF is read as 3140140 (Wh)- clearly above the 16 bit integer value. The true value that I want to display is the real reading that the meter displays at source - which is 3140.14 KWh. 

I guess I could split it up into sections but I fear that the emoncms software may struggle to combine it again successfully and display beyond the decimal point.

Any suggestions?

thanks

 

Ian

MartinR's picture

Re: displaying fractional data on emoncms website

Hi Ian,

Yes, I think you are right. If you split the data into two 16-bit integers then you would probably be able to combine them back together ok by multiplying the most significant word by 65536 but you would have problems if the least significant word is greater than 32767 as the EmonCMS code will convert this to a negative value.

It may be possible to split it if you only use 15 bits of the least significant word?

-martin

 

Series530's picture

Re: displaying fractional data on emoncms website

I did a split of the lower and upper 16 bits of the 32 bit word and rebuilt them using feed manipulation on emoncms. Result was the same: just an integer.

 

Comment viewing options

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