iirc_system_getdata

PURPOSE ^

[sys_config, status]= iirc_system_configure( config_file )

SYNOPSIS ^

function Scan_Data= iirc_system_getdata( Data )

DESCRIPTION ^

 [sys_config, status]= iirc_system_configure( config_file )
 Read Data from the IIRC EIT system

 (C) 2006 tongin oh
 $Id: iirc_system_getdata.m 1535 2008-07-26 15:36:27Z aadler $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function Scan_Data= iirc_system_getdata( Data )
0002 % [sys_config, status]= iirc_system_configure( config_file )
0003 % Read Data from the IIRC EIT system
0004 %
0005 % (C) 2006 tongin oh
0006 % $Id: iirc_system_getdata.m 1535 2008-07-26 15:36:27Z aadler $
0007 
0008 Error_Flag=0;
0009 
0010 for CurrentFreq = 1 : Data.EIT_Setting_Information.Frequency_Num
0011     Error_Flag=FreqSet(Data, Error_Flag, CurrentFreq);
0012     Error_Flag=SetMFCP(Data, Error_Flag, CurrentFreq);
0013     if Data.EIT_Setting_Information.FreqIndex(CurrentFreq) > 10
0014         [Scan_Data, ErrorFlag]= Scan_EIT_50(Data, Error_Flag, CurrentFreq);
0015     else
0016         [Scan_Data, ErrorFlag]= Scan_EIT_48(Data, Error_Flag, CurrentFreq);
0017     end
0018     
0019 end
0020 
0021 
0022 function Error_Flag=FreqSet(Data, Error_Flag, CurrentFreq)
0023     Dummy = 51;
0024     Send_Data = [32 Data.EIT_Setting_Information.FreqInfo(CurrentFreq) 220 Dummy Dummy Dummy Dummy];
0025 
0026     [USB_Status Temp_Data Count] = Multi_USB_Comm(Data.EIT_Setting_Information.Device_Sel, Send_Data);
0027     if USB_Status == 0
0028         error('USB Read Error');
0029     end    
0030     Receive_Data = Temp_Data(1 : Count);
0031 
0032     Response_Data = [161 Send_Data(2 : 7)];
0033     if Receive_Data == Response_Data'
0034     %     msgbox('Frequency Setting OK');
0035     else    
0036         error('Frequency Setting Error');
0037         Error_Flag=1;
0038     end
0039 
0040 function Error_Flag= SetMFCP(Data, Error_Flag, CurrentFreq)
0041     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0042     % Frequency Setting for Scan(48)
0043     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0044     Dummy = 51;
0045     Test_OK = 1;
0046 
0047     Send_Data = [40 0 0 Data.EIT_Setting_Information.FreqInfo(CurrentFreq) Data.EIT_Setting_Information.GICCH(CurrentFreq) Dummy Dummy];
0048 
0049     [USB_Status Temp_Data Count] = Multi_USB_Comm(Data.EIT_Setting_Information.Device_Sel, Send_Data);
0050     if USB_Status == 0
0051         error('USB Read Error');
0052         Test_OK = 0;
0053     end    
0054     Receive_Data = Temp_Data(1 : Count);
0055 
0056     Response_Data = [169 Send_Data(2 : 7)];
0057     if Receive_Data ~= Response_Data'
0058         error('MFSet Error');
0059         Test_OK = 0;
0060     end
0061 
0062     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0063     % CCS & GIC Setting for Scan(48)
0064     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0065     
0066     Send_Data = [44 0 0 Data.CCS_CAL_Digipot_Value(Data.EIT_Setting_Information.FreqIndex(CurrentFreq), 1 : 4)];
0067 
0068     [USB_Status Temp_Data Count] = Multi_USB_Comm(Data.EIT_Setting_Information.Device_Sel, Send_Data);
0069     if USB_Status == 0
0070         error('USB Read Error');
0071         Test_OK = 0;
0072     end    
0073     Receive_Data = Temp_Data(1 : Count);
0074 
0075     Response_Data = [173 Send_Data(2 : 7)];
0076     if Receive_Data ~= Response_Data'
0077         error('MFSet Error');
0078         Test_OK = 0;
0079     end
0080 
0081     Send_Data = [44 0 1 Data.CCS_CAL_Digipot_Value(Data.EIT_Setting_Information.FreqIndex(CurrentFreq), 6 : 9)];
0082 
0083     [USB_Status Temp_Data Count] = Multi_USB_Comm(Data.EIT_Setting_Information.Device_Sel, Send_Data);
0084     if USB_Status == 0
0085         error('USB Read Error');
0086         Test_OK = 0;
0087     end    
0088     Receive_Data = Temp_Data(1 : Count);
0089 
0090     Response_Data = [173 Send_Data(2 : 7)];
0091     if Receive_Data(1) ~= Response_Data(1)
0092         msgbox('MFSet Error');
0093         Test_OK = 0;
0094     end
0095     
0096     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0097     % Setting current pattern for Scan(48)
0098     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0099 
0100     for k = 1 : Data.EIT_Setting_Information.Total_Projection(CurrentFreq)
0101         Send_Data = [36 0 (Data.EIT_Setting_Information.Total_Projection(CurrentFreq) - 1) (k - 1) ...
0102              Data.Channel_List(Data.EIT_Setting_Information.Current_Injection_Pattern((CurrentFreq), k, 1)) ...
0103              Data.Channel_List(Data.EIT_Setting_Information.Current_Injection_Pattern((CurrentFreq), k, 2)) ...
0104              Data.EIT_Setting_Information.Current_Injection_Pattern((CurrentFreq), k, 3)];
0105 
0106         [USB_Status Temp_Data Count] = Multi_USB_Comm(Data.EIT_Setting_Information.Device_Sel, Send_Data);
0107         if USB_Status == 0
0108             msgbox('USB Read Error');
0109             Test_OK = 0;
0110         end    
0111         Receive_Data = Temp_Data(1 : Count);
0112 
0113         Response_Data = [165 Send_Data(2 : 7)];
0114         if Receive_Data(1) ~= Response_Data(1)
0115             msgbox('SetCP Error');
0116             Test_OK = 0;
0117         end   
0118     end 
0119 
0120 
0121 function [Scan_Data, Error_Flag]= Scan_EIT_50(Data, Error_Flag, CurrentFreq)
0122     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0123     % Complex scan using 16 channel EIT System (50)
0124     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0125 
0126     Dummy = 51;
0127     Comm_Status = 1;
0128     Raw_Data = [];
0129 
0130     Send_Data = [50 1 Dummy Dummy Dummy Dummy Dummy];
0131 
0132     [USB_Status Temp_Data Count] = Multi_USB_Comm(Data.EIT_Setting_Information.Device_Sel, Send_Data);
0133     if USB_Status == 0
0134         msgbox('USB Read Error');
0135     end    
0136     Receive_Data = Temp_Data(1 : Count);
0137     if size(Receive_Data) ~= [896 1]
0138         Comm_Status = 0;
0139     end   
0140     Raw_Data = Receive_Data;
0141 
0142     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0143     % Data read when 1 scan using 16 channel EIT System (54)
0144     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0145 
0146     Send_Data = [54 1 Dummy Dummy Dummy Dummy Dummy];
0147     [USB_Status Temp_Data Count] = Multi_USB_Comm(Data.EIT_Setting_Information.Device_Sel, Send_Data);
0148     if USB_Status == 0
0149         msgbox('USB Read Error');
0150     end    
0151     Receive_Data = Temp_Data(1 : Count);
0152     if size(Receive_Data) ~= [896 1]
0153         Comm_OK = 0;
0154     end   
0155     Raw_Data = [Raw_Data; Receive_Data];
0156 
0157     Send_Data = [54 2 Dummy Dummy Dummy Dummy Dummy];
0158     [USB_Status Temp_Data Count] = Multi_USB_Comm(Data.EIT_Setting_Information.Device_Sel, Send_Data);
0159     if USB_Status == 0
0160         msgbox('USB Read Error');
0161     end    
0162     Receive_Data = Temp_Data(1 : Count);
0163     if size(Receive_Data) ~= [896 1]
0164         Comm_OK = 0;
0165     end   
0166     Raw_Data = [Raw_Data; Receive_Data];
0167 
0168     Send_Data = [54 3 Dummy Dummy Dummy Dummy Dummy];
0169     [USB_Status Temp_Data Count] = Multi_USB_Comm(Data.EIT_Setting_Information.Device_Sel, Send_Data);
0170     if USB_Status == 0
0171         msgbox('USB Read Error');
0172     end    
0173     Receive_Data = Temp_Data(1 : Count);
0174     if size(Receive_Data) ~= [896 1]
0175         Comm_OK = 0;
0176     end   
0177     Raw_Data = [Raw_Data; Receive_Data];
0178 
0179     switch (Data.EIT_Setting_Information.FreqIndex(CurrentFreq))
0180         case 11,
0181             Comp_Freq_Index = 11;
0182         case 12,
0183             Comp_Freq_Index = 14;
0184         case 13,
0185             Comp_Freq_Index = 17;
0186         otherwise
0187             msgbox('Out of Range !!!');
0188             Err_Flag = 1;
0189     end
0190 
0191     if Comm_Status == 1
0192         for Proj_Num = 1 : Data.EIT_Setting_Information.Total_Projection(CurrentFreq)
0193             for Data_Step = 1 : Data.EIT_Setting_Information.Total_Channel
0194                 Projection_Data = Raw_Data((14 * Data_Step - 13 : 14 * Data_Step)+(Data.EIT_Setting_Information.Total_Projection(CurrentFreq)*14*(Proj_Num-1)));
0195                 if Projection_Data(1) == ((Data_Step-1)*Channel_Gap + 192)
0196                     Real_Data_Temp = 256 * Projection_Data(3) + Projection_Data(4);
0197                     Quad_Data_Temp = 256 * Projection_Data(5) + Projection_Data(6);
0198                     if Real_Data_Temp >= 32768
0199                         Real_Data_Freq1 = Real_Data_Temp - 65536;
0200                     else
0201                         Real_Data_Freq1 = Real_Data_Temp;
0202                     end
0203                     if Quad_Data_Temp >= 32768
0204                         Quad_Data_Freq1 = Quad_Data_Temp - 65536;
0205                     else
0206                         Quad_Data_Freq1 = Quad_Data_Temp;
0207                     end
0208     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0209     % Calibration applied
0210     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0211     %             Theta = 0;
0212     %             Gain = 1;
0213 
0214                 Theta = Data.VMCal(1, Comp_Freq_Index).Phase_Data(1, Data_Step);
0215                 Gain = Data.VMCal(1, Comp_Freq_Index).Gain(1, Data.EIT_Setting_Information.Digipot).Magnitude(Proj_Num, Data_Step);
0216                 Theta_Cal_Real = cos(Theta)*Real_Data_Freq1 + sin(Theta)*Quad_Data_Freq1;
0217                 Theta_Cal_Quad = cos(Theta)*Quad_Data_Freq1 - sin(Theta)*Real_Data_Freq1;
0218                 Amp_Cal_Real = Theta_Cal_Real / Gain;
0219                 Amp_Cal_Quad = Theta_Cal_Quad / Gain;
0220 
0221     %             Scan_Data(Data.EIT_Operating_Information.Cur_Freq).Real_Data(Proj_Num, Data_Step) = Amp_Cal_Real;
0222     %             Scan_Data(Data.EIT_Operating_Information.Cur_Freq).Quad_Data(Proj_Num, Data_Step) = Amp_Cal_Quad;
0223     %             Scan_Data(Data.EIT_Operating_Information.Cur_Freq).Magnitude_Data(Proj_Num, Data_Step) = sqrt(Amp_Cal_Real^ 2 + Amp_Cal_Quad^ 2);
0224     %             Scan_Data(Data.EIT_Operating_Information.Cur_Freq).Theta_Data(Proj_Num, Data_Step) = rad2deg(angle(Amp_Cal_Real + i * Amp_Cal_Quad));
0225 
0226                 Scan_Data(Comp_Freq_Index).Meas_Data((Proj_Num-1)*Data.EIT_Setting_Information.Total_Channel+Data_Step, 1) = Amp_Cal_Real;
0227                 Scan_Data(Comp_Freq_Index).Meas_Data((Proj_Num-1)*Data.EIT_Setting_Information.Total_Channel+Data_Step, 2) = Amp_Cal_Quad;
0228                 Scan_Data(Comp_Freq_Index).Meas_Data((Proj_Num-1)*Data.EIT_Setting_Information.Total_Channel+Data_Step, 3) = sqrt(Amp_Cal_Real^ 2 + Amp_Cal_Quad^ 2);
0229                 Scan_Data(Comp_Freq_Index).Meas_Data((Proj_Num-1)*Data.EIT_Setting_Information.Total_Channel+Data_Step, 4) = rad2deg(angle(Amp_Cal_Real + i * Amp_Cal_Quad));
0230 
0231                 Real_Data_Temp = 256 * Projection_Data(7) + Projection_Data(8);
0232                 Quad_Data_Temp = 256 * Projection_Data(9) + Projection_Data(10);
0233                 if Real_Data_Temp >= 32768
0234                     Real_Data_Freq2 = Real_Data_Temp - 65536;
0235                 else
0236                     Real_Data_Freq2 = Real_Data_Temp;
0237                 end
0238                 if Quad_Data_Temp >= 32768
0239                     Quad_Data_Freq2 = Quad_Data_Temp - 65536;
0240                 else
0241                     Quad_Data_Freq2 = Quad_Data_Temp;
0242                 end
0243 
0244     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0245     % Calibration applied
0246     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0247     %             Theta = 0;
0248     %             Gain = 1;
0249 
0250                 Theta = Data.VMCal(1, (Comp_Freq_Index)+1).Phase_Data(1, Data_Step);
0251                 Gain = Data.VMCal(1, (Comp_Freq_Index)+1).Gain(1, Data.EIT_Setting_Information.Digipot).Magnitude(Proj_Num, Data_Step);
0252                 Theta_Cal_Real = cos(Theta)*Real_Data_Freq2 + sin(Theta)*Quad_Data_Freq2;
0253                 Theta_Cal_Quad = cos(Theta)*Quad_Data_Freq2 - sin(Theta)*Real_Data_Freq2;
0254                 Amp_Cal_Real = Theta_Cal_Real / Gain;
0255                 Amp_Cal_Quad = Theta_Cal_Quad / Gain;
0256 
0257     %             Scan_Data(Data.EIT_Operating_Information.Cur_Freq+1).Real_Data(Proj_Num, Data_Step) = Amp_Cal_Real;
0258     %             Scan_Data(Data.EIT_Operating_Information.Cur_Freq+1).Quad_Data(Proj_Num, Data_Step) = Amp_Cal_Quad;
0259     %             Scan_Data(Data.EIT_Operating_Information.Cur_Freq+1).Magnitude_Data(Proj_Num, Data_Step) = sqrt(Amp_Cal_Real^ 2 + Amp_Cal_Quad^ 2);
0260     %             Scan_Data(Data.EIT_Operating_Information.Cur_Freq+1).Theta_Data(Proj_Num, Data_Step) = rad2deg(angle(Amp_Cal_Real + i * Amp_Cal_Quad));
0261 
0262                 Scan_Data(Comp_Freq_Index+1).Meas_Data((Proj_Num-1)*Data.EIT_Setting_Information.Total_Channel+Data_Step, 1) = Amp_Cal_Real;
0263                 Scan_Data(Comp_Freq_Index+1).Meas_Data((Proj_Num-1)*Data.EIT_Setting_Information.Total_Channel+Data_Step, 2) = Amp_Cal_Quad;
0264                 Scan_Data(Comp_Freq_Index+1).Meas_Data((Proj_Num-1)*Data.EIT_Setting_Information.Total_Channel+Data_Step, 3) = sqrt(Amp_Cal_Real^ 2 + Amp_Cal_Quad^ 2);
0265                 Scan_Data(Comp_Freq_Index+1).Meas_Data((Proj_Num-1)*Data.EIT_Setting_Information.Total_Channel+Data_Step, 4) = rad2deg(angle(Amp_Cal_Real + i * Amp_Cal_Quad));
0266 
0267                 Real_Data_Temp = 256 * Projection_Data(11) + Projection_Data(12);
0268                 Quad_Data_Temp = 256 * Projection_Data(13) + Projection_Data(14);
0269                 if Real_Data_Temp >= 32768
0270                     Real_Data_Freq3 = Real_Data_Temp - 65536;
0271                 else
0272                     Real_Data_Freq3 = Real_Data_Temp;
0273                 end
0274                 if Quad_Data_Temp >= 32768
0275                     Quad_Data_Freq3 = Quad_Data_Temp - 65536;
0276                 else
0277                     Quad_Data_Freq3 = Quad_Data_Temp;
0278                 end
0279 
0280     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0281     % Calibration applied
0282     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0283     %             Theta = 0;
0284     %             Gain = 1;
0285 
0286                 Theta = Data.VMCal(1, (Comp_Freq_Index)+2).Phase_Data(1, Data_Step);
0287                 Gain = Data.VMCal(1, (Comp_Freq_Index)+2).Gain(1, Data.EIT_Setting_Information.Digipot).Magnitude(Proj_Num, Data_Step);
0288                 Theta_Cal_Real = cos(Theta)*Real_Data_Freq3 + sin(Theta)*Quad_Data_Freq3;
0289                 Theta_Cal_Quad = cos(Theta)*Quad_Data_Freq3 - sin(Theta)*Real_Data_Freq3;
0290                 Amp_Cal_Real = Theta_Cal_Real / Gain;
0291                 Amp_Cal_Quad = Theta_Cal_Quad / Gain;
0292 
0293                 Scan_Data(Comp_Freq_Index+2).Meas_Data((Proj_Num-1)*Data.EIT_Setting_Information.Total_Channel+Data_Step, 1) = Amp_Cal_Real;
0294                 Scan_Data(Comp_Freq_Index+2).Meas_Data((Proj_Num-1)*Data.EIT_Setting_Information.Total_Channel+Data_Step, 2) = Amp_Cal_Quad;
0295                 Scan_Data(Comp_Freq_Index+2).Meas_Data((Proj_Num-1)*Data.EIT_Setting_Information.Total_Channel+Data_Step, 3) = sqrt(Amp_Cal_Real^ 2 + Amp_Cal_Quad^ 2);
0296                 Scan_Data(Comp_Freq_Index+2).Meas_Data((Proj_Num-1)*Data.EIT_Setting_Information.Total_Channel+Data_Step, 4) = rad2deg(angle(Amp_Cal_Real + i * Amp_Cal_Quad));
0297 
0298                 else
0299                     error('Scan Error');
0300                 end
0301             end
0302         end
0303     end
0304 
0305 
0306 function [Scan_Data, Error_Flag]= Scan_EIT_48(Data, Error_Flag, CurrentFreq)
0307     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0308     % 1 scan using 16 channel EIT System (48)
0309     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0310     % Data.EIT_Operating_Information.Cur_Freq = Data.EIT_Setting_Information.FreqIndex;
0311     % Data.EIT_Operating_Information.Cur_Gain = Data.EIT_Setting_Information.Digipot;
0312 
0313 
0314     Dummy = 51;
0315     Comm_Status = 1;
0316     Raw_Data = [];
0317 
0318     Send_Data = [48 1 Dummy Dummy Dummy Dummy Dummy];
0319 
0320     [USB_Status Temp_Data Count] = Multi_USB_Comm(Data.EIT_Setting_Information.Device_Sel, Send_Data);
0321     if USB_Status == 0
0322         msgbox('USB Read Error');
0323     end    
0324     Receive_Data = Temp_Data(1 : Count);
0325     if size(Receive_Data) ~= [768 1]
0326         Comm_Status = 0;
0327     end   
0328     Raw_Data = Receive_Data;
0329 
0330     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0331     % Data read when 1 scan using 16 channel EIT System (52)
0332     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0333 
0334     Send_Data = [52 1 Dummy Dummy Dummy Dummy Dummy];
0335     [USB_Status Temp_Data Count] = Multi_USB_Comm(Data.EIT_Setting_Information.Device_Sel, Send_Data);
0336     if USB_Status == 0
0337         msgbox('USB Read Error');
0338     end    
0339     Receive_Data = Temp_Data(1 : Count);
0340     if size(Receive_Data) ~= [768 1]
0341         Comm_OK = 0;
0342     end   
0343     Raw_Data = [Raw_Data; Receive_Data];
0344 
0345     Channel_Gap = 64 / Data.EIT_Setting_Information.Total_Channel;
0346     if Comm_Status == 1
0347         for Proj_Num = 1 : Data.EIT_Setting_Information.Total_Projection(CurrentFreq)
0348             for Data_Step = 1 : Data.EIT_Setting_Information.Total_Channel
0349                 Projection_Data = Raw_Data((6 * Data_Step - 5 : 6 * Data_Step)+(Data.EIT_Setting_Information.Total_Projection(CurrentFreq)*6*(Proj_Num-1)));
0350                 if Projection_Data(1) == ((Data_Step-1)*Channel_Gap + 128)
0351                     Real_Data_Temp = 256 * Projection_Data(3) + Projection_Data(4);
0352                     Quad_Data_Temp = 256 * Projection_Data(5) + Projection_Data(6);
0353                     if Real_Data_Temp >= 32768
0354                         Real_Data = Real_Data_Temp - 65536;
0355                     else
0356                         Real_Data = Real_Data_Temp;
0357                     end
0358                     if Quad_Data_Temp >= 32768
0359                         Quad_Data = Quad_Data_Temp - 65536;
0360                     else
0361                         Quad_Data = Quad_Data_Temp;
0362                     end
0363 
0364     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0365     % Calibration applied
0366     %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0367     %             Theta = 0;
0368     %             Gain = 1;
0369 
0370                 Theta = Data.VMCal(1, Data.EIT_Setting_Information.FreqIndex(CurrentFreq)).Phase_Data(Data_Step);
0371                 Gain = Data.VMCal(1, Data.EIT_Setting_Information.FreqIndex(CurrentFreq)).Gain(1, Data.EIT_Setting_Information.Digipot).Magnitude(Proj_Num, Data_Step);
0372 
0373                 Theta_Cal_Real = cos(Theta)*Real_Data + sin(Theta)*Quad_Data;
0374                 Theta_Cal_Quad = cos(Theta)*Quad_Data - sin(Theta)*Real_Data;
0375                 Amp_Cal_Real = Theta_Cal_Real / Gain;
0376                 Amp_Cal_Quad = Theta_Cal_Quad / Gain;
0377 
0378                 Scan_Data(Data.EIT_Setting_Information.FreqIndex(CurrentFreq)).Meas_Data((Proj_Num-1)*Data.EIT_Setting_Information.Total_Channel+Data_Step, 1) = Amp_Cal_Real;
0379                 Scan_Data(Data.EIT_Setting_Information.FreqIndex(CurrentFreq)).Meas_Data((Proj_Num-1)*Data.EIT_Setting_Information.Total_Channel+Data_Step, 2) = Amp_Cal_Quad;
0380                 Scan_Data(Data.EIT_Setting_Information.FreqIndex(CurrentFreq)).Meas_Data((Proj_Num-1)*Data.EIT_Setting_Information.Total_Channel+Data_Step, 3) = sqrt(Amp_Cal_Real^ 2 + Amp_Cal_Quad^ 2);
0381                 Scan_Data(Data.EIT_Setting_Information.FreqIndex(CurrentFreq)).Meas_Data((Proj_Num-1)*Data.EIT_Setting_Information.Total_Channel+Data_Step, 4) = rad2deg(angle(Amp_Cal_Real + i * Amp_Cal_Quad));
0382 
0383 
0384                 else
0385                     msgbox('Scan Error');
0386                 end
0387             end
0388         end
0389     end

Generated on Wed 21-Jun-2017 09:29:07 by m2html © 2005