⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pnspectm.h

📁 PQDIF软件包(SDK,Software Development Kit),它能转换、生成并且显示PQDIF文件.对于开发电力系统的数据输出非常有用。
💻 H
字号:
/*
**  Class PQNodeSpectrum
**      Harmonic data object for PQNode data.  All objects of this class
**      come from PQNode waveform data, beit periodic sampling, wave fault,
**      etc.   This class hold all REAL FFT and summary data for a single
**      channel.  Creation of this object automatically does the requisit fft.
*/

#ifndef PNSPECTM_INC
#define PNSPECTM_INC

typedef struct SparseElm_Tag 
    {
    int iFreq;
    float fMag;
    float fAng;
    } SPARSEELM, *PSPARSEELM;

class PQNodeSparseSpectrum
    {
    private:
        int iChannel;
        int iNumFreq; 
        int iNumSparse; 
        float fBaseFreq;
        float fMinVal;
        float fMaxVal;
        BOOL bIsTrigger;
        PSPARSEELM pData;
        float fNoiseFloor;
        BOOL CompressSpectrum(float *pMag,float *pAng);
        PSPARSEELM FindHarm(int iHarm);

    protected:

    public:
        PQNodeSparseSpectrum(int iChan,int iNumF, float fFreqBase,
                             float *pMag, float *pAng, float fNoise,
                             float fMin, float fMax);

        ~PQNodeSparseSpectrum();
        int DecompressSpectrum(int iMax,float **pMag,float **pAng);
        int GetDataSize() {return iNumFreq;}
        int GetChannel() {return iChannel;}
        float GetMag(int iHarm);
        float GetAng(int iHarm);
        float GetFreq(int iHarm);

    };

class PQNodeSpectrum
    {
    private:
        int iChannel;
        float fFreqBase;
        float fMinVal;
        float fMaxVal;
        BOOL bIsTrigger;
        int iNumFreq;
        float * pfMag;
        float * pfAng;
        float * pfFreq;
        float fFund;
        float fCrestFact;
        float fPeak;
        float fRMS;
        float fHarmRMS;
        float fTHD;
        float fEvenTHD;
        float fOddTHD;
        float fASum;
        float fAveVal;
        float fFormFact;
        float fTIForIT;
        float fNoiseFloor;
        BOOL bFromCompressed;

        void ProduceSpectrum(float *pfData,int iNumPnts,int iNumCycles);
        void ProcessSpectrum(float fPrefScale,float fTDScale,BOOL bUsePCFund);
        float * MakeFreqVector(float fFreqScale);
        BOOL DoFFT(float *vfWave,int iNumPoints);
    protected:


    public:

        /*
        ** Main form of the constructor usually called by one of the 
        ** disturbance decoder modules.  Not normally called by an app
        ** directly since app doesn't have direct access to some of the info.
        ** See pnwavsrc.h,.cpp for example of creating one of these beasts.
        */
        PQNodeSpectrum(int iChan,int iNumPnt,int iNumCycles, BOOL bIsTrig,
                    float *pfDataVec,float fBaseFreq, 
                    float fPref,float fTD,BOOL bUsePCFund,float fFreqScl,
                    float fNoiseFlr = 0);

        PQNodeSpectrum(int iChan,BOOL bIsTrig,int iFrqCnt,
                    float *pMag,float *pAng, float fBaseFreq, 
                    float fPref,float fTD,BOOL bUsePCFund,float fFreqScl,
                    float fNoiseFl,float fMin,float fMax);

        virtual ~PQNodeSpectrum();

        /*
        ** Return the frequency axis as is was specified in creation (hz or 
        ** harmonic number).  There will be GetDataSize() elements at this
        ** pointer.  This is not a copy and its owned by this object.
        */
        float *GetFreqData() { return pfFreq; }

        /*
        ** Return the magnutude axis as is was specified in creation (% fund
        ** or VoltPref).  If %fund, all values will be normalized to the 
        ** fundumental.  There will be GetDataSize() elements at this
        ** pointer. This is not a copy and its owned by this object.
        */
        float *GetSpectrumData() { return pfMag; }
        float *GetAngleData() { return pfAng; }

        /*
        ** Returns the number of data points in the harmonic spectra.
        */
        int GetDataSize() {return iNumFreq;}

        /*
        ** Returns the channel id that this sample came from.
        ** 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
        */
        int GetChannel() {return iChannel;}

        /*
        ** Returns the number of data points in the harmonic spectra.
        */
        BOOL IsTrigger() {return bIsTrigger;}
        /*
        ** Returns the number of data points in the harmonic spectra.
        */
        float GetMin() {return fMinVal;}
        /*
        ** Returns the number of data points in the harmonic spectra.
        */
        float GetMax() {return fMaxVal;}
        /*
        ** Returns the fundemental value in VoltPref units
        */
        float GetFund() {return fFund;}
        /*
        ** Returns the peak / rms of the waveform
        */
        float GetCrestFact() {return fCrestFact;}
        /*
        ** Returns the peak value of the waveform in VoltPref units
        */
        float GetPeak()      {return fPeak;}
        /*
        ** Returns rms value of the waveform in VoltPref units
        */
        float GetRMS()      {return fRMS;}
        /*
        ** Returns RMS harmonic components in VoltPref units.
        */
        float GetHarmRMS()  {return fHarmRMS;}
        /*
        ** Returns THD of the harmonic spectra.
        */
        float GetTHD()      {return fTHD;}
        float GetEvenTHD()  {return fEvenTHD;}
        float GetOddTHD()   {return fOddTHD;}
        /*
        ** Returns the TIF for voltage channels and the IT product for
        ** current channels
        */
        float GetTIForIT()  {return fTIForIT;}

        /*
        ** Returns the magnitude for a particular harmonic.  1 = fund, etc
        */
        float GetMag(int iHarm) {return pfMag[iHarm];}

        float GetAng(int iHarm) {return pfAng[iHarm];}

        float GetFormFact() {return fFormFact;}

        float GetArithSum() {return fASum;}
        float GetSparseAng(int iHarm);
        float GetSparseMag(int iHarm);
    };     

#endif

⌨️ 快捷键说明

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