pnwavsrc.h

来自「PQDIF软件包(SDK,Software Development Kit),它」· C头文件 代码 · 共 171 行

H
171
字号
/*
** Class  WaveformRecord - PQNode Raw Data Decoder class for periodic waveform
**          data files.
*/


#ifndef PNWAVSRC_INC
#define PNWAVSRC_INC

/*
** include declaration of our base class
*/
#include "pndisrec.h"

/*
** Forward declare the classes that we will return.
*/

class PQNodeWaveform;
class PQNodeSpectrum;
class PQNodeSpectrumSSCalcs;
class PQNodeWaveSSCalcs;
class PQNodeSequenceCalc;
/*
** All Raw data decoders are based upon the PQNodeDistRec (pndisrec.h)
*/

class WaveformRecord : public PQNodeDistRec
    {
    private:
    protected:
        int iNumCycles;
        int iVoltRecSize;
        int iCurrRecSize;
        LPSHORT pfPhaseData[8];

        /*
        ** friend function in pndxlate.  This function handles the data
        ** at download time, changing it from absolutely raw PQNode data to
        ** our form with headers and setup info.
        */
        friend LONG ProcessWaveform(struct PQNodeXlateDataInfo_tag *p);

        int iTrigChan;
        struct WaveSampInfoHead_tag *pWaveInfo;
        struct WaveSampDataHead_tag *pWaveHeader;

        float * MakeCurrentData(int iChannel,LPSHORT piRaw,VOLTDISPLAYS VoltPref);
        float * MakeVoltageData(int iChannel,LPSHORT piRaw,VOLTDISPLAYS VoltPref);
        float *SumChannels(int iChan1,int iChan2,int iChan3, 
                                  int iNumPoints,VOLTDISPLAYS VoltPref,int iNeutral = -1);
        float * MakeTimeVector(int iNumPoints);
        BOOL DecodeRawData(LPSTR pData);
        BOOL SetGains();
        BOOL DecodeData(void *pSetupHeader);
		float GetChanNoiseFloor(int iChannel,VOLTDISPLAYS VoltPref);

    public:
        /*
        ** Various forms of consturctor.  ALL CONSTRUCTORS COPY THE DATA EXCEPT
        ** THE WaveformRecord(void *pData,DWORD dwDataSize) FORM.  THIS FORM
        ** is reserved for the file translator (pndxlate download time functions).
        **
        ** Constructing does not automatically force a decode to occur.  You must
        ** call DecodeData before using other methods. 
        */

        /*
        ** For the following constructors, the szTime is the Hex String format
        ** of the disturbance time.  The hex time is the only way to set the
        ** hundredths so the third form is not recommended.  The name parameters
        ** are self explanitory.  At the pointer, should be the data file as
        ** delivered by PNDS, or read directly from the file.  dwDataSize tells
        ** how big the memory block at pData is and is used to validate the
        ** decoding operations.
        */
        WaveformRecord(LPSTR szTime, ATOM atName, void *pData,DWORD dwDataSize);
        WaveformRecord(LPSTR szTime, LPSTR szName, void *pData,DWORD dwDataSize);
        WaveformRecord(long tTime, LPSTR szName, void *pData,DWORD dwDataSize);

        /*
        ** Special constructor for pndxlate.  No copy of the data is made,
        ** much info is missing after the decode.
        */
        WaveformRecord(void *pData,DWORD dwDataSize);
        WaveformRecord() 
            {
            pWaveInfo = NULL;
            pWaveHeader = NULL;
            }

        virtual ~WaveformRecord();

        /*
        ** Decode the Raw data record.  If the function returns false then 
        ** this object was not created with a valid waveform data record.
        */
        BOOL DecodeData();

        /*
        ** Channel numbering for a methods below is:
        ** 0 = Va, 1 = Vb, 2 = Vc, 3 = Vn 
        ** 4 = Ia, 5 = Ib, 6 = Ic, 7 = In
        ** IDCHAN_VOLTRESIDUALS = Sum of enabled voltage channels
        ** IDCHAN_CURRRESIDUALS = Sum of enabled current channels
        **
        ** Determine if a channel is enabled in the data record.
        */
        BOOL IsChannelEnabled(int iChannel);

        /*
        ** Find out how many data points are in the record for the channel.
        */
        int GetDataSize(int iChannel);

        /*
        ** Obtain a vector of time data points for the voltage or current data 
        ** for the channel.
        */
        float *GetTimeData(int iChannel);

        /*
        ** Obtain a vector of data points for the voltage or current data 
        ** for the channel.  For voltage channels the values will be scaled
        ** as indicated by the VoltPref parameter (see pndatprf.h)
        */
        float *GetWaveData(int iChannel,VOLTDISPLAYS VoltPref);

        int GetVoltRecSize() { return iVoltRecSize; }
        int GetCurrRecSize() { return iCurrRecSize; }

        /*
        ** Helper function for creating PQNodeWaveform object from the 
        ** waveform information for one channel.  iChannel may 
        ** take on standard values as described above.  The VoltPref parameter
        ** specifies the "base" or unit voltage channels should be created
        ** in.  Once created, these values are not easily changed.
        */
        PQNodeWaveform *GetWaveformData(int iChannel,VOLTDISPLAYS VoltPref);

        /*
        ** Create a PQSSCalcs object for the indicated voltage and current
        ** channels.
        */
        PQNodeWaveSSCalcs *GetSSCalcs(int iVChannel,int iIChannel,
                                       VOLTDISPLAYS VoltPref);

        PQNodeSpectrumSSCalcs *GetSpecSSCalcs(int iVChannel,int iIChannel,
                                       VOLTDISPLAYS VoltPref);

        PQNodeSpectrumSSCalcs *GetSpecSSCalcs(PQNodeSpectrum *pVSpec,
                       PQNodeSpectrum *pISpec,VOLTDISPLAYS VoltPref);

        PQNodeSequenceCalc *GetSeqCalcs(int iNumHarm,PQNodeSpectrum *pSpec1,
                         PQNodeSpectrum *pSpec2,PQNodeSpectrum *pSpec3);
        /*
        ** Create a Harmonic Spectrum object for the indicated channel.  The
        ** HarmOpt specifies frequency in hertz or harmonic number and the 
        ** HarmQuant parameter specifies if the VoltPref or Percent Fundemental
        ** should be used for voltage spectrums.
        */
        PQNodeSpectrum *GetSpectrumData(int iChannel,VOLTDISPLAYS VoltPref,
              HARMAXISOPT HarmOpt, HARMQUANTOPT HarmQuant);

        float GetChanPrefGain(int iChannel,VOLTDISPLAYS VoltPref = VD_ACTUAL);
        float GetBaseV();

    };    // end of class Waveform

#endif    // prevent multiple includes

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?