diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2020-05-18 08:22:45 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2020-05-18 08:22:45 +0300 |
| commit | 9f6741e51a0145b684b182cb8a01ca32ee77d0a5 (patch) | |
| tree | 9f2b430f234ecef592f48f70bdfa094ab3b74899 /Software | |
| parent | 53c0914998b553411977f0a63fd75ceeec71d16f (diff) | |
| download | Tango-9f6741e51a0145b684b182cb8a01ca32ee77d0a5.tar.gz Tango-9f6741e51a0145b684b182cb8a01ca32ee77d0a5.zip | |
stubs updated
Diffstat (limited to 'Software')
44 files changed, 3106 insertions, 991 deletions
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_LimitSwitch.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_LimitSwitch.cs index 4d9f116bb..59374a636 100644 --- a/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_LimitSwitch.cs +++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_LimitSwitch.cs @@ -21,15 +21,17 @@ public void OnExecute(StubManager stubManager) Int32 Bit = 1; uint Temp = 0; int counter = 0; + UInt32 PowerStep_driver=0; -// stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,23, false,0x800000+2); - - stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,4, false, 0x800000+0); //mov Dryer Lid motor up + if (Get_Driver_Type(4)>0x14) + PowerStep_driver=1; + + stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,4, false, 0x800000+2*PowerStep_driver); //mov Dryer Lid motor up while (Bit != 0x0) //wait until Dryer Lid open { Bit = GetBit(FPGA1, F1_LS_01_Direct,4); - Thread.Sleep(10); + Thread.Sleep(100); } stubManager.Write("\n--------1-Lid Open--------"); @@ -39,13 +41,13 @@ stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,4, 2); //Hard st - stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,4, false, 0x800000+2); //mov Dryer Lid motor up + stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,4, false, 0x800000+2*(1-PowerStep_driver)); //mov Dryer Lid motor up Bit = 1; while (Bit != 0x0) //wait until Dryer Lid open { Bit = GetBit(FPGA1, F1_LS_01_Direct,5); - Thread.Sleep(10); + Thread.Sleep(100); } stubManager.Write("\n--------2-Lid Close--------"); @@ -54,4 +56,19 @@ stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,4, 2); //Hard st -}
\ No newline at end of file +} + +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/Assemblies/Dryer/test_dryer_heater.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/test_dryer_heater.cs new file mode 100644 index 000000000..d2b36b111 --- /dev/null +++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/test_dryer_heater.cs @@ -0,0 +1,57 @@ +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.Printing; +using Tango.Stubs; + +public void OnExecute(StubManager stubManager) +{ + +UploadProcessParametersRequest uploadProcessParametersRequest = new UploadProcessParametersRequest(); + +ProcessParameters processParameters = new ProcessParameters(); +processParameters.DyeingSpeed = 0; +processParameters.MinInkUptake = 0; +processParameters.MaxInkUptake = 0; +processParameters.FeederTension = 0; +processParameters.PullerTension = 0; +processParameters.WinderTension = 0; +processParameters.MixerTemp = 0; +processParameters.HeadZone1Temp = 0; +processParameters.HeadZone2Temp = 0; +processParameters.HeadZone3Temp = 0; +processParameters.HeadZone4Temp = 0; +processParameters.HeadZone5Temp = 0; +processParameters.HeadZone6Temp = 0; +processParameters.DryerAirFlow = 0; +processParameters.DryerZone1Temp = 100; +processParameters.DryerZone2Temp = 0; +processParameters.DryerZone3Temp = 0; +processParameters.DryerBufferLength = 0; +processParameters.HeadAirFlow = 0; +processParameters.TableIndex = 0; +processParameters.HeadZone7Temp = 0; +processParameters.HeadZone8Temp = 0; +processParameters.HeadZone9Temp = 0; +processParameters.HeadZone10Temp = 0; +processParameters.HeadZone11Temp = 0; +processParameters.HeadZone12Temp = 0; +processParameters.RBlowerFlow = 0; +processParameters.RBlowerTemp = 0; +processParameters.LBlowerFlow = 0; +processParameters.LBlowerTemp = 0; +processParameters.PressureBuildUp = 0; + +uploadProcessParametersRequest.ProcessParameters = processParameters; + + + + var response = stubManager.Run<UploadProcessParametersResponse>(uploadProcessParametersRequest); + +}
\ No newline at end of file diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/test_dryer_heater1.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/test_dryer_heater1.cs new file mode 100644 index 000000000..1df44f0d0 --- /dev/null +++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/test_dryer_heater1.cs @@ -0,0 +1,165 @@ +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.Printing; +using Tango.Stubs; +using Tango.PMR.Stubs; + + +public void OnExecute(StubManager stubManager) +{ + int j; + for (int i=0;i<10;i++) + + { + stubManager.WriteLine("--------------------loop number " + i +" ---------------------" ); + + Blower_180(); + stubManager.WriteLine("Heating to 180 " ); + + j=0; + + while (j==0) + { + var response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,6); //read air temp + +// stubManager.WriteLine(response.TemperatureCMultBy100); +// stubManager.Write("\n"); + if (response.TemperatureCMultBy100>(17900)) //17900 + j=1; + Thread.Sleep(1000); + + } + stubManager.WriteLine("start motor " ); + + stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,3, true, 2200); //rotate Dryer Motor. +// Thread.Sleep(1000*20);// + Thread.Sleep(1000*60*20);// + + stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,3,3); //stop motor + stubManager.WriteLine("stop motor " ); + + + Blower_0(); + stubManager.WriteLine("cooling down " ); + + j=0; + while (j==0) + { + var response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,6); //read air temp +// stubManager.WriteLine(response.TemperatureCMultBy100); +// stubManager.Write("\n"); + if (response.TemperatureCMultBy100<6000)// + j=1; + Thread.Sleep(1000); + + } + + + + + + + + } + + + + +} + +void Blower_180() + + { +UploadProcessParametersRequest uploadProcessParametersRequest = new UploadProcessParametersRequest(); + +ProcessParameters processParameters = new ProcessParameters(); +processParameters.DyeingSpeed = 0; +processParameters.MinInkUptake = 0; +processParameters.MaxInkUptake = 0; +processParameters.FeederTension = 0; +processParameters.PullerTension = 0; +processParameters.WinderTension = 0; +processParameters.MixerTemp = 0; +processParameters.HeadZone1Temp = 0; +processParameters.HeadZone2Temp = 0; +processParameters.HeadZone3Temp = 0; +processParameters.HeadZone4Temp = 0; +processParameters.HeadZone5Temp = 0; +processParameters.HeadZone6Temp = 0; +processParameters.DryerAirFlow = 0; +processParameters.DryerZone1Temp = 180; +processParameters.DryerZone2Temp = 0; +processParameters.DryerZone3Temp = 0; +processParameters.DryerBufferLength = 0; +processParameters.HeadAirFlow = 0; +processParameters.TableIndex = 0; +processParameters.HeadZone7Temp = 0; +processParameters.HeadZone8Temp = 0; +processParameters.HeadZone9Temp = 0; +processParameters.HeadZone10Temp = 0; +processParameters.HeadZone11Temp = 0; +processParameters.HeadZone12Temp = 0; +processParameters.RBlowerFlow = 0; +processParameters.RBlowerTemp = 0; +processParameters.LBlowerFlow = 0; +processParameters.LBlowerTemp = 0; +processParameters.PressureBuildUp = 0; + +uploadProcessParametersRequest.ProcessParameters = processParameters; + + + + var response = stubManager.Run<UploadProcessParametersResponse>(uploadProcessParametersRequest); +} + +void Blower_0() + + { +UploadProcessParametersRequest uploadProcessParametersRequest = new UploadProcessParametersRequest(); + +ProcessParameters processParameters = new ProcessParameters(); +processParameters.DyeingSpeed = 0; +processParameters.MinInkUptake = 0; +processParameters.MaxInkUptake = 0; +processParameters.FeederTension = 0; +processParameters.PullerTension = 0; +processParameters.WinderTension = 0; +processParameters.MixerTemp = 0; +processParameters.HeadZone1Temp = 0; +processParameters.HeadZone2Temp = 0; +processParameters.HeadZone3Temp = 0; +processParameters.HeadZone4Temp = 0; +processParameters.HeadZone5Temp = 0; +processParameters.HeadZone6Temp = 0; +processParameters.DryerAirFlow = 0; +processParameters.DryerZone1Temp = 00; +processParameters.DryerZone2Temp = 0; +processParameters.DryerZone3Temp = 0; +processParameters.DryerBufferLength = 0; +processParameters.HeadAirFlow = 0; +processParameters.TableIndex = 0; +processParameters.HeadZone7Temp = 0; +processParameters.HeadZone8Temp = 0; +processParameters.HeadZone9Temp = 0; +processParameters.HeadZone10Temp = 0; +processParameters.HeadZone11Temp = 0; +processParameters.HeadZone12Temp = 0; +processParameters.RBlowerFlow = 0; +processParameters.RBlowerTemp = 0; +processParameters.LBlowerFlow = 0; +processParameters.LBlowerTemp = 0; +processParameters.PressureBuildUp = 0; + +uploadProcessParametersRequest.ProcessParameters = processParameters; + + + + var response = stubManager.Run<UploadProcessParametersResponse>(uploadProcessParametersRequest); +}
\ No newline at end of file diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/DyeHead_SSR.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/DyeHead_SSR.cs deleted file mode 100644 index cb01a86c4..000000000 --- a/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/DyeHead_SSR.cs +++ /dev/null @@ -1,117 +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 "..\..\Defines\Tango_Defines_Basic.cs" -include "Tango_Defines_SSR.cs" -//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Tango_Defines_Basic.cs" -//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Interfaces\Tango_Defines_SSR.cs" - - -public void OnExecute(StubManager stubManager) -{ - - - UInt32 temp=0; - - - - stubManager.Write("\n"); - var response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,1); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 8 - SetBit (FPGA2, F2_CTRL, 3, 1); - stubManager.Write("\tTesting SSR no. 8\tHeadZone-1"); - Thread.Sleep(10000); - SetBit (FPGA2, F2_CTRL, 3, 0); - var response1 = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,1); // - stubManager.WriteHex(response1.TemperatureCMultBy100,4); - - stubManager.Write("\n"); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,2); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 7 - SetBit (FPGA2, F2_CTRL, 4, 1); - stubManager.Write("\tTesting SSR no. 7\tHeadZone-2"); - Thread.Sleep(10000); - SetBit (FPGA2, F2_CTRL, 4, 0); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,2); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - - - - stubManager.Write("\n"); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,3); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 6 - SetBit (FPGA2, F2_CTRL, 5, 1); - stubManager.Write("\tTesting SSR no. 6\tHeadZone-3"); - Thread.Sleep(10000); - SetBit (FPGA2, F2_CTRL, 5, 0); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,3); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - - - - stubManager.Write("\n"); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,4); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 5 - SetBit (FPGA2, F2_CTRL, 6, 1); - stubManager.Write("\tTesting SSR no. 6\tHeadZone-4"); - Thread.Sleep(10000); - SetBit (FPGA2, F2_CTRL, 6, 0); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,4); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - - - - stubManager.Write("\n"); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,5); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 10 - SetBit (FPGA1, F1_gpo_01, 2, 1); - stubManager.Write("\tTesting SSR no. 6\tHeadZone-5"); - Thread.Sleep(10000); - SetBit (FPGA1, F1_gpo_01, 2, 0); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,5); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - - - - stubManager.Write("\n"); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,11); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 11 - SetBit (FPGA3, F3_GPO_01_bus, 4, 1); - stubManager.Write("\tTesting SSR no. 6\tHeadZone-6"); - Thread.Sleep(10000); - SetBit (FPGA3, F3_GPO_01_bus, 4, 0); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,11 - ); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - - - - stubManager.Write("\n"); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,0); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - //Write F2_GPO_MIXCHIP_SSR4_CTRL SSR/SSR no. 4 - SetBit (FPGA2, F2_CTRL, 7, 1); - stubManager.Write("Testing SSR no. 4\tMIXCHIP "); - Thread.Sleep(10000); - SetBit (FPGA2, F2_CTRL, 7, 0); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,0); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - - - -}
\ No newline at end of file diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/DyeHead_SSR_CURRENT_SENSE.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/DyeHead_SSR_CURRENT_SENSE.cs deleted file mode 100644 index b9793a336..000000000 --- a/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/DyeHead_SSR_CURRENT_SENSE.cs +++ /dev/null @@ -1,237 +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 "..\..\Defines\Tango_Defines_Basic.cs" -include "Tango_Defines_SSR.cs" -//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Tango_Defines_Basic.cs" -//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Interfaces\Tango_Defines_SSR.cs" - -//---------------------- -const Int32 I2C_ID = 2; -//const Int32 I2C_Slave_Add = 0x46; //must be 0x40, 0x44 or 0x46 -//---------------------- - - -public void OnExecute(StubManager stubManager) -{ - - - UInt32 temp=0; - - - stubManager.Write("\n"); - var response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,1); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 8 - SetBit (FPGA2, F2_CTRL, 3, 1); - stubManager.Write("\tTesting SSR no. 8\tHeadZone-1\t"); - Thread.Sleep(10000); - adc_configuration(0x40,0x10); //a2d_address 0x40 channel 3 - adc_set_for_read_ch(0x40); - adc_read_ch(0x40); - SetBit (FPGA2, F2_CTRL, 3, 0); - var response1 = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,1); // - stubManager.WriteHex(response1.TemperatureCMultBy100,4); - - stubManager.Write("\n"); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,2); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 7 - SetBit (FPGA2, F2_CTRL, 4, 1); - stubManager.Write("\tTesting SSR no. 7\tHeadZone-2\t"); - Thread.Sleep(10000); - adc_configuration(0x40,0x08); //a2d_address 0x40 channel 4 - adc_set_for_read_ch(0x40); - adc_read_ch(0x40); - SetBit (FPGA2, F2_CTRL, 4, 0); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,2); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - - - stubManager.Write("\n"); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,3); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 6 - SetBit (FPGA2, F2_CTRL, 5, 1); - stubManager.Write("\tTesting SSR no. 6\tHeadZone-3\t"); - Thread.Sleep(10000); - adc_configuration(0x40,0x04); //a2d_address 0x40 channel 5 - adc_set_for_read_ch(0x40); - adc_read_ch(0x40); - SetBit (FPGA2, F2_CTRL, 5, 0); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,3); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - - - stubManager.Write("\n"); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,4); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 5 - SetBit (FPGA2, F2_CTRL, 6, 1); - stubManager.Write("\tTesting SSR no. 5\tHeadZone-4\t"); - Thread.Sleep(10000); - adc_configuration(0x44,0x80); //a2d_address 0x44 channel 0 - adc_set_for_read_ch(0x44); - adc_read_ch(0x44); - SetBit (FPGA2, F2_CTRL, 6, 0); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,4); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - - - stubManager.Write("\n"); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,5); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 10 - SetBit (FPGA1, F1_gpo_01, 2, 1); - stubManager.Write("\tTesting SSR no. 10\tHeadZone-5\t"); - Thread.Sleep(10000); - adc_configuration(0x44,0x40); //a2d_address 0x44 channel 1 - adc_set_for_read_ch(0x44); - adc_read_ch(0x44); - SetBit (FPGA1, F1_gpo_01, 2, 0); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,5); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - - - stubManager.Write("\n"); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,11); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - //Write GPO_DYEINGH_SSR1_CTRL SSR/SSR no. 11 - SetBit (FPGA3, F3_GPO_01_bus, 4, 1); - stubManager.Write("\tTesting SSR no. 11\tHeadZone-6\t"); - Thread.Sleep(10000); - adc_configuration(0x44,0x40); //a2d_address 0x44 channel 1 - adc_set_for_read_ch(0x44); - adc_read_ch(0x44); - SetBit (FPGA3, F3_GPO_01_bus, 4, 0); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,11); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - - - stubManager.Write("\n"); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,0); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - //Write F2_GPO_MIXCHIP_SSR4_CTRL SSR/SSR no. 4 - SetBit (FPGA2, F2_CTRL, 7, 1); - stubManager.Write("Testing SSR no. 4\tMIXCHIP \t"); - Thread.Sleep(10000); - adc_configuration(0x46,0x08); //a2d_address 0x46 channel 4 - adc_set_for_read_ch(0x46); - adc_read_ch(0x46); - - SetBit (FPGA2, F2_CTRL, 7, 0); - response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,0); // - stubManager.WriteHex(response.TemperatureCMultBy100,4); - - -} - -//---------------------- - -int adc_configuration(uint I2C_Slave_Add,uint channel ) - { - StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest(); - stubI2CWriteBytesRequest.I2CId = I2C_ID; - 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_temp(uint I2C_Slave_Add) - { - StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest(); - stubI2CWriteBytesRequest.I2CId = I2C_ID; - stubI2CWriteBytesRequest.SlaveAddress = I2C_Slave_Add; - - UInt32 uInt32 = new UInt32(); - stubI2CWriteBytesRequest.BytesTWrite.Add(0x02);//Byte 0 to write - - var response = stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest); - - return 1; - } - - - - -int adc_read_temp(uint I2C_Slave_Add) - { - - StubI2CReadBytesRequest stubI2CReadBytesRequest = new StubI2CReadBytesRequest(); - stubI2CReadBytesRequest.I2CId = I2C_ID; - stubI2CReadBytesRequest.SlaveAddress = I2C_Slave_Add; - stubI2CReadBytesRequest.NumberOfBytesToRead = 2; // Number of bytes to read - - var response1 = stubManager.Run<StubI2CReadBytesResponse>(stubI2CReadBytesRequest); - - for(int i=0; i<stubI2CReadBytesRequest.NumberOfBytesToRead;i++) - { - stubManager.WriteLineHex(response1.ReadBytes[i],2); - } - - - return 1; - } - - - - -int adc_set_for_read_ch(uint I2C_Slave_Add) - { - StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest(); - stubI2CWriteBytesRequest.I2CId = I2C_ID; - 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; - } - - -int adc_read_ch(uint I2C_Slave_Add) - { - StubI2CReadBytesRequest stubI2CReadBytesRequest = new StubI2CReadBytesRequest(); - stubI2CReadBytesRequest.I2CId = I2C_ID; - 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; - for(int i=0; i<stubI2CReadBytesRequest.NumberOfBytesToRead;i=i+2) - { - temph=response1.ReadBytes[i]; - templ=response1.ReadBytes[i+1]; - temp = (temph << 8) | templ; - temp=temp & 0x0fff; - stubManager.WriteHex(temp,4); - - } - - return 1; - } - - diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/header_LimitSwitch.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/header_LimitSwitch.cs deleted file mode 100644 index 4454e9c63..000000000 --- a/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/header_LimitSwitch.cs +++ /dev/null @@ -1,48 +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 "..\..\Defines\Tango_Defines_Basic.cs" -include "Tango_Defines_LimitSwitch.cs" -//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\LAB_Tests\Main_PCB\ATP_Test\Scripts\Defines\Tango_Defines_Basic.cs" -//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\LAB_Tests\Main_PCB\ATP_Test\Scripts\Defines\Tango_Defines_LimitSwitch.cs" - - - - -public void OnExecute(StubManager stubManager) -{ - - uint Temp = 0; - int counter = 0; - stubManager.Write("\nReading register F1_LS_01_Direct: "); - var RetVal = Fpga_Read_Reg(FPGA1, F1_LS_01_Direct, 0); - stubManager.WriteHex(RetVal.Value,4); - Temp = RetVal.Value; - stubManager.Write("\nActivate limit switches one-by-one"); - - while ( counter != 10000) - { - RetVal = Fpga_Read_Reg(FPGA1, F1_LS_01_Direct, 0); - if (RetVal.Value != Temp) - { - stubManager.Write("\nRegister F1_LS_01_Direct new value: "); - stubManager.WriteHex(RetVal.Value,4); - counter = counter + 1; - } - Thread.Sleep(100); - Temp = RetVal.Value; - - } - - - -}
\ No newline at end of file diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/magner_motor_limit_switch.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/magner_motor_limit_switch.cs deleted file mode 100644 index 0dcf29853..000000000 --- a/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/magner_motor_limit_switch.cs +++ /dev/null @@ -1,69 +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 "..\..\Defines\Tango_Defines_Basic.cs" -include "Tango_Defines_SSR.cs" -include "Tango_Defines_LimitSwitch.cs" - -//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Tango_Defines_Basic.cs" -//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Interfaces\Tango_Defines_SSR.cs" - - -public void OnExecute(StubManager stubManager) -{ -Int32 Bit = 1; - - //Write GPO_DRYER_SSR1_CTRL SSR/SSR no. 1 - SetBit (FPGA2, F2_CTRL, 0, 1); - stubManager.Write("\nTesting SSR no. 13 of magnet"); - Thread.Sleep(4000); - -var response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,2, true, 50); - - - stubManager.Write("\n*** Open Lid Head "); - Bit = 1; - - while (Bit != 0x0) //wait until LTFU LOADRAM Down - { - Bit = GetBit(FPGA1, F1_LS_01_Direct,7); - Thread.Sleep(10); - } - Thread.Sleep(100); - stubManager.Write("\n--------1--------"); - - - stubManager.Write("\n*** Close Lid Head "); - Bit = 1; - response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,2, false, 50); - - while (Bit != 0x0) //wait until LTFU LOADRAM Down - { - Bit = GetBit(FPGA1, F1_LS_01_Direct,8); - Thread.Sleep(10); - } - Thread.Sleep(100); - stubManager.Write("\n--------2--------"); - - response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,2, true, 0); - - SetBit (FPGA2, F2_CTRL, 0, 0); - - -// var response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,0, true, 50); motor clean - -//response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,1, true, 50); motor clean - - - - -}
\ No newline at end of file diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/magner_ssr.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/magner_ssr.cs deleted file mode 100644 index 54e3f4844..000000000 --- a/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/magner_ssr.cs +++ /dev/null @@ -1,68 +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 "..\..\Defines\Tango_Defines_Basic.cs" -include "Tango_Defines_SSR.cs" -//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Tango_Defines_Basic.cs" -//include "C:\To_Backup\Mulberry\Mulberry_current\Customers\Twine\Tango\Software\Stub_scripts\Interfaces\Tango_Defines_SSR.cs" - - -public void OnExecute(StubManager stubManager) -{ -Int32 Bit = 1; - - //Write GPO_DRYER_SSR1_CTRL SSR/SSR no. 1 - //SetBit (FPGA2, F2_CTRL, 0, 1); - stubManager.Write("\nTesting SSR no. 13 of magnet"); - //Thread.Sleep(4000); - -//var response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,2, true, 50); - - - stubManager.Write("\n*** Open Lid Head "); - Bit = 1; - - /*while (Bit != 0x0) //wait until LTFU LOADRAM Down - { - Bit = GetBit(FPGA1, F1_LS_01_Direct,7); - Thread.Sleep(10); - } - Thread.Sleep(100); - stubManager.Write("\n--------1--------"); - - - stubManager.Write("\n*** Close Lid Head "); - Bit = 1; - response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,2, false, 50); - - while (Bit != 0x0) //wait until LTFU LOADRAM Down - { - Bit = GetBit(FPGA1, F1_LS_01_Direct,8); - Thread.Sleep(10); - } - Thread.Sleep(100); - stubManager.Write("\n--------2--------"); - - response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,2, true, 0);*/ - - SetBit (FPGA2, F2_CTRL, 0, 1);//open - SetBit (FPGA2, F2_CTRL, 0, 0);//close - - -// var response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,0, true, 50); motor clean - -//response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,1, true, 50); motor clean - - - - -}
\ No newline at end of file diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/MidTank/midtanksetparams.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/MidTank/midtanksetparams.cs index 2208ee094..352666c85 100644 --- a/Software/Stubs Collection/stubs/Scripts/Assemblies/MidTank/midtanksetparams.cs +++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/MidTank/midtanksetparams.cs @@ -22,46 +22,46 @@ MidTankDataSetupRequest midTankDataSetupRequest = new MidTankDataSetupRequest(); MidTankData midTankData = new MidTankData(); midTankData.MidTankId = 0; -midTankData.InitialOffsetA = 1.93242734375; -midTankData.SlopeB = 1; +midTankData.InitialOffsetA = 2.64273428916931; +midTankData.SlopeB = 0.899999976158142; MidTankData midTankData1 = new MidTankData(); midTankData1.MidTankId = 1; -midTankData1.InitialOffsetA = 1.94375546875; -midTankData1.SlopeB = 2; +midTankData1.InitialOffsetA = 2.63755464553833; +midTankData1.SlopeB = 0.899999976158142; MidTankData midTankData2 = new MidTankData(); midTankData2.MidTankId = 2; -midTankData2.InitialOffsetA = 1.935259375; -midTankData2.SlopeB = 3; +midTankData2.InitialOffsetA = 2.63525938987732; +midTankData2.SlopeB = 0.899999976158142; MidTankData midTankData3 = new MidTankData(); midTankData3.MidTankId = 3; -midTankData3.InitialOffsetA = 1.935259375; -midTankData3.SlopeB = 4; +midTankData3.InitialOffsetA = 1.4276158142; +midTankData3.SlopeB = 0.899999976158142; MidTankData midTankData4 = new MidTankData(); midTankData4.MidTankId = 4; -midTankData4.InitialOffsetA = 1.92109921875; -midTankData4.SlopeB = 5; +midTankData4.InitialOffsetA = 2.61099219322205; +midTankData4.SlopeB = 0.899999976158142; MidTankData midTankData5 = new MidTankData(); midTankData5.MidTankId = 5; -midTankData5.InitialOffsetA = 2.8245171875; -midTankData5.SlopeB = 6; +midTankData5.InitialOffsetA = 2.62451720237732; +midTankData5.SlopeB = 0.899999976158142; MidTankData midTankData6 = new MidTankData(); midTankData6.MidTankId = 6; -midTankData6.InitialOffsetA = 1.92676328125; -midTankData6.SlopeB = 7; +midTankData6.InitialOffsetA = 2.62676334381104; +midTankData6.SlopeB = 0.899999976158142; MidTankData midTankData7 = new MidTankData(); midTankData7.MidTankId = 7; -midTankData7.InitialOffsetA = 1.92676328125; -midTankData7.SlopeB = 8; +midTankData7.InitialOffsetA = 2.62676334381104; +midTankData7.SlopeB = 0.899999976158142; diff --git a/Software/Stubs Collection/stubs/newWHS/Blower.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/Blower.cs index f9807f6f3..f9807f6f3 100644 --- a/Software/Stubs Collection/stubs/newWHS/Blower.cs +++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/Blower.cs diff --git a/Software/Stubs Collection/stubs/newWHS/Fan_speed.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/Fan_speed.cs index 045db16fe..045db16fe 100644 --- a/Software/Stubs Collection/stubs/newWHS/Fan_speed.cs +++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/Fan_speed.cs diff --git a/Software/Stubs Collection/stubs/newWHS/Fan_test.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/Fan_test.cs index 166c1cd2a..166c1cd2a 100644 --- a/Software/Stubs Collection/stubs/newWHS/Fan_test.cs +++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/Fan_test.cs diff --git a/Software/Stubs Collection/stubs/newWHS/Rehostat.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/Rehostat.cs index 142c1597d..142c1597d 100644 --- a/Software/Stubs Collection/stubs/newWHS/Rehostat.cs +++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/Rehostat.cs diff --git a/Software/Stubs Collection/stubs/newWHS/Set_Blower_Get_Q_Qavarege_Volt.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/Set_Blower_Get_Q_Qavarege_Volt.cs index 13d0c3471..13d0c3471 100644 --- a/Software/Stubs Collection/stubs/newWHS/Set_Blower_Get_Q_Qavarege_Volt.cs +++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/Set_Blower_Get_Q_Qavarege_Volt.cs diff --git a/Software/Stubs Collection/stubs/newWHS/get_A2D_MAX11614.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/get_A2D_MAX11614.cs index 670732ae0..670732ae0 100644 --- a/Software/Stubs Collection/stubs/newWHS/get_A2D_MAX11614.cs +++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/get_A2D_MAX11614.cs diff --git a/Software/Stubs Collection/stubs/newWHS/pump.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/pump.cs index 8999da126..8999da126 100644 --- a/Software/Stubs Collection/stubs/newWHS/pump.cs +++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/pump.cs diff --git a/Software/Stubs Collection/stubs/newWHS/set_gas_get_A2D_MAX11614.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/set_gas_get_A2D_MAX11614.cs index fad4ac22a..fad4ac22a 100644 --- a/Software/Stubs Collection/stubs/newWHS/set_gas_get_A2D_MAX11614.cs +++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/set_gas_get_A2D_MAX11614.cs diff --git a/Software/Stubs Collection/stubs/newWHS/test_Blower.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/test_Blower.cs index 2e44d901d..2e44d901d 100644 --- a/Software/Stubs Collection/stubs/newWHS/test_Blower.cs +++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/test_Blower.cs diff --git a/Software/Stubs Collection/stubs/newWHS/test_Fan_speed.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/test_Fan_speed.cs index 582a7f7e7..582a7f7e7 100644 --- a/Software/Stubs Collection/stubs/newWHS/test_Fan_speed.cs +++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/test_Fan_speed.cs diff --git a/Software/Stubs Collection/stubs/newWHS/test_blower_and_ORF3.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/test_blower_and_ORF3.cs index 3eb47bc93..3eb47bc93 100644 --- a/Software/Stubs Collection/stubs/newWHS/test_blower_and_ORF3.cs +++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/test_blower_and_ORF3.cs diff --git a/Software/Stubs Collection/stubs/newWHS/test_valv1_valv2_pump.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/test_valv1_valv2_pump.cs index c4435ab42..c4435ab42 100644 --- a/Software/Stubs Collection/stubs/newWHS/test_valv1_valv2_pump.cs +++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/test_valv1_valv2_pump.cs diff --git a/Software/Stubs Collection/stubs/newWHS/test_valv1_valv2_pump_Blower.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/test_valv1_valv2_pump_Blower.cs index f873ba057..f873ba057 100644 --- a/Software/Stubs Collection/stubs/newWHS/test_valv1_valv2_pump_Blower.cs +++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/test_valv1_valv2_pump_Blower.cs diff --git a/Software/Stubs Collection/stubs/newWHS/valv1.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/valv1.cs index 47f5cdff5..47f5cdff5 100644 --- a/Software/Stubs Collection/stubs/newWHS/valv1.cs +++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/valv1.cs diff --git a/Software/Stubs Collection/stubs/newWHS/valv2.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/valv2.cs index ce19f0d1e..ce19f0d1e 100644 --- a/Software/Stubs Collection/stubs/newWHS/valv2.cs +++ b/Software/Stubs Collection/stubs/Scripts/Assemblies/newWHS/valv2.cs diff --git a/Software/Stubs Collection/stubs/Scripts/Head_EEPROM.cs b/Software/Stubs Collection/stubs/Scripts/Head_EEPROM.cs new file mode 100644 index 000000000..1b3ab7213 --- /dev/null +++ b/Software/Stubs Collection/stubs/Scripts/Head_EEPROM.cs @@ -0,0 +1,135 @@ +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 I2C_ID = 3; //MCU_I2C3 +const Int32 TCA9548A_address = 0xE2; +const Int32 I2C_Slave_Add = 0xA0; // //eeprom address - 32kByte +int Head_Mux_Channel_ID = 4; //Head MUX channel +//---------------------- + + +int enable_channel(int Channel_ID) +{ + uint Const_temp = 0x01; + + StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest(); + stubI2CWriteBytesRequest.I2CId = I2C_ID; + stubI2CWriteBytesRequest.SlaveAddress = TCA9548A_address; + + Const_temp = Const_temp << Channel_ID; + stubI2CWriteBytesRequest.BytesTWrite.Add(Const_temp); + + var response = stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest); + + return 1; +} + + +int adc_write(uint I2C_Slave_Add, uint Page) +{ + StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest(); + stubI2CWriteBytesRequest.I2CId = I2C_ID; + stubI2CWriteBytesRequest.SlaveAddress = I2C_Slave_Add; + + UInt32 uInt32 = new UInt32(); + stubI2CWriteBytesRequest.BytesTWrite.Add(0);//Byte 0 to write + stubI2CWriteBytesRequest.BytesTWrite.Add(Page);//Byte 0 to write + //-------------------------------------------------------------- + + stubI2CWriteBytesRequest.BytesTWrite.Add(0x12 + Page);//Data 0 to write + stubI2CWriteBytesRequest.BytesTWrite.Add(0x34 + Page);//Data 1 to write + stubI2CWriteBytesRequest.BytesTWrite.Add(0x56 + Page);//Data 2 to write + stubI2CWriteBytesRequest.BytesTWrite.Add(0x78 + Page);//Data 3 to write + stubI2CWriteBytesRequest.BytesTWrite.Add(0x90 + Page);//Data 4 to write + stubI2CWriteBytesRequest.BytesTWrite.Add(0xAB + Page);//Data 5 to write + stubI2CWriteBytesRequest.BytesTWrite.Add(0xCD + Page);//Data 6 to write + stubI2CWriteBytesRequest.BytesTWrite.Add(0xEF + Page);//Data 7 to write + stubI2CWriteBytesRequest.BytesTWrite.Add(0x01 + Page);//Data 8 to write + stubI2CWriteBytesRequest.BytesTWrite.Add(0x02 + Page);//Data 9 to write + + var response = stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest); + + return 1; +} + +int adc_set_for_read_ch(uint I2C_Slave_Add, uint Page) +{ + StubI2CWriteBytesRequest stubI2CWriteBytesRequest = new StubI2CWriteBytesRequest(); + stubI2CWriteBytesRequest.I2CId = I2C_ID; + stubI2CWriteBytesRequest.SlaveAddress = I2C_Slave_Add; + + + UInt32 uInt32 = new UInt32(); + stubI2CWriteBytesRequest.BytesTWrite.Add(0);//Byte 0 to write + stubI2CWriteBytesRequest.BytesTWrite.Add(Page);//Byte 0 to write + + var response = stubManager.Run<StubI2CWriteBytesResponse>(stubI2CWriteBytesRequest); + + return 1; +} + +int adc_read_ch(uint I2C_Slave_Add) +{ + StubI2CReadBytesRequest stubI2CReadBytesRequest = new StubI2CReadBytesRequest(); + stubI2CReadBytesRequest.I2CId = I2C_ID; + stubI2CReadBytesRequest.SlaveAddress = I2C_Slave_Add + 1; + stubI2CReadBytesRequest.NumberOfBytesToRead = 10; // Number of bytes to read + + var response1 = stubManager.Run<StubI2CReadBytesResponse>(stubI2CReadBytesRequest); + uint temph=0; + + for(int i=0; i<stubI2CReadBytesRequest.NumberOfBytesToRead;i++) + { + temph=response1.ReadBytes[i]; + stubManager.WriteHex(temph,2); + } + + return 1; +} + + +public void OnExecute(StubManager stubManager) +{ + + //enable_all_channel(); + enable_channel(Head_Mux_Channel_ID); // Chanel 0-7 => Disp0enser 0-7 + + for (int i = 0; i<1; i++) + { + + adc_write(I2C_Slave_Add,0x10); + Thread.Sleep(10); //Sleep for 5 milli. - must! otherwise read 0xff (See data sheet ) + + adc_write(I2C_Slave_Add,0x00); + Thread.Sleep(10); //Sleep for 5 milli. - must! otherwise read 0xff (See data sheet ) + + stubManager.Write("\nPage 0x10 #"); + stubManager.Write(i); + stubManager.Write("\t- The Buffer is: "); + adc_set_for_read_ch(I2C_Slave_Add,0x10); + //Thread.Sleep(1); //Sleep for 10 milli. + adc_read_ch(I2C_Slave_Add); + + Thread.Sleep(10); + + stubManager.Write("\nPage 0x00 #"); + stubManager.Write(i); + stubManager.Write("\t- The Buffer is: "); + adc_set_for_read_ch(I2C_Slave_Add, 0x00); + //Thread.Sleep(1); //Sleep for 10 milli. + adc_read_ch(I2C_Slave_Add); + + Thread.Sleep(1000); + + } +}
\ No newline at end of file diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/test.cs b/Software/Stubs Collection/stubs/Scripts/Head_Type_Indification.cs index 397c6fbd4..948b847af 100644 --- a/Software/Stubs Collection/stubs/Scripts/Assemblies/LTFU/test.cs +++ b/Software/Stubs Collection/stubs/Scripts/Head_Type_Indification.cs @@ -10,16 +10,16 @@ using System.Collections.Generic; using Tango.PMR.Stubs; using Tango.Stubs; - -include "..\..\Defines\Tango_Defines_Basic.cs" -include "Tango_Defines_LimitSwitch.cs" - public void OnExecute(StubManager stubManager) { - Int32 Bit = 1; + + var response = stubManager.Run<ProgressResponse>("ProgressRequest" ,0xFEAD, 0); - //Write GPO_DRYER_SSR1_CTRL SSR/SSR no. 1 - SetBit (FPGA2, F2_CTRL, 0, 1); - stubManager.Write("\nTesting SSR no. 13 of magnet"); - Thread.Sleep(4000); + /* Response: + HEAD_TYPE_UNKNOWN // 0 + HEAD_TYPE_SYLKO_WITHOUT_CARD// 1 + HEAD_TYPE_UNKNOWN_WITH_CARD// 2 + HEAD_TYPE_SYLKO// 3 + HEAD_TYPE_STAPLE_SPUN// 4 + */ }
\ No newline at end of file diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Dryer_Jig.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Dryer_Jig.cs index deb9031fd..01a3fa828 100644 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Dryer_Jig.cs +++ b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Dryer_Jig.cs @@ -18,22 +18,22 @@ const int Dryer_UNDER_TEST=12; //--------------------------- Int32 last_14bit_position; Int32 position_32bit=0; -float [] DryerTemp = new float[3] ; +float [] DryerTemp = new float[20] ; string [,] Units_status_Dryer = new string[Dryer_UNDER_TEST,2] { - {"Lid_Motor","Not Test"}, - {"LS_Lid_Open","Not Test"}, - {"LS_Lid_Close","Not Test"}, - {"DRIVING_Motor","Not Test"}, - {"SSI_Encoder","Not Test"}, - {"LoadArm_Motor","Not Test"}, - {"Blower_test","Not Test"}, - {"Air_PT100_test","Not Test"}, - {"Main_PT100_test","Not Test"}, - {"Sec.PT100","Not Test"}, - {"SSR1_heater","Not Test"}, - {"SSR2_heater","Not Test"}, + {"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 }; @@ -59,7 +59,7 @@ public Task<decimal> Dryer_test( Action<string> settext, CancellationToken cance Test_motor_driving(); settext("Test Dryer Load Arm"); - Test_Load_Arm (); + Test_Load_Arm (); settext("Test Dryer Blower heaters pt100"); Test_Blower_heaters_pt100(); @@ -87,13 +87,6 @@ int Test_Blower_heaters_pt100() var RetVal=Fpga_Read_Reg(F1_Tacho_reg8); DialogResult result = MessageBox.Show("Close Dryer Door", "Warning"); - RetVal=Fpga_Read_Reg(F1_Tacho_reg8); - if(RetVal.Value>20) - { - Units_status[6,1]="Fail"; - stubManager.Write("Error,Fan rotate\n"); - return 0; - } SetBit(F1_gpo_01,4,1); //Dir SetBit(F1_gpo_01,3,1); //Torqer High @@ -115,7 +108,6 @@ int Test_Blower_heaters_pt100() } Units_status[6,1]="Pass"; - stubManager.Write("Temp Befor heating \n"); if (test_pt100_dryer()!=0) return 0; @@ -143,9 +135,8 @@ var response1 = stubManager.Run<StubIntADCReadResponse>("StubIntADCReadRequest" delay(1000); response1 = stubManager.Run<StubIntADCReadResponse>("StubIntADCReadRequest" ,17); temp=Convert.ToUInt32 (response1.SamplingInBits); - stubManager.WriteLine(temp); temp=temp*800*3*100; - temp=temp/(4096*95*120); + temp=temp/(4096*95*100); stubManager.Write("Current = "+ temp + "A\n"); if ((temp>3) || (temp<1)) Units_status[11,1]="Fail"; @@ -157,8 +148,8 @@ var response1 = stubManager.Run<StubIntADCReadResponse>("StubIntADCReadRequest" //check air temp ftemp=Read_pt100(6); stubManager.Write("After heating air temp is " + ftemp + "\n"); - ftemp = ftemp - DryerTemp[0]; - if ((ftemp<5)||(ftemp>25)) + ftemp = ftemp - DryerTemp[6]; + if ((ftemp<5)||(ftemp>40)) Units_status[7,1]="Fail"; else Units_status[7,1]="Pass"; @@ -168,8 +159,8 @@ var response1 = stubManager.Run<StubIntADCReadResponse>("StubIntADCReadRequest" //check Main temp ftemp=Read_pt100(7); stubManager.Write("After heating Main temp is " + ftemp + "\n"); - ftemp = ftemp - DryerTemp[1]; - if ((ftemp<5)||(ftemp>40)) + ftemp = ftemp - DryerTemp[7]; + if ((ftemp<5)||(ftemp>60)) Units_status[8,1]="Fail"; else Units_status[8,1]="Pass"; @@ -177,8 +168,8 @@ var response1 = stubManager.Run<StubIntADCReadResponse>("StubIntADCReadRequest" //check Sec. temp ftemp=Read_pt100(8); stubManager.Write("After heating Sec. temp is " + ftemp + "\n"); - ftemp = ftemp - DryerTemp[2]; - if ((ftemp<5)||(ftemp>40)) + ftemp = ftemp - DryerTemp[8]; + if ((ftemp<5)||(ftemp>60)) Units_status[9,1]="Fail"; else Units_status[9,1]="Pass"; @@ -199,17 +190,18 @@ var response1 = stubManager.Run<StubIntADCReadResponse>("StubIntADCReadRequest" for (int i = 6; i < 9; i++) { DryerTemp[i]=Read_pt100(i); + ftemp=DryerTemp[i]; - if ((ftemp>100)|| (ftemp<10)) + if ((ftemp>140)|| (ftemp<10)) { - Units_status[i+7,1]="Fail"; + Units_status[i+1,1]="Fail"; } else { - Units_status[i+7,1]="Pass"; + Units_status[i+1,1]="Pass"; } - stubManager.Write(Units_status[i+7,0] +"\t"+ ftemp.ToString("F2")); - stubManager.Write("°C\n"); + stubManager.Write(Units_status[i+1,0] +"\t"+ ftemp.ToString("F2")); + stubManager.Write("°C \t" + Units_status[i+1,1] + " \n"); } return 0; @@ -218,10 +210,10 @@ var response1 = stubManager.Run<StubIntADCReadResponse>("StubIntADCReadRequest" int Test_motor_driving () { - + MessageBox.Show("Open Dryer Door and add CHEATER to Door. ", "Warning"); stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,DryerMain_Motor, true, 500); //rotate Dryer Motor. stubManager.Write("Dryer Motor rotate \n "); - DialogResult result = MessageBox.Show("Are Dryer Motor rotate?", "Warning",MessageBoxButtons.YesNo); + DialogResult result = MessageBox.Show("Are Dryer Motor rotate smoothly ?", "Warning",MessageBoxButtons.YesNo); if(result == DialogResult.No) { Units_status[3,1]="Fail"; @@ -239,25 +231,38 @@ int Test_motor_driving () //---------------------------------- int Test_Load_Arm() { - + Int32 temp3=0; Int32 j=0; Int32 i=0; - position_32bit=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, 60);//40 + stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,DrierLoadingArm_Motor, false, 100);//40 delay(50); - temp=ReadEncoder_Dryer(); - while ((temp3==0)&& (i<6000) ) //wait until Limit Switch or timeout 200*50msec=10sec +// temp=ReadEncoder_Dryer(); + while ((temp3<2)&& (i<12000) ) //wait until Limit Switch or timeout 12000*50msec=10min { - delay(50); + i++; + delay(50); ReadEncoder_Dryer(); // stubManager.Write("position_32bit " + position_32bit +"\t"); if (Math.Abs(position_32bit)> (50*0x4000)) - temp3=1; + temp3=3; if ((position_32bit-temp)>20) - temp3=2; + temp3++; // stubManager.Write("Temp " + temp +"\n"); temp=position_32bit; // stubManager.Write("Temp3 " + temp3 +"\n"); @@ -277,23 +282,39 @@ int Test_Load_Arm() if(result2 == DialogResult.No) { Units_status[4,1]="Fail"; - stubManager.Write("Arm Motor arrive to mecahnicl stopper \n"); + stubManager.Write("Arm Motor Not arrive to mecahnicl stopper \n"); return 0; } position_32bit=0; - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,DrierLoadingArm_Motor, true, 60); + stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,DrierLoadingArm_Motor, true, 100); delay(50); i=0; - while ((Math.Abs(ReadEncoder_Dryer())< (30*0x4000))&& (i<6000)) + 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" + i + "\n" ); +// 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?", "Warning",MessageBoxButtons.YesNo); @@ -306,8 +327,24 @@ int Test_Load_Arm() 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; +} -Int32 ReadEncoder_Dryer() + + +void ReadEncoder_Dryer() { Int32 temp; Int32 temp1; @@ -335,20 +372,28 @@ Int32 ReadEncoder_Dryer() last_14bit_position=temp; - return position_32bit; + 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); //mov Dryer Lid motor down + 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+0); //mov Dryer Lid motor up + 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 { @@ -368,7 +413,7 @@ int Test_LId () } Units_status[1,1]="Pass"; - stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,DryerLid_Motor, false, 0x800000+2); //mov Dryer Lid motor down + stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,DryerLid_Motor, false, 0x800000+2*(1-PowerStep_driver)); //mov Dryer Lid motor down Bit = 1; i=0; @@ -393,3 +438,18 @@ int Test_LId () 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/Dryer_Jig1.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Dryer_Jig1.cs new file mode 100644 index 000000000..d1f0efa94 --- /dev/null +++ b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Dryer_Jig1.cs @@ -0,0 +1,455 @@ +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, 500); //rotate Dryer Motor. + stubManager.Write("Dryer Motor rotate \n "); + DialogResult result = MessageBox.Show("Are Dryer Motor rotate?", "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>1)&& (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 mecahnicl stopper ?", "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" + i + "\n" ); + ReadEncoder_Dryer(); +// stubManager.Write("position_32bit " + position_32bit +"\t"); + + if (Math.Abs(position_32bit)> (50*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?", "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.Write("\n--------1-Lid Open--------"); + + 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) + { + Units_status[1,1]="Fail"; + stubManager.Write("LS_Lid_Open Not calibrate\n"); + return 0; + } + Units_status[1,1]="Pass"; + + 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.Write("\n--------2-Lid Close--------"); + + 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) + { + Units_status[2,1]="Fail"; + stubManager.Write("LS_Lid_Close Not calibrate\n"); + return 0; + } + 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/JIG_TESTER.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/JIG_TESTER.cs index 48a12dad2..4f26d545f 100644 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/JIG_TESTER.cs +++ b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/JIG_TESTER.cs @@ -342,7 +342,7 @@ public void OnExecute(StubManager stubManager) { Run_text.Text = "Run"; stubManager.WriteLine("DUT- Winder "); - path="%userprofile%\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\Winder\\" ; + path="C:\\Users\\lp4\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\Winder\\" ; Timer_en(); _cancellationTokenSource = new CancellationTokenSource(); try @@ -370,7 +370,7 @@ public void OnExecute(StubManager stubManager) { Run_text.Text = "Run"; stubManager.WriteLine("DUT- LTFU "); - path="%userprofile%\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\LTFU\\" ; + path="C:\\Users\\lp4\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\LTFU\\" ; Timer_en(); _cancellationTokenSource = new CancellationTokenSource(); @@ -404,7 +404,7 @@ public void OnExecute(StubManager stubManager) { Run_text.Text = "Run"; stubManager.WriteLine("DUT- Dryer "); - path="%userprofile%\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\Dryer\\" ; + path="C:\\Users\\lp4\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\Dryer\\" ; Timer_en(); _cancellationTokenSource = new CancellationTokenSource(); @@ -438,7 +438,7 @@ public void OnExecute(StubManager stubManager) { Run_text.Text = "Run"; stubManager.WriteLine("DUT- DyeHead "); - path="%userprofile%\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\DyeHead\\" ; + path="C:\\Users\\lp4\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\DyeHead\\" ; Timer_en(); _cancellationTokenSource = new CancellationTokenSource(); @@ -474,7 +474,8 @@ public void OnExecute(StubManager stubManager) { Run_text.Text = "Run"; stubManager.WriteLine("DUT- New DyeHead "); - path="%userprofile%\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\NewDyeHead\\" ; +// path="C:\\Users\\lp4\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\NewDyeHead\\" ; + path="C:\\Users\\lp4\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\DyeHead\\" ; Timer_en(); _cancellationTokenSource = new CancellationTokenSource(); @@ -510,7 +511,7 @@ public void OnExecute(StubManager stubManager) { Run_text.Text = "Run"; stubManager.WriteLine("DUT- RTFU "); - path="%userprofile%\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\RTFU\\" ; + path="C:\\Users\\lp4\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\RTFU\\" ; Timer_en(); _cancellationTokenSource = new CancellationTokenSource(); try @@ -540,7 +541,7 @@ public void OnExecute(StubManager stubManager) { Run_text.Text = "Run"; stubManager.WriteLine("DUT- MidTank "); - path="%userprofile%\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\MidTank\\" ; + path="C:\\Users\\lp4\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\MidTank\\" ; Timer_en(); _cancellationTokenSource = new CancellationTokenSource(); try @@ -567,7 +568,7 @@ public void OnExecute(StubManager stubManager) { Run_text.Text = "Run"; stubManager.WriteLine("DUT- Mixer "); - path="%userprofile%\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\Mixer\\" ; + path="C:\\Users\\lp4\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\Mixer\\" ; Timer_en(); _cancellationTokenSource = new CancellationTokenSource(); @@ -595,7 +596,7 @@ public void OnExecute(StubManager stubManager) { Run_text.Text = "Run"; stubManager.WriteLine("DUT- New Mixer "); - path="%userprofile%\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\Mixer\\" ; + path="C:\\Users\\lp4\\Dropbox\\"+Location_TexstBox.Text +"_Bench_Tester"+"\\Mixer\\" ; Timer_en(); _cancellationTokenSource = new CancellationTokenSource(); @@ -783,7 +784,8 @@ StubFpgaReadRegResponse Fpga_Read_Reg(Int32 Addr) float Read_pt100(int i) { - var response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,i); // + var response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,i); // + float ftemp = (float)response.TemperatureCMultBy100; ftemp = ftemp / 100; return (ftemp); diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/JIG_TESTER1.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/JIG_TESTER1.cs new file mode 100644 index 000000000..7b7fd452d --- /dev/null +++ b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/JIG_TESTER1.cs @@ -0,0 +1,968 @@ +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_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) +{ + 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); + 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 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(); + + 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; + temp=PN_TexstBox.Text.Substring(0, PN_TexstBox.Text.IndexOf("-")); + disable_test(); + if (SN_TexstBox.Text.Length!=15) + return; + 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; +// case "AM00281": // Mixer +// Mixer_btm.Enabled= true; +// break; + + + } + + }; + SN_TexstBox.TextChanged += (_,__)=> + + { + string temp; + temp=PN_TexstBox.Text.Substring(0, PN_TexstBox.Text.IndexOf("-")); + disable_test(); + if (SN_TexstBox.Text.Length!=15) + return; + 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; +// case "AM00281": // Mixer +// Mixer_btm.Enabled= true; +// break; + + } + + }; +//----------------------------------------- + Winder_btm.Click += async(_,__) => + { + Run_text.Text = "Run"; + stubManager.WriteLine("DUT- Winder "); + path="C:\\Users\\lp4\\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(_,__) => + { + Run_text.Text = "Run"; + stubManager.WriteLine("DUT- LTFU "); + path="C:\\Users\\lp4\\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" ,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(_,__) => + { + Run_text.Text = "Run"; + stubManager.WriteLine("DUT- Dryer "); + path="C:\\Users\\lp4\\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(_,__) => + { + Run_text.Text = "Run"; + stubManager.WriteLine("DUT- DyeHead "); + path="C:\\Users\\lp4\\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(_,__) => + { + Run_text.Text = "Run"; + stubManager.WriteLine("DUT- New DyeHead "); + path="C:\\Users\\lp4\\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 + 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(); + }; +//----------------------------------------- + RTFU_btm.Click += async(_,__) => + { + Run_text.Text = "Run"; + stubManager.WriteLine("DUT- RTFU "); + path="C:\\Users\\lp4\\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(_,__) => + { + Run_text.Text = "Run"; + stubManager.WriteLine("DUT- MidTank "); + path="C:\\Users\\lp4\\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(_,__) => + { + Run_text.Text = "Run"; + stubManager.WriteLine("DUT- Mixer "); + path="C:\\Users\\lp4\\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(_,__) => + { + Run_text.Text = "Run"; + stubManager.WriteLine("DUT- New Mixer "); + path="C:\\Users\\lp4\\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; + } + + + +string 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/LTFU_Jig.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/LTFU_Jig.cs index e986e7942..2d50bab45 100644 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/LTFU_Jig.cs +++ b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/LTFU_Jig.cs @@ -12,7 +12,7 @@ using Tango.PMR.Stubs; using Tango.Stubs; //-------------------------------------------------------------------------------- -const int LTFU_UNDER_TEST=9; +const int LTFU_UNDER_TEST=12; //--------------------------- string [,] Units_status_LTFU = new string[LTFU_UNDER_TEST,2] { @@ -20,11 +20,15 @@ string [,] Units_status_LTFU = new string[LTFU_UNDER_TEST,2] { {"LS_LLOADMOTOR_DOWN","Not Test"}, //1 {"LLOADING_Motor","Not Test"}, //2 {"LDRIVING_Motor","Not Test"}, //3 - {"LS_LDANCER1_DOWN","Not Test"}, //4 - {"LS_LDANCER1_UP","Not Test"}, //5 - {"LDANCER1_Motor","Not Test"}, //6 - {"LDANCER1_ROTENC","Not Test"}, //7 - {"LDANCER1_ROTENC","Not Test"}, //8 + {"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 + }; //----------------------------------------------------- //-------------------------------------------------------------------------------- @@ -32,14 +36,17 @@ string [,] Units_status_LTFU = new string[LTFU_UNDER_TEST,2] { public Task<decimal> LTFU_test( Action<string> settext, CancellationToken cancellationToken, string SN, string Location) { - Task<decimal> task = null; + 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 (LTFU_UNDER_TEST,Units_status_LTFU); + copy_table (no_of_test,Units_status_LTFU); settext("Test LLOADING LTFU"); Test_LLOADING_LTFU(); @@ -52,10 +59,10 @@ public Task<decimal> LTFU_test( Action<string> settext, CancellationToken cancel settext("Test DANCER LTFU"); - 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,LTFU_UNDER_TEST,"LTFU"); + Status=write_to_file(SN,Location,no_of_test,"LTFU"); settext("End Test"); @@ -73,7 +80,7 @@ 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 +// 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); @@ -99,9 +106,9 @@ int Test_LLOADING_LTFU() } } //----------------------------------------- mov LLOADING up ------------------------------------------------- - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,LLOADING_Motor,true,200); //move Lloading up + stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,LLOADING_Motor,true,300); //move Lloading up counter =0; - while ( counter < 150) + while ( counter < 200) { counter = counter + 1; response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_02_Direct); //if LS_LLOADMOTOR_UP is up then move down @@ -112,7 +119,7 @@ int Test_LLOADING_LTFU() } stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,LLOADING_Motor, 3); //hold Lloading high z - if (counter == 150) + if (counter == 200) { Units_status[0,1]="Fail"; stubManager.Write("LS_LLOADMOTOR_UP\tFail\n"); @@ -140,9 +147,9 @@ int Test_LLOADING_LTFU() } //------------------------------------------ mov LLOADING dn ------------------------------------------------ - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,LLOADING_Motor, false,200); //move Lloading down + stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,LLOADING_Motor, false,300); //move Lloading down counter =0; - while ( counter < 150) + while ( counter < 200) { counter = counter + 1; response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_02_Direct); //if LS_LLOADMOTOR_UP is up then move down @@ -152,7 +159,7 @@ int Test_LLOADING_LTFU() delay(100); } - if (counter == 150) + if (counter == 200) { Units_status[1,1]="Fail"; stubManager.Write("LS_LLOADMOTOR_DN\tFail\n"); @@ -171,7 +178,7 @@ int Test_LLOADING_LTFU() stubManager.Write("LLOADMOTOR\tPass\n"); stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,LLOADING_Motor, false,200); //move Lloading down - delay(2000); + delay(4000); stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,LLOADING_Motor, 3); //hold Lloading high z return 1 ; @@ -183,7 +190,7 @@ Int32 ReadEncoder(int i) { Int32 temp; - if (i==0) //LDANCER1_ROTENC + if (i==1) //LDANCER1_ROTENC == LTFU Danser Right { stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,F1_LDANCER1_ROTENC_TX, 0x0000); //triggers a TX transmission @@ -195,7 +202,7 @@ Int32 ReadEncoder(int i) return temp; } - //LDANCER2_ROTENC + //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); @@ -210,29 +217,26 @@ Int32 ReadEncoder(int i) int Test_DANCER_LTFU() { int counter; - Int32 temp; - Int32 temp1; - Int32 temp2; - Int32 temp3; + 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 LDANCER Doun"); + 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_UP\tFail\n"); - return 0; + stubManager.Write("LS_LDANCER_Left_UP\tFail\n"); + return 12; } - //----------------------------------------- check F1_LS_LDANCER1_UP ------------------------------------------------- - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,LDANCER1_Motor,false,400); //move Lloading up + stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,LDANCER1_Motor,false,450); //move Lloading up counter =0; - while ( counter < 250) + 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 @@ -242,21 +246,19 @@ int Test_DANCER_LTFU() delay(100); } stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,LDANCER1_Motor, 3); //hold Ldancer high z - - - if (counter == 250) + if (counter == 300) { Units_status[5,1]="Fail"; - stubManager.Write("LS_LDANCER1_UP\tFail\n"); - return 0; + 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_LDANCER1_DOWN\tFail\n"); - return 0; + stubManager.Write("LS_LDANCER_Left_DN\tFail\n"); + return 12; } DialogResult result5= MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.YesNo); @@ -264,23 +266,22 @@ int Test_DANCER_LTFU() if(result5== DialogResult.No) { Units_status[5,1]="Fail"; - stubManager.Write("LS_LDANCER1_UP Not calibrate\n"); - return 0; + stubManager.Write("LS_LDANCER_Left_UP Not calibrate\n"); + return 12; } Units_status[5,1]="Pass"; - stubManager.Write("LS_LDANCER1_UP\tPass\n"); + stubManager.Write("LS_LDANCER_Left_UP\tPass\n"); //----------------------------------------- mov LDANCER1_Motor down and check Ldancer encoder ------------------------------------------------- - temp= ReadEncoder(0); + temp_left_before= ReadEncoder(0); delay(10); - temp2= ReadEncoder(1); - + temp_right_before= ReadEncoder(1); - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,LDANCER1_Motor,true,400); //move Rloading down + stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,LDANCER1_Motor,true,450); //move Rloading down counter =0; - while ( counter < 250) + while ( counter < 300) { counter = counter + 1; response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_02_Direct); //if LS_LDANCER1_DN is dn then move stop @@ -290,82 +291,184 @@ int Test_DANCER_LTFU() delay(100); } stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,LDANCER1_Motor, 3); //hold Rloading high z - if (counter == 250) - { - Units_status[4,1]="Fail"; - stubManager.Write("LS_LDANCER1_DOWN\tFail\n"); - return 0; - } + // 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_LDANCER1_DN Not calibrate\n"); - return 0; + stubManager.Write("LS_LDANCER_Left_DN Not calibrate\n"); + return 12; } - + else + { Units_status[4,1]="Pass"; - stubManager.Write("LS_LDANCER1_DN\tPass\n"); - + stubManager.Write("LS_LDANCER_Left_DN\tPass\n"); + } Units_status[6,1]="Pass"; - stubManager.Write("LDANCER1_Motor\tPass\n"); + stubManager.Write("LDANCER_Left_Motor\tPass\n"); + + temp_left_after= ReadEncoder(0); + delay(10); + temp_right_after= ReadEncoder(1); + delay(10); - temp1= ReadEncoder(0); - temp3= ReadEncoder(1); + stubManager.Write("temp_left_before="+temp_left_before + "\ttemp_left_after="+temp_left_after +"\n"); + delay(10); - stubManager.Write("temp="+temp + "\temp1="+temp1 +"\n"); + stubManager.Write("temp_right_before="+temp_right_before + "\ttemp_right_after="+temp_right_after +"\n"); + delay(10); - DialogResult result = MessageBox.Show("SSI Dancer1 led is Green(not blinking)?", "Warning",MessageBoxButtons.YesNo); + 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("LDANCER1_SSI\tFail\n"); + stubManager.Write("LDANCER_Left_SSI\tFail\n"); + return 9; + } else { - if (temp>temp1) - temp1=temp1+0x4000; - temp1=temp1-temp; - if ((temp1> 4000) || (temp1 <200)) + + 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> 4000) || (temp_left_before <200)) { Units_status[7,1]="Fail"; - stubManager.Write("LDANCER1_SSI\tFail\n"); - } - else - { - Units_status[7,1]="Pass"; - stubManager.Write("LDANCER1_SSI\tPass\n"); + stubManager.Write("LDANCER_Left_SSI\tFail\n"); + return 9; } } - stubManager.Write("temp2="+temp2 + "\temp3="+temp3 +"\n"); - - DialogResult result3 = MessageBox.Show("SSI Dancer2 led is Green(not blinking)?", "Warning",MessageBoxButtons.YesNo); + 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("LDANCER2_SSI\tFail\n"); + stubManager.Write("LDANCER_Right_SSI\tFail\n"); + return 12; } - else - { - if (temp3>temp2) - temp2=temp2+0x4000; - temp2=temp2-temp3; - if ((temp2> 4000) || (temp2 <200)) + + + if (temp_right_after>temp_right_before) + temp_right_before=temp_right_before+0x4000; + temp_right_before=temp_right_before-temp_right_after; + if ((temp_right_before< 4000) && (temp_right_before >200)) { - Units_status[8,1]="Fail"; - stubManager.Write("LDANCER2_SSI\tFail\n"); + Units_status[8,1]="Pass"; + stubManager.Write("LDANCER_Right_SSI\tPass\n"); + return 9; } - else + +//------------------------------------------ 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_before=temp_right_before+0x4000; + temp_right_before=temp_right_before-temp_right_after; + if ((temp_right_before< 4000) && (temp_right_before >200)) { Units_status[8,1]="Pass"; - stubManager.Write("LDANCER2_SSI\tPass\n"); + stubManager.Write("LDANCER_Right_SSI\tPass\n"); + return 12; } - } - return 1; -} - + Units_status[8,1]="Fail"; + stubManager.Write("LDANCER2_SSI\tFail\n"); + + return 12; +} //------------------------------------------------------------- int Test_LDRIVING_LTFU() { diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/MidTank_Jig.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/MidTank_Jig.cs index 1a0a591bc..27e17ed93 100644 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/MidTank_Jig.cs +++ b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/MidTank_Jig.cs @@ -87,8 +87,8 @@ int Test_MIDTANK() double temp; for (Int32 i=1;i<9;i++) { - open_valve(i,0,1) ; //open Air valve - open_valve(i,1,1) ; //open Ink valve + 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)) @@ -98,9 +98,9 @@ int Test_MIDTANK() } else { - close_valve(i,1,0) ; //close Ink valve - DialogResult result = MessageBox.Show("ADD 20cc air thru Air valve of Midtank"+ i, "Warning"); - close_valve(i,0,0) ; //close Air valve + 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); @@ -139,7 +139,8 @@ int open_valve (int valve_nm,int valve_type,int check_valve) //valve_type=0 is int temp1=Convert_Midtank_No[valve_nm-1] ; string temp; - SetBit (F3_VALVE_OUT,((valve_type+1)*8)- temp1, 1); + SetBit (F3_VALVE_OUT,(((valve_type+1)*8)- temp1), 1); + if (check_valve!=0) { temp="Air"; @@ -170,7 +171,7 @@ 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); + SetBit (F3_VALVE_OUT,(((valve_type+1)*8)- temp1), 0); if (check_valve!=0) { temp="Air"; 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 index 8d483b664..4d58caa14 100644 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/New_DyeHead_Jig.cs +++ b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/New_DyeHead_Jig.cs @@ -11,34 +11,17 @@ 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 ACTRST_DIS=0x420310; -const Int32 ACTRST_EN=0x420300; - - -const Int32 ACTDIR_ON=0x460200; -const Int32 ACTDIR_OFF=0x460280; - -const Int32 ACTIN_ON=0x460308; -const Int32 ACTOUT_ON=0x460304; - -const Int32 ACTIN_OFF=0x46030C; -const Int32 ACTOUT_OFF=0x46030C; - +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; -const Int32 ACTIN_EN=0X460101; -const Int32 ACTOUT_EN=0X460102; - string EEPROM_Header="Header_1 "; //16 characters @@ -103,6 +86,8 @@ string [,] Units_status_New_DyeHead = new string[New_DyeHead_UNDER_TEST,2] { {"LS_OUT_UP","Not Test"}, //45 {"LS_OUT_DN","Not Test"}, //46 + {"LS_UPPER_DN","Not Test"}, //47 + }; @@ -115,7 +100,7 @@ public Task<decimal> NewDyeHead_test( Action<string> settext, CancellationToken Task<decimal> task = null; // Start a task and return it task = Task.Run(() => - { + { stubManager.Write("S/N:" +SN+ "\n"); stubManager.Write("Location:" +Location+ "\n"); @@ -129,21 +114,25 @@ public Task<decimal> NewDyeHead_test( Action<string> settext, CancellationToken } else { - stubManager.Run<ProgressResponse>("ProgressRequest" ,0xC3,0); // disable i2c //------------------------------- start test ----------- settext("Test Magnet Motor LS"); -// Test_Magnet_Motor_LS_New_DyeHead(); +// 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_heaters_pt100 (); + Test_new_heaters_pt100 (); settext("Test Head EEPROM"); -// Test_Head_EEPROM(SN); //pass + Test_Head_EEPROM(SN); //pass settext("Test Actuator In"); -// Test_Actuator_in(); + Test_Actuator_in(); //pass settext("Test Actuator Out"); - Test_Actuator_out(); + Test_Actuator_out(); //pass Status=write_to_file(SN,Location,New_DyeHead_UNDER_TEST,"Dyehead"); - stubManager.Run<ProgressResponse>("ProgressRequest" ,0xC3,1); // disable i2c settext("End Test"); } @@ -160,169 +149,111 @@ public Task<decimal> NewDyeHead_test( Action<string> settext, CancellationToken Int32 temp; int i=0; - DialogResult result = MessageBox.Show("Make shure, ACTUATOR-IN is down", "Warning",MessageBoxButtons.OKCancel); - if(result == DialogResult.Cancel) + DialogResult result = MessageBox.Show("Is ACTUATOR-IN on Upper Limit Swtich?", "Warning",MessageBoxButtons.YesNo); + if(result == DialogResult.Yes) { - 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++; - } + stubManager.Run<ProgressResponse>("ProgressRequest" ,0xfead, 0xcaf000); //mov ACTUATOR-IN down - if(i == 200) - { - Units_status[41,1]="Fail"; - stubManager.Write("CTUATOR-IN is not moving Up\n"); + 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; } - - 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"); + 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; - } - 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) + DialogResult result = MessageBox.Show("Is ACTUATOR-OUT on Upper Limit swtich?", "Warning",MessageBoxButtons.YesNo); + if(result == DialogResult.Yes) { - 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,ACTRST_DIS); // act_OUT enable + stubManager.Run<ProgressResponse>("ProgressRequest" ,0xfead, 0xcaf100); - DialogResult result_debug0 = MessageBox.Show("result_debug0", "Warning",MessageBoxButtons.OKCancel); - - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTOUT_ON); // act_OUT enable - DialogResult result_debug1 = MessageBox.Show("result_debug1", "Warning",MessageBoxButtons.OKCancel); - - - delay(10); - stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,ACTOUT_OFF); // act_OUT disable - DialogResult result_debug2 = MessageBox.Show("result_debug2", "Warning",MessageBoxButtons.OKCancel); - - 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++; - } + 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; + } - if(i == 200) - { - Units_status[44,1]="Fail"; - stubManager.Write("CTUATOR-OUT is not moving Up\n"); + 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; } - - 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"); + 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; } - Units_status[46,1]="Pass"; - return 0; - -} - //-------------------------------------------- @@ -336,7 +267,7 @@ public Task<decimal> NewDyeHead_test( Action<string> settext, CancellationToken delay(100); stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,MGNET_EN); // magnet enable -// delay(100); + delay(100); stubManager.Write("Magnet is Open\n"); delay(1000); @@ -344,12 +275,11 @@ public Task<decimal> NewDyeHead_test( Action<string> settext, CancellationToken temp=read_pio (LS_UPPER); // read LS_UPPER if (temp != 0) { - Units_status[36,1]="Fail"; - stubManager.Write("Magnet is close\n"); - return 0; + Units_status[47,1]="Fail"; + stubManager.Write("LS_UPPER of Magnet is close\n"); } - DialogResult result = MessageBox.Show("Make shure, Magnet is open", "Warning",MessageBoxButtons.OKCancel); - if(result == DialogResult.Cancel) + DialogResult result = MessageBox.Show("Make shure, Magnet is open", "Warning",MessageBoxButtons.YesNo); + if(result == DialogResult.No) { Units_status[36,1]="Fail"; stubManager.Write("Magnet is close\n"); @@ -357,7 +287,7 @@ public Task<decimal> NewDyeHead_test( Action<string> settext, CancellationToken } //---------------------- Move DyeingHead Lid Motor rear---------------------------- stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,DyeingHeadLid_Motor, true, 250); - stubManager.Write("*** Open Lid Head \n"); + stubManager.Write("*** Open Lid Head ********* \n"); temp = 0; i=0; @@ -365,25 +295,28 @@ public Task<decimal> NewDyeHead_test( Action<string> settext, CancellationToken { 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) +// 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.YesNo); + if(result2 == DialogResult.No || i==200) { Units_status[37,1]="Fail"; - Units_status[39,1]="Fail"; + // Units_status[39,1]="Fail"; stubManager.Write("LS_REAR Not calibrate\n"); return 0; } - Units_status[37,1]="Pass"; + 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); @@ -396,20 +329,21 @@ public Task<decimal> NewDyeHead_test( Action<string> settext, CancellationToken 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; - } +// 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) + 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"); - return 0; +// return 0; } +// else Units_status[39,1]="Pass"; Units_status[38,1]="Pass"; @@ -424,8 +358,8 @@ public Task<decimal> NewDyeHead_test( Action<string> settext, CancellationToken temp=read_pio (LS_UPPER); // read LS_UPPER if (temp == 0) { - Units_status[36,1]="Fail"; - stubManager.Write("Magnet is open\n"); + Units_status[47,1]="Fail"; + stubManager.Write("LS_UPPER of Magnet is open\n"); return 0; } DialogResult result4 = MessageBox.Show("Make shure, Magnet is close", "Warning",MessageBoxButtons.OKCancel); @@ -436,6 +370,9 @@ public Task<decimal> NewDyeHead_test( Action<string> settext, CancellationToken return 0; } Units_status[36,1]="Pass"; + Units_status[47,1]="Pass"; + Units_status[38,1]="Pass"; + stubManager.Write("Magnet is close\n"); return 0; } @@ -452,11 +389,11 @@ public int Test_new_heaters_pt100() float current=0; Double current_sense; - for (Int32 i = 0; i < 12; i++) + for (Int32 i = 0; i < 12; i++) //12 { Int32 tdly=10000; //---------------------- get tempurature of heaters---------------------------- - temp= 0x8000 +12+i/2+(i%2)*8; //HZone_1=12 + temp= 12+i/2+(i%2)*8; //HZone_1=12 //HZone_2=20 //HZone_3=13 //HZone_4=21 @@ -468,6 +405,7 @@ public int Test_new_heaters_pt100() //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; @@ -475,10 +413,10 @@ public int Test_new_heaters_pt100() if ((ftemp>50)|| (ftemp<15)) { Units_status[i,1]="Fail"; - tdly=1000; + tdly=2000; } - stubManager.Write("Zone-"+(i+1)+ "\t" + ftemp.ToString("F2")+"°C\n"); + 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; @@ -486,44 +424,46 @@ public int Test_new_heaters_pt100() { Units_status[i+12,1]="Fail"; } - stubManager.Write("current is "+(i+1)+ "\t" + current_sense +"\n"); + 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 + 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"); + 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.Write("Heater - "+(i+1)+ "\t is On\n"); - delay(2000); //delay 20 second +// 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.1) ||(current_sense>1.4) ) //if current not 1.25A + if ((current_sense<1.0) ||(current_sense>1.5) ) //if current not 1.25A { Units_status[i+12,1]="Fail"; } - stubManager.Write("current is "+(i+1)+ "\t" + current_sense +"\n"); + 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 - { + 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"; - stubManager.Write("Break Zone "+(i+1)+ "\t is Off\n"); } else { - stubManager.Write("Break Zone "+(i+1)+ "\t is On\n"); + stubManager.Write("Break Zone "+(i+1)+ "\t is Off\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; @@ -533,9 +473,11 @@ public int Test_new_heaters_pt100() { Units_status[i,1]="Fail"; } - stubManager.Write("Zone-"+(i+1)+ "after heating is \t" + ftemp1.ToString("F2")+"°C\n"); + 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,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"); } @@ -546,8 +488,10 @@ 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 @@ -555,7 +499,6 @@ Int32 read_pio(Int32 i2c_input) //enable_all_channel(); public int Test_Head_EEPROM(string s_n) { - stubManager.WriteLine("--debug -1"); enable_channel(Head_Mux_Channel_ID); // Chanel 0-7 => Disp0enser 0-7 @@ -639,7 +582,6 @@ int Read_EEPROM(uint I2C_Slave_Add) var response1 = stubManager.Run<StubI2CReadBytesResponse>(stubI2CReadBytesRequest); uint temph=0; char[] characters = EEPROM_Header.ToCharArray(); - stubManager.WriteLine("--debug --7 "); for(int i=0; i<stubI2CReadBytesRequest.NumberOfBytesToRead;i++) { temp = Convert.ToChar(response1.ReadBytes[i]); diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/New_DyeHead_Jig1.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/New_DyeHead_Jig1.cs new file mode 100644 index 000000000..801326136 --- /dev/null +++ b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/New_DyeHead_Jig1.cs @@ -0,0 +1,590 @@ +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_UPPER_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; + + 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; + + 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 ---------------------------- + 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"); + } + DialogResult result = MessageBox.Show("Make shure, Magnet is open", "Warning",MessageBoxButtons.YesNo); + if(result == DialogResult.No) + { + 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.YesNo); + if(result2 == DialogResult.No || i==200) + { + Units_status[37,1]="Fail"; + // Units_status[39,1]="Fail"; + stubManager.Write("LS_REAR Not calibrate\n"); + return 0; + } + 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 +// 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.YesNo); + if(result3 == DialogResult.No || i==200) + { + Units_status[38,1]="Fail"; + stubManager.Write("LS_FRONT Not calibrate\n"); +// return 0; + } + 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 ---------------------------- + 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; + } + 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++) //12 + { + 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=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)<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.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 index 949d0a194..14ac034fc 100644 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/New_Mixer_Jig.cs +++ b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/New_Mixer_Jig.cs @@ -12,10 +12,11 @@ using Tango.PMR.Stubs; using Tango.Stubs; const int New_Mixer_UNDER_TEST=4; -const Int32 Valve_EN=0x420220; -const Int32 Valve_DIS=0x420200; -const Int32 Mixer_ON=0x420210; -const Int32 Mixer_OFF=0x420200; + +const Int32 Valve_EN=0x42F501; +const Int32 Valve_DIS=0x42F500; +const Int32 Mixer_ON=0x42F401; +const Int32 Mixer_OFF=0x42F400; float NewMixerTemp ; @@ -58,7 +59,7 @@ public Task<decimal> New_Mixer_test( Action<string> settext, CancellationToken c }); return task; } - + //-------------------------------------------- int Test_VALVE_New_Mixer () { @@ -96,7 +97,7 @@ public int Test_New_Mixer_heater_pt100() //---------------------- get tempurature of mixer---------------------------- - stubManager.Write("\nTemp Befor heating \n"); +// stubManager.Write("\nTemp Befor heating \n"); var response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" , 19); //get temperature from mixer ftemp = (float)response.TemperatureCMultBy100; @@ -118,19 +119,19 @@ public int Test_New_Mixer_heater_pt100() //---------------------- 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 + if ((temp & 0x10 )==0) //if break ok { Units_status[2,1]="Fail"; - stubManager.Write("Break Mixer is Off\n"); + stubManager.Write("Break Mixer is On\n"); } else { - stubManager.Write("Break Mixer is On\n"); + 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(2000); //delay 20 second + delay(tdly); //delay 20 second //---------------------- get current of mixer ---------------------------- var response3 = stubManager.Run<StubMidTankPressureSensorResponse>("StubMidTankPressureSensorRequest" ,0x8000 + 20); // get current current_sense=response3.Pressure; @@ -142,21 +143,21 @@ public int Test_New_Mixer_heater_pt100() //---------------------- 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 + if ((temp & 0x10 )==0) //if break ok { Units_status[2,1]="Fail"; - stubManager.Write("Break Mixer is Off\n"); + stubManager.Write("Break Mixer is On\n"); } else { - stubManager.Write("Break Mixer is On\n"); + 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)>35)) + if (((ftemp1-ftemp)<5)|| ((ftemp1-ftemp)>50)) { Units_status[0,1]="Fail"; } diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/RTFU_Jig.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/RTFU_Jig.cs index d63cbe86c..9863a2ea1 100644 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/RTFU_Jig.cs +++ b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/RTFU_Jig.cs @@ -48,7 +48,7 @@ public Task<decimal> RTFU_test( Action<string> settext, CancellationToken cancel 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 +// 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(); @@ -76,7 +76,7 @@ int Test_RLOADING_RTFU() int temp=1; int counter; - Motor_SetParam(F1_MOTO_RLOADING_TX1,F1_MOTO_RLOADING_TX0,0x0a,0x40000000); //set kval ran to 0x40- 1.9A +// Motor_SetParam(F1_MOTO_RLOADING_TX1,F1_MOTO_RLOADING_TX0,0x0a,0x40000000); //set kval ran to 0x40- 1.9A delay(100); stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,RLOADING_Motor, true,200); //move Rloading down delay(3000); @@ -103,9 +103,9 @@ int Test_RLOADING_RTFU() } //----------------------------------------- mov RLOADING up ------------------------------------------------- - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,RLOADING_Motor,false,200); //move Rloading up + stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,RLOADING_Motor,false,300); //move Rloading up counter =0; - while ( counter < 150) + while ( counter < 200) { counter = counter + 1; response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_03_Direct); //if LS_RLOADMOTOR_UP is up then move down @@ -116,7 +116,7 @@ int Test_RLOADING_RTFU() } stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,RLOADING_Motor, 3); //hold Rloading high z - if (counter == 150) + if (counter == 200) { Units_status[0,1]="Fail"; stubManager.Write("LS_RLOADMOTOR_UP\tFail\n"); @@ -144,9 +144,9 @@ int Test_RLOADING_RTFU() } //------------------------------------------ mov RLOADING dn ------------------------------------------------ - stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,RLOADING_Motor, true,200); //move Rloading down + stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,RLOADING_Motor, true,300); //move Rloading down counter =0; - while ( counter < 150) + while ( counter < 200) { counter = counter + 1; response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_LS_03_Direct); //if LS_RLOADMOTOR_UP is up then move down diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Tango_define.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Tango_define.cs index 8f2d3b28f..a66fa5fa1 100644 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Tango_define.cs +++ b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Tango_define.cs @@ -111,6 +111,8 @@ 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; diff --git a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Winder_Jig.cs b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Winder_Jig.cs index 9c52ee205..f1f3cd357 100644 --- a/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Winder_Jig.cs +++ b/Software/Stubs Collection/stubs/Scripts/Jig_Tester/Winder_Jig.cs @@ -162,7 +162,7 @@ public int Test_Winder_motor () if ((temp>20000) && temp<28000) Units_status[4,1]="Pass"; else - Units_status[4,1]="Fail"; + Units_status[4,1]="Fail";// return 1; } @@ -177,7 +177,7 @@ int Test_Pooler_Exist() DialogResult result2 = MessageBox.Show("Remove Spool"); if ( (GetBit(F1_LS_03_Direct,11))!=0) - Units_status[5,1]="Fail"; + Units_status[5,1]="Fail"; // else Units_status[5,1]="Pass"; diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/1.cs b/Software/Stubs Collection/stubs/Scripts/Set loading arm center.cs index 4100a770c..bb502309e 100644 --- a/Software/Stubs Collection/stubs/Scripts/Assemblies/Header/1.cs +++ b/Software/Stubs Collection/stubs/Scripts/Set loading arm center.cs @@ -10,19 +10,13 @@ using System.Collections.Generic; using Tango.PMR.Stubs; using Tango.Stubs; - -include "..\..\Defines\Tango_Defines_Basic.cs" -include "Tango_Defines_SSR.cs" - public void OnExecute(StubManager stubManager) { - - //Write GPO_DRYER_SSR1_CTRL SSR/SSR no. 1 - SetBit (FPGA2, F2_CTRL, 0, 1); - stubManager.Write("\nTesting SSR no. 13 of magnet"); - - - +ProgressRequest progressRequest = new ProgressRequest(); +progressRequest.Amount = 0xB1; + +var response = stubManager.Run<ProgressResponse>(progressRequest); + }
\ No newline at end of file diff --git a/Software/Stubs Collection/stubs/Scripts/load parameters from machine.cs b/Software/Stubs Collection/stubs/Scripts/load parameters from machine.cs new file mode 100644 index 000000000..62ceff195 --- /dev/null +++ b/Software/Stubs Collection/stubs/Scripts/load parameters from machine.cs @@ -0,0 +1,59 @@ +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; +using Google.Protobuf; +using Tango.PMR.EmbeddedParameters; +using System.IO; +using Tango.PMR.IO; + + +public void OnExecute(StubManager stubManager) +{ + + +ConfigurationParameters configurationParameters = new ConfigurationParameters(); + + Thread.Sleep(1000); + +stubManager.Write("\n\n Loading file from machine"); + +FileDownloadRequest fileDownloadRequest = new FileDownloadRequest(); +fileDownloadRequest.FileName = "SYSINFO//EmbParam.cfg"; +FileDownloadResponse response2 = stubManager.Run<FileDownloadResponse>(fileDownloadRequest); + Thread.Sleep(1000); +long chunk_size = response2.MaxChunkLength; +string Download_Id = response2.DownloadID; +//FileStream fs = new FileStream("C:/temp/EmbParam.cfg",FileMode.Open); + +stubManager.Write("Position "+ response2.DownloadID+ " Length "+ response2.MaxChunkLength +"\n\n"); +FileChunkDownloadRequest fileChunkDownloadRequest = new FileChunkDownloadRequest(); +fileChunkDownloadRequest.DownloadID = response2.DownloadID; +var response3 = stubManager.Run<FileChunkDownloadResponse>(fileChunkDownloadRequest); +Thread.Sleep(2000); +//byte[] chunk = new byte[500];//Math.Min(chunk_size,fs.Length - fs.Position) +//chunk.Copy(response3.Buffer); +//fs.Write(fs,chunk,chunk.Length); + //fileChunkDownloadRequest.Buffer = ByteString.CopyFrom(chunk); +//fs.Close(fs); + +//byte[] fileBytes = File.ReadAllBytes(fs); + + +var config = ConfigurationParameters.Parser.ParseFrom(response3.Buffer); + + stubManager.Write( config); + +/* +13:46:42.38: Executing script 'embeddedparametersbuild.cs'... +{ "BreakSensorLimit": 10, "DiagnosticCollectionLimit": 1, "OverHeatCountLimit": 3, "UnderHeatCountLimit": 3, "CloseValveTimeout": 255, "OpenValveTimeout": 255, "InitialDispenserPressure": 1.5, "InitialDispenserTimeout": 60000, "InitialDispenserTimeLag": 100, "DispenserBuildPressureSpeed": 800, "DispenserBuildPressureLimit": 0.9, "DispenserBuildPressureTimeout": 80000, "DispenserBuildPressureLag": 50, "ACHeatersLowerOperationLimit": 995, "ACHeatersUpperOperationLimit": 1005, "DCHeatersLowerOperationLimit": 978, "DCHeatersUpperOperationLimit": 1005, "DispenserPresegmentWFCF": 80, "StartHeatingOnInitSequence": true, "GeneralParameters": [ 1, 1, 1, 1, 800, 1000 ], "CurrentAlarmLowLimit": 0.8, "CurrentAlarmHighLimit": 1.07, "IDSSegmentRefillTimeout": 5000, "IDSPreSegmentBuildupTime": 5000, "IDSCleaningSpeed": 50, "IDSCleaningStopBeforeSegmentTime": 3000, "IDSCleaningStartSprayPreSegmentTime": 1000, "IDSLeftCleaningMotorSpeed": 30, "IDSRightCleaningMotorSpeed": 23, "SwitchToIdleTimeinSeconds": 3600, "IdleDrierTemperature": 80, "IdleHeadTemperature": 80, "PowerOffTemperatureLimit": 50, "IDSPreSegmentWFCFTimeBeforeSegment": 1500 } */ + + +}
\ No newline at end of file diff --git a/Software/Stubs Collection/stubs/Scripts/magnet_new_head.cs b/Software/Stubs Collection/stubs/Scripts/magnet_new_head.cs new file mode 100644 index 000000000..bf48de49e --- /dev/null +++ b/Software/Stubs Collection/stubs/Scripts/magnet_new_head.cs @@ -0,0 +1,23 @@ +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; + +public void OnExecute(StubManager stubManager) +{ + for (int i = 0; i < 1000; i++) + { + stubManager.Run<ProgressResponse>("ProgressRequest" ,0x0EAD,0x42F701); // turn magnet on //slave add 0x42, F for write, set bit 7 + Thread.Sleep(100); + + + + } +}
\ No newline at end of file diff --git a/Software/Stubs Collection/stubs/Scripts/process parameters.cs b/Software/Stubs Collection/stubs/Scripts/process parameters.cs new file mode 100644 index 000000000..d2b36b111 --- /dev/null +++ b/Software/Stubs Collection/stubs/Scripts/process parameters.cs @@ -0,0 +1,57 @@ +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.Printing; +using Tango.Stubs; + +public void OnExecute(StubManager stubManager) +{ + +UploadProcessParametersRequest uploadProcessParametersRequest = new UploadProcessParametersRequest(); + +ProcessParameters processParameters = new ProcessParameters(); +processParameters.DyeingSpeed = 0; +processParameters.MinInkUptake = 0; +processParameters.MaxInkUptake = 0; +processParameters.FeederTension = 0; +processParameters.PullerTension = 0; +processParameters.WinderTension = 0; +processParameters.MixerTemp = 0; +processParameters.HeadZone1Temp = 0; +processParameters.HeadZone2Temp = 0; +processParameters.HeadZone3Temp = 0; +processParameters.HeadZone4Temp = 0; +processParameters.HeadZone5Temp = 0; +processParameters.HeadZone6Temp = 0; +processParameters.DryerAirFlow = 0; +processParameters.DryerZone1Temp = 100; +processParameters.DryerZone2Temp = 0; +processParameters.DryerZone3Temp = 0; +processParameters.DryerBufferLength = 0; +processParameters.HeadAirFlow = 0; +processParameters.TableIndex = 0; +processParameters.HeadZone7Temp = 0; +processParameters.HeadZone8Temp = 0; +processParameters.HeadZone9Temp = 0; +processParameters.HeadZone10Temp = 0; +processParameters.HeadZone11Temp = 0; +processParameters.HeadZone12Temp = 0; +processParameters.RBlowerFlow = 0; +processParameters.RBlowerTemp = 0; +processParameters.LBlowerFlow = 0; +processParameters.LBlowerTemp = 0; +processParameters.PressureBuildUp = 0; + +uploadProcessParametersRequest.ProcessParameters = processParameters; + + + + var response = stubManager.Run<UploadProcessParametersResponse>(uploadProcessParametersRequest); + +}
\ No newline at end of file diff --git a/Software/Stubs Collection/stubs/Scripts/single temperature.cs b/Software/Stubs Collection/stubs/Scripts/single temperature.cs new file mode 100644 index 000000000..a65e7ccca --- /dev/null +++ b/Software/Stubs Collection/stubs/Scripts/single temperature.cs @@ -0,0 +1,23 @@ +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; + +public void OnExecute(StubManager stubManager) +{ + + +ProgressRequest progressRequest = new ProgressRequest(); +progressRequest.Amount = 0xCC; +progressRequest.Delay = 1; + + var response = stubManager.Run<ProgressResponse>(progressRequest); + +}
\ No newline at end of file diff --git a/Software/Stubs Collection/stubs/newWHS/newWHS.zip b/Software/Stubs Collection/stubs/newWHS/newWHS.zip Binary files differdeleted file mode 100644 index aa40eca3a..000000000 --- a/Software/Stubs Collection/stubs/newWHS/newWHS.zip +++ /dev/null |
