aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder
diff options
context:
space:
mode:
authorMirta <mirta@twine-s.com>2020-12-30 16:39:52 +0200
committerMirta <mirta@twine-s.com>2020-12-30 16:39:52 +0200
commit00a491d93733d4625ad329b2ba8237f445364b3f (patch)
tree4b24c6fa78d7648f4bb7cefafa464bb0b063fec4 /Software/Stubs Collection/stubs/Scripts/Assemblies/Winder
parent124ad4150f80c6846fdee41dbbda9848c105f6e5 (diff)
downloadTango-00a491d9.tar.gz
Tango-00a491d9.zip
merge
Diffstat (limited to 'Software/Stubs Collection/stubs/Scripts/Assemblies/Winder')
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Screw_Encoder.cs44
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_Jig.cs370
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_Zero.cs90
-rw-r--r--Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_spoll_exist.cs65
4 files changed, 0 insertions, 569 deletions
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Screw_Encoder.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Screw_Encoder.cs
deleted file mode 100644
index 88a2e703a..000000000
--- a/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Screw_Encoder.cs
+++ /dev/null
@@ -1,44 +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;
-
-public void OnExecute(StubManager stubManager)
-{
-
-UInt32 temp ;
-
-
-
-
-
- // Request ----
-// UInt32 : Address
-
-// Response ----
-// UInt32 : Address
-// UInt32 : Value
-// String : Status
-// UInt32 : StatusWord
-
-while (true)
- {
-var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,0x60000100);
-var response1 = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,0x60000102);
-
-temp=(response.Value & 0xffff )+((response1.Value & 0xffff )<<16);
-temp=temp&0x0fffffff;
-stubManager.WriteHex(temp,8);
-stubManager.Write("\n");
-
- Thread.Sleep(100);
-
-}
-} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_Jig.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_Jig.cs
deleted file mode 100644
index 518cd5be3..000000000
--- a/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_Jig.cs
+++ /dev/null
@@ -1,370 +0,0 @@
-using System;
-using System.Text;
-using System.IO;
-using System.Linq;
-using System.Drawing;
-using System.Diagnostics;
-using System.Windows.Forms;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Collections.Generic;
-using Tango.PMR.Stubs;
-using Tango.Stubs;
-
-
-//include "..\..\Defines\Tango_Defines_Basic.cs"
-//include "Tango_Defines_LimitSwitch.cs"
-
-const Int32 FPGA1 = 0x60000000;
-const Int32 FPGA2 = 0x60000400;
-const Int32 FPGA3 = 0x60000800;
-const Int32 F1_LS_03_Direct = 0x040 ; // Reads the direct values that are currently being sent to the fpga. rsv rsv rsv rsv F1_SW_SPOOL_EXISTS F1_SW_SPARE F1_LS_RDANCER_DOWN F1_LS_RDANCER_UP F1_LS_RLOADMOTOR_DOWN F1_LS_RLOADMOTOR_UP F1_LS_RLOADRAM_DOWN F1_LS_RLOADRAM_UP F1_LS_RSPARE1 F1_LS_RSPARE2 F1_LS_SCREW_LEFT F1_LS_SCREW_RIGHT
-
-
-
-
-const int UNIT_UNDER_TEST=6;
-//--------------------------------------------------------------------------------
-string path1="P:\\Scripts\\Assemblies\\Winder\\WinderLog\\";
-string path2="C:\\WinderLog\\";
-
-string File_Name1 ;
-string Status;
-//---------------------------
-
-
-string [,] Units_status = new string[UNIT_UNDER_TEST,2] {
- {"Winder_Motor","Not Test"},
- {"Screw_Motor","Not Test"},
- {"LS_Screw_Right","Not Test"},
- {"LS_Screw_Left","Not Test"},
- {"Screw_Encoder","Not Test"},
- {"SW_Spool_Exist","Not Test"},
- };
-
-
-
-//-----------------------------------------------------
-string Winder_Sn;
-//--------------------------------------------------------------------------------
-
-public void OnExecute(StubManager stubManager)
-{
-string path="";
- Form form1 = new Form();
-
-// Set the caption bar text of the form.
-
- form1.Text = "Winder Test";
- form1.FormBorderStyle = FormBorderStyle.FixedDialog;
- form1.MaximizeBox = false;
- form1.MinimizeBox = false;
- form1.StartPosition = FormStartPosition.CenterScreen;
- form1.AutoSize = true;
- form1.AutoSizeMode = AutoSizeMode.GrowAndShrink;
-// Create buttons to Run.
- Button button1 = new Button ()
- {
- Width = 100,
- Height = 100,
- };
- button1.Text = "Run";
- button1.Location = new Point (40, 100);
- form1.Controls.Add(button1);
-//-----Winder Serial Number -----------
-
- Label Label1 = new Label ()
- {
- Width = 150,
- Height = 20,
- Text =" Winder S/N"
- };
- Label1.Location = new Point (30, 10);
- form1.Controls.Add(Label1);
- TextBox TextBox1 = new TextBox ()
- {
- Width = 100,
- Height = 10,
- Text =""
- };
- TextBox1.Location = new Point (40, 40);
- form1.Controls.Add(TextBox1);
- //----------LOCATION----------
-
- Label Label3 = new Label ()
- {
- Width = 150,
- Height = 20,
- Text ="LOCATION"
- };
-Label3.Location = new Point (350, 10);
- form1.Controls.Add(Label3);
-
-
-
-TextBox TextBox3 = new TextBox ()
- {
- Width = 100,
- Height = 10,
- Text =""
- };
-TextBox3.Location = new Point (360, 40);
- form1.Controls.Add(TextBox3);
-
-//--------------------------------------------------------------------------------
-
- stubManager.Write("Counter is 2 \n");
-
- button1.Click += (_,__) =>
-
- {
-if (!Directory.Exists(path1))
- {
- path=path2;
- if (!Directory.Exists(path2))
- Directory.CreateDirectory(path2);
- }
-else
-path=path1;
-
-
-File_Name1=path + TextBox1.Text +"_Winder_" + DateTime.Now.ToString("MM_dd_yyyy_HH_mm_ss")+".log" ;
-
-
-stubManager.Write(File_Name1 +"\n");
-stubManager.WriteToFile(File_Name1,DateTime.Now +" " );
-stubManager.Write(DateTime.Now +"\n" );
-
-stubManager.AppendToFile(File_Name1,"Winder Test Report" );
-stubManager.Write("Winder Test Report\n" );
-
-stubManager.AppendToFile(File_Name1,"Winder S/N: \t" + TextBox1.Text );
-stubManager.Write("Winder S/N:" + TextBox1.Text +"\n" );
-
-
-stubManager.AppendToFile(File_Name1,"Location:\t" + TextBox3.Text );
-stubManager.Write("Location:" + TextBox3.Text +"\n" );
-
-
-
-Label Label5 = new Label ()
- {
- Width = 120,
- Height =100,
- Text = ""
- };
-Label5.Location = new Point (300, 100);
-Label5.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
-
-Label5.Text="Pros";
-Label5.Font = new Font("Arial", 24,FontStyle.Bold);
-form1.Controls.Add(Label5);
-
-
-//------------------------------- start test -----------
- Test_Winder_motor();
- Test_Screw_LS_Motor_Encoder ();
- Test_Pooler_Exist ();
-
-
-
- Status=write_to_file();
-
- Label5.Text=Status;
- TextBox1.Text="";
-};
-
- form1.ShowDialog();
-
- return ;
- }
-//------------------------------------------
-int Test_Winder_motor ()
-
-{
-
- stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,15, true, 500); //rotate Winder Motor.
- stubManager.Write("Winder Motor rotate \n ");
- DialogResult result = MessageBox.Show("Are Winder Motor rotate?", "Warning",MessageBoxButtons.YesNo);
- if(result == DialogResult.No)
- {
- Units_status[0,1]="Fail";
- stubManager.Write("Winder Motor not rotate\n");
- }
- else
- {
- Units_status[0,1]="Pass";
- stubManager.Write("Winder Motor rotate\n");
- }
- stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,15,3); //stop motor
-
- return 0;
-}
-
-
-//--------------------------------------------
- int Test_Screw_LS_Motor_Encoder()
-{
- UInt32 temp ;
- Int32 Bit = 1;
-
- stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,14, false, 250); //rotate screw Motor out.
- Thread.Sleep(1000);
- stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,14,3); //stop motor
-
- DialogResult result2 = MessageBox.Show("Did screw Motor move ?", "Warning",MessageBoxButtons.YesNo);
- if(result2 == DialogResult.No)
- {
- Units_status[1,1]="Fail";
- stubManager.Write("Screw Motor not move\n");
- return 0;
- }
- Units_status[1,1]="Pass";
-
- stubManager.Write("Screw Motor rotate \n ");
-
- stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,14, true, 250);
- stubManager.Write("\nMove screw in ");
-
- Bit = 1;
- int i=0;
- while ((Bit != 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec
- {
- Bit = GetBit(FPGA1, F1_LS_03_Direct,0);
- Thread.Sleep(50);
- i++;
- }
- stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,14,3); //stop motor
-
- DialogResult result1 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.YesNo);
- if(result1 == DialogResult.No)
- {
- Units_status[2,1]="Fail";
- stubManager.Write("LS_SCREW_RIGHT Not calibrate\n");
- return 0;
- }
- Units_status[2,1]="Pass";
- stubManager.Write("\nMove screw out \n");
-
- stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000100, 0x0000); //clear encoder
- stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000102, 0x0000); //clear encoder
-
- Bit = 1;
- stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,14, false, 250);
- i=0;
- while ((Bit != 0x0) && (i<200)) //wait until Limit Switch or timeout 200*50msec=10sec
- {
- Bit = GetBit(FPGA1, F1_LS_03_Direct,1);
- Thread.Sleep(50);
- i++;
- }
- stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,14,3); //stop motor
-
- DialogResult result3 = MessageBox.Show("Limit Switch calibrate ?", "Warning",MessageBoxButtons.YesNo);
- if(result3 == DialogResult.No)
- {
- Units_status[3,1]="Fail";
- stubManager.Write("LS_SCREW_LEFT Not calibrate\n");
- return 0;
- }
- Units_status[3,1]="Pass";
-
- var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,0x60000100);
- var response1 = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,0x60000102);
-
- temp=(response.Value & 0xffff )+((response1.Value & 0xffff )<<16);
- temp=temp&0x0fffffff;
- temp= 0x4000000-temp;
- stubManager.Write("Encoder positio:" +temp+"\n");
-
- if ((temp>20000) && temp<28000)
- Units_status[4,1]="Pass";
- else
- Units_status[4,1]="Fail";
-
- return 1;
-}
- //---------------------------------------
-int Test_Pooler_Exist()
-{
- if ( (GetBit(FPGA1, F1_LS_03_Direct,11))==0)
- {
- Units_status[5,1]="Fail";
- return 0;
- }
-
- DialogResult result2 = MessageBox.Show("Remove Spool");
- if ( (GetBit(FPGA1, F1_LS_03_Direct,11))!=0)
- Units_status[5,1]="Fail";
- else
- Units_status[5,1]="Pass";
-
- return 0 ;
-
-
-}
- //------------------------------------
-string write_to_file()
-{
- stubManager.Write("write_to_file\n");
-
-string Stemp="Pass";
- for (int i=0;i<UNIT_UNDER_TEST;i++)
- {
- stubManager.AppendToFile(File_Name1,Units_status[i,0]+"\t" + Units_status[i,1] );
- stubManager.Write(Units_status[i,0]+"\t" + Units_status[i,1]+"\n" );
-
- if ((Units_status[i,1]=="Fail")||(Units_status[i,1]=="Not Test"))
- Stemp="Fail";
- }
- if (Stemp=="Fail")
- {
- stubManager.AppendToFile(File_Name1,"-------------Winder Fail ------------ ");
- stubManager.Write("-------------Winder Fail ------------ ");
- }
- else
- {
- stubManager.AppendToFile(File_Name1,"-------------Winder Pass ------------ )");
- stubManager.Write("-------------Winder Pass ------------ ");
- }
-
- return Stemp;
-
-}
-
-
-
-Int32 GetBit(Int32 Fpga, Int32 Adr, Int32 BitNo)
-{
- Int32 BitMask;
- var RetVal = Fpga_Read_Reg(Fpga, Adr, 0);
- BitMask = 0x1 << BitNo;
- if ( ( (Int32) RetVal.Value & BitMask) == BitMask )
- {
- return 1;
- }
- else
- {
- return 0;
- }
-
-}
-
-
-StubFpgaReadRegResponse Fpga_Read_Reg(Int32 Fpga, Int32 Addr, Int32 Verbose)
-{
- var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" , Fpga + Addr);
- response.Value = response.Value & 0xffff;
-
- if (Verbose == 1) {
- stubManager.Write("FPGA Reg. Read (FPGA Base, Addr, Data): (");
- stubManager.WriteHex(Fpga,4);
- stubManager.Write(", ");
- stubManager.WriteHex(Addr,4);
- stubManager.Write(", ");
- stubManager.WriteHex(response.Value,4);
- stubManager.Write(")");
- }
-
- return response;
-}
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_Zero.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_Zero.cs
deleted file mode 100644
index 46894812c..000000000
--- a/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_Zero.cs
+++ /dev/null
@@ -1,90 +0,0 @@
-using System;
-using System.Text;
-using System.Linq;
-using System.Drawing;
-using System.Diagnostics;
-using System.Windows.Forms;
-using System.Threading;
-using System.Threading.Tasks;
-using System.Collections.Generic;
-using Tango.PMR.Stubs;
-using Tango.Stubs;
-
-const Int32 FPGA1 = 0x60000000;
-const Int32 FPGA2 = 0x60000400;
-const Int32 FPGA3 = 0x60000800;
-const Int32 F1_LS_03_Direct = 0x040 ; // Reads the direct values that are currently being sent to the fpga. rsv rsv rsv rsv F1_SW_SPOOL_EXISTS F1_SW_SPARE F1_LS_RDANCER_DOWN F1_LS_RDANCER_UP F1_LS_RLOADMOTOR_DOWN F1_LS_RLOADMOTOR_UP F1_LS_RLOADRAM_DOWN F1_LS_RLOADRAM_UP F1_LS_RSPARE1 F1_LS_RSPARE2 F1_LS_SCREW_LEFT F1_LS_SCREW_RIGHT
-
-//include "..\..\Defines\Tango_Defines_Basic.cs"
-//include "Tango_Defines_Motors.cs"
-
-
-public void OnExecute(StubManager stubManager)
-{
- Int32 position=30;
- UInt32 temp ;
- Int32 Bit = 1;
-
- stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,14, false, 250); //rotate screw Motor out.
- Thread.Sleep(2000);
- stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,14,3); //stop motor
- Thread.Sleep(1000);
-
-
- stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,14, true, 50);
- stubManager.Write("\nMove screw in ");
-
- Bit = 1;
- int i=0;
- while ((Bit != 0x0)&& (i<200) ) //wait until Limit Switch or timeout 200*50msec=10sec
- {
- Bit = GetBit(FPGA1, F1_LS_03_Direct,0);
- Thread.Sleep(10);
- i++;
- }
- stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,14,3); //stop motor
- Thread.Sleep(1000);
-
-
- stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,14, true, position );
- Thread.Sleep(1000);
-
-
-}
-
-
-
-
-Int32 GetBit(Int32 Fpga, Int32 Adr, Int32 BitNo)
-{
- Int32 BitMask;
- var RetVal = Fpga_Read_Reg(Fpga, Adr, 0);
- BitMask = 0x1 << BitNo;
- if ( ( (Int32) RetVal.Value & BitMask) == BitMask )
- {
- return 1;
- }
- else
- {
- return 0;
- }
-
-}
-
-StubFpgaReadRegResponse Fpga_Read_Reg(Int32 Fpga, Int32 Addr, Int32 Verbose)
-{
- var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" , Fpga + Addr);
- response.Value = response.Value & 0xffff;
-
- if (Verbose == 1) {
- stubManager.Write("FPGA Reg. Read (FPGA Base, Addr, Data): (");
- stubManager.WriteHex(Fpga,4);
- stubManager.Write(", ");
- stubManager.WriteHex(Addr,4);
- stubManager.Write(", ");
- stubManager.WriteHex(response.Value,4);
- stubManager.Write(")");
- }
-
- return response;
-}
diff --git a/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_spoll_exist.cs b/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_spoll_exist.cs
deleted file mode 100644
index c0ada87e1..000000000
--- a/Software/Stubs Collection/stubs/Scripts/Assemblies/Winder/Winder_spoll_exist.cs
+++ /dev/null
@@ -1,65 +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_03_Direct: ");
- var RetVal = Fpga_Read_Reg(FPGA1, F1_LS_03_Direct, 0);
- Temp=RetVal.Value & 0x0800;
- if (Temp==0x0800)
- {
- stubManager.Write("\nWinder Spoll Exist ");
- }
- else
- {
- stubManager.Write("\nWinder Spoll NOT Exist ");
- }
- Temp = RetVal.Value;
- stubManager.Write("\nActivate limit switches one-by-one");
-
- while ( counter != 100)
- {
- RetVal = Fpga_Read_Reg(FPGA1, F1_LS_03_Direct, 0);
- if (RetVal.Value != Temp)
- {
-// stubManager.Write("\nRegister F1_LS_03_Direct new value: ");
-// stubManager.WriteHex(RetVal.Value,4);
-
- Temp=RetVal.Value & 0x0800;
- if (Temp==0x0800)
- {
- stubManager.Write("\nWinder Spoll Exist ");
- }
- else
- {
- stubManager.Write("\nWinder Spoll NOT Exist ");
- }
-
-
-
- counter = counter + 1;
- }
- Thread.Sleep(50);
- Temp=RetVal.Value;
- }
-
-
-
-} \ No newline at end of file