RT2_Cuboid_demo / Mbed 2 deprecated nucf446-cuboid-balance1_strong

Dependencies:   mbed

Revision:
20:1d5e89b2f22e
Parent:
19:27ae2ce2e302
Child:
24:308f40175b27
--- a/GPA.cpp	Mon Apr 09 18:23:39 2018 +0000
+++ b/GPA.cpp	Tue Apr 10 12:25:13 2018 +0000
@@ -30,19 +30,21 @@
            
     instantiate option 2: (for a second, refined frequency grid measurement)
     
-    GPA(float f0, float f1, float *fexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1)
+    GPA(float f0, float f1, float *fexcDes, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1)
     
         f0:       frequency point for the calculation of Aexc0 in Hz (should be chosen like in the first measurement)
         f1:       frequency point for the calculation of Aexc1 in Hz (should be chosen like in the first measurement)
         *fexcDes: sorted frequency point array in Hz
+        NfexcDes: length of fexcDes
         
     instantiate option 3: (for an arbitary but sorted frequency grid measurement)
     
-    GPA(float *fexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1)
+    GPA(float *fexcDes, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1)
     
         *fexcDes: sorted frequency point array in Hz
         Aexc0:    excitation amplitude at fexcDes[0]
         Aexc1:    excitation amplitude at fexcDes[NfexcDes-1]
+        NfexcDes: length of fexcDes
 
     hints:    the amplitude drops with 1/fexc, if you're using Axc1 = Aexc0/fMax then d/dt exc = const.,
               this is recommended if your controller does not have a rolloff. if a desired frequency point
@@ -127,10 +129,10 @@
     reset();
 }
 
-GPA::GPA(float f0, float f1, float *fexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1)
+GPA::GPA(float f0, float f1, float *fexcDes, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1)
 {
     // convert fexcDes from float to double, it is assumed that it is sorted
-    NfexcDes = sizeof(fexcDes)/sizeof(fexcDes[0]);
+    this->NfexcDes = NfexcDes;
     this->fexcDes = (double*)malloc(NfexcDes*sizeof(double));
     for(int i = 0; i < NfexcDes; i++) {
         this->fexcDes[i] = (double)fexcDes[i];
@@ -153,10 +155,10 @@
     reset();
 }
 
-GPA::GPA(float *fexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1)
+GPA::GPA(float *fexcDes, int NfexcDes, int NperMin, int NmeasMin, float Ts, float Aexc0, float Aexc1)
 {
     // convert fexcDes from float to double, it is assumed that it is sorted
-    NfexcDes = sizeof(fexcDes)/sizeof(fexcDes[0]);
+    this->NfexcDes = NfexcDes;
     this->fexcDes = (double*)malloc(NfexcDes*sizeof(double));
     for(int i = 0; i < NfexcDes; i++) {
         this->fexcDes[i] = (double)fexcDes[i];
@@ -345,4 +347,10 @@
     printLine();
     printf(" number of data points:  %9i\r\n", NmeasTotal);
     printf(" measurment time in sec: %9.2f\r\n", (float)((double)NmeasTotal*Ts));
-}
\ No newline at end of file
+}
+
+void GPA::printNfexcDes()
+{
+    printLine();
+    printf(" number of frequancy points:  %2i\r\n", NfexcDes);
+}