NMEA2000 icon indicating copy to clipboard operation
NMEA2000 copied to clipboard

NMEA 2000 Ac Bus input PGN127503

Open AntonisPapa opened this issue 4 years ago • 11 comments

Hello Timo,

I would like to ask you if you have any experience with the AC inputs? I am trying to make a program to run the information of AC Voltage and Current to the Nmea 2000 network. Thanks in advance.

AntonisPapa avatar Mar 25 '20 12:03 AntonisPapa

Would you like to have ready module with ESP32? I have contact. They may sell it as blank module, but then you need also small programmer. The same programmer works with their othe modules. Other option is ready module.

ttlappalainen avatar Mar 25 '20 13:03 ttlappalainen

I already make a dc battery monitor with arduino due .And now I would like to make an ac monitor only voltage and current in the same board.If you have any idea please let me know.

AntonisPapa avatar Mar 25 '20 14:03 AntonisPapa

Check the module PZEM-004T-100A

ttlappalainen avatar Mar 25 '20 15:03 ttlappalainen

Thank you very much for your help. I would like to ask you something else,are you planing to add the pgn127503 sentences in your library or else you have any idea to start to make a programme for that pgn 127503?

AntonisPapa avatar Mar 25 '20 23:03 AntonisPapa

Timo please let me know how i could add to your library the pgn127503? Thanks

AntonisPapa avatar Apr 23 '20 11:04 AntonisPapa

i want to use this pgn too. How could this be solved? What should be changed in the description ( N2kMessages.h , N2kMessages.h , N2kTypes.h ? Please help me. Thanks.

Csaba

Tarakona2850 avatar Jan 03 '22 14:01 Tarakona2850

Hello Timo!

We tried but not perfect 😭 :

N2kMessages.h :

//*****************************************************************************

void SetN2kPGN127503(tN2kMsg &N2kMsg, unsigned char Instance, unsigned char NrLines, tN2kACLine Line, tN2kACAcceptability Acceptability, double Voltage, double Current, double Frequency, double BreakerSize, uint32_t RealPower, uint32_t ReactivePower, int8_t PowerFactor);

inline void SetN2kACInputStatus(tN2kMsg &N2kMsg, unsigned char Instance, unsigned char NrLines, tN2kACLine Line, tN2kACAcceptability Acceptability, double Voltage, double Current, double Frequency, double BreakerSize, uint32_t RealPower, uint32_t ReactivePower, int8_t PowerFactor) { SetN2kPGN127503(N2kMsg, Instance, NrLines, Line, Acceptability, Voltage, Current, Frequency, BreakerSize, RealPower, ReactivePower, PowerFactor); }

‐------------------------------------------------------------------------------- N2kMessages.cpp :

//***************************************************************************** // AC Input Status void SetN2kPGN127503(tN2kMsg &N2kMsg, unsigned char Instance, unsigned char NrLines, tN2kACLine Line, tN2kACAcceptability Acceptability, double Voltage, double Current, double Frequency, double BreakerSize, uint32_t RealPower, uint32_t ReactivePower, int8_t PowerFactor) { N2kMsg.SetPGN(127503L); N2kMsg.Priority=6; N2kMsg.AddByte(Instance); N2kMsg.AddByte(NrLines); N2kMsg.AddByte((Line&0x03) | ((Acceptability&0x03)<<2) | (0x0f<<4)); N2kMsg.Add2ByteDouble(Voltage,99); N2kMsg.Add2ByteDouble(Frequency,99); N2kMsg.Add2ByteDouble(BreakerSize,99); N2kMsg.Add4ByteUDouble(RealPower,99); N2kMsg.Add4ByteUDouble(ReactivePower,99); N2kMsg.AddByte(PowerFactor); }

‐-------------------------------------------------------------------------

N2KTypes.h :

enum tN2kACLine { N2kacl_Line1=0, N2kacl_Line2=1, N2kacl_Line3=2, N2kacl_reserved=3 };

enum tN2kACAcceptability { N2aca_Bad_Level=0, N2aca_Bad_Frequency=1, N2aca_Being_Qualified=2, N2aca_Good=3 };

Unfortunately only the first two fields go through .. then no data. What do I do wrong?

20220102_161428

Happy New Year

Csabi

Tarakona2850 avatar Jan 03 '22 16:01 Tarakona2850

First on parameters provide all physically real values as double. E.g. RealPower is real not integer.

Then why you have 99 as precision? Voltage precision is 0.01, current 0.1, Frequency 0.01, breaker 0.1, power 1, and power factor 0.01.

You also seem to miss current. It should be: N2kMsg.Add2ByteUDouble(Voltage,0.01); N2kMsg.Add2ByteUDouble(Current,0.1); N2kMsg.Add2ByteUDouble(Frequency,0.01); N2kMsg.Add2ByteUDouble(BreakerSize,0.1); N2kMsg.Add4ByteUDouble(RealPower,1); N2kMsg.Add4ByteUDouble(ReactivePower,1); N2kMsg.Add1ByteDouble(PowerFactor,0.01);

ttlappalainen avatar Jan 03 '22 18:01 ttlappalainen

Note also that this is deprecated and should not be used in new desings. Instead J1939-75 AC parameters are recommended.

For data output your picture does not prove anything. It may be that the reader you use does not fully support this PGN. I have it supported on my NMEA Simulator commercial version.

ttlappalainen avatar Jan 03 '22 18:01 ttlappalainen

Thanks for the help! I'll test it on a B&G Vulcan plotter tomorrow.

Best regards! Csabi

Tarakona2850 avatar Jan 03 '22 19:01 Tarakona2850

Thanks! Working perfectly. 269705278_351121549728211_5976260497372168622_n

Tarakona2850 avatar Jan 05 '22 06:01 Tarakona2850