add CAL_DELTA_T support
authora0220410 <peter-li@ti.com>
Fri, 16 Sep 2016 17:17:23 +0000 (01:17 +0800)
committera0220410 <peter-li@ti.com>
Fri, 16 Sep 2016 17:17:23 +0000 (01:17 +0800)
TAS2555-FTC/app/src/main/java/com/ti/tas2555/tas2555_ftc/MainActivity.java
TAS2555-FTC/ftcc/src/main/java/com/ti/tas2555/ftcc/TFTCConfiguration.java

index c102a3f094dab69812a6ee7957e41292862f550e..fb8dce3550d859ece8972ed76ff07970453d62ad 100755 (executable)
@@ -169,8 +169,8 @@ public class MainActivity extends AppCompatActivity implements MediaPlayer.OnPre
             mDevNode.OpenNode("/dev/tiload_node");\r
             mInfo.append("/dev/tiload_node opened \n");\r
             mInfo.setSelection(mInfo.getText().length());\r
-            mFTCConfiguration.nTCal = 25;\r
-            mInfo.append("ambient temperature :" + mFTCConfiguration.nTCal + "\n");\r
+            mFTCConfiguration.setTCal(25.0);\r
+            mInfo.append("ambient temperature :" + mFTCConfiguration.getTCal() + "\n");\r
             mInfo.setSelection(mInfo.getText().length());\r
             mFTCConfiguration.bLoadCalibration = false;\r
             mInfo.append("reload calibration :" + mFTCConfiguration.bLoadCalibration + "\n");\r
@@ -213,8 +213,21 @@ public class MainActivity extends AppCompatActivity implements MediaPlayer.OnPre
             mInfo.append("STEP3: Re-program Re for worst case \n");\r
             mInfo.setSelection(mInfo.getText().length());\r
             double re = mFTCConfiguration.nPPC3_Re0;\r
-            re = mFTCConfiguration.nPPC3_Re0 * (1 - 2 * mFTCConfiguration.nSpkReTolPer / 100.0);\r
+            re = mFTCConfiguration.nPPC3_Re0 * (1 - 2 * mFTCConfiguration.nSpkReTolPer / 100.0);                       \r
+                       int prm_pow = mDevNode.Calc_Prm_Pow(re, \r
+                                       mFTCConfiguration.nCalDeltaT, \r
+                                       mFTCConfiguration.nPPC3_RTV, \r
+                                       mFTCConfiguration.nPPC3_RTM, \r
+                                       mFTCConfiguration.nPPC3_RTVA, \r
+                                       mFTCConfiguration.nPPC3_SysGain);\r
+                       int prm_tlimit = mDevNode.calc_Prm_Tlimit(mFTCConfiguration.nCalDeltaT, \r
+                                       mFTCConfiguration.nSpkReAlpha, \r
+                                       mFTCConfiguration.nPPC3_DevNonlinPer, \r
+                                       mFTCConfiguration.nPPC3_RTV, \r
+                                       mFTCConfiguration.nPPC3_RTM, \r
+                                       mFTCConfiguration.nPPC3_RTVA);\r
             mDevNode.set_Re(mFTCConfiguration.nPPC3_Re0, re, mFTCConfiguration.nSpkReAlpha);\r
+                       mDevNode.set_TempCal(prm_pow, prm_tlimit);\r
             mDevNode.set_NFS(mFTCConfiguration.nNFS);\r
             mDevNode.set_SCTH(mFTCConfiguration.nSCTH);\r
 \r
