Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

There has a error message when I call HarmonicAnalyzer..

I don't know why you can not re-produce the issue I mentioned.
I use the NI Measurement studio example to add the exception code
  try
  {
    double s=0;
    double x= 5/s;
  }
  catch (...)
  {
     MessageBox("Get divide zero Exception","Exception",  MB_OK| MB_ICONERROR );             //can not get this exception dialog        
  }
  try
  {
    int *p = 0000;
    *p = 1000;
  }
  catch (...)
  {
     MessageBox("Get *p Exception"," Exception",   MB_OK| MB_ICONERROR );      //but can get this                
  }
 
So I doubt in NI component, it handles the exception and filter some special one.
Message 11 of 23
(2,780 Views)
I don't think you can have a double be exactly zero.  It returns infinity.  If you change it to an int you get the divide by zero error.  Which brings us back to the Harmonic Analyzer function.  It is being passed an int and that somehow is causing the error.  I am still trying to reproduce the divide by zero error using the Harmonic Analyzer function but to no avail yet.  I will continue to look into it. 
jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 12 of 23
(2,770 Views)
Yes, you are right if I set interger as zero, I can get the exception.
But my problem is in AP, if I set double s = 0, and double t=100/s, I can not get exception. (so you think s is not set to 0)
But in DLL, if I set double s = 0, and double t=100/s, I can get exception. (so the s is exactly set to 0)
So I think in HarmonicAnalyzer function, it has a double value is zero and ,inside function, they don't handle that exception.
I think you can give me a debug code and I can capture the error code to you. For example, you can try to trace all the double variable in your function. And check which one could be the dividor. Then put the try.. exception handle process in that. And if I can capture the exception in my DLL , then we can approve which value caused the execption.
0 Kudos
Message 13 of 23
(2,757 Views)

I change my code to

try
  {
    double dTF =TargetFrequency;
    MathError error =  CNiMath::HarmonicAnalyzer(SpectrumArray
      ,dw_WaveArraynSamplePerSec
      ,dTF,harmonicAmp,harmonicFreq,*thd,thdNoise
      ,iInputBufferNumber ,HarmonicNumber,static_cast<CNiMath::WindowType>(i_WindowType));
  } catch (...)
  {
    char ErrString[1024];
    sprintf(ErrString, "Error: only %d Harmonic", harmonicFreq.GetSize());
    DE_ShowRunningInformation( ErrString);
    *thd = -1;
    return false;
  }

And I will get 'Float devide by zero' exception, and there has only 2 harmonics. So I doubt there has bug inside NI component.

 

0 Kudos
Message 14 of 23
(2,748 Views)

Hey Bird,

Are you saying that the issue is with the environment and not with Measurement Studio?   If so you may need to contact Microsoft.

 

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 15 of 23
(2,727 Views)
Maybe there has some relative with Microsoft.
But the function is developed by NI and NI should have responsibility to clarify / solve this. Been a SW provider (and this software is not free), you should do your best to provide a bug-free software.
I really got except from your HarmonicAnalyzer function. And if I have source code and trace in this function, I could find out which variable caused this. If you are not the owner could support so deep, I suggest you forward this to the core person.
 
0 Kudos
Message 16 of 23
(2,724 Views)

Hey Bird,

When you say something like: "So I doubt there has bug inside NI component."  Then I'm led to believe that you are assuming it is not the NI component that is causing the problem.  That's why I suggested contacting MS.  But if you still believe it is the HarmonicAnalyzer() function that is not handling the error correctly I want to make sure we figure this out.  We are not able to reproduce the issue.  I had R&D try and reproduce it and they can not reproduce the error.  Do you have a simple project that will reproduce it?  If so can you post it?  If you do not feel comfortable posting it then can you post an email address and we'll take this offline?  Sorry for the confusion.

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 17 of 23
(2,710 Views)
Hi Sam,
 
I can not update the source code this websit. I don't have any ftp server to let you download.
Could you give me a ftp area to upload the source code.
 
And by summery,
 
NITest.dll  --> the dll wihich implement HarmonicAnalyzer function
b.wav    --> the wav file which will exception in the above function
TestDlg.exe  --> the AP to dynamic load NITest.dll and execute the ext_DebugFunction function. (this is implemented by VC++)
Project1.exe  ---> this AP is the same as TestDlg.exe but this is implemented by Delphi.
 
So you will get the result that if you use TestDlg.exe to execute the NItest.dll, there will have no exception. But if you use Project1.exe to load that dll and execute the funtion, it would have exception error.
0 Kudos
Message 18 of 23
(2,698 Views)
Hey Bird,
 
The ftp site is: ftp://ftp.ni.com/incoming.  Zip up your project and name it HarmonicAnalyzer.  Let me know when you have placed it there.
 
Regards,
jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 19 of 23
(2,687 Views)

Hi Sam,

I upload that 'HarmonicAnalyzer.zip' today. Thank you for your help.

0 Kudos
Message 20 of 23
(2,680 Views)