diff options
| author | Mirta <mirta@twine-s.com> | 2020-12-30 16:39:52 +0200 |
|---|---|---|
| committer | Mirta <mirta@twine-s.com> | 2020-12-30 16:39:52 +0200 |
| commit | 00a491d93733d4625ad329b2ba8237f445364b3f (patch) | |
| tree | 4b24c6fa78d7648f4bb7cefafa464bb0b063fec4 /Software/Stubs Collection/stubs/Scripts/Jig_Tester | |
| parent | 124ad4150f80c6846fdee41dbbda9848c105f6e5 (diff) | |
| download | Tango-00a491d9.tar.gz Tango-00a491d9.zip | |
merge
Diffstat (limited to 'Software/Stubs Collection/stubs/Scripts/Jig_Tester')
16 files changed, 0 insertions, 5341 deletions
diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Dryer_Jig.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Dryer_Jig.cs deleted file mode 100644 index 91b8944ca..000000000 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Dryer_Jig.cs +++ /dev/null @@ -1,457 +0,0 @@ -using System; -using System.Text; -using System.IO; -using System.Linq; -using System.Drawing; -using System.Diagnostics; -using System.Windows.Forms; -using System.Threading; -using System.Threading.Tasks; -using System.Collections.Generic; -using Tango.PMR.Stubs; -using Tango.Stubs; - - - -const int Dryer_UNDER_TEST=12; -//-------------------------------------------------------------------------------- -//--------------------------- -Int32 last_14bit_position; -Int32 position_32bit=0; -float [] DryerTemp = new float[20] ; - - -string [,] Units_status_Dryer = new string[Dryer_UNDER_TEST,2] { - {"Lid_Motor","Not Test"}, //0 - {"LS_Lid_Open","Not Test"}, //1 - {"LS_Lid_Close","Not Test"}, //2 - {"DRIVING_Motor","Not Test"}, //3 - {"SSI_Encoder","Not Test"}, //4 - {"LoadArm_Motor","Not Test"}, //5 - {"Blower_test","Not Test"}, //6 - {"Air_PT100_test","Not Test"}, //7 - {"Main_PT100_test","Not Test"}, //8 - {"Sec.PT100","Not Test"}, //9 - {"SSR1_heater","Not Test"}, //10 - {"SSR2_heater","Not Test"}, //11 - }; - - - -//-------------------------------------------------------------------------------- - - -public Task<decimal> Dryer_test( Action<string> settext, CancellationToken cancellationToken, string SN, string Location ) -{ - Task<decimal> task = null; - // Start a task and return it - task = Task.Run(() => - { - stubManager.Write("S/N:" +SN+ "\n"); - stubManager.Write("Location:" +Location+ "\n"); - - copy_table (Dryer_UNDER_TEST,Units_status_Dryer); - - settext("Test Dryer LId"); - Test_LId(); - - settext("Test Dryer motor Driving"); - Test_motor_driving(); - - settext("Test Dryer Load Arm"); - Test_Load_Arm (); - - settext("Test Dryer Blower heaters pt100"); - Test_Blower_heaters_pt100(); - - Status=write_to_file(SN,Location,Dryer_UNDER_TEST,"Dryer"); - - settext("End Test"); - - decimal result = 0; - - return result; - }); - return task; -} -//------------------------------------------ -int Test_Blower_heaters_pt100() -{ - - float ftemp=0; - float ftemp1=0; - - SetBit(F1_gpo_01,5,1); //turn off Blower - delay(500); - - var RetVal=Fpga_Read_Reg(F1_Tacho_reg8); - - DialogResult result = MessageBox.Show("Close Dryer Door", "Warning"); - - SetBit(F1_gpo_01,4,1); //Dir - SetBit(F1_gpo_01,3,1); //Torqer High - SetBit(F1_gpo_01,5,0); //turn on Blower - - const int LOW = 70;//0 - 100% - stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,F2_Prescaler1_reg11, 0xFF);//Freq 8 bit - stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,F2_BLOWER_PWM_LOW, LOW+1);//Low 8 bit - stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,F2_BLOWER_PWM_HIGH, 101 - LOW);//High 8 bit - - delay(1000); - RetVal=Fpga_Read_Reg(F1_Tacho_reg8); - stubManager.Write("blower Speed- " + RetVal.Value + "\n"); - if ((RetVal.Value<150)||(RetVal.Value>250) ) - { - Units_status[6,1]="Fail"; - stubManager.Write("Error,Fan rotate\n"); - return 0; - } - Units_status[6,1]="Pass"; - - stubManager.Write("Temp Befor heating \n"); - if (test_pt100_dryer()!=0) - return 0; - -float temp=0; -float temp1=4096*95*5; - - //Write GPO_DRYER_SSR1_CTRL SSR/SSR no. 1 - SetBit (F2_CTRL, 10, 1); //turn SSR1 on - stubManager.Write("\tTesting SSR no. 1\t"); - delay(1000); -var response1 = stubManager.Run<StubIntADCReadResponse>("StubIntADCReadRequest" ,16); - temp=Convert.ToUInt32 (response1.SamplingInBits); - temp=temp*800*3*100; - temp=temp/(4096*95*50); - stubManager.Write("Current = "+ temp + "A\n"); - if ((temp>6) || (temp<3)) - Units_status[10,1]="Fail"; - else - Units_status[10,1]="Pass"; - - //Write GPO_DRYER_SSR2_CTRL SSR/SSR no. 2 - SetBit (F2_CTRL, 9, 1); - stubManager.Write("\tTesting SSR no. 2\t"); - delay(1000); - response1 = stubManager.Run<StubIntADCReadResponse>("StubIntADCReadRequest" ,17); - temp=Convert.ToUInt32 (response1.SamplingInBits); - temp=temp*800*3*100; - temp=temp/(4096*95*100); - stubManager.Write("Current = "+ temp + "A\n"); - if ((temp>3) || (temp<1)) - Units_status[11,1]="Fail"; - else - Units_status[11,1]="Pass"; - - delay(50000); - -//check air temp - ftemp=Read_pt100(6); - stubManager.Write("After heating air temp is " + ftemp + "\n"); - ftemp = ftemp - DryerTemp[6]; - if ((ftemp<5)||(ftemp>40)) - Units_status[7,1]="Fail"; - else - Units_status[7,1]="Pass"; - - - -//check Main temp - ftemp=Read_pt100(7); - stubManager.Write("After heating Main temp is " + ftemp + "\n"); - ftemp = ftemp - DryerTemp[7]; - if ((ftemp<5)||(ftemp>60)) - Units_status[8,1]="Fail"; - else - Units_status[8,1]="Pass"; - -//check Sec. temp - ftemp=Read_pt100(8); - stubManager.Write("After heating Sec. temp is " + ftemp + "\n"); - ftemp = ftemp - DryerTemp[8]; - if ((ftemp<5)||(ftemp>60)) - Units_status[9,1]="Fail"; - else - Units_status[9,1]="Pass"; - - SetBit (F2_CTRL, 10, 0); //turn SSR1 off - SetBit (F2_CTRL, 9, 0); //turn SSR2 off - - SetBit(F1_gpo_01,5,1); //turn off Blower - return 1; - -} - - int test_pt100_dryer() - { - float ftemp=0; - int temp=0; - int j=0; - for (int i = 6; i < 9; i++) - { - DryerTemp[i]=Read_pt100(i); - - ftemp=DryerTemp[i]; - if ((ftemp>140)|| (ftemp<10)) - { - Units_status[i+1,1]="Fail"; - } - else - { - Units_status[i+1,1]="Pass"; - } - stubManager.Write(Units_status[i+1,0] +"\t"+ ftemp.ToString("F2")); - stubManager.Write("°C \t" + Units_status[i+1,1] + " \n"); - - } - return 0; - } -//------------------------------------------ -int Test_motor_driving () - -{ - MessageBox.Show("Open Dryer Door and add CHEATER to Door. ", "Warning"); - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,DryerMain_Motor, true, 2200); //rotate Dryer Motor. - stubManager.Write("Dryer Motor rotate \n "); - DialogResult result = MessageBox.Show("Are Dryer Motor rotate smoothly ?", "Warning",MessageBoxButtons.YesNo); - if(result == DialogResult.No) - { - Units_status[3,1]="Fail"; - stubManager.Write("Dryer Motor not rotate\n"); - } - else - { - Units_status[3,1]="Pass"; - stubManager.Write("Dryer Motor rotate\n"); - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,DryerMain_Motor,3); //stop motor - - return 0; -} -//---------------------------------- -int Test_Load_Arm() -{ - - Int32 temp3=0; - Int32 j=0; - Int32 i=0; - - if (!Encoder_Dryer_Exist()) - { - Units_status[4,1]="Fail"; - stubManager.Write("Encoder of Dryer Fail \n"); - return 0; - - } -// position_32bit=0; -//last_14bit_position - ReadEncoder_Dryer(); - position_32bit=0; - ReadEncoder_Dryer(); - Int32 temp=position_32bit; - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,DrierLoadingArm_Motor, false, 100);//40 - delay(50); -// temp=ReadEncoder_Dryer(); - while ((temp3<2)&& (i<12000) ) //wait until Limit Switch or timeout 12000*50msec=10min - { - i++; - delay(50); - ReadEncoder_Dryer(); -// stubManager.Write("position_32bit " + position_32bit +"\t"); - - if (Math.Abs(position_32bit)> (50*0x4000)) - temp3=3; - if ((position_32bit-temp)>20) - temp3++; -// stubManager.Write("Temp " + temp +"\n"); - temp=position_32bit; -// stubManager.Write("Temp3 " + temp3 +"\n"); - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,DrierLoadingArm_Motor, 3); - - DialogResult result1 = MessageBox.Show("Arm Motor rotate ?", "Warning",MessageBoxButtons.YesNo); - if(result1 == DialogResult.No) - { - Units_status[5,1]="Fail"; - stubManager.Write("Arm Motor Not rotate\n"); - return 0; - } - Units_status[5,1]="Pass"; - - DialogResult result2 = MessageBox.Show("Did Arm Motor arrive to mechanical stopper?. See picture on document", "Warning",MessageBoxButtons.YesNo); - if(result2 == DialogResult.No) - { - Units_status[4,1]="Fail"; - stubManager.Write("Arm Motor Not arrive to mecahnicl stopper \n"); - return 0; - } - - position_32bit=0; - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,DrierLoadingArm_Motor, true, 100); - delay(50); - i=0; - temp3=0; - - - while ((temp3<1)&& (i<12000) ) //wait until Limit Switch or timeout 12000*50msec=10min - { - - -// while ((Math.Abs(ReadEncoder_Dryer())< (30*0x4000))&& (i<12000)) -// -// { - delay(50); - i++; -// stubManager.Write("position_32bit " + position_32bit +"\t" + temp3 + "\n" ); - ReadEncoder_Dryer(); -// stubManager.Write("position_32bit " + position_32bit +"\t"); - - if (Math.Abs(position_32bit)> (30*0x4000)) - temp3=3; - if ((temp-position_32bit)>20) - temp3++; -// stubManager.Write("Temp " + temp +"\n"); - temp=position_32bit; - - - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,DrierLoadingArm_Motor, 3); - - DialogResult result3 = MessageBox.Show("Did Arm Motor make 30 rounds? See picture on document", "Warning",MessageBoxButtons.YesNo); - if(result3 == DialogResult.No) - { - Units_status[4,1]="Fail"; - stubManager.Write("Arm Motor not make 30 rounds\n"); - return 0; - } - Units_status[4,1]="Pass"; - return 1; -} -bool Encoder_Dryer_Exist() -{ - Int32 temp; - stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x6000019e, 0x0000); //triggers a TX transmission - - var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,0x60000190); - var response1 = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,0x60000192); - - temp = Convert.ToInt32 (response.Value & 0x0300); - if (temp==0) - return true; - else - return false; -} - - - -void ReadEncoder_Dryer() -{ - Int32 temp; - Int32 temp1; - stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x6000019e, 0x0000); //triggers a TX transmission - - var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,0x60000190); - var response1 = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,0x60000192); - - temp = Convert.ToInt32 (((((response1.Value <<16) + response.Value)>>10 ) & 0x3fff)); - if (temp>last_14bit_position) - { - temp1=temp-last_14bit_position; - position_32bit=position_32bit+temp1; - if (temp1>0x2000) - position_32bit=position_32bit-0x4000; - } - else if (temp<last_14bit_position) - - { - temp1=last_14bit_position-temp; - position_32bit=position_32bit-temp1; - if (temp1>0x2000) - position_32bit=position_32bit+0x4000; - } - - last_14bit_position=temp; - - return ; -} -//----------------------------------- -int Test_LId () -{ - Int32 Bit = 1; - int i = 0; - - UInt32 PowerStep_driver=0; - - if (Get_Driver_Type(4)>0x14) - PowerStep_driver=1; - - - - - stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,DryerLid_Motor, false, 0x800000+2*(1-PowerStep_driver)); //mov Dryer Lid motor down - delay(2000); - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,DryerLid_Motor, 2); //Hard stop hiZ motor - delay(1000); - - stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,DryerLid_Motor, false, 0x800000+2*PowerStep_driver); //mov Dryer Lid motor up - - while ((Bit != 0x0) && (i<200)) //wait until Limit Switch or timeout 200*50msec=10sec - { - Bit = GetBit(F1_LS_01_Direct,4); - delay(50); - i++; - } - - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,DryerLid_Motor, 2); //Hard stop hiZ motor - DialogResult result1 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.YesNo); - if((result1 == DialogResult.No) || (i==200) ) - { - Units_status[1,1]="Fail"; - stubManager.Write("LS_Lid_Open Not calibrate\n"); - return 0; - } - Units_status[1,1]="Pass"; - stubManager.Write("\n--------1-Lid Open--------"); - - stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,DryerLid_Motor, false, 0x800000+2*(1-PowerStep_driver)); //mov Dryer Lid motor down - - Bit = 1; - i=0; - while ((Bit != 0x0) && (i<200)) //wait until Limit Switch or timeout 200*50msec=10sec - { - Bit = GetBit(F1_LS_01_Direct,5); - delay(50); - i++; - } - - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,DryerLid_Motor, 2); //Hard stop hiZ motor - DialogResult result2 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.YesNo); - if((result2 == DialogResult.No) || (i==200)) - { - Units_status[2,1]="Fail"; - stubManager.Write("LS_Lid_Close Not calibrate\n"); - return 0; - } - - stubManager.Write("\n--------2-Lid Close--------"); - - Units_status[2,1]="Pass"; - Units_status[0,1]="Pass"; - return 1; - -} - -UInt32 Get_Driver_Type(UInt32 i) -{ - Int32 x_GET_PARAM = 0x20; - Int32 x_ADC_OUT = 0x12; - UInt32 ADC_out ; - - - var response = stubManager.Run<StubMotorResponse>("StubMotorRequest" ,i, (x_GET_PARAM | x_ADC_OUT)<<8, 0, 0); - - ADC_out= (response.RecivedData) & 0x001F; - stubManager.WriteHex(ADC_out,2) ; - return ADC_out ; -} - diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/DyeHead_Jig.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/DyeHead_Jig.cs deleted file mode 100644 index bf1a7d9c8..000000000 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/DyeHead_Jig.cs +++ /dev/null @@ -1,344 +0,0 @@ -using System; -using System.Text; -using System.IO; -using System.Linq; -using System.Drawing; -using System.Diagnostics; -using System.Windows.Forms; -using System.Threading; -using System.Threading.Tasks; -using System.Collections.Generic; -using Tango.PMR.Stubs; -using Tango.Stubs; - -const int DyeHead_UNDER_TEST=16; - -float [] DyeHeadTemp = new float[6] ; - -string [,] Units_status_DyeHead = new string[DyeHead_UNDER_TEST,2] { - {"Pt100_Zone_1","Not Test"}, - {"Pt100_Zone_2","Not Test"}, - {"Pt100_Zone_3","Not Test"}, - {"Pt100_Zone_4","Not Test"}, - {"Pt100_Zone_5","Not Test"}, - {"Pt100_Zone_6","Not Test"}, - {"Heater_Zone_1","Not Test"}, - {"Heater_Zone_2","Not Test"}, - {"Heater_Zone_3","Not Test"}, - {"Heater_Zone_4","Not Test"}, - {"Heater_Zone_5","Not Test"}, - {"Heater_Zone_6","Not Test"}, - {"Magnet ","Not Test"}, - {"LS_DH_LID_Open","Not Test"}, - {"LS_DH_LID_Close","Not Test"}, - {"DH_LID_Motor","Not Test"}, - }; - - - -//-------------------------------------------------------------------------------- - -public Task<decimal> DyeHead_test( Action<string> settext, CancellationToken cancellationToken, string SN, string Location) -{ - Task<decimal> task = null; - // Start a task and return it - task = Task.Run(() => - { - stubManager.Write("S/N:" +SN+ "\n"); - stubManager.Write("Location:" +Location+ "\n"); - - copy_table (DyeHead_UNDER_TEST,Units_status_DyeHead); - - DialogResult result1 = MessageBox.Show("Make shure, Dyehead is not hot", "Warning",MessageBoxButtons.OKCancel); - if(result1 == DialogResult.Cancel) - { - stubManager.AppendToFile(File_Name1,"Dyehead is too hot \tFail"); - stubManager.Write("Dyehead is too hot \tFail\n"); - return 0 ; - } - else - { - -//------------------------------- start test ----------- - settext("Test Magnet Motor LS"); - Test_Magnet_Motor_LS_DyeHead(); - settext("Test heaters &pt100"); - Test_heaters_pt100 (); - - Status=write_to_file(SN,Location,DyeHead_UNDER_TEST,"Dyehead"); - - settext("End Test"); - } - decimal result = 0; - - return result; - }); - return task; -} - - - -//-------------------------------------------- - int Test_Magnet_Motor_LS_DyeHead() -{ - Int32 Bit = 1; - - stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,MAGNET_Driver, false,0x800000+0); - stubManager.Write("\nTesting SSR no. 13 of magnet or motor driver"); - - DialogResult result = MessageBox.Show("Make shure, Magnet is open", "Warning",MessageBoxButtons.OKCancel); - if(result == DialogResult.Cancel) - { - Units_status[12,1]="Fail"; - stubManager.Write("Magnet Not Open\n"); - return 0; - } - Units_status[12,1]="Pass"; - - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,DyeingHeadLid_Motor, true, 250); - stubManager.Write("\n*** Open Lid Head "); - - Bit = 1; - int i=0; - while ((Bit != 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec - { - Bit = GetBit(F1_LS_01_Direct,7); - delay(50); - i++; - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,DyeingHeadLid_Motor,3); //stop motor - - DialogResult result1 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.OKCancel); - if(result1 == DialogResult.Cancel) - { - Units_status[15,1]="Fail"; - Units_status[13,1]="Fail"; - stubManager.Write("LS_DH_LID_Open Not calibrate\n"); - return 0; - } - Units_status[13,1]="Pass"; - stubManager.Write("\n*** Close Lid Head "); - Bit = 1; - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,DyeingHeadLid_Motor, false, 250); - i=0; - while ((Bit != 0x0) && (i<200)) //wait until Limit Switch or timeout 200*50msec=10sec - { - Bit = GetBit(F1_LS_01_Direct,8); - delay(50); - i++; - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,DyeingHeadLid_Motor,3); //stop motor - - DialogResult result2 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.OKCancel); - if(result2 == DialogResult.Cancel) - { - Units_status[14,1]="Fail"; - Units_status[15,1]="Fail"; - stubManager.Write("LS_DH_LID_Close Not calibrate\n"); - return 0; - } - Units_status[14,1]="Pass"; - stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,MAGNET_Driver, false,0x800000+2); - DialogResult result3 = MessageBox.Show("Make shure, Magnet is close", "Warning",MessageBoxButtons.OKCancel); - if(result3 == DialogResult.Cancel) - { - Units_status[12,1]="Fail"; - stubManager.Write("Magnet Not close\n"); - return 0; - } - Units_status[12,1]="Pass"; - Units_status[15,1]="Pass"; - - return 0; -} - - -//------------------------------------ -public int Test_heaters_pt100() -{ - -// uint utemp=0; - uint temp=0; - float ftemp=0; - float ftemp1=0; - float current=0; - - stubManager.Write("\nTemp Befor heating \n"); - if (test_pt100_dyehead()!=0) - return 0; - -//------------Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 8 - SetBit (F2_CTRL, 3, 1); - stubManager.Write("Testing SSR no. 8\tHeadZone-1\t"); - delay(15000); - adc_configuration(0x40,0x10); //a2d_address 0x40 channel 3 - adc_set_for_read_ch(0x40); - temp=adc_read_ch(0x40); - current= (float)(temp); - current=( float) (0.001221) * current; - SetBit (F2_CTRL, 3, 0); - ftemp=Read_pt100(1); - stubManager.Write("After heating " + ftemp +"c\tCurrent is "+ current + "\n"); - ftemp = ftemp - DyeHeadTemp[0]; - - if ((current>1.5)|| (current<0.9)||(ftemp<5)||(ftemp>40)) - Units_status[6,1]="Fail"; - else - Units_status[6,1]="Pass"; - - //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 7 - ftemp=Read_pt100(2); - ftemp1 = ftemp - DyeHeadTemp[1]; - if ( ftemp1>4) - Units_status[7,1]="Fail"; - else - { - SetBit (F2_CTRL, 4, 1); - stubManager.Write("Testing SSR no. 7\tHeadZone-2\t"); - delay(15000); - adc_configuration(0x40,0x08); //a2d_address 0x40 channel 4 - adc_set_for_read_ch(0x40); - temp=adc_read_ch(0x40); - current= (float)(temp); - current=( float) (0.001221) * current; - SetBit (F2_CTRL, 4, 0); - ftemp=Read_pt100(2); - stubManager.Write("After heating " + ftemp +"c\tCurrent is "+ current + "\n"); - ftemp = ftemp - DyeHeadTemp[1]; - if ((current<1.6)|| (current>2.1)||(ftemp<5)||(ftemp>40)) - Units_status[7,1]="Fail"; - else - Units_status[7,1]="Pass"; - } - - //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 6 - - ftemp=Read_pt100(3); - ftemp1 = ftemp - DyeHeadTemp[2]; - if ( ftemp1>4) - Units_status[8,1]="Fail"; - else - { - SetBit (F2_CTRL, 5, 1); - stubManager.Write("Testing SSR no. 6\tHeadZone-3\t"); - delay(15000); - adc_configuration(0x40,0x04); //a2d_address 0x40 channel 5 - adc_set_for_read_ch(0x40); - temp=adc_read_ch(0x40); - current= (float)(temp); - current=( float) (0.001221) * current; - SetBit (F2_CTRL, 5, 0); - ftemp=Read_pt100(3); - stubManager.Write("After heating " + ftemp +"c\tCurrent is "+current +"\n"); - ftemp = ftemp - DyeHeadTemp[2]; - if ((current<1.6)|| (current>2.1)||(ftemp<5)||(ftemp>40)) - Units_status[8,1]="Fail"; - else - Units_status[8,1]="Pass"; - } - - //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 5 - ftemp=Read_pt100(4); - ftemp1 = ftemp - DyeHeadTemp[3]; - if ( ftemp1>4) - Units_status[9,1]="Fail"; - else - { - SetBit (F2_CTRL, 6, 1); - stubManager.Write("Testing SSR no. 5\tHeadZone-4\t"); - delay(15000); - adc_configuration(0x44,0x80); //a2d_address 0x44 channel 0 - adc_set_for_read_ch(0x44); - temp=adc_read_ch(0x44); - current= (float)(temp); - current=( float) (0.001221) * current; - - SetBit (F2_CTRL, 6, 0); - ftemp=Read_pt100(4); - stubManager.Write("After heating " + ftemp +"c\tCurrent is "+current + "\n"); - ftemp = ftemp - DyeHeadTemp[3]; - if ((current<2.9)|| (current>3.4)||(ftemp<5)||(ftemp>40 )) - Units_status[9,1]="Fail"; - else - Units_status[9,1]="Pass"; - } - - //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 10 - ftemp=Read_pt100(5); - ftemp1 = ftemp - DyeHeadTemp[4]; - if ( ftemp1>4) - Units_status[10,1]="Fail"; - else - { - SetBit (F1_gpo_01, 2, 1); - stubManager.Write("Testing SSR no. 10\tHeadZone-5\t"); - delay(15000); - adc_configuration(0x44,0x40); //a2d_address 0x44 channel 1 - adc_set_for_read_ch(0x44); - temp=adc_read_ch(0x44); - current= (float)(temp); - current=( float) (0.001526) * current; - SetBit (F1_gpo_01, 2, 0); - ftemp=Read_pt100(5); - stubManager.Write("After heating " + ftemp +"c\tCurrent is "+current + "\n"); - ftemp = ftemp - DyeHeadTemp[4]; - if ((current<2.9)|| (current>3.4)||(ftemp<5)||(ftemp>40)) - Units_status[10,1]="Fail"; - else - Units_status[10,1]="Pass"; - } - - //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 11 - ftemp=Read_pt100(11); - ftemp1 = ftemp - DyeHeadTemp[5]; - if ( ftemp1>4) - Units_status[11,1]="Fail"; - else - { - SetBit (F3_GPO_01_bus, 4, 1); - stubManager.Write("Testing SSR no. 11\tHeadZone-6\t"); - delay(15000); - adc_configuration(0x44,0x40); //a2d_address 0x44 channel 1 - adc_set_for_read_ch(0x44); - temp=adc_read_ch(0x44); - current= (float)(temp); - current=( float) (0.001526) * current; - SetBit (F3_GPO_01_bus, 4, 0); - ftemp=Read_pt100(11); - stubManager.Write("After heating " + ftemp +"c\tCurrent is "+current + "\n"); - ftemp = ftemp - DyeHeadTemp[5]; - if ((current<1.6)|| (current>2.1)||(ftemp<5)||(ftemp>40)) - Units_status[11,1]="Fail"; - else - Units_status[11,1]="Pass"; - } - return 0; -} -//------------------------------------------------ - int test_pt100_dyehead() - { - float ftemp=0; - int temp=0; - int j=0; - for (int i = 0; i < 6; i++) - { - if (i==5) - j=11; - else - j=i+1; - DyeHeadTemp[i]=Read_pt100(j); - ftemp=DyeHeadTemp[i]; - if ((ftemp>100)|| (ftemp<10)) - { - Units_status[i,1]="Fail"; - } - else - { - Units_status[i,1]="Pass"; - } - stubManager.Write("Zone-"+(i+1)+ "\t" + ftemp.ToString("F2")); - stubManager.Write("°C\n"); - - } - return 0; - } diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/JIG_TESTER.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/JIG_TESTER.cs deleted file mode 100644 index a90acd902..000000000 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/JIG_TESTER.cs +++ /dev/null @@ -1,1032 +0,0 @@ -using System; -using System.Text; -using System.Linq; -using System.Drawing; -using System.Diagnostics; -using System.Windows.Forms; -using System.Threading; -using System.Threading.Tasks; -using System.Collections.Generic; -using Tango.PMR.Stubs; -using Tango.Stubs; - -include "Tango_define.cs" -include "MidTank_Jig.cs" -include "DyeHead_Jig.cs" -include "LTFU_Jig.cs" -include "RTFU_Jig.cs" -include "Winder_Jig.cs" -include "Dryer_Jig.cs" -include "Mixer_Jig.cs" -include "Location.cs" -include "New_DyeHead_Jig.cs" -include "New_Mixer_Jig.cs" - -//bool _click = false; -System.Timers.Timer timer; - - -string [,] Units_status = new string[50,2]; - -string File_Name2; -string File_Name1 ; -string Status; - - -const int Winder =0 ; -const int LTFU =1 ; - -string path; -string path1="C:\\Jig_Log\\";; - -bool BlinkOn = false; -bool timer_started = false; -CancellationTokenSource _cancellationTokenSource; - -int UNIT_UNDER_TEST ; - - -public void OnExecute(StubManager stubManager) -{ - string u =System.Environment.UserName; - - - - Label Run_text = new Label () - { - Width = 110, - Height =35, - Text = "", - BackColor = Color.White - }; - - System.Windows.Forms.Label _calc_text= new Label() - { - Width = 350, - Height = 125, - Text = "" - }; - void setLabel1TextSafe(string txt) - { - if (_calc_text.InvokeRequired) - _calc_text.Invoke(new Action(() => _calc_text.Text = txt)); - else - _calc_text.Text = txt; - } - - void timer_Tick(object sender, EventArgs e) - { - if (BlinkOn) - { - Run_text.ForeColor = Color.Green; - Run_text.BackColor = Color.White; - } - else - { - Run_text.ForeColor = Color.Red; - Run_text.BackColor = Color.Black; - - } - BlinkOn = !BlinkOn; - } - - timer = new System.Timers.Timer(); - timer.Elapsed += timer_Tick; - timer.Interval = new TimeSpan(0, 0, 0, 0, 500).TotalMilliseconds; - //stubManager.WriteLine("OK!"); - Form form1 = new Form(); -// Set the caption bar text of the form. - //form1.TopMost = true; - form1.Text = "Tests"; - form1.FormBorderStyle = FormBorderStyle.FixedDialog; - form1.MaximizeBox = false; - form1.MinimizeBox = false; - form1.StartPosition = FormStartPosition.CenterScreen; - form1.AutoSize = true; - form1.AutoSizeMode = AutoSizeMode.GrowAndShrink; - form1.BackColor = Color.FromArgb(233, 245, 255); -//start mat -// Create buttons to Winder. - Button Winder_btm = new Button () - { - Width = 80, - Height = 40, - }; - Winder_btm.Text = "Winder"; - Winder_btm.Location = new Point (4, 70); - Winder_btm.BackColor = System.Drawing.Color.Gray; - form1.Controls.Add(Winder_btm); - -// Create buttons to LTFU. - Button LTFU_btm = new Button () - { - Width = 80, - Height = 40, - }; - LTFU_btm.Text = "LTFU"; - LTFU_btm.Location = new Point (94, 70); - LTFU_btm.BackColor = System.Drawing.Color.Gray; - form1.Controls.Add(LTFU_btm); - -// Create buttons to Dryer. - Button Dryer_btm = new Button () - { - Width = 80, - Height = 40, - }; - Dryer_btm.Text = "Dryer"; - Dryer_btm.Location = new Point (184, 70); - Dryer_btm.BackColor = System.Drawing.Color.Gray; - form1.Controls.Add(Dryer_btm); - -// Create buttons to Dye head. - Button DyeHead_btm = new Button () - { - Width = 80, - Height = 40, - }; - DyeHead_btm.Text = "Dye head"; - DyeHead_btm.Location = new Point (4, 114); - DyeHead_btm.BackColor = System.Drawing.Color.Gray; - form1.Controls.Add(DyeHead_btm); - -// Create buttons to RTFU. - Button RTFU_btm = new Button () - { - Width = 80, - Height = 40, - }; - RTFU_btm.Text = "RTFU"; - RTFU_btm.Location = new Point (94, 114); - RTFU_btm.BackColor = System.Drawing.Color.Gray; - form1.Controls.Add(RTFU_btm); - -// Create buttons to Mid Tank. - Button MidTank_btm = new Button () - { - Width = 80, - Height = 40, - }; - MidTank_btm.Text = "Mid Tank"; - MidTank_btm.Location = new Point (184, 114); - MidTank_btm.BackColor = System.Drawing.Color.Gray; - form1.Controls.Add(MidTank_btm); - -// Create buttons to WHS. - Button WHS_btm = new Button () - { - Width = 80, - Height = 40, - }; - WHS_btm.Text = "WHS"; - WHS_btm.Location = new Point (94, 158); - WHS_btm.BackColor = System.Drawing.Color.Gray; - form1.Controls.Add(WHS_btm); - -// Create buttons to Mixer. - Button Mixer_btm = new Button () - { - Width = 80, - Height = 40, - }; - Mixer_btm.Text = "Mixer"; - Mixer_btm.Location = new Point (4, 158) ; - Mixer_btm.BackColor = System.Drawing.Color.Gray; - form1.Controls.Add(Mixer_btm); - -// Create buttons to New Mixer . - Button NewMixer_btm = new Button () - { - Width = 80, - Height = 40, - }; - NewMixer_btm.Text = "New Mixer"; - NewMixer_btm.Location = new Point (4, 202); - NewMixer_btm.BackColor = System.Drawing.Color.Gray; - form1.Controls.Add(NewMixer_btm); - -// Create buttons to NewDyeHead. - Button NewDyeHead_btm = new Button () - { - Width = 80, - Height = 40, - }; - NewDyeHead_btm.Text = "New Dye head"; - NewDyeHead_btm.Location = new Point (184, 158); - NewDyeHead_btm.BackColor = System.Drawing.Color.Gray; - form1.Controls.Add(NewDyeHead_btm); - -//-----Create Lable to Serial Number ----------- - - Label SN_lbl = new Label () - { - Width = 150, - Height = 20, - Text =" S/N" - }; - SN_lbl.Location = new Point (40, 10); - form1.Controls.Add(SN_lbl); - TextBox SN_TexstBox = new TextBox () - { - Width = 150, - Height = 20, - Text ="" - }; - SN_TexstBox.Location = new Point (40, 40); - form1.Controls.Add(SN_TexstBox); - //-----Create Lable to Part Number ----------- - - Label PN_lbl = new Label () - { - Width = 150, - Height = 20, - Text =" P/N" - }; - PN_lbl.Location = new Point (190, 10); - form1.Controls.Add(PN_lbl); - - TextBox PN_TexstBox = new TextBox () - { - Width = 150, - Height = 20, - Text ="" - }; - PN_TexstBox.Location = new Point (190, 40); - PN_TexstBox.CharacterCasing = CharacterCasing.Upper; - - form1.Controls.Add(PN_TexstBox); - //----------Create Lable to LOCATION---------- - Label Location_lbl = new Label () - { - Width = 150, - Height = 20, - Text ="LOCATION" - }; - Location_lbl.Location = new Point (440, 10); - form1.Controls.Add(Location_lbl); - - TextBox Location_TexstBox = new TextBox () - { - Width = 150, - Height = 20, - Text =Location_str - }; - Location_TexstBox.Location = new Point (440, 40); - form1.Controls.Add(Location_TexstBox); - - Run_text.Location = new System.Drawing.Point(300, 100); - Run_text.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - Run_text.Name = "blink_Text"; - Run_text.Font = new Font("Areal", 16, System.Drawing.FontStyle.Bold); - form1.Controls.Add(Run_text); -//-------------------------------------------------------------------------------- - Button Open_Log_btm = new Button() - { - Width = 100, - Height = 40, - }; - Open_Log_btm.Text = "Open Log File"; - Open_Log_btm.BackColor = System.Drawing.Color.Red; - Open_Log_btm.Location = new System.Drawing.Point(300, 286); - Open_Log_btm.Enabled= false; - form1.Controls.Add(Open_Log_btm); - - - Open_Log_btm.Click += (_, __) => - { - System.Diagnostics.Process.Start(File_Name2 ); - }; - - -//-------------------------------------------------------------------------------- - Button Stop_btm = new Button() - { - Width = 260, - Height = 40, - }; - Stop_btm.Text = "Stop process"; - Stop_btm.BackColor = System.Drawing.Color.Red; - Stop_btm.Location = new System.Drawing.Point(4, 286); - Stop_btm.Enabled= false; - - - - - Stop_btm.Click += (_, __) => - { - timer.Stop(); - timer_started = false; - _cancellationTokenSource.Cancel(); - stubManager.WriteLine("stop "); - - }; - - form1.Controls.Add(Stop_btm); - disable_test(); - void disable_test() - { - Winder_btm.Enabled = false; - LTFU_btm.Enabled = false; - RTFU_btm.Enabled = false; - Dryer_btm.Enabled = false; - MidTank_btm.Enabled= false; - DyeHead_btm.Enabled= false; - WHS_btm.Enabled= false; - Mixer_btm.Enabled= false; - NewMixer_btm.Enabled= false; - NewDyeHead_btm.Enabled= false; - Stop_btm.Enabled= false; - } - -// void enable_test() -// { -// Winder_btm.Enabled = true; -// LTFU_btm.Enabled = true; -// RTFU_btm.Enabled = true; -// Dryer_btm.Enabled = true; -// MidTank_btm.Enabled= true; -// DyeHead_btm.Enabled= true; -// WHS_btm.Enabled= true; -// Mixer_btm.Enabled= true; -// NewMixer_btm.Enabled= true; -// NewDyeHead_btm.Enabled= true; -// Stop_btm.Enabled= false; -// } - void Timer_en() - { - if (timer_started == false) - { - timer.Start(); - timer_started = true; - } - } - void Timer_dis() - { - if (timer_started == true) - { - timer.Stop(); - timer_started = false; - } - } - void end_test() - { disable_test(); - //enable_test(); - - Timer_dis(); - Open_Log_btm.Enabled= true; - Run_text.Text = Status; - if (Status=="Pass") - { - Run_text.ForeColor = Color.White;; - Run_text.BackColor = Color.Green; - } - else - { - Run_text.ForeColor = Color.Black; - Run_text.BackColor = Color.Red; - - } - } - -PN_TexstBox.TextChanged += (_,__)=> - - { - string temp; - - if (SN_TexstBox.Text.Length!=15) - { - disable_test(); - return; - } - - if (PN_TexstBox.Text.Contains("-")) - - { - temp=PN_TexstBox.Text.Substring(0, PN_TexstBox.Text.IndexOf("-")); - switch (temp) - { - case "AM00315": //DyeHead - NewDyeHead_btm.Enabled= true; - break; - case "AM00103": //Winder - Winder_btm.Enabled = true; - break; - case "AM00087": //MidTank - MidTank_btm.Enabled = true; - break; - case "AM00031": //LTFU - LTFU_btm.Enabled = true; - break; - case "AM00007": //Dryer - Dryer_btm.Enabled = true; - break; - case "AM00030": //RTFU - RTFU_btm.Enabled = true; - break; - case "AM00281": //New Mixer - NewMixer_btm.Enabled= true; - break; - // case "AM00281": // Mixer - // Mixer_btm.Enabled= true; - // break; - default: - disable_test(); - break; - } - } - else - disable_test(); - - - }; - SN_TexstBox.TextChanged += (_,__)=> - - { - string temp; - if (SN_TexstBox.Text.Length!=15) - { - disable_test(); - return; - } - if (PN_TexstBox.Text.Contains("-")) - { - - temp=PN_TexstBox.Text.Substring(0, PN_TexstBox.Text.IndexOf("-")); - - switch (temp) - { - case "AM00315": //DyeHead - NewDyeHead_btm.Enabled= true; - break; - case "AM00103": //Winder - Winder_btm.Enabled = true; - break; - case "AM00087": //MidTank - MidTank_btm.Enabled = true; - break; - case "AM00031": //LTFU - LTFU_btm.Enabled = true; - break; - case "AM00007": //Dryer - Dryer_btm.Enabled = true; - break; - case "AM00030": //RTFU - RTFU_btm.Enabled = true; - break; - case "AM00286": //New Mixer - NewMixer_btm.Enabled= true; - break; - default: - disable_test(); - break; -// case "AM00281": // Mixer -// Mixer_btm.Enabled= true; -// break; - } - } - else - disable_test(); - }; -//----------------------------------------- - Winder_btm.Click += async(_,__) => - { - Open_Log_btm.Enabled= false; - Run_text.Text = "Run"; - stubManager.WriteLine("DUT- Winder "); -// path="C:\\Users\\" + u + "\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\Winder\\" ; - path="C:\\Users\\" + u + "\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\Winder\\" ; - - Timer_en(); - _cancellationTokenSource = new CancellationTokenSource(); - try - { - // disable_test(); - Winder_btm.Enabled = false; - Stop_btm.Enabled= true; - var longRunningTask = await Winder_test(setLabel1TextSafe, _cancellationTokenSource.Token, SN_TexstBox.Text ,Location_TexstBox.Text ); - } - catch (OperationCanceledException) - { - disable_test(); - Status="Cancel"; - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,WINDER_Motor,3); //stop motor - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,SCREW,3); //stop motor - - stubManager.WriteLine("Task was cancelled"); - } - finally - { - _cancellationTokenSource.Dispose(); - } - end_test(); - }; -//----------------------------------------- - LTFU_btm.Click += async(_,__) => - { - Open_Log_btm.Enabled= false; - Run_text.Text = "Run"; - stubManager.WriteLine("DUT- LTFU "); - path="C:\\Users\\" + u + "\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\LTFU\\" ; - - Timer_en(); - _cancellationTokenSource = new CancellationTokenSource(); - try - { -// disable_test(); - LTFU_btm.Enabled = false; - Stop_btm.Enabled= true; - var longRunningTask = await LTFU_test(setLabel1TextSafe, _cancellationTokenSource.Token, SN_TexstBox.Text ,Location_TexstBox.Text ); - } - catch (OperationCanceledException) - { - disable_test(); - Status="Cancel"; - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,LLOADING_Motor, 3); //hold LRoading high z - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,LDANCER1_Motor, 3); //hold Lloading high z - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,LDANCER2_Motor, 3); //hold Lloading high z - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,LDRIVING_Motor,3); //stop motor - - Thread.Sleep(100); - Motor_SetParam(F1_MOTO_LLOADING_TX1,F1_MOTO_LLOADING_TX0,0x0a,0x14000000); //set kval ran to 0x14,0.65A - - - stubManager.WriteLine("Task was cancelled"); - } - finally - { - _cancellationTokenSource.Dispose(); - } - end_test(); - }; -//----------------------------------------- - Dryer_btm.Click += async(_,__) => - { - Open_Log_btm.Enabled= false; - Run_text.Text = "Run"; - stubManager.WriteLine("DUT- Dryer "); - path="C:\\Users\\" + u + "\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\Dryer\\" ; - - Timer_en(); - _cancellationTokenSource = new CancellationTokenSource(); - try - { -// disable_test(); - Dryer_btm.Enabled = false; - Stop_btm.Enabled= true; - var longRunningTask = await Dryer_test(setLabel1TextSafe, _cancellationTokenSource.Token, SN_TexstBox.Text ,Location_TexstBox.Text ); - } - catch (OperationCanceledException) - { - - disable_test(); - Status="Cancel"; - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,DryerLid_Motor, 2); //Hard stop hiZ motor - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,DryerMain_Motor,3); //stop motor - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,DrierLoadingArm_Motor, 3); - SetBit (F2_CTRL, 10, 0); //turn SSR1 off - SetBit (F2_CTRL, 9, 0); //turn SSR2 off - - - stubManager.WriteLine("Task was cancelled"); - } - finally - { - _cancellationTokenSource.Dispose(); - } - end_test(); - }; -//----------------------------------------- - DyeHead_btm.Click += async(_,__) => - { - Open_Log_btm.Enabled= false; - Run_text.Text = "Run"; - stubManager.WriteLine("DUT- DyeHead "); - path="C:\\Users\\" + u + "\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\DyeHead\\" ; - - Timer_en(); - _cancellationTokenSource = new CancellationTokenSource(); - try - { -// disable_test(); - DyeHead_btm.Enabled= false; - Stop_btm.Enabled= true; - var longRunningTask = await DyeHead_test(setLabel1TextSafe, _cancellationTokenSource.Token, SN_TexstBox.Text ,Location_TexstBox.Text ); - } - catch (OperationCanceledException) - { - disable_test(); - Status="Cancel"; - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,MAGNET_Driver,3); //stop magnet - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,DyeingHeadLid_Motor,3); //stop motor - SetBit (F2_CTRL, 3, 0); - SetBit (F2_CTRL, 4, 0); - SetBit (F2_CTRL, 5, 0); - SetBit (F2_CTRL, 6, 0); - SetBit (F1_gpo_01, 2, 0); - SetBit (F3_GPO_01_bus, 4, 0); - - - stubManager.WriteLine("Task was cancelled"); - } - finally - { - _cancellationTokenSource.Dispose(); - } - end_test(); - }; -//----------------------------------------- - NewDyeHead_btm.Click += async(_,__) => - { - Open_Log_btm.Enabled= false; - Run_text.Text = "Run"; - stubManager.WriteLine("DUT- New DyeHead "); - path="C:\\Users\\" + u + "\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\NewDyeHead\\" ; - - Timer_en(); - _cancellationTokenSource = new CancellationTokenSource(); - try - { -// disable_test(); - NewDyeHead_btm.Enabled= false; - Stop_btm.Enabled= true; - var longRunningTask = await NewDyeHead_test(setLabel1TextSafe, _cancellationTokenSource.Token, SN_TexstBox.Text ,Location_TexstBox.Text ); - } - catch (OperationCanceledException) - { - disable_test(); - Status="Cancel"; - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,MAGNET_Driver,3); //stop magnet - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,DyeingHeadLid_Motor,3); //stop motor - - for (Int32 i = 0; i < 12; i++) //???MF - { - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,0x40F000 + i*0x100); // turn all heaters OFF - Thread.Sleep(10); - } - - stubManager.WriteLine("Task was cancelled"); - } - finally - { - _cancellationTokenSource.Dispose(); - } - end_test(); - }; -//----------------------------------------- - RTFU_btm.Click += async(_,__) => - { - Open_Log_btm.Enabled= false; - Run_text.Text = "Run"; - stubManager.WriteLine("DUT- RTFU "); - path="C:\\Users\\" + u + "\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\RTFU\\" ; - Timer_en(); - _cancellationTokenSource = new CancellationTokenSource(); - try - { -// disable_test(); - RTFU_btm.Enabled= false; - Stop_btm.Enabled= true; - var longRunningTask = await RTFU_test(setLabel1TextSafe, _cancellationTokenSource.Token, SN_TexstBox.Text ,Location_TexstBox.Text ); - } - catch (OperationCanceledException) - { - disable_test(); - Status="Cancel"; - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,RLOADING_Motor, 3); //hold Rloading high z - Thread.Sleep(100); - Motor_SetParam(F1_MOTO_RLOADING_TX1,F1_MOTO_RLOADING_TX0,0x0a,0x14000000); //set kval ran to 0x14,0.65A - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,RDANCER_Motor, 3); //hold Rloading high z - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,RDRIVING_Motor,3); //stop motor - stubManager.WriteLine("Task was cancelled"); - } - finally - { - _cancellationTokenSource.Dispose(); - } - end_test(); - }; -//----------------------------------------- - MidTank_btm.Click += async(_,__) => - { - Open_Log_btm.Enabled= false; - Run_text.Text = "Run"; - stubManager.WriteLine("DUT- MidTank "); - path="C:\\Users\\" + u + "\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\MidTank\\" ; - Timer_en(); - _cancellationTokenSource = new CancellationTokenSource(); - try - { -// disable_test(); - MidTank_btm.Enabled= false; - Stop_btm.Enabled= true; - var longRunningTask = await MidTank_test(setLabel1TextSafe, _cancellationTokenSource.Token, SN_TexstBox.Text ,Location_TexstBox.Text ); - } - catch (OperationCanceledException) - { - disable_test(); - Status="Cancel"; - stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,F3_VALVE_OUT, 0); //close all valve - - stubManager.WriteLine("Task was cancelled"); - } - finally - { - _cancellationTokenSource.Dispose(); - } - end_test(); - }; -//---------------------------Mixer-------------- - Mixer_btm.Click += async(_,__) => - { - Open_Log_btm.Enabled= false; - Run_text.Text = "Run"; - stubManager.WriteLine("DUT- Mixer "); - path="C:\\Users\\" + u + "\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\Mixer\\" ; - - Timer_en(); - _cancellationTokenSource = new CancellationTokenSource(); - try - { -// disable_test(); - Mixer_btm.Enabled= false; - Stop_btm.Enabled= true; - var longRunningTask = await Mixer_test(setLabel1TextSafe, _cancellationTokenSource.Token, SN_TexstBox.Text ,Location_TexstBox.Text ); - } - catch (OperationCanceledException) - { - disable_test(); - Status="Cancel"; - SetBit (F1_gpo_01, 7, 0); //clear bit F1_VALVE_MIXCHIP_WASTECH - SetBit (F2_CTRL, 7, 0); //clear bit mixer SSR - stubManager.WriteLine("Task was cancelled"); - } - finally - { - _cancellationTokenSource.Dispose(); - } - end_test(); - }; -//---------------------------new Mixer-------------- - NewMixer_btm.Click += async(_,__) => - { - Open_Log_btm.Enabled= false; - Run_text.Text = "Run"; - stubManager.WriteLine("DUT- New Mixer "); - path="C:\\Users\\" + u + "\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\Mixer\\" ; - - Timer_en(); - _cancellationTokenSource = new CancellationTokenSource(); - try - { -// disable_test(); - NewMixer_btm.Enabled= false; - Stop_btm.Enabled= true; - var longRunningTask = await New_Mixer_test(setLabel1TextSafe, _cancellationTokenSource.Token, SN_TexstBox.Text ,Location_TexstBox.Text ); - } - catch (OperationCanceledException) - { - disable_test(); - Status="Cancel"; - // SetBit (F1_gpo_01, 7, 0); ????????????//clear bit F1_VALVE_MIXCHIP_WASTECH - // SetBit (F2_CTRL, 7, 0); //????????????clear bit mixer SSR - stubManager.WriteLine("Task was cancelled"); - } - finally - { - _cancellationTokenSource.Dispose(); - } - end_test(); - }; - -//---------------------------WHS-------------- - -//---------------------------------------- - _calc_text.Location = new System.Drawing.Point(300, 150); - _calc_text.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; - _calc_text.Name = ""; - _calc_text.Font = new Font("Areal", 16, System.Drawing.FontStyle.Bold); - form1.Controls.Add(_calc_text); -// stubManager.WriteLine("Start dialog!"); - form1.ShowDialog(); - return ; - - -} - //--------------------------------------------------------------------------------------------------------------------- -string write_to_file(string s_n,string loocation,int unit_nm,string DUT) - -{ -string Stemp="Pass"; -string Stemp1="P"; - -int i; - - for ( i=0;i<unit_nm;i++) - { - if ((Units_status[i,1]=="Fail")||(Units_status[i,1]=="Not Test")) - { Stemp="Fail"; - Stemp1="F"; - } - } - -if (!Directory.Exists(path)) - { - if (!Directory.Exists(path1)) - Directory.CreateDirectory(path1); - path=path1; - } - - - - File_Name2=Environment.ExpandEnvironmentVariables(path +Stemp1+"_"+ s_n +"_"+DUT +"_"+ DateTime.Now.ToString("MM_dd_yyyy_HH_mm_ss")+".log" ); - -stubManager.Write(File_Name2 +"\n"); - -stubManager.WriteToFile(File_Name2,DateTime.Now +" " ); -stubManager.Write(DateTime.Now +"\n" ); - -stubManager.AppendToFile(File_Name2,DUT + " Test Report" ); -stubManager.Write(DUT + " Test Report\n" ); - -stubManager.AppendToFile(File_Name2,DUT + " S/N: \t" + s_n ); -stubManager.Write(DUT + " S/N: \t" + s_n+"\n" ); - - -stubManager.AppendToFile(File_Name2,"Location:\t" + loocation +"\n" ); -stubManager.Write("Location:" + loocation+"\n\n" ); - - for ( i=0;i<unit_nm;i++) - { - stubManager.AppendToFile(File_Name2,Units_status[i,0]+"\t" + Units_status[i,1] ); - stubManager.Write(Units_status[i,0]+"\t" + Units_status[i,1]+"\n" ); - } - if (Stemp=="Fail") - { - stubManager.AppendToFile(File_Name2,"-------------"+DUT+ " Fail ------------ "); - stubManager.Write("-------------"+DUT+ " Fail ------------ "); - } - else - { - stubManager.AppendToFile(File_Name2,"-------------"+DUT+ " Pass ------------ "); - stubManager.Write("-------------"+DUT+ " Pass ------------ "); - } - return Stemp; -} - -//------------------------------------------------------------------------------------- -void copy_table(int testing_nm,string [,]Units_status_DUT) -{ - for (int i=0;i<testing_nm;i++) - { -/// Units_status[i,0]=Units_status_Winder[i,0]; -// Units_status[i,1]=Units_status_Winder[i,1]; - Units_status[i,0]=Units_status_DUT[i,0]; - Units_status[i,1]=Units_status_DUT[i,1]; - - } -} - -public int delay(Int32 ms_delay) - { -int i; - for (i=0 ;i<ms_delay;i=i+10) - { - Thread.Sleep(10); - if (_cancellationTokenSource.Token.IsCancellationRequested) - { - _cancellationTokenSource.Token.ThrowIfCancellationRequested(); - throw new TaskCanceledException(); - return 0; - } - } - return 0; - - } - - -Int32 GetBit(Int32 Adr, Int32 BitNo) -{ - Int32 BitMask; - var RetVal = Fpga_Read_Reg(Adr); - BitMask = 0x1 << BitNo; - if ( ( (Int32) RetVal.Value & BitMask) == BitMask ) - { - return 1; - } - else - { - return 0; - } - -} - -public Int32 SetBit(Int32 Adr, Int32 BitNo, Int32 Bit) -{ - Int32 BitMask; - var RetVal = Fpga_Read_Reg(Adr); - Int32 RV = (Int32) RetVal.Value; - - if (Bit == 0x1) - { - BitMask = 0x1 << BitNo; - RV = RV | BitMask; - Fpga_Write_Reg( Adr, RV ); - } - else if (Bit == 0x0) - { - BitMask = ~(0x1 << BitNo); - RV = RV & BitMask; - Fpga_Write_Reg(Adr, RV ); - } - return 1; -} - - -int Fpga_Write_Reg(Int32 Addr, Int32 Data) -{ - var response = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,Addr, Data); - - return 1; -} - - - -StubFpgaReadRegResponse Fpga_Read_Reg(Int32 Addr) -{ - var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,Addr); - response.Value = response.Value & 0xffff; - - return response; -} - -float Read_pt100(int i) -{ - var response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,i); // - - float ftemp = (float)response.TemperatureCMultBy100; - ftemp = ftemp / 100; - return (ftemp); -} -int Motor_SetParam(Int32 HighAdr, Int32 LowAdr, Int32 ParaAddr, uint ParaData1) -{ - - Int32 Temp = 0; - Temp = (ParaAddr << 8 ) + ( (Int32) ParaData1 >> 24); - - stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,HighAdr, (Temp & 0xffff)); - Temp = ((Int32)ParaData1 >> 8) & 0xffff; - stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,LowAdr, (Temp)); - - return 1; -} - -//-------------------------------- -int adc_configuration(uint I2C_Slave_Add,uint channel ) -{ - StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest(); - stubI2CWriteBytesRequest.I2CId = I2C_ID2; - stubI2CWriteBytesRequest.SlaveAddress = I2C_Slave_Add; - - UInt32 uInt32 = new UInt32(); - stubI2CWriteBytesRequest.BytesTWrite.Add(0x00);//Byte 0 to write - stubI2CWriteBytesRequest.BytesTWrite.Add(channel);//Byte 1 to Write, must be 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02 or 0x01 for different channels - stubI2CWriteBytesRequest.BytesTWrite.Add(0x80);//Byte 2 to Write - - var response = stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest); - - return 1; -} -//-------------------------------- -int adc_set_for_read_ch(uint I2C_Slave_Add) -{ - StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest(); - stubI2CWriteBytesRequest.I2CId = I2C_ID2; - stubI2CWriteBytesRequest.SlaveAddress = I2C_Slave_Add; - - UInt32 uInt32 = new UInt32(); - stubI2CWriteBytesRequest.BytesTWrite.Add(0x01);//Byte 0 to write - - var response = stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest); - - return 1; -} -//-------------------------------- - -uint adc_read_ch(uint I2C_Slave_Add) -{ - StubI2CReadBytesRequest stubI2CReadBytesRequest = new StubI2CReadBytesRequest(); - stubI2CReadBytesRequest.I2CId = I2C_ID2; - stubI2CReadBytesRequest.SlaveAddress = I2C_Slave_Add; - stubI2CReadBytesRequest.NumberOfBytesToRead = 2; // Number of bytes to read - - var response1 = stubManager.Run<StubI2CReadBytesResponse>(stubI2CReadBytesRequest); - uint temph=0; - uint templ=0; - uint temp; - temph=response1.ReadBytes[0]; - templ=response1.ReadBytes[1]; - temp = (temph << 8) | templ; - temp=temp & 0x0fff; - - return temp; -}
\ No newline at end of file diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Jig-TesterV 1.0.docx b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Jig-TesterV 1.0.docx Binary files differdeleted file mode 100644 index f7aa53997..000000000 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Jig-TesterV 1.0.docx +++ /dev/null diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Jig-TesterV 1.1.docx b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Jig-TesterV 1.1.docx Binary files differdeleted file mode 100644 index 948efd86b..000000000 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Jig-TesterV 1.1.docx +++ /dev/null diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/LTFU_Jig.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/LTFU_Jig.cs deleted file mode 100644 index 7d954e8b1..000000000 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/LTFU_Jig.cs +++ /dev/null @@ -1,496 +0,0 @@ -using System; -using System.Text; -using System.IO; -using System.Linq; -using System.Drawing; -using System.Diagnostics; -using System.Windows.Forms; -using System.Threading; -using System.Threading.Tasks; -using System.Collections.Generic; -using Tango.PMR.Stubs; -using Tango.Stubs; -//-------------------------------------------------------------------------------- - -const int LTFU_UNDER_TEST=12; -//--------------------------- - -string [,] Units_status_LTFU = new string[LTFU_UNDER_TEST,2] { - {"LS_LLOADMOTOR_Up","Not Test"}, //0 - {"LS_LLOADMOTOR_DOWN","Not Test"}, //1 - {"LLOADING_Motor","Not Test"}, //2 - {"LDRIVING_Motor","Not Test"}, //3 - {"LS_LDANCER_Left_DOWN","Not Test"}, //4 - {"LS_LDANCER_Left_UP","Not Test"}, //5 - {"LDANCER_Left_Motor","Not Test"}, //6 - {"LDANCER_Left_ROTENC","Not Test"}, //7 - {"LDANCER_Right_ROTENC","Not Test"}, //8 - {"LS_LDANCER_Right_DOWN","Not Test"}, //9 - {"LS_LDANCER_Right_UP","Not Test"}, //10 - {"LDANCER_Right_Motor","Not Test"}, //11 - - }; -//----------------------------------------------------- -//-------------------------------------------------------------------------------- - - -public Task<decimal> LTFU_test( Action<string> settext, CancellationToken cancellationToken, string SN, string Location) -{ - int no_of_test=12; - - Task<decimal> task = null; - // Start a task and return it - task = Task.Run(() => - { - - stubManager.Write("S/N:" +SN+ "\n"); - stubManager.Write("Location:" +Location+ "\n"); - - copy_table (no_of_test,Units_status_LTFU); - - settext("Test LLOADING LTFU"); - Test_LLOADING_LTFU(); - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,LLOADING_Motor, 3); //hold LRoading high z - delay(100); - Motor_SetParam(F1_MOTO_LLOADING_TX1,F1_MOTO_LLOADING_TX0,0x0a,0x14000000); //set kval ran to 0x14,0.65A - - settext("Test LDRIVING LTFU"); - Test_LDRIVING_LTFU(); - - settext("Test DANCER LTFU"); - -no_of_test=Test_DANCER_LTFU(); - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,LDANCER1_Motor, 3); //hold Lloading high z - - Status=write_to_file(SN,Location,no_of_test,"LTFU"); - - settext("End Test"); - - decimal result = 0; - - return result; - }); - return task; -} - - - //------------------------------------ -int Test_LLOADING_LTFU() -{ - int temp=1; - int counter; - - Motor_SetParam(F1_MOTO_LLOADING_TX1,F1_MOTO_LLOADING_TX0,0x0a,0x2c000000); //set kval ran to 0x2c- 1.3A - delay(100); - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,LLOADING_Motor, false,200); //move Rloading down - delay(3000); - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,LLOADING_Motor, 3); //hold Rloading high z - delay(1000); -//------------------------------------------ check F1_LS_LLOADMOTOR_UP------------------------------------------------ - - var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_02_Direct); //read LS - if ((response.Value & F1_LS_LLOADMOTOR_UP) !=F1_LS_LLOADMOTOR_UP ) //if LS_RLOADMOTOR_UP is up then error - { - DialogResult result = MessageBox.Show("Did LLOADIN MOTOR Move?", "Warning",MessageBoxButtons.YesNo); - if(result == DialogResult.Yes) - { - Units_status[0,1]="Fail"; - stubManager.Write("LS_LLOADMOTOR_UP\tFail\n"); - return 0; - } - else - { - Units_status[2,1]="Fail"; - stubManager.Write("LLOADMOTOR\tFail\n"); - return 0; - } - } -//----------------------------------------- mov LLOADING up ------------------------------------------------- - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,LLOADING_Motor,true,300); //move Lloading up - counter =0; - while ( counter < 200) - { - counter = counter + 1; - response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_02_Direct); //if LS_LLOADMOTOR_UP is up then move down - if ((response.Value & F1_LS_LLOADMOTOR_UP) != F1_LS_LLOADMOTOR_UP ) - counter=250; - - delay(100); - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,LLOADING_Motor, 3); //hold Lloading high z - - if (counter == 200) - { - Units_status[0,1]="Fail"; - stubManager.Write("LS_LLOADMOTOR_UP\tFail\n"); - return 0; - } - DialogResult result1 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.YesNo); - if(result1 == DialogResult.No) - { - Units_status[0,1]="Fail"; - stubManager.Write("LS_LLOADMOTOR_UP Not calibrate\n"); - return 0; - } - Units_status[0,1]="Pass"; - Units_status[2,1]="Pass"; - -//------------------------------------------ check F1_LS_LLOADMOTOR_DN------------------------------------------------ - - response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_02_Direct); //read LS - - if ((response.Value & F1_LS_LLOADMOTOR_DN) !=F1_LS_LLOADMOTOR_DN ) //if LS_LLOADMOTOR_DN is up then error - { - Units_status[1,1]="Fail"; - stubManager.Write("LS_LLOADMOTOR_DN\tFail\n"); - return 0; - } -//------------------------------------------ mov LLOADING dn ------------------------------------------------ - - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,LLOADING_Motor, false,300); //move Lloading down - counter =0; - while ( counter < 200) - { - counter = counter + 1; - response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_02_Direct); //if LS_LLOADMOTOR_UP is up then move down - if ((response.Value & F1_LS_LLOADMOTOR_DN) != F1_LS_LLOADMOTOR_DN ) - counter=250; - - delay(100); - } - - if (counter == 200) - { - Units_status[1,1]="Fail"; - stubManager.Write("LS_LLOADMOTOR_DN\tFail\n"); - return 0; - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,LLOADING_Motor, 3); //hold Lloading high z - - DialogResult result4 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.YesNo); - if(result4 == DialogResult.No) - { - Units_status[1,1]="Fail"; - stubManager.Write("LS_LLOADMOTOR_DN Not calibrate\n"); - return 0; - } - Units_status[1,1]="Pass"; - stubManager.Write("LLOADMOTOR\tPass\n"); - - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,LLOADING_Motor, false,200); //move Lloading down - delay(4000); - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,LLOADING_Motor, 3); //hold Lloading high z - - return 1 ; - -} - - -Int32 ReadEncoder(int i) -{ - Int32 temp; - - if (i==1) //LDANCER1_ROTENC == LTFU Danser Right - { - stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,F1_LDANCER1_ROTENC_TX, 0x0000); //triggers a TX transmission - - var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LDANCER1_ROTENC_LSB); - var response1 = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LDANCER1_ROTENC_MSB); - - temp = Convert.ToInt32 (((((response1.Value <<16) + response.Value)>>10 ) & 0x3fff)); - - - return temp; - } - //LDANCER2_ROTENC == LTFU Danser Left - - stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,F1_LDANCER2_ROTENC_TX, 0x0000); //triggers a TX transmission - var response2 = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LDANCER2_ROTENC_LSB); - var response3 = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LDANCER2_ROTENC_MSB); - - temp = Convert.ToInt32 (((((response3.Value <<16) + response2.Value)>>10 ) & 0x3fff)); - - - return temp; -} -//-------------------------------------------------------------------------------- -int Test_DANCER_LTFU() -{ - int counter; - Int32 temp_left_before; - Int32 temp_left_after; - Int32 temp_right_before; - Int32 temp_right_after; - - -//------------------------------------------ check F1_LS_LDANCER1_DN ------------------------------------------------ - MessageBox.Show("Make sure LDANCERs Down"); - var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_02_Direct); //read LS - - if ((response.Value & F1_LS_LDANCER1_UP) !=F1_LS_LDANCER1_UP ) //if F1_LS_LDANCER1_UP is up then error - { - Units_status[5,1]="Fail"; - stubManager.Write("LS_LDANCER_Left_UP\tFail\n"); - return 12; - } -//----------------------------------------- check F1_LS_LDANCER1_UP ------------------------------------------------- - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,LDANCER1_Motor,false,450); //move Lloading up - counter =0; - while ( counter < 300) - { - counter = counter + 1; - response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_02_Direct); //if F1_LS_LDANCER1_UP is up then move down - if ((response.Value & F1_LS_LDANCER1_UP) != F1_LS_LDANCER1_UP ) - counter=350; - - delay(100); - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,LDANCER1_Motor, 3); //hold Ldancer high z - if (counter == 300) - { - Units_status[5,1]="Fail"; - stubManager.Write("LS_LDANCER_Left_UP\tFail\n"); - return 12; - } - - response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_02_Direct); //read LS - if ((response.Value & F1_LS_LDANCER1_DN) !=F1_LS_LDANCER1_DN ) //if F1_LS_LDANCER1_DN is up then error - { - Units_status[4,1]="Fail"; - stubManager.Write("LS_LDANCER_Left_DN\tFail\n"); - return 12; - } - - DialogResult result5= MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.YesNo); - - if(result5== DialogResult.No) - { - Units_status[5,1]="Fail"; - stubManager.Write("LS_LDANCER_Left_UP Not calibrate\n"); - return 12; - } - - Units_status[5,1]="Pass"; - stubManager.Write("LS_LDANCER_Left_UP\tPass\n"); - -//----------------------------------------- mov LDANCER1_Motor down and check Ldancer encoder ------------------------------------------------- - temp_left_before= ReadEncoder(0); - delay(10); - - temp_right_before= ReadEncoder(1); - - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,LDANCER1_Motor,true,450); //move Rloading down - counter =0; - while ( counter < 300) - { - counter = counter + 1; - response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_02_Direct); //if LS_LDANCER1_DN is dn then move stop - if ((response.Value & F1_LS_LDANCER1_DN) != F1_LS_LDANCER1_DN ) - counter=350; - - delay(100); - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,LDANCER1_Motor, 3); //hold Rloading high z - // if (counter == 300) -// { -// Units_status[4,1]="Fail"; -// stubManager.Write("LS_LDANCER_Left_DN\tFail\n"); -// return 12; -// } - DialogResult result2 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.YesNo); - - if(result2 == DialogResult.No) - { - Units_status[4,1]="Fail"; - stubManager.Write("LS_LDANCER_Left_DN Not calibrate\n"); - return 12; - } - else - { - Units_status[4,1]="Pass"; - stubManager.Write("LS_LDANCER_Left_DN\tPass\n"); - } - Units_status[6,1]="Pass"; - stubManager.Write("LDANCER_Left_Motor\tPass\n"); - - temp_left_after= ReadEncoder(0); - delay(10); - temp_right_after= ReadEncoder(1); - delay(10); - - stubManager.Write("temp_left_before="+temp_left_before + "\ttemp_left_after="+temp_left_after +"\n"); - delay(10); - - stubManager.Write("temp_right_before="+temp_right_before + "\ttemp_right_after="+temp_right_after +"\n"); - delay(10); - - DialogResult result = MessageBox.Show("SSI Dancer Left led is Green(not blinking)?", "Warning",MessageBoxButtons.YesNo); - if(result == DialogResult.No) - { - Units_status[7,1]="Fail"; - stubManager.Write("LDANCER_Left_SSI\tFail\n"); - return 9; - - } - - if (temp_left_after>temp_left_before) - temp_left_before=temp_left_before+0x4000; - temp_left_before=temp_left_before-temp_left_after; - if ((temp_left_before> 5000) || (temp_left_before <200)) - { - Units_status[7,1]="Fail"; - stubManager.Write("LDANCER_Left_SSI\tFail\n"); - return 9; - } - Units_status[7,1]="Pass"; - stubManager.Write("LDANCER_Left_SSI\tPass\n"); - - - DialogResult result3 = MessageBox.Show("SSI Dancer_Right_led is Green(not blinking)?", "Warning",MessageBoxButtons.YesNo); - if(result3 == DialogResult.No) - { - Units_status[8,1]="Fail"; - stubManager.Write("LDANCER_Right_SSI\tFail\n"); - return 12; - } - - - if (temp_right_after<temp_right_before) - temp_right_after=temp_right_after+0x4000; - temp_right_before=temp_right_after-temp_right_before; - if ((temp_right_before< 5000) && (temp_right_before >200)) - { - Units_status[8,1]="Pass"; - stubManager.Write("LDANCER_Right_SSI\tPass\n"); - return 9; - } - -//------------------------------------------ check F1_LS_LSPARE2 ------------------------------------------------ - response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_02_Direct); //read LS - - if ((response.Value & F1_LS_LSPARE2) !=F1_LS_LSPARE2 ) //if F1_LS_LSPARE2 is up then error - { - Units_status[10,1]="Fail"; - stubManager.Write("LS_LDANCER_Right_UP\tFail\n"); - return 12; - } -//----------------------------------------- check F1_LS_LDANCER2_UP ------------------------------------------------- - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,LDANCER2_Motor,false,450); //move Lloading up - counter =0; - while ( counter < 300) - { - counter = counter + 1; - response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_02_Direct); //if F1_LS_LSPARE2 is up then move down - if ((response.Value & F1_LS_LSPARE2) != F1_LS_LSPARE2 ) - counter=350; - - delay(100); - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,LDANCER2_Motor, 3); //hold Ldancer high z - if (counter == 300) - { - Units_status[10,1]="Fail"; - stubManager.Write("LS_LDANCER_Right_UP\tFail\n"); - return 12; - } - - response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_02_Direct); //read LS - if ((response.Value & F1_LS_LSPARE1) !=F1_LS_LSPARE1 ) //if F1_LS_LSPARE1 is up then error - { - Units_status[9,1]="Fail"; - stubManager.Write("LS_LDANCER_Right_DN\tFail\n"); - return 12; - } - - DialogResult result7= MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.YesNo); - - if(result7== DialogResult.No) - { - Units_status[10,1]="Fail"; - stubManager.Write("LS_LDANCER_Right_UP Not calibrate\n"); - return 12; - } - - Units_status[10,1]="Pass"; - stubManager.Write("LS_LDANCER_Right_UP\tPass\n"); - -//----------------------------------------- mov LDANCER2_Motor down and check Ldancer encoder ------------------------------------------------- - temp_right_before= ReadEncoder(1); - - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,LDANCER2_Motor,true,450); //move Rloading down - counter =0; - while ( counter < 300) - { - counter = counter + 1; - response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_02_Direct); //if F1_LS_LSPARE1 is dn then move stop - if ((response.Value & F1_LS_LSPARE1) != F1_LS_LSPARE1 ) - counter=350; - - delay(100); - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,LDANCER2_Motor, 3); //hold Rloading high z - if (counter == 300) - { - Units_status[9,1]="Fail"; - stubManager.Write("LS_LDANCER_Right_DN\tFail\n"); - return 12; - } - DialogResult result8 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.YesNo); - - if(result8 == DialogResult.No) - { - Units_status[9,1]="Fail"; - stubManager.Write("LS_LDANCER_Right_DN Not calibrate\n"); - return 12; - } - - Units_status[9,1]="Pass"; - stubManager.Write("LS_LDANCER_Right_DN\tPass\n"); - - Units_status[11,1]="Pass"; - stubManager.Write("LDANCER_Right_Motor\tPass\n"); - - temp_right_after= ReadEncoder(1); - - stubManager.Write("temp_right_before="+temp_right_before + "\ttemp_right_after="+temp_right_after +"\n"); - - - if (temp_right_after<temp_right_before) - temp_right_after=temp_right_after+0x4000; - temp_right_before=temp_right_after-temp_right_before; - if ((temp_right_before< 5000) && (temp_right_before >200)) - { - Units_status[8,1]="Pass"; - stubManager.Write("LDANCER_Right_SSI\tPass\n"); - return 12; - } - Units_status[8,1]="Fail"; - stubManager.Write("LDANCER_Right_SSI\tFail\n"); - - - return 12; -} -//------------------------------------------------------------- -int Test_LDRIVING_LTFU() -{ - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,LDRIVING_Motor, true,200); //move Ldriving clockwise - stubManager.Write("LDRIVING_Motor Motor rotate \n "); - - DialogResult result = MessageBox.Show("Are LDRIVING Motor rotate?", "Warning",MessageBoxButtons.YesNo); - if(result == DialogResult.No) - { - Units_status[3,1]="Fail"; - stubManager.Write("LDRIVING Motor not rotate\n"); - } - else - { - Units_status[3,1]="Pass"; - stubManager.Write("LDRIVING Motor rotate\n"); - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,LDRIVING_Motor,3); //stop motor - - return 0; -} - - - diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/MidTank_Jig.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/MidTank_Jig.cs deleted file mode 100644 index 16139df2c..000000000 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/MidTank_Jig.cs +++ /dev/null @@ -1,201 +0,0 @@ -using System; -using System.Text; -using System.IO; -using System.Linq; -using System.Drawing; -using System.Diagnostics; -using System.Windows.Forms; -using System.Threading; -using System.Threading.Tasks; -using System.Collections.Generic; -using Tango.PMR.Stubs; -using Tango.Stubs; -using System.Timers; - -const int MidTank_UNDER_TEST =24; -int [] Convert_Midtank_No = new Int32 [8] {1,3,5,7,2,4,6,8}; -uint [,] ADC_Add_Chnl = new uint [8,2] { - {0x44,0x20}, - {0x44,0x08}, - {0x46,0x80}, - {0x46,0x20}, - {0x44,0x10}, - {0x44,0x04}, - {0x46,0x40}, - {0x46,0x10}, - }; - - -string [,] Units_status_MidTank = new string[MidTank_UNDER_TEST,2] { - {"Midtank1_Valve_Air","Not Test"}, //0 - {"Midtank1_Valve_Ink","Not Test"}, //1 - {"Midtank1_Pressure_Sensor","Not Test"}, //2 - {"Midtank2_Valve_Air","Not Test"}, //3 - {"Midtank2_Valve_Ink","Not Test"}, //4 - {"Midtank2_Pressure_Sensor","Not Test"}, //5 - {"Midtank3_Valve_Air","Not Test"}, //6 - {"Midtank3_Valve_Ink","Not Test"}, //7 - {"Midtank3_Pressure_Sensor","Not Test"}, //8 - {"Midtank4_Valve_Air","Not Test"}, //9 - {"Midtank4_Valve_Ink","Not Test"}, //10 - {"Midtank4_Pressure_Sensor","Not Test"}, //11 - {"Midtank5_Valve_Air","Not Test"}, //12 - {"Midtank5_Valve_Ink","Not Test"}, //13 - {"Midtank5_Pressure_Sensor","Not Test"}, //14 - {"Midtank6_Valve_Air","Not Test"}, //15 - {"Midtank6_Valve_Ink","Not Test"}, //16 - {"Midtank6_Pressure_Sensor","Not Test"}, //17 - {"Midtank7_Valve_Air","Not Test"}, //18 - {"Midtank7_Valve_Ink","Not Test"}, //19 - {"Midtank7_Pressure_Sensor","Not Test"}, //20 - {"Midtank8_Valve_Air","Not Test"}, //21 - {"Midtank8_Valve_Ink","Not Test"}, //22 - {"Midtank8_Pressure_Sensor","Not Test"}, //23 - }; -//-------------------------------------------------------------------------------- - -public Task<decimal> MidTank_test( Action<string> settext, CancellationToken cancellationToken, string SN, string Location) -{ - Task<decimal> task = null; - // Start a task and return it - task = Task.Run(() => - { - - stubManager.Write("S/N:" +SN+ "\n"); - stubManager.Write("Location:" +Location+ "\n"); - stubManager.Write("-----------------------\n"); - - copy_table (MidTank_UNDER_TEST,Units_status_MidTank); - stubManager.Write("+++++++++++++++++++\n"); - - settext("Test MidTank"); - Test_MIDTANK(); - - Status=write_to_file(SN,Location,MidTank_UNDER_TEST,"MidTank"); - settext("End Test"); - decimal result = 0; - - return result; - }); - return task; -} - - //------------------------------------ -int Test_MIDTANK() -{ - double Pressur_Volt; - double temp; - for (Int32 i=1;i<9;i++) - { - open_valve(i,1,1) ; //open Air valve - open_valve(i,0,1) ; //open Ink valve - delay(2000); - Pressur_Volt=read_pressuere_sense(i); - if ((Pressur_Volt>3 )||(Pressur_Volt<2)) - { - Units_status[(i-1)*3+2,1]="Fail"; - stubManager.Write("pressuere_sense of midtank" + i +"\tFail\n"); - } - else - { - close_valve(i,0,0) ; //close Ink valve - DialogResult result = MessageBox.Show("ADD 20cc air thru Ink valve of Midtank"+ i, "Warning"); - close_valve(i,1,0) ; //close Air valve - delay(2000); - - temp=read_pressuere_sense(i); - temp=temp-Pressur_Volt; - if ((temp>0.5) && ( temp <2)) - Units_status[(i-1)*3+2,1]="Pass"; - else - Units_status[(i-1)*3+2,1]="Fail"; - } - - close_valve(i,0,0) ; //close Air valve - close_valve(i,1,0) ; //close Ink valve - } - return 1; -} - -double read_pressuere_sense(Int32 Midtank_Nm) -{ -double Pressur_Volt; -double calc; -uint temp; - - adc_configuration((ADC_Add_Chnl[Midtank_Nm-1,0]),(ADC_Add_Chnl[Midtank_Nm-1,1]) ); //configure address and channel of midtank - adc_set_for_read_ch(ADC_Add_Chnl[Midtank_Nm-1,0]); - temp =adc_read_ch(ADC_Add_Chnl[Midtank_Nm-1,0]); - calc= (double)temp *2.5 / 4096.0; - Pressur_Volt = (1.96- calc) * 4.64 + 1.96; - stubManager.Write("pressure sense of midtank " + Midtank_Nm + "is " + Pressur_Volt+ "Volt\n"); - return Pressur_Volt; -} - - -//-------------------------------- -int open_valve (int valve_nm,int valve_type,int check_valve) //valve_type=0 is Air ,1 is Ink ; check_valve=1 send feedbak -{ - int temp1=Convert_Midtank_No[valve_nm-1] ; - - string temp; - SetBit (F3_VALVE_OUT,(((valve_type+1)*8)- temp1), 1); - - if (check_valve!=0) - { - temp="Air "; - if (valve_type==1) - temp="Ink "; - - DialogResult result = MessageBox.Show("Did " + temp + "Valve of Midtank " + valve_nm +" open?", "Warning",MessageBoxButtons.YesNo); - if(result == DialogResult.No) - { - Units_status[(valve_nm-1)*3+valve_type,1]="Fail"; - stubManager.Write(temp +"Valve\tFail\n"); - return 0; - } - else - { - Units_status[(valve_nm-1)*3+valve_type,1]="Pass"; - stubManager.Write(temp +"Valve\tOpen\n"); - return 1; - } - - } - return 1; - -} -//-------------------------------- -int close_valve (int valve_nm,int valve_type,int check_valve) -{ - int temp1=Convert_Midtank_No[valve_nm-1]; - - string temp; - SetBit (F3_VALVE_OUT,(((valve_type+1)*8)- temp1), 0); - if (check_valve!=0) - { - temp="Air"; - if (valve_type==1) - temp="Ink"; - - DialogResult result = MessageBox.Show("Did " + temp +" Valve of Midtank " + valve_nm +" close?", "Warning",MessageBoxButtons.YesNo); - if(result == DialogResult.No) - { - Units_status[(valve_nm-1)*3+valve_type,1]="Fail"; - stubManager.Write(temp +"Valve\tFail\n"); - return 0; - } - else - { - Units_status[(valve_nm-1)*3+valve_type,1]="Pass"; - stubManager.Write(temp +"Valve\tclose\n"); - return 1; - } - } - return 1; - - - - -} -//-------------------------------- diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Mixer_Jig.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Mixer_Jig.cs deleted file mode 100644 index c5d14855e..000000000 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Mixer_Jig.cs +++ /dev/null @@ -1,131 +0,0 @@ -using System; -using System.Text; -using System.IO; -using System.Linq; -using System.Drawing; -using System.Diagnostics; -using System.Windows.Forms; -using System.Threading; -using System.Threading.Tasks; -using System.Collections.Generic; -using Tango.PMR.Stubs; -using Tango.Stubs; - -const int Mixer_UNDER_TEST=3; - -float MixerTemp ; - -string [,] Units_status_Mixer = new string[Mixer_UNDER_TEST,2] { - {"Pt100_Mixer","Not Test"}, - {"Heater_Mixer","Not Test"}, - {"VALVE_Mixer","Not Test"}, - }; - - - -//-------------------------------------------------------------------------------- - -public Task<decimal> Mixer_test( Action<string> settext, CancellationToken cancellationToken, string SN, string Location) -{ - Task<decimal> task = null; - // Start a task and return it - task = Task.Run(() => - { - stubManager.Write("S/N:" +SN+ "\n"); - stubManager.Write("Location:" +Location+ "\n"); - - copy_table (Mixer_UNDER_TEST,Units_status_Mixer); - - -//------------------------------- start test ----------- - settext("Test heaters & pt100"); - Test_Mixer_heaters_pt100 (); - settext("Test VALVE Mixer"); - Test_VALVE_Mixer (); - - Status=write_to_file(SN,Location,Mixer_UNDER_TEST,"Mixer"); - - settext("End Test"); - - decimal result = 0; - - return result; - }); - return task; -} - -//-------------------------------------------- - int Test_VALVE_Mixer () - { - SetBit (F1_gpo_01, 7, 1); //set bit F1_VALVE_MIXCHIP_WASTECH - - DialogResult result = MessageBox.Show("MixCHIP Valve Open ?", "Warning",MessageBoxButtons.YesNo); - if(result == DialogResult.No) - { - Units_status[2,1]="Fail"; - stubManager.Write("VALVE_MIXCHIP_WASTECH Not open\n"); - return 0; - } - SetBit (F1_gpo_01, 7, 0); //clear bit F1_VALVE_MIXCHIP_WASTECH - - DialogResult result1 = MessageBox.Show("MixCHIP Valve close ?", "Warning",MessageBoxButtons.YesNo); - if(result1 == DialogResult.No) - { - Units_status[2,1]="Fail"; - stubManager.Write("VALVE_MIXCHIP_WASTECH Not close\n"); - return 0; - } - Units_status[2,1]="Pass"; - return 0; - } - -//------------------------------------ -public int Test_Mixer_heaters_pt100() -{ - -// uint utemp=0; - uint temp=0; - float ftemp=0; - float ftemp1=0; - float current=0; - - stubManager.Write("\nTemp Befor heating \n"); - - ftemp=Read_pt100(0); - if ((ftemp>100)|| (ftemp<10)) - { - Units_status[0,1]="Fail"; - return 0; - } - stubManager.Write("Temp Befor heating is"+ ftemp.ToString("F2")); - stubManager.Write("°C\n"); - - - - //Write F2_GPO_MIXCHIP_SSR4_CTRL SSR/SSR no. 4 - SetBit (F2_CTRL, 7, 1); - stubManager.Write("Testing SSR no. 4\tMIXCHIP \t"); - delay(10000); - adc_configuration(0x46,0x08); //a2d_address 0x46 channel 4 - adc_set_for_read_ch(0x46); - temp=adc_read_ch(0x46); - current= (float)(temp); - current=( float) (0.001221) * current; - SetBit (F2_CTRL, 7, 0); - - ftemp1=Read_pt100(0); - stubManager.Write("After heating " + ftemp1 +"c\tCurrent is "+ current + "\n"); - ftemp = ftemp1 - ftemp; - - if ((current>2.5)|| (current<1.5)||(ftemp<5)||(ftemp>25)) - { - Units_status[0,1]="Fail"; - Units_status[1,1]="Fail"; - } - else - { - Units_status[0,1]="Pass"; - Units_status[1,1]="Pass"; - } - return 0; -} diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/New_DyeHead_Jig.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/New_DyeHead_Jig.cs deleted file mode 100644 index 22cf14f3e..000000000 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/New_DyeHead_Jig.cs +++ /dev/null @@ -1,583 +0,0 @@ -using System; -using System.Text; -using System.IO; -using System.Linq; -using System.Drawing; -using System.Diagnostics; -using System.Windows.Forms; -using System.Threading; -using System.Threading.Tasks; -using System.Collections.Generic; -using Tango.PMR.Stubs; -using Tango.Stubs; - -const int New_DyeHead_UNDER_TEST=48; - -const Int32 MGNET_OPEN=0x42F801; -const Int32 MGNET_EN=0x42F701; -const Int32 MGNET_CLOSE=0x42F800; -const Int32 MGNET_DIS=0x42F700; - -const Int32 LS_FRONT=0X460110; -const Int32 LS_REAR=0X460120; -const Int32 LS_UPPER=0X460140; -const Int32 LS_SPARE=0X460180; - - -string EEPROM_Header="Header_1 "; //16 characters - -int Head_Mux_Channel_ID = 4; //Head MUX channel - char[] characters = new char[16]; - - -//float [] DyeHeadTemp = new float[6] ; - -string [,] Units_status_New_DyeHead = new string[New_DyeHead_UNDER_TEST,2] { - {"Pt100_Zone_1","Pass"}, //0 - {"Pt100_Zone_2","Pass"}, //1 - {"Pt100_Zone_3","Pass"}, //2 - {"Pt100_Zone_4","Pass"}, //3 - {"Pt100_Zone_5","Pass"}, //4 - {"Pt100_Zone_6","Pass"}, //5 - {"Pt100_Zone_7","Pass"}, //6 - {"Pt100_Zone_8","Pass"}, //7 - {"Pt100_Zone_9","Pass"}, //8 - {"Pt100_Zone_10","Pass"}, //9 - {"Pt100_Zone_11","Pass"}, //10 - {"Pt100_Zone_12","Pass"}, //11 - - {"Current_Zone_1","Pass"}, //12 - {"Current_Zone_2","Pass"}, //13 - {"Current_Zone_3","Pass"}, //14 - {"Current_Zone_4","Pass"}, //15 - {"Current_Zone_5","Pass"}, //16 - {"Current_Zone_6","Pass"}, //17 - {"Current_Zone_7","Pass"}, //18 - {"Current_Zone_8","Pass"}, //19 - {"Current_Zone_9","Pass"}, //20 - {"Current_Zone_10","Pass"}, //21 - {"Current_Zone_11","Pass"}, //22 - {"Current_Zone_12","Pass"}, //23 - - {"Break_Zone_1","Pass"}, //24 - {"Break_Zone_2","Pass"}, //25 - {"Break_Zone_3","Pass"}, //26 - {"Break_Zone_4","Pass"}, //27 - {"Break_Zone_5","Pass"}, //28 - {"Break_Zone_6","Pass"}, //29 - {"Break_Zone_7","Pass"}, //30 - {"Break_Zone_8","Pass"}, //31 - {"Break_Zone_9","Pass"}, //32 - {"Break_Zone_10","Pass"}, //33 - {"Break_Zone_11","Pass"}, //34 - {"Break_Zone_12","Pass"}, //35 - - {"Magnet ","Not Test"}, //36 - {"LS_REAR","Not Test"}, //37 - {"LS_FRONT","Not Test"}, //38 - {"DH_LID_Motor","Not Test"}, //39 - - {"EEPROM ","Pass"}, //40 - - {"ACTUATOR_IN","Not Test"}, //41 - {"LS_IN_UP","Not Test"}, //42 - {"LS_IN_DN","Not Test"}, //43 - {"ACTUATOR_OUT","Not Test"}, //44 - {"LS_OUT_UP","Not Test"}, //45 - {"LS_OUT_DN","Not Test"}, //46 - - {"LS_MAGNET_DN","Not Test"}, //47 - - - }; - - - -//-------------------------------------------------------------------------------- - -public Task<decimal> NewDyeHead_test( Action<string> settext, CancellationToken cancellationToken, string SN, string Location) -{ - Task<decimal> task = null; - // Start a task and return it - task = Task.Run(() => - { - stubManager.Write("S/N:" +SN+ "\n"); - stubManager.Write("Location:" +Location+ "\n"); - - copy_table (New_DyeHead_UNDER_TEST,Units_status_New_DyeHead); - DialogResult result1 = MessageBox.Show("Make shure, Dyehead is not hot", "Warning",MessageBoxButtons.OKCancel); - if(result1 == DialogResult.Cancel) - { - stubManager.AppendToFile(File_Name1,"Dyehead is too hot \tFail"); - stubManager.Write("Dyehead is too hot \tFail\n"); - return 0 ; - } - else - { - -//------------------------------- start test ----------- - settext("Test Magnet Motor LS"); -// stubManager.Run<ProgressResponse>("ProgressRequest" ,0xC3,0); // disable i2c - Test_Magnet_Motor_LS_New_DyeHead(); - delay(2000); -// stubManager.Run<ProgressResponse>("ProgressRequest" ,0xC3,1); // enable i2c - delay(2000); - - - settext("Test heaters &pt100"); - Test_new_heaters_pt100 (); - settext("Test Head EEPROM"); - Test_Head_EEPROM(SN); //pass - settext("Test Actuator In"); - Test_Actuator_in(); //pass - settext("Test Actuator Out"); - Test_Actuator_out(); //pass - Status=write_to_file(SN,Location,New_DyeHead_UNDER_TEST,"Dyehead"); - - settext("End Test"); - } - decimal result = 0; - - return result; - }); - return task; -} - -//------------------------------------------------------------- - int Test_Actuator_in() -{ - Int32 temp; - int i=0; - - stubManager.Run<ProgressResponse>("ProgressRequest" ,0xfead, 0xcaf000); //mov ACTUATOR-IN Dn - delay(2000); - - -// DialogResult result = MessageBox.Show("Is ACTUATOR-IN on Upper Limit Swtich?", "Warning",MessageBoxButtons.YesNo); -// if(result == DialogResult.Yes) -// { -// stubManager.Run<ProgressResponse>("ProgressRequest" ,0xfead, 0xcaf000); //mov ACTUATOR-IN down -// -// delay(2000); -// DialogResult result2 = MessageBox.Show("Is ACTUATOR-IN Move to Lower Limit Switch?", "Warning",MessageBoxButtons.YesNo); -// if(result2 != DialogResult.Yes) -// { -// Units_status[43,1]="Fail"; -// return 0; -// } -// stubManager.Run<ProgressResponse>("ProgressRequest" ,0xfead, 0xcaf001); //mov ACTUATOR-IN up -// delay(2000); -// DialogResult result3 = MessageBox.Show("Is ACTUATOR-IN Move to Upper Limit Switch?", "Warning",MessageBoxButtons.YesNo); -// if(result3 != DialogResult.Yes) -// { -// Units_status[42,1]="Fail"; -// return 0; -// } -// Units_status[41,1]="Pass"; -// Units_status[42,1]="Pass"; -// Units_status[43,1]="Pass"; -// return 0; -// } -// else - stubManager.Run<ProgressResponse>("ProgressRequest" ,0xfead, 0xcaf001); //mov ACTUATOR-IN up - delay(2000); - DialogResult result4 = MessageBox.Show("Is ACTUATOR-IN Move to Upper Limit Switch ?", "Warning",MessageBoxButtons.YesNo); - if(result4 != DialogResult.Yes) - { - Units_status[42,1]="Fail"; - return 0; - } - stubManager.Run<ProgressResponse>("ProgressRequest" ,0xfead, 0xcaf000); //mov ACTUATOR-IN down - delay(2000); - DialogResult result6 = MessageBox.Show("Is ACTUATOR-IN Move to Lower Limit Switch?", "Warning",MessageBoxButtons.YesNo); - if(result6 != DialogResult.Yes) - { - Units_status[43,1]="Fail"; - return 0; - } - Units_status[41,1]="Pass"; - Units_status[42,1]="Pass"; - Units_status[43,1]="Pass"; - return 0; -} - - - -//------------------------------------------------------------- - int Test_Actuator_out() -{ - Int32 temp; - int i=0; - stubManager.Run<ProgressResponse>("ProgressRequest" ,0xfead, 0xcaf100); //mov ACTUATOR-OUT down - delay(2000); - -// DialogResult result = MessageBox.Show("Is ACTUATOR-OUT on Upper Limit swtich?", "Warning",MessageBoxButtons.YesNo); -// if(result == DialogResult.Yes) -// { -// stubManager.Run<ProgressResponse>("ProgressRequest" ,0xfead, 0xcaf100); -// -// -// delay(2000); -// DialogResult result1 = MessageBox.Show("Is ACTUATOR-OUT Move to Lower Limit Switch?", "Warning",MessageBoxButtons.YesNo); -// if(result1 != DialogResult.Yes) -// { -// Units_status[46,1]="Fail"; -// return 0; -// } -// -// stubManager.Run<ProgressResponse>("ProgressRequest" ,0xfead, 0xcaf101); //mov ACTUATOR-OUT up -// delay(2000); -// DialogResult result3 = MessageBox.Show("Is ACTUATOR-OUT Move to Upper Limit Switch?", "Warning",MessageBoxButtons.YesNo); -// if(result3 != DialogResult.Yes) -// { -// Units_status[45,1]="Fail"; -// return 0; -// } -// Units_status[44,1]="Pass"; -// Units_status[45,1]="Pass"; -// Units_status[46,1]="Pass"; -// return 0; -// } -// else - stubManager.Run<ProgressResponse>("ProgressRequest" ,0xfead, 0xcaf101); //mov ACTUATOR-OUT up - delay(2000); - DialogResult result4 = MessageBox.Show("Is ACTUATOR-OUT Move to Upper Limit Switch?", "Warning",MessageBoxButtons.YesNo); - if(result4 != DialogResult.Yes) - { - Units_status[45,1]="Fail"; - return 0; - } - stubManager.Run<ProgressResponse>("ProgressRequest" ,0xfead, 0xcaf100); //mov ACTUATOR-OUT down - delay(2000); - DialogResult result6 = MessageBox.Show("Is ACTUATOR-OUT Move to Lower Limit Switch?", "Warning",MessageBoxButtons.YesNo); - if(result6 != DialogResult.Yes) - { - Units_status[46,1]="Fail"; - return 0; - } - Units_status[44,1]="Pass"; - Units_status[45,1]="Pass"; - Units_status[46,1]="Pass"; - return 0; - } - - -//-------------------------------------------- - int Test_Magnet_Motor_LS_New_DyeHead() -{ - Int32 temp; - int i=0; - -//---------------------- open Magnet ---------------------------- - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,MGNET_OPEN); // turn magnet on - delay(100); - - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,MGNET_EN); // magnet enable - delay(100); - - stubManager.Write("Magnet is Open\n"); - delay(1000); -//---------------------- chekc Magnet is open ---------------------------- - DialogResult result = MessageBox.Show("Make shure, Magnet is open and DyeHead cover on front.", "Warning",MessageBoxButtons.YesNo); - if(result == DialogResult.No) - { - Units_status[36,1]="Fail"; - stubManager.Write("Magnet is close\n"); - return 0; - } - temp=read_pio (LS_UPPER); // read LS_UPPER - if (temp != 0) - { - Units_status[47,1]="Fail"; - stubManager.Write("LS_UPPER of Magnet is close\n"); - } - - -//---------------------- Move DyeingHead Lid Motor rear---------------------------- - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,DyeingHeadLid_Motor, true, 250); - stubManager.Write("*** Open Lid Head ********* \n"); - - temp = 0; - i=0; - while ((temp == 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec - { - temp=read_pio (LS_REAR); // read LS_REAR - delay(50); - - i++; - } - - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,DyeingHeadLid_Motor,3); //stop motor - DialogResult result2 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.YesNo); - if(result2 == DialogResult.No || i==200) - { - Units_status[37,1]="Fail"; - stubManager.Write("LS_REAR Not calibrate\n"); - } - else - Units_status[37,1]="Pass"; -//---------------------- Move DyeingHead Lid Motor front---------------------------- - stubManager.Write("*** Close Lid Head \n"); - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,DyeingHeadLid_Motor, false, 250); - temp = 0; - i=0; - while ((temp == 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec - { - temp=read_pio (LS_FRONT); // read LS_FRONT - delay(50); - i++; - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,DyeingHeadLid_Motor,3); //stop motor - - DialogResult result3 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.YesNo); - if(result3 == DialogResult.No || i==200) - { - Units_status[38,1]="Fail"; - stubManager.Write("LS_FRONT Not calibrate\n"); - } - else - { - Units_status[39,1]="Pass"; - Units_status[38,1]="Pass"; - } -//---------------------- Close Magnet ---------------------------- - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,MGNET_CLOSE); // turn magnet off - delay(2000); - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,MGNET_DIS); // magnet Disable - - stubManager.Write("Magnet is Close\n"); - delay(1000); -//---------------------- chekc Magnet is close ---------------------------- - - DialogResult result4 = MessageBox.Show("Make shure, Magnet is close", "Warning",MessageBoxButtons.YesNo); - if(result4 == DialogResult.No) - { - Units_status[36,1]="Fail"; - stubManager.Write("Magnet is open\n"); - return 0; - } - Units_status[36,1]="Pass"; - temp=read_pio (LS_UPPER); // read LS_UPPER - if (temp == 0) - { - Units_status[47,1]="Fail"; - stubManager.Write("LS_UPPER of Magnet is open\n"); - return 0; - } - Units_status[47,1]="Pass"; - stubManager.Write("LS_UPPER of Magnet is close\n"); - return 0; - } -//------------------------------------ -public int Test_new_heaters_pt100() -{ - -// uint utemp=0; - Int32 temp=0; - float ftemp=0; - float ftemp1=0; - float current=0; - Double current_sense; - - for (Int32 i = 0; i < 12; i++) //12 - { - Int32 tdly=20000; -//---------------------- get tempurature of heaters---------------------------- - temp= 12+i/2+(i%2)*8; //HZone_1=12 - //HZone_2=20 - //HZone_3=13 - //HZone_4=21 - //HZone_5=14 - //HZone_6=22 - //HZone_7=15 - //HZone_8=23 - //HZone_9=16 - //HZone_10=24 - //HZone_11=17 - //HZone_11=25 - - var response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" , temp); //get temperature from the buffer - ftemp = (float)response.TemperatureCMultBy100; - ftemp = ftemp / 100; - - if ((ftemp>50)|| (ftemp<15)) - { - Units_status[i,1]="Fail"; - tdly=2000; - - } - stubManager.Write("Zone-"+(i+1)+ "-\t" + ftemp.ToString("F2")+"°C\n"); -//---------------------- get current of heaters ---------------------------- - var response1 = stubManager.Run<StubMidTankPressureSensorResponse>("StubMidTankPressureSensorRequest" ,0x8000 + i); // get current - current_sense=response1.Pressure; - if (current_sense>0.1) - { - Units_status[i+12,1]="Fail"; - } - stubManager.Write("current zone -" +(i+1)+ " is \t-" + current_sense +"\n"); -//---------------------- get Break of heaters ---------------------------- - var response2 = stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,0x440000 +(i/8)*0x100+(1<<(i&7))); // read break - temp = (Int32) (response2.Progress); - if ((temp & (1<<(i&7))) ==0) //if break ok - { - Units_status[i+24,1]="Fail"; - stubManager.Write("Break Zone "+(i+1)+ "\t is on\n"); - } - else - { - stubManager.Write("Break Zone "+(i+1)+ "\t is Off\n"); - } -//---------------------- turn heater on ---------------------------- -// stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,0x400200 +(i/8)*0x100+(1<<(i&7))); // turn heater on - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,0x40F001 + i*0x100); // turn heater on - - stubManager.Write("Heater- "+(i+1)+ "\t is On\n"); - delay(tdly); //delay 10 second -//---------------------- get current of heaters ---------------------------- - var response3 = stubManager.Run<StubMidTankPressureSensorResponse>("StubMidTankPressureSensorRequest" ,0x8000 + i); // get current - current_sense=response3.Pressure; - if ((current_sense<1.0) ||(current_sense>1.5) ) //if current not 1.25A - { - Units_status[i+12,1]="Fail"; - } - stubManager.Write("current zone -" +(i+1)+ " is \t-" + current_sense +"\n"); -//---------------------- get Break of heaters ---------------------------- - var response4 = stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,0x440000 +(i/8)*0x100+(1<<(i&7))); // read break - temp = (Int32) (response4.Progress); - if ((temp & (1<<(i&7))) ==0) //if break ok - { - stubManager.Write("Break Zone "+(i+1)+ "\t is On\n"); - Units_status[i+24,1]="Fail"; - } - else - { - stubManager.Write("Break Zone "+(i+1)+ "\t is Off\n"); - - } - temp= 12+i/2+(i%2)*8; - var response5 = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" , temp); //get temperature from the buffer - ftemp1 = (float)response5.TemperatureCMultBy100; - ftemp1 = ftemp1 / 100; - - if (((ftemp1-ftemp)<10)|| ((ftemp1-ftemp)>45)) - { - Units_status[i,1]="Fail"; - } - stubManager.Write("Zone-"+(i+1)+ " after heating is \t" + ftemp1.ToString("F2")+"°C\n"); -//---------------------- turn heater off ---------------------------- -// stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,0x400200 +(i/8)*0x100); // turn heater off - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,0x40F000 + i*0x100); // turn heater OFF - - stubManager.Write("Heater - "+(i+1)+ "\t is Off\n"); - - } - return 0; -} - -Int32 read_pio(Int32 i2c_input) -{ - Int32 temp=0; - var response = stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,i2c_input); // read break - - temp = (Int32) (response.Progress); - temp =temp & (i2c_input& 0xff); //if break ok - - return temp; -} -//end mati - - //enable_all_channel(); -public int Test_Head_EEPROM(string s_n) -{ - - enable_channel(Head_Mux_Channel_ID); // Chanel 0-7 => Disp0enser 0-7 - - Write_EEPROM(0xA0,s_n); - delay(200); //Sleep for 5 milli. - must! otherwise read 0xff (See data sheet ) - -//------------ go to address 0 on eeprom -------------- - StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest(); - stubI2CWriteBytesRequest.I2CId = I2C_ID3; - stubI2CWriteBytesRequest.SlaveAddress = 0xA0; - - UInt32 uInt32 = new UInt32(); - stubI2CWriteBytesRequest.BytesTWrite.Add(0);//Byte 0 to write - stubI2CWriteBytesRequest.BytesTWrite.Add(0);//Byte 0 to write - stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest); - - //Thread.Sleep(1); //Sleep for 10 milli. - Read_EEPROM(0xA0); - - delay(20); //Sleep for 5 milli. - must! otherwise read 0xff (See data sheet ) - return 0; - -} - -int enable_channel(int Channel_ID) -{ - uint Const_temp = 0x01; - - StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest(); - stubI2CWriteBytesRequest.I2CId = I2C_ID3; - stubI2CWriteBytesRequest.SlaveAddress = TCA9548A_address; - - Const_temp = Const_temp << Channel_ID; - stubI2CWriteBytesRequest.BytesTWrite.Add(Const_temp); - - var response = stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest); - - return 1; -} - -int Write_EEPROM (uint I2C_Slave_Add,string s_n ) -{ - - StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest(); - stubI2CWriteBytesRequest.I2CId = I2C_ID3; - stubI2CWriteBytesRequest.SlaveAddress = I2C_Slave_Add; - - UInt32 uInt32 = new UInt32(); - stubI2CWriteBytesRequest.BytesTWrite.Add(0);//Byte 0 to write - stubI2CWriteBytesRequest.BytesTWrite.Add(0);//Byte 0 to write - - //-------------------------------------------------------------- - characters = EEPROM_Header.ToCharArray(); - - for (int i=0;i<16;i++) - { - stubI2CWriteBytesRequest.BytesTWrite.Add(characters[i]); //add header - // characters[i]=0x20; - } - characters = s_n.ToCharArray(); - - for (int i=0;i<characters.Length ;i++) - { - - stubI2CWriteBytesRequest.BytesTWrite.Add(characters[i]); //add s/n - - } - var response = stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest); - - return 1; -} - -int Read_EEPROM(uint I2C_Slave_Add) -{ - char temp; - StubI2CReadBytesRequest stubI2CReadBytesRequest = new StubI2CReadBytesRequest(); - stubI2CReadBytesRequest.I2CId = I2C_ID3; - stubI2CReadBytesRequest.SlaveAddress = I2C_Slave_Add + 1; - stubI2CReadBytesRequest.NumberOfBytesToRead = 16; // Number of header bytes to read - - var response1 = stubManager.Run<StubI2CReadBytesResponse>(stubI2CReadBytesRequest); - uint temph=0; - char[] characters = EEPROM_Header.ToCharArray(); - for(int i=0; i<stubI2CReadBytesRequest.NumberOfBytesToRead;i++) - { - temp = Convert.ToChar(response1.ReadBytes[i]); - - - } - - return 1; -} diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/New_Mixer_Jig.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/New_Mixer_Jig.cs deleted file mode 100644 index 076f4ce68..000000000 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/New_Mixer_Jig.cs +++ /dev/null @@ -1,170 +0,0 @@ -using System; -using System.Text; -using System.IO; -using System.Linq; -using System.Drawing; -using System.Diagnostics; -using System.Windows.Forms; -using System.Threading; -using System.Threading.Tasks; -using System.Collections.Generic; -using Tango.PMR.Stubs; -using Tango.Stubs; - -const int New_Mixer_UNDER_TEST=4; - -const Int32 Valve_EN=0x42F501; -const Int32 Valve_DIS=0x42F500; -const Int32 Mixer_ON=0x42F401; -const Int32 Mixer_OFF=0x42F400; - -float NewMixerTemp ; - -string [,] Units_status_New_Mixer = new string[New_Mixer_UNDER_TEST,2] { - {"Pt100_Mixer","Pass"}, //0 - {"Heater_Mixer","Pass"}, //1 - {"Break_Mixer","Pass"}, //2 - {"VALVE_Mixer","Not Test"}, //3 - }; - - - -//-------------------------------------------------------------------------------- - -public Task<decimal> New_Mixer_test( Action<string> settext, CancellationToken cancellationToken, string SN, string Location) -{ - Task<decimal> task = null; - // Start a task and return it - task = Task.Run(() => - { - stubManager.Write("S/N:" +SN+ "\n"); - stubManager.Write("Location:" +Location+ "\n"); - - copy_table (New_Mixer_UNDER_TEST,Units_status_New_Mixer); - - -//------------------------------- start test ----------- - settext("Test heater & pt100"); - Test_New_Mixer_heater_pt100 (); - settext("Test VALVE Mixer"); - Test_VALVE_New_Mixer (); - - Status=write_to_file(SN,Location,New_Mixer_UNDER_TEST,"Mixer"); - - settext("End Test"); - - decimal result = 0; - - return result; - }); - return task; -} - -//-------------------------------------------- - int Test_VALVE_New_Mixer () - { - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,Valve_EN); // Valve enable - - DialogResult result = MessageBox.Show("MixCHIP Valve Open ?", "Warning",MessageBoxButtons.YesNo); - if(result == DialogResult.No) - { - Units_status[3,1]="Fail"; - stubManager.Write("VALVE_MIXCHIP_WASTECH Not open\n"); - return 0; - } - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,Valve_DIS); // Valve enable - - DialogResult result1 = MessageBox.Show("MixCHIP Valve close ?", "Warning",MessageBoxButtons.YesNo); - if(result1 == DialogResult.No) - { - Units_status[3,1]="Fail"; - stubManager.Write("VALVE_MIXCHIP_WASTECH Not close\n"); - return 0; - } - Units_status[3,1]="Pass"; - return 0; - } - -//------------------------------------ -public int Test_New_Mixer_heater_pt100() -{ - Int32 temp=0; - float ftemp=0; - float ftemp1=0; - float current=0; - Int32 tdly=15000; - Double current_sense; - -//---------------------- get tempurature of mixer---------------------------- - -// stubManager.Write("\nTemp Befor heating \n"); - - var response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" , 19); //get temperature from mixer - ftemp = (float)response.TemperatureCMultBy100; - ftemp = ftemp / 100; - if ((ftemp>100)|| (ftemp<10)) - { - Units_status[0,1]="Fail"; - tdly=1000; - } - stubManager.Write("Temp Befor heating is"+ ftemp.ToString("F2")); - stubManager.Write("°C\n"); -//---------------------- get current of mixer ---------------------------- - var response1 = stubManager.Run<StubMidTankPressureSensorResponse>("StubMidTankPressureSensorRequest" ,0x8000 + 20); // get current mixer - current_sense=response1.Pressure; - if (current_sense>0.1) - { - Units_status[1,1]="Fail"; - } - stubManager.Write("current is " + current_sense +"\n"); -//---------------------- get Break of Mixer ---------------------------- - var response2 = stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,0x460000 +0x10); // read break - temp = (Int32) (response2.Progress); - if ((temp & 0x10 )==0) //if break ok - { - Units_status[2,1]="Fail"; - stubManager.Write("Break Mixer is On\n"); - } - else - { - stubManager.Write("Break Mixer is off\n"); - } -//---------------------- turn Mixer on ---------------------------- - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,Mixer_ON); // turn mixer on - stubManager.Write("Mixer On\n"); - delay(tdly); //delay 20 second -//---------------------- get current of mixer ---------------------------- - var response3 = stubManager.Run<StubMidTankPressureSensorResponse>("StubMidTankPressureSensorRequest" ,0x8000 + 20); // get current - current_sense=response3.Pressure; - if ((current_sense<2) ||(current_sense>3) ) //if current not 2.5A - { - Units_status[3,1]="Fail"; - } - stubManager.Write("current in Mixer is " + current_sense +"\n"); -//---------------------- get Break of Mixer ---------------------------- - var response4 = stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,0x460000 +0x10); // read break - temp = (Int32) (response4.Progress); - if ((temp & 0x10 )==0) //if break ok - { - Units_status[2,1]="Fail"; - stubManager.Write("Break Mixer is On\n"); - } - else - { - stubManager.Write("Break Mixer is Off\n"); - } -//---------------------- get tempurature of mixer---------------------------- - var response5 = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" , 19); //get temperature from the mixer - ftemp1 = (float)response5.TemperatureCMultBy100; - ftemp1 = ftemp1 / 100; - - if (((ftemp1-ftemp)<5)|| ((ftemp1-ftemp)>50)) - { - Units_status[0,1]="Fail"; - } - stubManager.Write("Mixer after heating is \t" + ftemp1.ToString("F2")+"°C\n"); -//---------------------- turn Mixer off ---------------------------- - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,Mixer_OFF); // turn mixer off - stubManager.Write("Mixer is Off\n"); - return 0; -} diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/RTFU_Jig.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/RTFU_Jig.cs deleted file mode 100644 index 4e1223328..000000000 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/RTFU_Jig.cs +++ /dev/null @@ -1,367 +0,0 @@ -using System; -using System.Text; -using System.IO; -using System.Linq; -using System.Drawing; -using System.Diagnostics; -using System.Windows.Forms; -using System.Threading; -using System.Threading.Tasks; -using System.Collections.Generic; -using Tango.PMR.Stubs; -using Tango.Stubs; -//-------------------------------------------------------------------------------- -//-------------------------------------------------------------------------------- - -const int RTFU_UNDER_TEST=9; - -string [,] Units_status_RTFU = new string[RTFU_UNDER_TEST,2] { - {"LS_RLOADMOTOR_Up","Not Test"}, //0 - {"LS_RLOADMOTOR_DOWN","Not Test"}, //1 - {"RLOADING_Motor","Not Test"}, //2 - {"DRIVING_Motor","Not Test"}, //3 - {"LS_RDANCER_DOWN","Not Test"}, //4 - {"LS_RDANCER_UP","Not Test"}, //5 - {"LS_RLOADRAM_DOWN","Not Test"}, //6 - {"RDANCER_Motor","Not Test"}, //7 - {"RDANCER_ROTENC","Not Test"}, //8 - }; - - - -//----------------------------------------------------- - -public Task<decimal> RTFU_test( Action<string> settext, CancellationToken cancellationToken, string SN, string Location) -{ - Task<decimal> task = null; - // Start a task and return it - task = Task.Run(() => - { - - stubManager.Write("S/N:" +SN+ "\n"); - stubManager.Write("Location:" +Location+ "\n"); - - copy_table (RTFU_UNDER_TEST,Units_status_RTFU); - - settext("Test RLOADING RTFU"); - Test_RLOADING_RTFU(); - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,RLOADING_Motor, 3); //hold Rloading high z - - delay(100); - Motor_SetParam(F1_MOTO_RLOADING_TX1,F1_MOTO_RLOADING_TX0,0x0a,0x14000000); //set kval ran to 0x14,0.65A - - settext("Test RDRIVING RTFU"); - Test_RDRIVING_RTFU(); - - settext("Test DANCER RTFU"); - - Test_DANCER_RTFU(); - - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,RDANCER_Motor, 3); //hold Rloading high z - - Status=write_to_file(SN,Location,RTFU_UNDER_TEST,"RTFU"); - - settext("End Test"); - decimal result = 0; - - return result; - }); - return task; -} - - - //------------------------------------ -int Test_RLOADING_RTFU() -{ - int temp=1; - int counter; - - Motor_SetParam(F1_MOTO_RLOADING_TX1,F1_MOTO_RLOADING_TX0,0x0a,0x2c000000); //set kval ran to 0x40- 1.9A - delay(100); - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,RLOADING_Motor, true,200); //move Rloading down - delay(3000); - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,RLOADING_Motor, 3); //hold Rloading high z - delay(1000); -//------------------------------------------ check F1_LS_RLOADMOTOR_up------------------------------------------------ - - var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_03_Direct); //read LS - if ((response.Value & F1_LS_RLOADMOTOR_UP) !=F1_LS_RLOADMOTOR_UP ) //if LS_RLOADMOTOR_UP is up then error - { - DialogResult result = MessageBox.Show("Did RLOADIN MOTOR Move?", "Warning",MessageBoxButtons.YesNo); - if(result == DialogResult.Yes) - { - Units_status[0,1]="Fail"; - stubManager.Write("LS_RLOADMOTOR_UP\tFail\n"); - return 0; - } - else - { - Units_status[2,1]="Fail"; - stubManager.Write("RLOADMOTOR\tFail\n"); - return 0; - } - } - -//----------------------------------------- mov RLOADING up ------------------------------------------------- - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,RLOADING_Motor,false,300); //move Rloading up - counter =0; - while ( counter < 200) - { - counter = counter + 1; - response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_03_Direct); //if LS_RLOADMOTOR_UP is up then move down - if ((response.Value & F1_LS_RLOADMOTOR_UP) != F1_LS_RLOADMOTOR_UP ) - counter=250; - - delay(100); - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,RLOADING_Motor, 3); //hold Rloading high z - - if (counter == 200) - { - Units_status[0,1]="Fail"; - stubManager.Write("LS_RLOADMOTOR_UP\tFail\n"); - return 0; - } - DialogResult result1 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.YesNo); - if(result1 == DialogResult.No) - { - Units_status[0,1]="Fail"; - stubManager.Write("LS_RLOADMOTOR_UP Not calibrate\n"); - return 0; - } - Units_status[0,1]="Pass"; - Units_status[2,1]="Pass"; - -//------------------------------------------ check F1_LS_RLOADMOTOR_DN------------------------------------------------ - - response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_03_Direct); //read LS - - if ((response.Value & F1_LS_RLOADMOTOR_DN) !=F1_LS_RLOADMOTOR_DN ) //if LS_RLOADMOTOR_DN is up then error - { - Units_status[1,1]="Fail"; - stubManager.Write("LS_RLOADMOTOR_DN\tFail\n"); - return 0; - } -//------------------------------------------ mov RLOADING dn ------------------------------------------------ - - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,RLOADING_Motor, true,300); //move Rloading down - counter =0; - while ( counter < 200) - { - counter = counter + 1; - response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_03_Direct); //if LS_RLOADMOTOR_UP is up then move down - if ((response.Value & F1_LS_RLOADMOTOR_DN) != F1_LS_RLOADMOTOR_DN ) - counter=250; - - delay(100); - } - - if (counter == 150) - { - Units_status[1,1]="Fail"; - stubManager.Write("LS_RLOADMOTOR_DN\tFail\n"); - return 0; - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,RLOADING_Motor, 3); //hold Rloading high z - - DialogResult result2 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.YesNo); - if(result2 == DialogResult.No) - { - Units_status[1,1]="Fail"; - stubManager.Write("LS_RLOADMOTOR_DN Not calibrate\n"); - return 0; - } - Units_status[1,1]="Pass"; - stubManager.Write("RLOADMOTOR\tPass\n"); - - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,RLOADING_Motor, true,200); //move Rloading down - delay(2000); - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,RLOADING_Motor, 3); //hold Rloading high z - - return 1 ; - -} - -//---------------------------------- - -Int32 ReadEncoder() -{ - Int32 temp; - stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,F1_RDANCER_ROTENC_DATA_p_TX, 0x0000); //triggers a TX transmission - - var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_RDANCER_ROTENC_DATA_p_RX_lsb); - var response1 = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_RDANCER_ROTENC_DATA_p_RX_msb); - - temp = Convert.ToInt32 (((((response1.Value <<16) + response.Value)>>10 ) & 0x3fff)); - - - return temp; -} -//-------------------------------------------------------------------------------- -int Test_DANCER_RTFU() -{ - int counter; - Int32 temp; - Int32 temp1; - -//------------------------------------------ check F1_LS_RDANCER_DOWN ------------------------------------------------ - - MessageBox.Show("Make sure RDANCER Down"); - var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_03_Direct); //read LS - if ((response.Value & F1_LS_RDANCER_DOWN) !=F1_LS_RDANCER_DOWN ) //if F1_LS_RDANCER_DOWN is up then error - { - Units_status[4,1]="Fail"; - stubManager.Write("LS_RDANCER_DOWN\tFail\n"); - return 0; - } -//----------------------------------------- mov RDANCER_Motor up and check F1_LS_RDANCER_DOWN ------------------------------------------------- - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,RDANCER_Motor,true,10); //move Rloading up - counter =0; - while ( counter < 150) - { - counter = counter + 1; - response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_03_Direct); //if LS_RLOADMOTOR_UP is up then move down - if ((response.Value & F1_LS_RDANCER_DOWN) != F1_LS_RDANCER_DOWN ) - counter=250; - - delay(100); - } - if (counter == 150) - { - Units_status[4,1]="Fail"; - stubManager.Write("LS_RDANCER_DOWN\tFail\n"); - return 0; - } - Units_status[4,1]="Pass"; - stubManager.Write("LS_RDANCER_DOWN\tPass\n"); - -//----------------------------------------- check F1_LS_RDANCER_UP ------------------------------------------------- - - if ((response.Value & F1_LS_RDANCER_UP) !=F1_LS_RDANCER_UP ) //if F1_LS_RDANCER_UP is up then error - { - Units_status[5,1]="Fail"; - stubManager.Write("LS_RDANCER_UP\tFail\n"); - return 0; - } - counter =0; - while ( counter < 150) - { - counter = counter + 1; - response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_03_Direct); //if F1_LS_RDANCER_UP is up then move down - if ((response.Value & F1_LS_RDANCER_UP) != F1_LS_RDANCER_UP ) - counter=250; - - delay(100); - } - if (counter == 150) - { - Units_status[5,1]="Fail"; - stubManager.Write("LS_RDANCER_UP\tFail\n"); - return 0; - } - Units_status[5,1]="Pass"; - stubManager.Write("LS_RDANCER_UP\tPass\n"); - -//----------------------------------------- check F1_LS_RLOADRAM_DOWN ------------------------------------------------- - - if ((response.Value & F1_LS_RLOADRAM_DOWN) !=F1_LS_RLOADRAM_DOWN ) //if F1_LS_RLOADRAM_DOWN is up then error - { - Units_status[6,1]="Fail"; - stubManager.Write("LS_RLOADRAM_DOWN\tFail\n"); - return 0; - } - counter =0; - while ( counter < 150) - { - counter = counter + 1; - response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_03_Direct); //if F1_LS_RLOADRAM_DOWN is up then move down - if ((response.Value & F1_LS_RLOADRAM_DOWN) != F1_LS_RLOADRAM_DOWN ) - counter=250; - - delay(100); - } - if (counter == 150) - { - Units_status[6,1]="Fail"; - stubManager.Write("LS_RLOADRAM_DOWN\tFail\n"); - return 0; - } - Units_status[6,1]="Pass"; - stubManager.Write("LS_RLOADRAM_DOWN\tPass\n"); - -//----------------------------------------- mov RDANCER_Motor down and check rdancer encoder ------------------------------------------------- - temp= ReadEncoder(); - - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,RDANCER_Motor,false,10); //move Rloading down - counter =0; - while ( counter < 150) - { - counter = counter + 1; - response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_03_Direct); //if LS_RLOADMOTOR_UP is up then move down - if ((response.Value & F1_LS_RDANCER_DOWN) != F1_LS_RDANCER_DOWN ) - counter=250; - - delay(100); - } - if (counter == 150) - { - Units_status[4,1]="Fail"; - stubManager.Write("LS_RDANCER_DOWN\tFail\n"); - return 0; - } - Units_status[7,1]="Pass"; - stubManager.Write("RDANCER_Motor\tPass\n"); - - temp1= ReadEncoder(); - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,RDANCER_Motor, 3); //hold Rloading high z - - stubManager.Write("temp="+temp + "\temp1="+temp1 +"\n"); - - DialogResult result = MessageBox.Show("SSI Dancer led is Green(Not blinking)?", "Warning",MessageBoxButtons.YesNo); - if(result == DialogResult.No) - { - Units_status[8,1]="Fail"; - stubManager.Write("RDANCER_SSI\tFail\n"); - return 0; - } - - if (temp>temp1) - temp1=temp1+0x4000; - - temp1=temp1-temp; - if ((temp1> 15000) || (temp1 <1000)) - { - Units_status[8,1]="Fail"; - stubManager.Write("RDANCER_SSI\tFail\n"); - return 0; - } - Units_status[8,1]="Pass"; - stubManager.Write("RDANCER_SSI\tPass\n"); - - return 1; -} - - -//------------------------------------------------------------- -int Test_RDRIVING_RTFU() -{ - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,RDRIVING_Motor, true,200); //move Rdriving clockwise - stubManager.Write("RDRIVING_Motor Motor rotate \n "); - - DialogResult result = MessageBox.Show("Are RDRIVING Motor rotate?", "Warning",MessageBoxButtons.YesNo); - if(result == DialogResult.No) - { - Units_status[3,1]="Fail"; - stubManager.Write("RDRIVING Motor not rotate\n"); - } - else - { - Units_status[3,1]="Pass"; - stubManager.Write("RDRIVING Motor rotate\n"); - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,RDRIVING_Motor,3); //stop motor - - return 0; -} - - diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Tango_define.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Tango_define.cs deleted file mode 100644 index a66fa5fa1..000000000 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Tango_define.cs +++ /dev/null @@ -1,124 +0,0 @@ -using System; -using System.Text; -using System.Linq; -using System.Drawing; -using System.Diagnostics; -using System.Windows.Forms; -using System.Threading; -using System.Threading.Tasks; -using System.Collections.Generic; -using Tango.PMR.Stubs; -using Tango.Stubs; - - -const Int32 F1_LS_01_Direct = 0x60000020 ; -const Int32 F1_LS_02_Direct = 0x60000030 ; -const Int32 F1_LS_03_Direct = 0x60000040 ; - -const Int32 F1_gpo_01 = 0x600003D2 ; - - -const Int32 F2_CTRL = 0x600004E2 ; - -const Int32 F3_GPO_01_bus = 0x600008C2; - -const Int32 TCA9548A_address = 0xE2; - - -const Int32 I2C_ID2 = 2; -const Int32 I2C_ID3 = 3; - - - -const Int32 F1_SCREW_ROTENC_lsb = 0x60000100; -const Int32 F1_SCREW_ROTENC_msb = 0x60000102; - - - - - - - - - - -const Int32 F3_VALVE_OUT = 0x600008e2; - - -const Int32 F1_Tacho_reg8 = 0x600001e0 ; - - - - -//-------------------DEFINE Motors Parameters------------------ - -const Int32 F1_MOTO_RLOADING_TX1 = 0x60000202; -const Int32 F1_MOTO_RLOADING_TX0 = 0x60000200; -const Int32 F1_MOTO_RLOADING_RX1 = 0x60000206; -const Int32 F1_MOTO_RLOADING_RX0 = 0x60000204; - -//-------------------DEFINE Limit Switch--------------- - -const Int32 F1_LS_RLOADMOTOR_UP = 0x0040 ; -const Int32 F1_LS_RLOADMOTOR_DN = 0x0080 ; -const Int32 F1_LS_RDANCER_UP = 0x0100; -const Int32 F1_LS_RDANCER_DOWN = 0x0200; -const Int32 F1_LS_RLOADRAM_DOWN = 0x0020; - -const Int32 F1_RDANCER_ROTENC_DATA_p_RX_lsb = 0x600001a0; -const Int32 F1_RDANCER_ROTENC_DATA_p_RX_msb = 0x600001a2; -const Int32 F1_RDANCER_ROTENC_DATA_p_TX = 0x600001ae; - - - -const Int32 F2_Prescaler1_reg11 = 0x60000512 ; -const Int32 F2_BLOWER_PWM_LOW = 0x600007EC ; -const Int32 F2_BLOWER_PWM_HIGH = 0x600007EE ; - - -//-------------------DEFINE Motors------------------ -const Int32 CleaningHead_Motor = 0; -const Int32 CleaningMechanisim_Motor= 1; -const Int32 DyeingHeadLid_Motor = 2; -const Int32 DryerMain_Motor = 3; -const Int32 DryerLid_Motor = 4; -const Int32 DrierLoadingArm_Motor = 5; - -const Int32 SCREW = 14; -const Int32 WINDER_Motor = 15; - -const Int32 LDANCER1_Motor = 16; -const Int32 LDANCER2_Motor = 17; -const Int32 LDRIVING_Motor = 18; -const Int32 LLOADING_Motor = 19; - -const Int32 RDANCER_Motor = 21; -const Int32 RDRIVING_Motor = 22; -const Int32 MAGNET_Driver = 23; //replace RLOADARM -const Int32 RLOADING_Motor = 24; - - -//-------------------DEFINE Motors Parameters------------------ - -const Int32 F1_MOTO_LLOADING_TX1 = 0x60000232; -const Int32 F1_MOTO_LLOADING_TX0 = 0x60000230; - -const Int32 F1_LS_LLOADMOTOR_UP = 0x0100 ; -const Int32 F1_LS_LLOADMOTOR_DN = 0x0200 ; -const Int32 F1_LS_LDANCER1_UP = 0x1000; -const Int32 F1_LS_LDANCER1_DN = 0x2000; -const Int32 F1_LS_LDANCER2_UP = 0x0400; -const Int32 F1_LS_LDANCER2_DN = 0x0800; -const Int32 F1_LS_LLOADRAM_LF = 0x0080; -const Int32 F1_LS_LLOADRAM_RT = 0x0040; -const Int32 F1_LS_LSPARE1 = 0x0008; //dn -const Int32 F1_LS_LSPARE2 = 0x0004; //up - - -const Int32 F1_LDANCER1_ROTENC_MSB = 0x600001c2; -const Int32 F1_LDANCER1_ROTENC_LSB = 0x600001c0; -const Int32 F1_LDANCER1_ROTENC_TX = 0x600001ce; - -const Int32 F1_LDANCER2_ROTENC_MSB = 0x600001b2; -const Int32 F1_LDANCER2_ROTENC_LSB = 0x600001b0; -const Int32 F1_LDANCER2_ROTENC_TX = 0x600001be; diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Winder_Jig.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Winder_Jig.cs deleted file mode 100644 index 3ad16cb5e..000000000 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Winder_Jig.cs +++ /dev/null @@ -1,189 +0,0 @@ -using System; -using System.Text; -using System.IO; -using System.Linq; -using System.Drawing; -using System.Diagnostics; -using System.Windows.Forms; -using System.Threading; -using System.Threading.Tasks; -using System.Collections.Generic; -using Tango.PMR.Stubs; -using Tango.Stubs; - - -const int Winder_UNDER_TEST=6; - -string [,] Units_status_Winder = new string[Winder_UNDER_TEST,2] { - {"Winder_Motor","Not Test"}, - {"Screw_Motor","Not Test"}, - {"LS_Screw_Right","Not Test"}, - {"LS_Screw_Left","Not Test"}, - {"Screw_Encoder","Not Test"}, - {"SW_Spool_Exist","Not Test"}, - }; - - -//-------------------------------------------------------------------------------- - -public Task<decimal> Winder_test( Action<string> settext, CancellationToken cancellationToken, string SN, string Location) -{ - Task<decimal> task = null; - // Start a task and return it - task = Task.Run(() => - { - - stubManager.Write("S/N:" +SN+ "\n"); - stubManager.Write("Location:" +Location+ "\n"); - - copy_table (Winder_UNDER_TEST,Units_status_Winder); - DialogResult result2 = MessageBox.Show("Insert Spool"); - - settext("Test_Winder_motor"); - Test_Winder_motor(); - settext("Test_Screw_LS_Motor_Encoder"); - Test_Screw_LS_Motor_Encoder (); - settext("Test_Pooler_Exis"); - Test_Pooler_Exist (); - - Status=write_to_file(SN,Location,Winder_UNDER_TEST,"Winder"); - settext("End Test"); - decimal result = 0; - - return result; - }); - return task; -} - -//------------------------------------------ -public int Test_Winder_motor () - -{ - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,WINDER_Motor, true, 500); //rotate Winder Motor. - stubManager.Write("Winder Motor rotate \n"); - DialogResult result = MessageBox.Show("Are Winder Motor rotate?", "Warning",MessageBoxButtons.YesNo); - if (_cancellationTokenSource.Token.IsCancellationRequested) - { - _cancellationTokenSource.Token.ThrowIfCancellationRequested(); - throw new TaskCanceledException(); - return 0; - } - if(result == DialogResult.No) - { - Units_status[0,1]="Fail"; - stubManager.Write("Winder Motor not rotate\n"); - } - else - { - Units_status[0,1]="Pass"; - stubManager.Write("Winder Motor rotate\n"); - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,WINDER_Motor,3); //stop motor - - return 0; -} - - -//-------------------------------------------- - int Test_Screw_LS_Motor_Encoder() -{ - UInt32 temp ; - Int32 Bit = 1; - - - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,SCREW, false, 250); //rotate screw Motor out. - delay(1000); - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,SCREW,3); //stop motor - - DialogResult result2 = MessageBox.Show("Did screw Motor move ?", "Warning",MessageBoxButtons.YesNo); - if(result2 == DialogResult.No) - { - Units_status[1,1]="Fail"; - stubManager.Write("Screw Motor not move\n"); - return 0; - } - Units_status[1,1]="Pass"; - - stubManager.Write("Screw Motor rotate \n"); - - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,SCREW, true, 250); - stubManager.Write("Move screw in\n"); - - Bit = 1; - int i=0; - while ((Bit != 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec - { - Bit = GetBit(F1_LS_03_Direct,0); - delay(50); - i++; - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,SCREW,3); //stop motor - - DialogResult result1 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.YesNo); - if(result1 == DialogResult.No) - { - Units_status[2,1]="Fail"; - stubManager.Write("LS_SCREW_RIGHT Not calibrate\n"); - return 0; - } - Units_status[2,1]="Pass"; - stubManager.Write("Move screw out\n"); - - stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,F1_SCREW_ROTENC_lsb, 0x0000); //clear encoder - stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,F1_SCREW_ROTENC_msb, 0x0000); //clear encoder - - Bit = 1; - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,SCREW, false, 250); - i=0; - while ((Bit != 0x0) && (i<200)) //wait until Limit Switch or timeout 200*50msec=10sec - { - Bit = GetBit(F1_LS_03_Direct,1); - delay(50); - i++; - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,SCREW,3); //stop motor - - DialogResult result3 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.YesNo); - if(result3 == DialogResult.No) - { - Units_status[3,1]="Fail"; - stubManager.Write("LS_SCREW_LEFT Not calibrate\n"); - return 0; - } - Units_status[3,1]="Pass"; - - var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_SCREW_ROTENC_lsb); - var response1 = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_SCREW_ROTENC_msb); - - temp=(response.Value & 0xffff )+((response1.Value & 0xffff )<<16); - temp=temp&0x0fffffff; - temp= 0x4000000-temp; - stubManager.Write("Encoder positio:" +temp+"\n"); - - if ((temp>20000) && temp<28000) - Units_status[4,1]="Pass"; - else - Units_status[4,1]="Fail";// - - return 1; -} - //--------------------------------------- -int Test_Pooler_Exist() -{ - if ( (GetBit(F1_LS_03_Direct,11))==0) - { - Units_status[5,1]="Fail"; - return 0; - } - - DialogResult result2 = MessageBox.Show("Remove Spool"); - if ( (GetBit(F1_LS_03_Direct,11))!=0) - Units_status[5,1]="Fail"; // - else - Units_status[5,1]="Pass"; - - return 0 ; - - -} - diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/location.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/location.cs deleted file mode 100644 index 11bf6556a..000000000 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/location.cs +++ /dev/null @@ -1 +0,0 @@ -string Location_str = "Hameshabev";
\ No newline at end of file diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/span.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/span.cs deleted file mode 100644 index 1b31dbb4e..000000000 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/span.cs +++ /dev/null @@ -1,615 +0,0 @@ -using System; -using System.Text; -using System.IO; -using System.Linq; -using System.Drawing; -using System.Diagnostics; -using System.Windows.Forms; -using System.Threading; -using System.Threading.Tasks; -using System.Collections.Generic; -using Tango.PMR.Stubs; -using Tango.Stubs; - -const int New_DyeHead_UNDER_TEST=47; -const Int32 MGNET_OPEN=0x420301; -const Int32 MGNET_EN=0x420280; -const Int32 MGNET_CLOSE=0x420300; -const Int32 MGNET_DIS=0x420200; -const Int32 ACTDIR_ON=0x460280; -const Int32 ACTDIR_OFF=0x460200; - -const Int32 ACTIN_ON=0x460308; -const Int32 ACTOUT_ON=0x460304; - -const Int32 ACTIN_OFF=0x46030C; -const Int32 ACTOUT_OFF=0x46030C; - - - -const Int32 LS_FRONT=0X460110; -const Int32 LS_REAR=0X460120; -const Int32 LS_UPPER=0X460140; -const Int32 LS_SPARE=0X460180; -const Int32 ACTIN_EN=0X460101; -const Int32 ACTOUT_EN=0X460102; - - - -string EEPROM_Header="Header_1 "; //16 characters - -int Head_Mux_Channel_ID = 4; //Head MUX channel - - -//float [] DyeHeadTemp = new float[6] ; - -string [,] Units_status_New_DyeHead = new string[New_DyeHead_UNDER_TEST,2] { - {"Pt100_Zone_1","Pass"}, //0 - {"Pt100_Zone_2","Pass"}, //1 - {"Pt100_Zone_3","Pass"}, //2 - {"Pt100_Zone_4","Pass"}, //3 - {"Pt100_Zone_5","Pass"}, //4 - {"Pt100_Zone_6","Pass"}, //5 - {"Pt100_Zone_7","Pass"}, //6 - {"Pt100_Zone_8","Pass"}, //7 - {"Pt100_Zone_9","Pass"}, //8 - {"Pt100_Zone_10","Pass"}, //9 - {"Pt100_Zone_11","Pass"}, //10 - {"Pt100_Zone_12","Pass"}, //11 - - {"Current_Zone_1","Pass"}, //12 - {"Current_Zone_2","Pass"}, //13 - {"Current_Zone_3","Pass"}, //14 - {"Current_Zone_4","Pass"}, //15 - {"Current_Zone_5","Pass"}, //16 - {"Current_Zone_6","Pass"}, //17 - {"Current_Zone_7","Pass"}, //18 - {"Current_Zone_8","Pass"}, //19 - {"Current_Zone_9","Pass"}, //20 - {"Current_Zone_10","Pass"}, //21 - {"Current_Zone_11","Pass"}, //22 - {"Current_Zone_12","Pass"}, //23 - - {"Break_Zone_1","Pass"}, //24 - {"Break_Zone_2","Pass"}, //25 - {"Break_Zone_3","Pass"}, //26 - {"Break_Zone_4","Pass"}, //27 - {"Break_Zone_5","Pass"}, //28 - {"Break_Zone_6","Pass"}, //29 - {"Break_Zone_7","Pass"}, //30 - {"Break_Zone_8","Pass"}, //31 - {"Break_Zone_9","Pass"}, //32 - {"Break_Zone_10","Pass"}, //33 - {"Break_Zone_11","Pass"}, //34 - {"Break_Zone_12","Pass"}, //35 - - {"Magnet ","Not Test"}, //36 - {"LS_REAR","Not Test"}, //37 - {"LS_FRONT","Not Test"}, //38 - {"DH_LID_Motor","Not Test"}, //39 - - {"EEPROM ","Pass"}, //40 - - {"ACTUATOR_IN","Not Test"}, //41 - {"LS_IN_UP","Not Test"}, //42 - {"LS_IN_DN","Not Test"}, //43 - {"ACTUATOR_OUT","Not Test"}, //44 - {"LS_OUT_UP","Not Test"}, //45 - {"LS_OUT_DN","Not Test"}, //46 - - - }; - - - -//-------------------------------------------------------------------------------- - -public Task<decimal> NewDyeHead_test( Action<string> settext, CancellationToken cancellationToken, string SN, string Location) -{ - Task<decimal> task = null; - // Start a task and return it - task = Task.Run(() => - { - stubManager.Write("S/N:" +SN+ "\n"); - stubManager.Write("Location:" +Location+ "\n"); - - copy_table (New_DyeHead_UNDER_TEST,Units_status_New_DyeHead); - - DialogResult result1 = MessageBox.Show("Make shure, Dyehead is not hot", "Warning",MessageBoxButtons.OKCancel); - if(result1 == DialogResult.Cancel) - { - stubManager.AppendToFile(File_Name1,"Dyehead is too hot \tFail"); - stubManager.Write("Dyehead is too hot \tFail\n"); - return 0 ; - } - else - { - -//------------------------------- start test ----------- - settext("Test Magnet Motor LS"); - Test_Magnet_Motor_LS_New_DyeHead(); - settext("Test heaters &pt100"); - Test_heaters_pt100 (); - settext("Test Head EEPROM"); - Test_Head_EEPROM(SN); - settext("Test Actuator In"); - Test_Actuator_in(); - settext("Test Actuator Out"); - Test_Actuator_out(); - Status=write_to_file(SN,Location,DyeHead_UNDER_TEST,"Dyehead"); - - settext("End Test"); - } - decimal result = 0; - - return result; - }); - return task; -} - -//------------------------------------------------------------- - int Test_Actuator_in() -{ - Int32 temp; - int i=0; - - DialogResult result = MessageBox.Show("Make shure, ACTUATOR-IN is down", "Warning",MessageBoxButtons.OKCancel); - if(result == DialogResult.Cancel) - { - Units_status[41,1]="Fail"; - stubManager.Write("ACTUATOR-IN is Up\n"); - return 0; - } -//---------------------- move ACTUATOR-IN Up ---------------------------- - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTDIR_ON); // DIR=1 - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTIN_ON); // act_in enable - delay(10); - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTIN_OFF); // act_in disable - stubManager.Write("ACTUATOR-IN moving Up\n"); - - temp = 1; - i=0; - while ((temp != 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec - { - temp=read_pio (ACTIN_EN); // read ACTIN_EN - delay(50); - i++; - } - - if(i == 200) - { - Units_status[41,1]="Fail"; - stubManager.Write("CTUATOR-IN is not moving Up\n"); - return 0; - } - - DialogResult result2 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.OKCancel); - if(result2 == DialogResult.Cancel) - { - Units_status[42,1]="Fail"; - stubManager.Write("LS_IN_UP Not calibrate\n"); - return 0; - } - Units_status[41,1]="Pass"; - Units_status[42,1]="Pass"; -//---------------------- move ACTUATOR-IN Dn ---------------------------- - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTDIR_OFF); // DIR=0 - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTIN_ON); // act_in enable - delay(10); - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTIN_OFF); // act_in disable - stubManager.Write("ACTUATOR-IN moving Dn\n"); - - temp = 1; - i=0; - while ((temp != 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec - { - temp=read_pio (ACTIN_EN); // read ACTIN_EN - delay(50); - i++; - } - - if(i == 200) - { - Units_status[41,1]="Fail"; - stubManager.Write("CTUATOR-IN is not moving Down\n"); - return 0; - } - - DialogResult result3 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.OKCancel); - if(result3 == DialogResult.Cancel) - { - Units_status[43,1]="Fail"; - stubManager.Write("LS_IN_Down Not calibrate\n"); - return 0; - } - Units_status[43,1]="Pass"; - return 0; - -} -//------------------------------------------------------------- - int Test_Actuator_out() -{ - Int32 temp; - int i=0; - - DialogResult result = MessageBox.Show("Make shure, ACTUATOR-OUT is down", "Warning",MessageBoxButtons.OKCancel); - if(result == DialogResult.Cancel) - { - Units_status[44,1]="Fail"; - stubManager.Write("ACTUATOR-OUT is Up\n"); - return 0; - } -//---------------------- move ACTUATOR-OUT Up ---------------------------- - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTDIR_ON); // DIR=1 - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTOUT_ON); // act_OUT enable - delay(10); - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTOUT_OFF); // act_OUT disable - stubManager.Write("ACTUATOR-OUT moving Up\n"); - - temp = 1; - i=0; - while ((temp != 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec - { - temp=read_pio (ACTOUT_EN); // read ACTOUT_EN - delay(50); - i++; - } - - if(i == 200) - { - Units_status[44,1]="Fail"; - stubManager.Write("CTUATOR-OUT is not moving Up\n"); - return 0; - } - - DialogResult result2 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.OKCancel); - if(result2 == DialogResult.Cancel) - { - Units_status[45,1]="Fail"; - stubManager.Write("LS_OUT_UP Not calibrate\n"); - return 0; - } - Units_status[44,1]="Pass"; - Units_status[45,1]="Pass"; -//---------------------- move ACTUATOR-OUT Dn ---------------------------- - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTDIR_OFF); // DIR=0 - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTOUT_ON); // act_out enable - delay(10); - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTOUT_OFF); // act_out disable - stubManager.Write("ACTUATOR-OUT moving Dn\n"); - - temp = 1; - i=0; - while ((temp != 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec - { - temp=read_pio (ACTOUT_EN); // read ACTOUT_EN - delay(50); - i++; - } - - if(i == 200) - { - Units_status[44,1]="Fail"; - stubManager.Write("CTUATOR-OUT is not moving Down\n"); - return 0; - } - - DialogResult result3 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.OKCancel); - if(result3 == DialogResult.Cancel) - { - Units_status[46,1]="Fail"; - stubManager.Write("LS_OUT_Down Not calibrate\n"); - return 0; - } - Units_status[46,1]="Pass"; - return 0; - -} - - - -//-------------------------------------------- - int Test_Magnet_Motor_LS_New_DyeHead() -{ - Int32 temp; - int i=0; -//---------------------- open Magnet ---------------------------- - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,MGNET_OPEN); // turn magnet on - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,MGNET_EN); // magnet enable - stubManager.Write("Magnet is Open\n"); - delay(1000); -//---------------------- chekc Magnet is open ---------------------------- - temp=read_pio (LS_UPPER); // read LS_UPPER - if (temp != 0) - { - Units_status[36,1]="Fail"; - stubManager.Write("Magnet is close\n"); - return 0; - } - DialogResult result = MessageBox.Show("Make shure, Magnet is open", "Warning",MessageBoxButtons.OKCancel); - if(result == DialogResult.Cancel) - { - Units_status[36,1]="Fail"; - stubManager.Write("Magnet is close\n"); - return 0; - } -//---------------------- Move DyeingHead Lid Motor rear---------------------------- - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,DyeingHeadLid_Motor, true, 250); - stubManager.Write("*** Open Lid Head \n"); - - temp = 0; - i=0; - while ((temp == 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec - { - temp=read_pio (LS_REAR); // read LS_REAR - delay(50); - i++; - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,DyeingHeadLid_Motor,3); //stop motor - if(i == 200) - { - Units_status[37,1]="Fail"; - Units_status[39,1]="Fail"; - stubManager.Write("LS_REAR Not calibrate\n"); - return 0; - } - DialogResult result2 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.OKCancel); - if(result2 == DialogResult.Cancel) - { - Units_status[37,1]="Fail"; - Units_status[39,1]="Fail"; - stubManager.Write("LS_REAR Not calibrate\n"); - return 0; - } - Units_status[37,1]="Pass"; -//---------------------- Move DyeingHead Lid Motor front---------------------------- - stubManager.Write("*** Close Lid Head \n"); - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,DyeingHeadLid_Motor, false, 250); - temp = 0; - i=0; - while ((temp == 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec - { - temp=read_pio (LS_FRONT); // read LS_FRONT - delay(50); - i++; - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,DyeingHeadLid_Motor,3); //stop motor - if(i == 200) - { - Units_status[38,1]="Fail"; - stubManager.Write("LS_FRONT Not calibrate\n"); - return 0; - } - - DialogResult result3 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.OKCancel); - if(result3 == DialogResult.Cancel) - { - Units_status[38,1]="Fail"; - stubManager.Write("LS_FRONT Not calibrate\n"); - return 0; - } - Units_status[37,1]="Pass"; - Units_status[38,1]="Pass"; -//---------------------- Close Magnet ---------------------------- - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,MGNET_CLOSE); // turn magnet off - delay(2000); - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,MGNET_DIS); // magnet Disable - - stubManager.Write("Magnet is Close\n"); - delay(1000); -//---------------------- chekc Magnet is close ---------------------------- - temp=read_pio (LS_UPPER); // read LS_UPPER - if (temp == 0) - { - Units_status[36,1]="Fail"; - stubManager.Write("Magnet is open\n"); - return 0; - } - DialogResult result4 = MessageBox.Show("Make shure, Magnet is close", "Warning",MessageBoxButtons.OKCancel); - if(result4 == DialogResult.Cancel) - { - Units_status[36,1]="Fail"; - stubManager.Write("Magnet is open\n"); - return 0; - } - Units_status[36,1]="Pass"; - stubManager.Write("Magnet is close\n"); - return 0; -} - - -//------------------------------------ -public int Test_new_heaters_pt100() -{ - -// uint utemp=0; - Int32 temp=0; - float ftemp=0; - float ftemp1=0; - float current=0; - Double current_sense; - - for (Int32 i = 0; i < 12; i++) - { - Int32 tdly=10000; -//---------------------- get tempurature of heaters---------------------------- - temp= 12+i/2+(i%2)*8; //HZone_1=12 - //HZone_2=20 - //HZone_3=13 - //HZone_4=21 - //HZone_5=14 - //HZone_6=22 - //HZone_7=15 - //HZone_8=23 - //HZone_9=16 - //HZone_10=24 - //HZone_11=17 - //HZone_11=25 - var response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" , temp); //get temperature from the buffer - ftemp = (float)response.TemperatureCMultBy100; - ftemp = ftemp / 100; - - if ((ftemp>50)|| (ftemp<15)) - { - Units_status[i,1]="Fail"; - tdly=1000; - - } - stubManager.Write("Zone-"+(i+1)+ "\t" + ftemp.ToString("F2")+"°C\n"); -//---------------------- get current of heaters ---------------------------- - var response1 = stubManager.Run<StubMidTankPressureSensorResponse>("StubMidTankPressureSensorRequest" ,0x8000 + i); // get current - current_sense=response1.Pressure; - if (current_sense>0.1) - { - Units_status[i+12,1]="Fail"; - } - stubManager.Write("current is "+(i+1)+ "\t" + current_sense +"\n"); -//---------------------- get Break of heaters ---------------------------- - var response2 = stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,0x440000 +(i/8)*0x100+(1<<(i&7))); // read break - temp = (Int32) (response2.Progress); - if ((temp & (1<<(i&7))) !=0) //if break ok - { - Units_status[i+24,1]="Fail"; - stubManager.Write("Break Zone "+(i+1)+ "\t is Off\n"); - } - else - { - stubManager.Write("Break Zone "+(i+1)+ "\t is Off\n"); - } -//---------------------- turn heater on ---------------------------- - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,0x400200 +(i/8)*0x100+(1<<(i&7))); // turn heater on - stubManager.Write("Heater - "+(i+1)+ "\t is On\n"); - delay(2000); //delay 20 second -//---------------------- get current of heaters ---------------------------- - var response3 = stubManager.Run<StubMidTankPressureSensorResponse>("StubMidTankPressureSensorRequest" ,0x8000 + i); // get current - current_sense=response3.Pressure; - if ((current_sense<1.1) ||(current_sense>1.4) ) //if current not 1.25A - { - Units_status[i+12,1]="Fail"; - } - stubManager.Write("current is "+(i+1)+ "\t" + current_sense +"\n"); -//---------------------- get Break of heaters ---------------------------- - var response4 = stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,0x440000 +(i/8)*0x100+(1<<(i&7))); // read break - temp = (Int32) (response4.Progress); - if ((temp & (1<<(i&7))) !=0) //if break ok - { - Units_status[i+24,1]="Fail"; - stubManager.Write("Break Zone "+(i+1)+ "\t is Off\n"); - } - else - { - stubManager.Write("Break Zone "+(i+1)+ "\t is On\n"); - } - delay(tdly); //delay 20 second - temp= 12+i/2+(i%2)*8; - var response5 = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" , temp); //get temperature from the buffer - ftemp1 = (float)response5.TemperatureCMultBy100; - ftemp1 = ftemp1 / 100; - - if (((ftemp1-ftemp)<5)|| ((ftemp1-ftemp)>35)) - { - Units_status[i,1]="Fail"; - } - stubManager.Write("Zone-"+(i+1)+ "after heating is \t" + ftemp1.ToString("F2")+"°C\n"); -//---------------------- turn heater off ---------------------------- - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,0x400200 +(i/8)*0x100); // turn heater off - stubManager.Write("Heater - "+(i+1)+ "\t is Off\n"); - - } - return 0; -} - -Int32 read_pio(Int32 i2c_input) -{ - Int32 temp=0; - var response = stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,i2c_input); // read break - temp = (Int32) (response.Progress); - temp =temp & (i2c_input& 0xff); //if break ok - return temp; -} -//end mati - - //enable_all_channel(); -public int Test_Head_EEPROM(string s_n) -{ - - enable_channel(Head_Mux_Channel_ID); // Chanel 0-7 => Disp0enser 0-7 - - Write_EEPROM(0xA0,s_n); - delay(20); //Sleep for 5 milli. - must! otherwise read 0xff (See data sheet ) - - adc_set_for_read_ch(0xA0); - //Thread.Sleep(1); //Sleep for 10 milli. - Read_EEPROM(0xA0); - - delay(20); //Sleep for 5 milli. - must! otherwise read 0xff (See data sheet ) - return 0; - -} - - - -int enable_channel(int Channel_ID) -{ - uint Const_temp = 0x01; - - StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest(); - stubI2CWriteBytesRequest.I2CId = I2C_ID3; - stubI2CWriteBytesRequest.SlaveAddress = TCA9548A_address; - - Const_temp = Const_temp << Channel_ID; - stubI2CWriteBytesRequest.BytesTWrite.Add(Const_temp); - - var response = stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest); - - return 1; -} - -int Write_EEPROM (uint I2C_Slave_Add,string s_n ) -{ - - StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest(); - stubI2CWriteBytesRequest.I2CId = I2C_ID3; - stubI2CWriteBytesRequest.SlaveAddress = I2C_Slave_Add; - - UInt32 uInt32 = new UInt32(); - stubI2CWriteBytesRequest.BytesTWrite.Add(0);//Byte 0 to write - stubI2CWriteBytesRequest.BytesTWrite.Add(0);//Byte 0 to write - //-------------------------------------------------------------- - char[] characters = EEPROM_Header.ToCharArray(); - - for (int i=0;i<16;i++) - { - stubI2CWriteBytesRequest.BytesTWrite.Add(characters[i]); //add header - } - characters = s_n.ToCharArray(); - - for (int i=0;i<16;i++) - { - stubI2CWriteBytesRequest.BytesTWrite.Add(characters[i]); //add s/n - } - var response = stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest); - - return 1; -} - -int Read_EEPROM(uint I2C_Slave_Add) -{ - StubI2CReadBytesRequest stubI2CReadBytesRequest = new StubI2CReadBytesRequest(); - stubI2CReadBytesRequest.I2CId = I2C_ID3; - stubI2CReadBytesRequest.SlaveAddress = I2C_Slave_Add + 1; - stubI2CReadBytesRequest.NumberOfBytesToRead = 16; // Number of header bytes to read - - var response1 = stubManager.Run<StubI2CReadBytesResponse>(stubI2CReadBytesRequest); - uint temph=0; - char[] characters = EEPROM_Header.ToCharArray(); - - for(int i=0; i<stubI2CReadBytesRequest.NumberOfBytesToRead;i++) - { - if (characters[i]!=response1.ReadBytes[i]); - Units_status[40,1]="Fail"; - } - stubManager.Write("EEprom "+ Units_status[40,1]+"\n"); - - return 1; -} diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/stapele_span.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/stapele_span.cs deleted file mode 100644 index 656786ad7..000000000 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/stapele_span.cs +++ /dev/null @@ -1,631 +0,0 @@ -using System; -using System.Text; -using System.IO; -using System.Linq; -using System.Drawing; -using System.Diagnostics; -using System.Windows.Forms; -using System.Threading; -using System.Threading.Tasks; -using System.Collections.Generic; -using Tango.PMR.Stubs; -using Tango.Stubs; - -const int New_Stapele_Span_UNDER_TEST=47; -const Int32 MGNET_OPEN=0x420301; -const Int32 MGNET_EN=0x420280; -const Int32 MGNET_CLOSE=0x420300; -const Int32 MGNET_DIS=0x420200; -const Int32 ACTDIR_ON=0x460280; -const Int32 ACTDIR_OFF=0x460200; - -const Int32 ACTIN_ON=0x460308; -const Int32 ACTOUT_ON=0x460304; - -const Int32 ACTIN_OFF=0x46030C; -const Int32 ACTOUT_OFF=0x46030C; - - - -const Int32 LS_FRONT=0X460110; -const Int32 LS_REAR=0X460120; -const Int32 LS_UPPER=0X460140; -const Int32 LS_SPARE=0X460180; -const Int32 ACTIN_EN=0X460101; -const Int32 ACTOUT_EN=0X460102; - - - -string EEPROM_Header="Header_1 "; //16 characters - -int Head_Mux_Channel_ID = 4; //Head MUX channel - - -//float [] Stapele_SpanTemp = new float[6] ; - -string [,] Units_status_New_Stapele_Span = new string[New_Stapele_Span_UNDER_TEST,2] { - {"Pt100_HTIN","Pass"}, //0 - {"Pt100_HTOUT","Pass"}, //1 - - {"Current_HTIN1","Pass"}, //2 - {"Current_HTIN2","Pass"}, //3 - {"Current_HTIN3","Pass"}, //4 - {"Current_HTIN4","Pass"}, //5 - {"Current_HTOUT1","Pass"}, //6 - {"Current_HTOUT2","Pass"}, //7 - {"Current_HTOUT3","Pass"}, //8 - {"Current_HTOUT4","Pass"}, //9 - - {"Break_HTIN1","Pass"}, //10 - {"Break_HTIN2","Pass"}, //11 - {"Break_HTIN3","Pass"}, //12 - {"Break_HTIN4","Pass"}, //13 - {"Break_HTOUT1","Pass"}, //14 - {"Break_HTOUT2","Pass"}, //15 - {"Break_HTOUT3","Pass"}, //16 - {"Break_HTOUT4","Pass"}, //17 - - {"Fan_in","Not Test"}, //18 - {"Fan_out","Not Test"}, //19 - - - - {"Magnet ","Not Test"}, //18 - {"LS_REAR","Not Test"}, //19 - {"LS_FRONT","Not Test"}, //2 - {"DH_LID_Motor","Not Test"}, //39 - - {"EEPROM ","Pass"}, //40 - - {"ACTUATOR_IN","Not Test"}, //41 - {"LS_IN_UP","Not Test"}, //42 - {"LS_IN_DN","Not Test"}, //43 - {"ACTUATOR_OUT","Not Test"}, //44 - {"LS_OUT_UP","Not Test"}, //45 - {"LS_OUT_DN","Not Test"}, //46 - - - }; - - - -//-------------------------------------------------------------------------------- - -public Task<decimal> NewStapele_Span_test( Action<string> settext, CancellationToken cancellationToken, string SN, string Location) -{ - Task<decimal> task = null; - // Start a task and return it - task = Task.Run(() => - { - stubManager.Write("S/N:" +SN+ "\n"); - stubManager.Write("Location:" +Location+ "\n"); - - copy_table (New_Stapele_Span_UNDER_TEST,Units_status_New_Stapele_Span); - - DialogResult result1 = MessageBox.Show("Make shure, Stapele_Span is not hot", "Warning",MessageBoxButtons.OKCancel); - if(result1 == DialogResult.Cancel) - { - stubManager.AppendToFile(File_Name1,"Stapele_Span is too hot \tFail"); - stubManager.Write("Stapele_Span is too hot \tFail\n"); - return 0 ; - } - else - { - -//------------------------------- start test ----------- - settext("Test Magnet Motor LS"); - Test_Magnet_Motor_LS_New_Stapele_Span(); - settext("Test blowers &pt100"); - Test_blowers_pt100 (); - settext("Test Head EEPROM"); - Test_Head_EEPROM(SN); - settext("Test Actuator In"); - Test_Actuator_in(); - settext("Test Actuator Out"); - Test_Actuator_out(); - Status=write_to_file(SN,Location,Stapele_Span_UNDER_TEST,"Stapele_Span"); - - settext("End Test"); - } - decimal result = 0; - - return result; - }); - return task; -} - -//------------------------------------------------------------- - int Test_Actuator_in() -{ - Int32 temp; - int i=0; - - DialogResult result = MessageBox.Show("Make shure, ACTUATOR-IN is down", "Warning",MessageBoxButtons.OKCancel); - if(result == DialogResult.Cancel) - { - Units_status[41,1]="Fail"; - stubManager.Write("ACTUATOR-IN is Up\n"); - return 0; - } -//---------------------- move ACTUATOR-IN Up ---------------------------- - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTDIR_ON); // DIR=1 - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTIN_ON); // act_in enable - delay(10); - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTIN_OFF); // act_in disable - stubManager.Write("ACTUATOR-IN moving Up\n"); - - temp = 1; - i=0; - while ((temp != 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec - { - temp=read_pio (ACTIN_EN); // read ACTIN_EN - delay(50); - i++; - } - - if(i == 200) - { - Units_status[41,1]="Fail"; - stubManager.Write("CTUATOR-IN is not moving Up\n"); - return 0; - } - - DialogResult result2 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.OKCancel); - if(result2 == DialogResult.Cancel) - { - Units_status[42,1]="Fail"; - stubManager.Write("LS_IN_UP Not calibrate\n"); - return 0; - } - Units_status[41,1]="Pass"; - Units_status[42,1]="Pass"; -//---------------------- move ACTUATOR-IN Dn ---------------------------- - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTDIR_OFF); // DIR=0 - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTIN_ON); // act_in enable - delay(10); - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTIN_OFF); // act_in disable - stubManager.Write("ACTUATOR-IN moving Dn\n"); - - temp = 1; - i=0; - while ((temp != 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec - { - temp=read_pio (ACTIN_EN); // read ACTIN_EN - delay(50); - i++; - } - - if(i == 200) - { - Units_status[41,1]="Fail"; - stubManager.Write("CTUATOR-IN is not moving Down\n"); - return 0; - } - - DialogResult result3 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.OKCancel); - if(result3 == DialogResult.Cancel) - { - Units_status[43,1]="Fail"; - stubManager.Write("LS_IN_Down Not calibrate\n"); - return 0; - } - Units_status[43,1]="Pass"; - return 0; - -} -//------------------------------------------------------------- - int Test_Actuator_out() -{ - Int32 temp; - int i=0; - - DialogResult result = MessageBox.Show("Make shure, ACTUATOR-OUT is down", "Warning",MessageBoxButtons.OKCancel); - if(result == DialogResult.Cancel) - { - Units_status[44,1]="Fail"; - stubManager.Write("ACTUATOR-OUT is Up\n"); - return 0; - } -//---------------------- move ACTUATOR-OUT Up ---------------------------- - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTDIR_ON); // DIR=1 - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTOUT_ON); // act_OUT enable - delay(10); - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTOUT_OFF); // act_OUT disable - stubManager.Write("ACTUATOR-OUT moving Up\n"); - - temp = 1; - i=0; - while ((temp != 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec - { - temp=read_pio (ACTOUT_EN); // read ACTOUT_EN - delay(50); - i++; - } - - if(i == 200) - { - Units_status[44,1]="Fail"; - stubManager.Write("CTUATOR-OUT is not moving Up\n"); - return 0; - } - - DialogResult result2 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.OKCancel); - if(result2 == DialogResult.Cancel) - { - Units_status[45,1]="Fail"; - stubManager.Write("LS_OUT_UP Not calibrate\n"); - return 0; - } - Units_status[44,1]="Pass"; - Units_status[45,1]="Pass"; -//---------------------- move ACTUATOR-OUT Dn ---------------------------- - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTDIR_OFF); // DIR=0 - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTOUT_ON); // act_out enable - delay(10); - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTOUT_OFF); // act_out disable - stubManager.Write("ACTUATOR-OUT moving Dn\n"); - - temp = 1; - i=0; - while ((temp != 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec - { - temp=read_pio (ACTOUT_EN); // read ACTOUT_EN - delay(50); - i++; - } - - if(i == 200) - { - Units_status[44,1]="Fail"; - stubManager.Write("CTUATOR-OUT is not moving Down\n"); - return 0; - } - - DialogResult result3 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.OKCancel); - if(result3 == DialogResult.Cancel) - { - Units_status[46,1]="Fail"; - stubManager.Write("LS_OUT_Down Not calibrate\n"); - return 0; - } - Units_status[46,1]="Pass"; - return 0; - -} - - - -//-------------------------------------------- - int Test_Magnet_Motor_LS_New_Stapele_Span() -{ - Int32 temp; - int i=0; -//---------------------- open Magnet ---------------------------- - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,MGNET_OPEN); // turn magnet on - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,MGNET_EN); // magnet enable - stubManager.Write("Magnet is Open\n"); - delay(1000); -//---------------------- chekc Magnet is open ---------------------------- - temp=read_pio (LS_UPPER); // read LS_UPPER - if (temp != 0) - { - Units_status[36,1]="Fail"; - stubManager.Write("Magnet is close\n"); - return 0; - } - DialogResult result = MessageBox.Show("Make shure, Magnet is open", "Warning",MessageBoxButtons.OKCancel); - if(result == DialogResult.Cancel) - { - Units_status[36,1]="Fail"; - stubManager.Write("Magnet is close\n"); - return 0; - } -//---------------------- Move DyeingHead Lid Motor rear---------------------------- - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,DyeingHeadLid_Motor, true, 250); - stubManager.Write("*** Open Lid Head \n"); - - temp = 0; - i=0; - while ((temp == 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec - { - temp=read_pio (LS_REAR); // read LS_REAR - delay(50); - i++; - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,DyeingHeadLid_Motor,3); //stop motor - if(i == 200) - { - Units_status[37,1]="Fail"; - Units_status[39,1]="Fail"; - stubManager.Write("LS_REAR Not calibrate\n"); - return 0; - } - DialogResult result2 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.OKCancel); - if(result2 == DialogResult.Cancel) - { - Units_status[37,1]="Fail"; - Units_status[39,1]="Fail"; - stubManager.Write("LS_REAR Not calibrate\n"); - return 0; - } - Units_status[37,1]="Pass"; -//---------------------- Move DyeingHead Lid Motor front---------------------------- - stubManager.Write("*** Close Lid Head \n"); - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,DyeingHeadLid_Motor, false, 250); - temp = 0; - i=0; - while ((temp == 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec - { - temp=read_pio (LS_FRONT); // read LS_FRONT - delay(50); - i++; - } - stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,DyeingHeadLid_Motor,3); //stop motor - if(i == 200) - { - Units_status[38,1]="Fail"; - stubManager.Write("LS_FRONT Not calibrate\n"); - return 0; - } - - DialogResult result3 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.OKCancel); - if(result3 == DialogResult.Cancel) - { - Units_status[38,1]="Fail"; - stubManager.Write("LS_FRONT Not calibrate\n"); - return 0; - } - Units_status[37,1]="Pass"; - Units_status[38,1]="Pass"; -//---------------------- Close Magnet ---------------------------- - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,MGNET_CLOSE); // turn magnet off - delay(2000); - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,MGNET_DIS); // magnet Disable - - stubManager.Write("Magnet is Close\n"); - delay(1000); -//---------------------- chekc Magnet is close ---------------------------- - temp=read_pio (LS_UPPER); // read LS_UPPER - if (temp == 0) - { - Units_status[36,1]="Fail"; - stubManager.Write("Magnet is open\n"); - return 0; - } - DialogResult result4 = MessageBox.Show("Make shure, Magnet is close", "Warning",MessageBoxButtons.OKCancel); - if(result4 == DialogResult.Cancel) - { - Units_status[36,1]="Fail"; - stubManager.Write("Magnet is open\n"); - return 0; - } - Units_status[36,1]="Pass"; - stubManager.Write("Magnet is close\n"); - return 0; -} - - -//------------------------------------ -public int Test_blowers_pt100_fan() -{ - -// uint utemp=0; - Int32 temp=0; - float ftemp=0; - float ftemp1=0; - float current=0; - Double current_sense; - - for (Int32 i = 0; i < 2; i++) - { - //---------------------- check fans---------------------------- - stubManager.Run<ProgressResponse>("ProgressRequest" ,0xfac0+i, 0xff);//Fan Click Head Card , Fan 1 Setting - 0xFF Full PWM 0x80 = 50% FF = 100% 0 - STOP - delay(2000); //delay 2 second - - var response5 = stubManager.Run<ProgressResponse>("ProgressRequest" ,0xfac0+i, 0xff);//Fan Click Head Card , Fan 1 Setting - 0xFF Full PWM 0x80 = 50% FF = 100% 0 - STOP - temp = (Int32) (response.Progress); - temp =temp & (response.Progress & 0xffff); // - if (temp>0xEC0) - { - Units_status[18+i,1]="Fail"; - return 0; - } - Units_status[18+i,1]="Pass"; - - //---------------------- get tempurature of heaters---------------------------- - if (i==0) - temp=18; - else - temp=16; - var response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" , 0x8000 +temp); //get temperature from the buffer - ftemp = (float)response.TemperatureCMultBy100; - ftemp = ftemp / 100; - - if ((ftemp>50)|| (ftemp<15)) - { - Units_status[i,1]="Fail"; - tdly=1000; - - } - stubManager.Write("Hit-"+(i+1)+ "\t" + ftemp.ToString("F2")+"°C\n"); - - for (Int32 j = 0; j < 4; j++) - { - Int32 tdly=10000; - //---------------------- get current of heaters ---------------------------- - var response1 = stubManager.Run<StubMidTankPressureSensorResponse>("StubMidTankPressureSensorRequest" ,0x8000 +12 + 4*i +j); // get current - current_sense=2*response1.Pressure; - if (current_sense>0.1) - { - Units_status[2+j+4*i,1]="Fail"; - } - stubManager.Write("current is "+(j+1+4*i )+ "\t" + current_sense +"\n"); - //---------------------- get Break of heaters ---------------------------- - var response2 = stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,0x440000 +0x20000*i +(1-i)*0x100); // read break - temp = (Int32) (response2.Progress); - if ((temp & (1<<((1-i)*4+j))) !=0) //if break ok - { - Units_status[10+j+4*i,1]="Fail"; - stubManager.Write("Break Zone "+(i*4+j+1)+ "\t is Off\n"); - } - else - { - stubManager.Write("Break Zone "+(i*4+j+1)+ "\t is On\n"); - } - //---------------------- turn heater on ---------------------------- - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,0x400300 +0x1fff00*i +(1<<((1-i)*4+j))); // turn heater on - stubManager.Write("Heater - "+(i*4+j+1)+ "\t is On\n"); - delay(2000); //delay 2 second - //---------------------- get current of heaters ---------------------------- - var response3 = stubManager.Run<StubMidTankPressureSensorResponse>("StubMidTankPressureSensorRequest" ,0x8000 + +12 + 4*i +j); // get current - current_sense=2*response3.Pressure; - if ((current_sense<1.1) ||(current_sense>1.4) ) //if current not 2.5A - { - Units_status[2+j+4*i,1]="Fail"; - } - stubManager.Write("current is "+(j+1+4*i )+"\t" + current_sense +"\n"); - //---------------------- get Break of heaters ---------------------------- - var response4 = stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,0x440000 +0x20000*i +(1-i)*0x100); // read break - temp = (Int32) (response4.Progress); - if ((temp & (1<<((1-i)*4+j))) !=0) //if break ok - { - Units_status[10+j+4*i,1]="Fail"; - stubManager.Write("Break Zone "+(i*4+j+1)+ "\t is Off\n"); - } - else - { - stubManager.Write("Break Zone "+(i*4+j+1)+ "\t is On\n"); - } - - delay(tdly); //delay 20 second - //---------------------- turn heater off ---------------------------- - - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,0x400300 +0x1fff00*i ); // turn heater on - stubManager.Write("Heater - "+(i*4+j+1)+ "\t is Off\n"); - } - //---------------------- get tempurature of heaters---------------------------- - if (i==0) - temp=18; - else - temp=16; - var response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" , 0x8000 +temp); //get temperature from the buffer - ftemp1 = (float)response.TemperatureCMultBy100; - ftemp1 = ftemp1 / 100; - - if (((ftemp1-ftemp)<5)|| ((ftemp1-ftemp)>35)) - { - Units_status[i,1]="Fail"; - } - stubManager.Write("Zone-"+(i+1)+ "after heating is \t" + ftemp1.ToString("F2")+"°C\n"); - - //---------------------- check fan off---------------------------- - - stubManager.Run<ProgressResponse>("ProgressRequest" ,0xfac0+i, 0);//Fan Click Head Card , Fan 1 Setting - 0xFF Full PWM 0x80 = 50% FF = 100% 0 - STOP - delay(2000); //delay 2 second - var response6 = stubManager.Run<ProgressResponse>("ProgressRequest" ,0xfac0+i, 0);//Fan Click Head Card , Fan 1 Setting - 0xFF Full PWM 0x80 = 50% FF = 100% 0 - STOP - temp = (Int32) (response6.Progress); - temp =temp & (response.Progress & 0xffff); // - if (temp<0x0xFF00) - { - Units_status[18+i,1]="Fail"; - return 0; - } - - } - return 0; -} - -Int32 read_pio(Int32 i2c_input) -{ - Int32 temp=0; - var response = stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,i2c_input); // read break - temp = (Int32) (response.Progress); - temp =temp & (i2c_input& 0xff); //if break ok - return temp; -} -//end mati - - //enable_all_channel(); -public int Test_Head_EEPROM(string s_n) -{ - - enable_channel(Head_Mux_Channel_ID); // Chanel 0-7 => Disp0enser 0-7 - - Write_EEPROM(0xA0,s_n); - delay(20); //Sleep for 5 milli. - must! otherwise read 0xff (See data sheet ) - - adc_set_for_read_ch(0xA0); - //Thread.Sleep(1); //Sleep for 10 milli. - Read_EEPROM(0xA0); - - delay(20); //Sleep for 5 milli. - must! otherwise read 0xff (See data sheet ) - return 0; - -} - - - -int enable_channel(int Channel_ID) -{ - uint Const_temp = 0x01; - - StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest(); - stubI2CWriteBytesRequest.I2CId = I2C_ID3; - stubI2CWriteBytesRequest.SlaveAddress = TCA9548A_address; - - Const_temp = Const_temp << Channel_ID; - stubI2CWriteBytesRequest.BytesTWrite.Add(Const_temp); - - var response = stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest); - - return 1; -} - -int Write_EEPROM (uint I2C_Slave_Add,string s_n ) -{ - - StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest(); - stubI2CWriteBytesRequest.I2CId = I2C_ID3; - stubI2CWriteBytesRequest.SlaveAddress = I2C_Slave_Add; - - UInt32 uInt32 = new UInt32(); - stubI2CWriteBytesRequest.BytesTWrite.Add(0);//Byte 0 to write - stubI2CWriteBytesRequest.BytesTWrite.Add(0);//Byte 0 to write - //-------------------------------------------------------------- - char[] characters = EEPROM_Header.ToCharArray(); - - for (int i=0;i<16;i++) - { - stubI2CWriteBytesRequest.BytesTWrite.Add(characters[i]); //add header - } - characters = s_n.ToCharArray(); - - for (int i=0;i<16;i++) - { - stubI2CWriteBytesRequest.BytesTWrite.Add(characters[i]); //add s/n - } - var response = stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest); - - return 1; -} - -int Read_EEPROM(uint I2C_Slave_Add) -{ - StubI2CReadBytesRequest stubI2CReadBytesRequest = new StubI2CReadBytesRequest(); - stubI2CReadBytesRequest.I2CId = I2C_ID3; - stubI2CReadBytesRequest.SlaveAddress = I2C_Slave_Add + 1; - stubI2CReadBytesRequest.NumberOfBytesToRead = 16; // Number of header bytes to read - - var response1 = stubManager.Run<StubI2CReadBytesResponse>(stubI2CReadBytesRequest); - uint temph=0; - char[] characters = EEPROM_Header.ToCharArray(); - - for(int i=0; i<stubI2CReadBytesRequest.NumberOfBytesToRead;i++) - { - if (characters[i]!=response1.ReadBytes[i]); - Units_status[40,1]="Fail"; - } - stubManager.Write("EEprom "+ Units_status[40,1]+"\n"); - - return 1; -} |