@@ -343,14 +356,14 @@ public class MainActivity extends AppCompatActivity implements MediaPlayer.OnPre
         // STEP 7: Set temperature limit to target TMAX\r
         mFTCConfiguration.nprm_pow = mDevNode.Calc_Prm_Pow(\r
                 mFTCConfiguration.nRe,\r
-                mFTCConfiguration.nSpkTMax - mFTCConfiguration.nTCal,\r
+                mFTCConfiguration.nSpkTMax - mFTCConfiguration.getTCal(),\r
                 mFTCConfiguration.nPPC3_RTV,\r
                 mFTCConfiguration.nPPC3_RTM,\r
                 mFTCConfiguration.nPPC3_RTVA,\r
                 mFTCConfiguration.nPPC3_SysGain);\r
 \r
         mFTCConfiguration.nprm_tlimit = mDevNode.calc_Prm_Tlimit(\r
-                mFTCConfiguration.nSpkTMax - mFTCConfiguration.nTCal,\r
+                mFTCConfiguration.nSpkTMax - mFTCConfiguration.getTCal(),\r
                 mFTCConfiguration.nSpkReAlpha,\r
                 mFTCConfiguration.nPPC3_DevNonlinPer,\r
                 mFTCConfiguration.nPPC3_RTV,\r
index bd3d1dc3d6b0c3987572a9fe25e44a473804c968..48620acbd8bb7bfae3916ef6565b260f0bb80060 100755 (executable)
@@ -20,6 +20,7 @@ public class TFTCConfiguration {
     private static final String TAG  = "TFTCConfiguration";\r
     private static final String CALIBRATION_TIME = "CALIBRATION_TIME";\r
     private static final String VERIFICATION_TIME = "VERIFICATION_TIME";\r
+       private static final String CAL_DELTA_T = "CAL_DELTA_T";\r
     private static final String TEST_DELTA_T = "TEST_DELTA_T";\r
     private static final String CONFIGURATION = "CONFIGURATION";\r
     private static final String CONFIGURATION_CALIBRATION = "CONFIGURATION_CALIBRATION";\r
@@ -70,6 +71,8 @@ public class TFTCConfiguration {
 \r
     public boolean bFTCBypass;\r
     public double nTestDeltaT;\r
+       public double nCalDeltaT;\r
+       public boolean bCalDeltaTPresent;\r
     public int nConfiguration;\r
     public int nConfigurationCalibration;\r
 \r
@@ -98,7 +101,7 @@ public class TFTCConfiguration {
     public double nRe;\r
     public double nF0;\r
     public double nQ;\r
-    public double nTCal;\r
+    private double nTCal;\r
     public double ntest_delta_tv;\r
     public int nResult;\r
     public int nprm_pow;\r
@@ -109,7 +112,20 @@ public class TFTCConfiguration {
     private int gnBinIndex = 0;\r
     private int gnBinBlockIndex = 0;\r
 \r
+       public void setTCal(double t_cal)\r
+       {\r
+               nTCal = t_cal;\r
+               if(bCalDeltaTPresent == false){\r
+                       nCalDeltaT = nSpkTMax - nTCal;\r
+               }\r
+       }\r
+       \r
+       public double getTCal(){\r
+               return nTCal;\r
+       }\r
+       \r
     public void LoadFTCC(String filename)throws java.io.IOException{\r
+               bCalDeltaTPresent = false;\r
         FileReader fileReader = new FileReader(filename);\r
         BufferedReader bufferedReader = new BufferedReader(fileReader);\r
 \r
@@ -123,6 +139,9 @@ public class TFTCConfiguration {
             ftcc_parse(line);\r
         }\r
 \r
+               if(bCalDeltaTPresent == false){\r
+                       nCalDeltaT = nSpkTMax - nTCal;\r
+               }\r
         bufferedReader.close();\r
         fileReader.close();\r
     }\r
@@ -134,7 +153,10 @@ public class TFTCConfiguration {
             nVerificationTime = getInt(VERIFICATION_TIME, line);\r
         else if(line.contains(TEST_DELTA_T))\r
             nTestDeltaT = getFloat(TEST_DELTA_T, line);\r
-        else if(line.contains(CONFIGURATION_CALIBRATION))\r
+               else if(line.contains(CAL_DELTA_T)){\r
+                       bCalDeltaTPresent = true;\r
+            nCalDeltaT = getFloat(CAL_DELTA_T, line);\r
+               }else if(line.contains(CONFIGURATION_CALIBRATION))\r
             nConfigurationCalibration = getInt(CONFIGURATION_CALIBRATION, line);\r
         else if(line.contains(CONFIGURATION))\r
             nConfiguration = getInt(CONFIGURATION, line);\r