📄 pnrmsdrc.h
字号:
#ifndef PNRMSDRC_INC
#define PNRMSDRC_INC
/*
** RMS Deviation Record Class - Raw data decoder class for PQNode RMS
** disturbance data.
*/
/*
** include the definition for our base class.
*/
#include "pndisrec.h"
/*
** Forward declare some of the "processed" types that we can produce.
*/
class PQNodeRMSEnvelope;
class PQNodeRMSSummary;
class PQNodeWaveform;
class PQNodeSpectrum;
class PQNodeSpectrumSSCalcs;
class PQNodeWaveSSCalcs;
class PQNodeSequenceCalc;
class RMSDevRecord : public PQNodeDistRec
{
private:
protected:
int iNumCycles;
int iVoltRecSize;
int iCurrRecSize;
LPSHORT pfPhaseData[8];
friend LONG ProcessRMSVar(struct PQNodeXlateDataInfo_tag *p);
float fTrigTime;
float fLowThesh;
float fHighThesh;
int iTotalPoints;
int iNumRMSPreTrig;
int iNumRMSPostTrig;
int iNumMAMData[3];
float fMAMTime[3];
struct RMSDevRMSData_tag *pRMSDat;
struct RMSDevMAMData_tag *pMAMDat[3];
struct RMSDevDataHead_tag *pRMSHeader;
struct RMSDevInfoHead_tag *pRMSDataInfo;
struct RMSDevVoltSummary_tag *pRMSVoltSum;
int iNumPnts[4];
float fSegInterval[4];
int iNumInterval;
BOOL bAuxDataValid;
float * MakeTimeAxis();
float FindSwellDuration(float *pfData, float fHiThesh,
int iStart, int iNumPoints,float *pfTime,
int *piStop);
float FindSagDuration(float *pfData, float fLowThesh,
int iStart, int iNumPoints,float *pfTime,
int *piStop);
int FindAStartPoint(int iChannel,float *pfMin, float *pfMax,
float fLow, float fHigh, int *piCat);
BOOL DecodeRawData(LPSTR pData);
BOOL SetGains();
float * SumChannels(int iChan1,int iChan2,int iChan3,
int iNumPoints,VOLTDISPLAYS VoltPref,int iNeutral = 0);
float * MakeCurrentData(int iChannel,LPSHORT piRaw,VOLTDISPLAYS VoltPref);
float * MakeVoltageData(int iChannel,LPSHORT piRaw,VOLTDISPLAYS VoltPref);
float * MakeWaveTimeVector(int iNumPoints);
float GetHysterysis(int iChannel);
float GetPhaseArea(int iChannel,VOLTDISPLAYS VoltPref,
float *pfVals,float *pfTime,int iStart,int iStop);
/*
** Decoder when raw pqnode data is comming in.
*/
BOOL DecodeData(void *pSetupHeader);
public:
void Initialize()
{
fTrigTime = 0;
fLowThesh = 0;
fHighThesh = 0;
iTotalPoints = 0;
iNumRMSPreTrig = 0;
iNumRMSPostTrig = 0;
iNumMAMData[0] = iNumMAMData[1] = iNumMAMData[2] = 0;
fMAMTime[0] = fMAMTime[1] = fMAMTime[2] = 0;
pRMSDat = NULL;
pMAMDat[0] = pMAMDat[1] = pMAMDat[2] = NULL;
pRMSHeader = NULL;
pRMSDataInfo = NULL;
pRMSVoltSum = NULL;
iNumCycles = 0;
iVoltRecSize = 0;
iCurrRecSize = 0;
pfPhaseData[0] =
pfPhaseData[1] =
pfPhaseData[2] =
pfPhaseData[3] =
pfPhaseData[4] =
pfPhaseData[5] =
pfPhaseData[6] =
pfPhaseData[7] = NULL;
iNumPnts[0] =
iNumPnts[1] =
iNumPnts[2] =
iNumPnts[3] = 0;
fSegInterval[0] =
fSegInterval[1] =
fSegInterval[2] =
fSegInterval[3] = 0;
iNumInterval = 0;
bAuxDataValid = 0;
}
/*
** Various forms of consturctor. ALL CONSTRUCTORS COPY THE DATA EXCEPT
** THE RMSDrvevRecord(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.
*/
RMSDevRecord(LPSTR szTime, ATOM atName, void *pData, DWORD dwDataSize);
RMSDevRecord(LPSTR szTime, LPSTR szName, void *pData, DWORD dwDataSize);
RMSDevRecord(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.
*/
RMSDevRecord(void *pData, DWORD dwDataSize);
RMSDevRecord()
{
ClassDebug("Construct PQNodeWaveCalib\r\n");
Initialize();
}
virtual ~RMSDevRecord();
/*
** Normal Decoder when data is comming from the data base.
*/
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);
/*
**
** Determine if a channel is enabled for triggering a disturbance
*/
BOOL IsTriggerEnabled(int iChannel);
/*
** Determine if a channel in variation. iPhase should always be a
** voltage channel.
*/
BOOL IsPhaseInVariation(int iPhase);
/*
** Find out how many data points are in the rms record for the channel.
*/
int GetPhaseDataCount(int iChannel);
/*
** Obtain a vector of time data points for the RMS evnvelope.
*/
float * GetTimeVector();
/*
** Primitive methods for finding the min, ave or max curve of the
** rms envelope. Use these only if the RMSEnvelope helper class
** doesn't fit your needs. iChannel, VoltPref are as always.
** The pfMin, pfMax and pfAve pointers if provided will receive the
** min max or average of the data respetively. A vector of
** GetPhaseDataCount(int iChannel) floats is returned by each method.
** The caller owns the returned data.
*/
float *GetPhaseMinData(int iChannel,VOLTDISPLAYS VoltPref,float *pfMin);
float *GetPhaseMaxData(int iChannel,VOLTDISPLAYS VoltPref,float *pfMax);
float *GetPhaseAveData(int iChannel,VOLTDISPLAYS VoltPref,float *pfAve);
/*
** Report the thresholds from the setting record.
*/
float GetHighThresh(int iChannel,VOLTDISPLAYS VoltPref);
float GetLowThresh(int iChannel,VOLTDISPLAYS VoltPref);
/*
** Waveform access functions - First the size of a waveform in points.
*/
int GetWaveDataSize(int iChannel);
/*
** Get the waveform itself.
*/
float *GetWaveData(int iChannel,VOLTDISPLAYS VoltPref);
/*
** Get a time vector (in seconds) for the waveform.
*/
float *GetWaveTimeVector(int iChannel);
/*
** Helper function for creating an RMS Envelope object from this
** RMS object. This is the way to get one of these since it takes a
** a fair amount of processing to crunch out the required values to
** create the envelope and associated parameters. 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.
**
** Once created, the envelope objects are independent of the creating
** RMSDevRecord.
*/
PQNodeRMSEnvelope *GetPhaseEnvelope(int iChannel,VOLTDISPLAYS VoltPref);
/*
** Helper function for creating an RMS Phase Summary object.
** The summary objects track the type of rms deviation (swell, sag)
** the maximum depth and duration for a single 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.
**
** Once created, the summary objects are independent of the creating
** RMSDevRecord.
*/
PQNodeRMSSummary *GetPhaseSummary(int iChannel,VOLTDISPLAYS VoltPref);
/*
** Helper function for creating PQNodeWaveform object for assuming
** waveform information was saved with the RMS object. 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);
float * GetWaveData(int iCycle, int iChannel,VOLTDISPLAYS VoltPref);
PQNodeWaveSSCalcs * GetSSCalcs(int iCycle, int iVChannel,int iIChannel,VOLTDISPLAYS VoltPref);
PQNodeSpectrumSSCalcs * GetSpecSSCalcs(int iCycle, int iVChannel,int iIChannel,VOLTDISPLAYS VoltPref);
PQNodeSequenceCalc * GetSeqCalcs(int iNumHarm,
PQNodeSpectrum *pSpec1,PQNodeSpectrum *pSpec2,PQNodeSpectrum *pSpec3);
PQNodeSpectrumSSCalcs * GetSpecSSCalcs(PQNodeSpectrum *pVSpec,
PQNodeSpectrum *pISpec,VOLTDISPLAYS VoltPref);
float GetChanNoiseFloor(int iChannel,VOLTDISPLAYS VoltPref);
int GetDataSize(int iChannel);
PQNodeSpectrum * GetSpectrumData(int iCycle, int iChannel,VOLTDISPLAYS VoltPref,
HARMAXISOPT HarmOpt, HARMQUANTOPT HarmQuant);
/*
** Method to disclose the identity of the triggering channel.
** Standard channel numbering is used.
*/
int GetTriggerChannel() { return idTrigger; }
float GetChanPrefGain(int iChannel,VOLTDISPLAYS VoltPref);
float GetBaseV();
}; // end of class RMSDevRecord
#endif // prevent multiple includes
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -