This demonstrates the process of communicating through ethernet to a SEL-2431 Voltage Regulator Control Panel using SEL Fast Message. Basic device commands and data cna be requested and displayed over a connected serial port. This is a basic version and full testing and documentation has yet to be completed.

Dependencies:   BufferedSerial analogAverager voltageRegulator netStatReg analogMinMax CounterMinMax

selMsg.h

Committer:
masterkookus
Date:
2019-10-01
Revision:
9:d6e7981dfc89
Parent:
8:fa2a2c3a16ce
Child:
10:9da863a6da3e

File content as of revision 9:d6e7981dfc89:

#ifndef SELMSG_H 
#define SELMSG_H 

const char fmCmd[3][2] = {
    {0xA5,0xC0},
    {0xA5,0xC1},
    {0xA5,0xD1}
};

const char serCmd[5][7] =  {
    {'M','E','T',' ','M','\r','\n'},
    {'T','A','P','\r','\n',' ',' '},
    {'A','C','C','\r','\n',' ',' '},
    {'O','T','T','E','R','\r','\n'},
    {'\r','\n',' ',' ',' ',' ',' '}
};

const char serCmdSeq[3][5] = {
    {0x02,0x03,0x04,0x04,0x00},
    {0x02,0x03,0x04,0x04,0x01},
    {0x05,0x07,0x04,0x04,0x07}
};

const char vRegDevCfg[23] = {
    0xA5,0xC0,0x17,0x02,0x03,0x00,0xA5,0xC1,0xA5,0xD1,0xA5,0xC2,0xA5,0xD2,0xA5,0xC3,0xA5,0xD3,0x01,0x00,0x00,0x05,0x21
};

/*const char vRegMsgCfg204] = {
    0xA5,0xC1,0xBB,0x01,0x00,0x00,0x11,0x01,0x34,0x00,0x00,0x04,0x00,0x48,0x00,0x50,0x49,0x4C,0x00,0x00,0x00,0x00,0x01,0xFF,
    0xFF,0x00,0x00,0x49,0x4C,0x41,0x00,0x00,0x00,0x01,0xFF,0xFF,0x00,0x00,0x56,0x53,0x00,0x00,0x00,0x00,0x01,0xFF,0xFF,0x00,
    0x00,0x56,0x53,0x41,0x00,0x00,0x00,0x01,0xFF,0xFF,0x00,0x00,0x56,0x4C,0x00,0x00,0x00,0x00,0x01,0xFF,0xFF,0x00,0x00,0x56,
    0x4C,0x41,0x00,0x00,0x00,0x01,0xFF,0xFF,0x00,0x00,0x56,0x43,0x4D,0x50,0x00,0x00,0x01,0xFF,0xFF,0x00,0x00,0x54,0x41,0x50,
    0x50,0x4F,0x53,0x01,0xFF,0xFF,0x00,0x00,0x56,0x53,0x53,0x45,0x43,0x00,0x01,0xFF,0xFF,0x00,0x00,0x56,0x4C,0x53,0x45,0x43,
    0x00,0x01,0xFF,0xFF,0x00,0x00,0x56,0x43,0x4D,0x50,0x53,0x43,0x01,0xFF,0xFF,0x00,0x00,0x50,0x4C,0x00,0x00,0x00,0x00,0x01,
    0xFF,0xFF,0x00,0x00,0x51,0x4C,0x00,0x00,0x00,0x00,0x01,0xFF,0xFF,0x00,0x00,0x53,0x4C,0x00,0x00,0x00,0x00,0x01,0xFF,0xFF,
    0x00,0x00,0x50,0x46,0x00,0x00,0x00,0x00,0x01,0xFF,0xFF,0x00,0x00,0x50,0x46,0x4C,0x44,0x00,0x00,0x01,0xFF,0xFF,0x00,0x00,
    0x46,0x52,0x45,0x51,0x00,0x00,0x01,0xFF,0xFF,0x00,0x00,0x23
    };*/

//short2byte analogScaleOffset;

struct analog1Sample {
    char analogName[6];
    float analog1Value;
};
struct analog2Sample {
    char analogName[6];
    float analog1Value;
    float analog2Value;
};
struct analog3Sample {
    char analogName[6];
    float analog1Value;
    float analog2Value;
    float analog3Value;
};
struct analog4Sample {
    char analogName[6];
    float analog1Value;
    float analog2Value;
    float analog3Value;
    float analog4Value;
};

struct fmTimeStamp {
    char month;
    char day;
    char year;
    char hour;
    char min;
    char sec;
    short msec;
};

struct vRegData {
    char numAnalog;
    char numDigital;
    struct analog1Sample analogs[17];
    struct fmTimeStamp timeStamp;
    char digitalTargets[52];
};

void initVoltageRegulator(vRegData *vReg);

#endif