aboutsummaryrefslogtreecommitdiffstats
path: root/Software
diff options
context:
space:
mode:
authorAvi Levkovich <avi@twine-s.com>2019-02-20 12:32:15 +0200
committerAvi Levkovich <avi@twine-s.com>2019-02-20 12:32:15 +0200
commit1767535a1e6ecbdb05ffe62dda85c9fb78e6718f (patch)
treec35b2595b65c2bb0a62993d80a6af93861be14fe /Software
parenta576283d2a9288938796491582dd9f575f3ff571 (diff)
downloadTango-1767535a1e6ecbdb05ffe62dda85c9fb78e6718f.tar.gz
Tango-1767535a1e6ecbdb05ffe62dda85c9fb78e6718f.zip
upload stubs
Diffstat (limited to 'Software')
-rw-r--r--Software/Stubs Collection/stubs/2Way_valve.cs58
-rw-r--r--Software/Stubs Collection/stubs/ADS120_Internal_Temperature_Sensor.cs46
-rw-r--r--Software/Stubs Collection/stubs/Breathing LED Command.cs68
-rw-r--r--Software/Stubs Collection/stubs/Breathing LED.cs41
-rw-r--r--Software/Stubs Collection/stubs/ElectricalEnclosure_Fans1.cs43
-rw-r--r--Software/Stubs Collection/stubs/FAN_Drawer_RPM.cs40
-rw-r--r--Software/Stubs Collection/stubs/Load_F1_Tango_Full_Vme.cs73
-rw-r--r--Software/Stubs Collection/stubs/Load_F2_Tango_Full_Vme.cs73
-rw-r--r--Software/Stubs Collection/stubs/Load_F3_Tango_Full_Vme.cs73
-rw-r--r--Software/Stubs Collection/stubs/Motors drivers SPI clock Prescaler.cs41
-rw-r--r--Software/Stubs Collection/stubs/Read_Tacho.cs25
-rw-r--r--Software/Stubs Collection/stubs/Screw_Loop.cs70
-rw-r--r--Software/Stubs Collection/stubs/Valves2wy OFF.cs47
-rw-r--r--Software/Stubs Collection/stubs/read_f2_ctrl.cs26
-rw-r--r--Software/Stubs Collection/stubs/screw_LS.cs30
-rw-r--r--Software/Stubs Collection/stubs/valve3 OFF.cs32
16 files changed, 786 insertions, 0 deletions
diff --git a/Software/Stubs Collection/stubs/2Way_valve.cs b/Software/Stubs Collection/stubs/2Way_valve.cs
new file mode 100644
index 000000000..cdc556144
--- /dev/null
+++ b/Software/Stubs Collection/stubs/2Way_valve.cs
@@ -0,0 +1,58 @@
+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 FPGA3 = 0x60000800;
+const Int32 F3_VALVE_OUT = 0x0E2;
+
+/*
+
+4 5
+3 6
+2 7
+1 8
+FRONT
+
+*/
+
+const Int32 MIDTANK2MANIF4_VALVE_2 = 1 << 0;//1
+const Int32 MIDTANK2MANIF4_VALVE_1 = 1 << 1;//8
+const Int32 MIDTANK2MANIF3_VALVE_2 = 1 << 2;//2
+const Int32 MIDTANK2MANIF3_VALVE_1 = 1 << 3;//7
+const Int32 MIDTANK2MANIF2_VALVE_2 = 1 << 4;//3
+const Int32 MIDTANK2MANIF2_VALVE_1 = 1 << 5;//6
+const Int32 MIDTANK2MANIF1_VALVE_2 = 1 << 6;//4
+const Int32 MIDTANK2MANIF1_VALVE_1 = 1 << 7;//5
+
+const Int32 CART2MIDTANK4_VALVE_2 = 1 << 8; //1
+const Int32 CART2MIDTANK4_VALVE_1 = 1 << 9;//8
+const Int32 CART2MIDTANK3_VALVE_2 = 1 << 10;//2
+const Int32 CART2MIDTANK3_VALVE_1 = 1 << 11;//7
+const Int32 CART2MIDTANK2_VALVE_2 = 1 << 12;//3
+const Int32 CART2MIDTANK2_VALVE_1 = 1 << 13;//6
+const Int32 CART2MIDTANK1_VALVE_2 = 1 << 14;//4
+const Int32 CART2MIDTANK1_VALVE_1 = 1 << 15;//5
+
+
+
+public void OnExecute(StubManager stubManager)
+{
+ //ON
+ //var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" , FPGA3 + F3_VALVE_OUT);
+ //stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,FPGA3 | F3_VALVE_OUT, response | MIDTANK2MANIF4_VALVE_2); // ON
+ stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,FPGA3 | F3_VALVE_OUT, MIDTANK2MANIF1_VALVE_1); // ON
+
+
+ //OFF
+ //var response1 = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" , FPGA3 + F3_VALVE_OUT);
+ //stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,FPGA3 + F3_VALVE_OUT, response1 & ~MIDTANK2MANIF4_VALVE_2); // OFF
+ //stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,FPGA3 + F3_VALVE_OUT, 0); // OFF
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/ADS120_Internal_Temperature_Sensor.cs b/Software/Stubs Collection/stubs/ADS120_Internal_Temperature_Sensor.cs
new file mode 100644
index 000000000..6c9d3de2b
--- /dev/null
+++ b/Software/Stubs Collection/stubs/ADS120_Internal_Temperature_Sensor.cs
@@ -0,0 +1,46 @@
+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)
+{
+
+
+ //need embedded version > 20-02-2019
+
+
+
+ //MIXCHIP_TEMP = 0
+ //DYEINGH_TEMP1 = 1
+ //DYEINGH_TEMP2 = 2
+ //DYEINGH_TEMP3 = 3
+ //DYEINGH_TEMP4 = 4
+ //DYEINGH_TEMP5 = 5
+ //DRYER_TEMP1 = 6
+ //DRYER_TEMP2 = 7
+ //DRYER_TEMP3 = 8
+ //AN_ENCLOSURETEMP1 = 9
+ //AN_ENCLOSURETEMP2 = 10
+ //AN_ENCLOSURETEMP3 = 11
+
+ const Int32 Sensor = 2 ;//0-11
+
+ //Pay attention - We are changing the ADS setup - it will be updated only after the second call. - So run the stub twice !!!!!!!!!!!!!!!
+
+ var response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,0x100 | Sensor );
+
+ stubManager.WriteLine("ADS120 - Internal Temperature Sensor: ");
+
+ stubManager.Write(response.TemperatureCMultBy100);
+
+ stubManager.Write(" °C \t");
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Breathing LED Command.cs b/Software/Stubs Collection/stubs/Breathing LED Command.cs
new file mode 100644
index 000000000..7b75631d3
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Breathing LED Command.cs
@@ -0,0 +1,68 @@
+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)
+{
+ int LOW = 0;//0 - 100%
+ int i = 0;
+
+ var response = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000400 | 0x112, 0xFF);//Freq 8 bit
+ while(true)
+ {
+ LOW = 0;
+ for(i=0;i<=100;i++)
+ //while(LOW<100)
+ {
+ var response1 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000400 | 0x3EC, LOW+1);//LOW 8 bit
+ var response2 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000400 | 0x3EE, 101 - LOW);//High 8 bit
+
+ if(i < 33)
+ LOW = LOW + (i % 2);
+ else
+ if(i < 66)
+ LOW = LOW + 1;
+ else
+ LOW = LOW + (i % 2)+1;
+
+ //stubManager.WriteLine(LOW);
+
+ Thread.Sleep(10); //Sleep for 10 milli.
+ }
+ Thread.Sleep(1000);
+
+ //stubManager.WriteLine(LOW);
+ LOW = 100;
+ for(i = 0; i<=100;i++)
+ {
+ var response1 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000400 | 0x3EC, LOW+1);//LOW 8 bit
+ var response2 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000400 | 0x3EE, 101 - LOW);//High 8 bit
+ //Thread.Sleep(14-((LOW*10+50)/100)); //Sleep for 10 milli.
+
+ if(i < 33)
+
+ LOW = LOW - (i % 2)-1;
+ else
+ if(i < 66)
+ LOW = LOW - 1;
+ else
+ LOW = LOW - (i % 2);
+
+ //stubManager.WriteLine(LOW);
+
+ Thread.Sleep(10);
+ }
+
+ }
+
+ // LOW + high = 100 % in order use the same freq
+ // there is option to change only the high (LOW + freq constasnt) this will chnga the freq
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Breathing LED.cs b/Software/Stubs Collection/stubs/Breathing LED.cs
new file mode 100644
index 000000000..197fcb597
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Breathing LED.cs
@@ -0,0 +1,41 @@
+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)
+{
+ int LOW = 0;//0 - 100%
+
+ var response = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000400 | 0x112, 0xFF);//Freq 8 bit
+ while(true)
+ {
+ for(LOW=0;LOW<100;LOW++)
+ {
+ var response1 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000400 | 0x3EC, LOW+1);//Low 8 bit
+ var response2 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000400 | 0x3EE, 101 - LOW);//High 8 bit
+
+
+ Thread.Sleep(14-((LOW*10+50)/100)); //Sleep for 10 milli.
+ }
+ Thread.Sleep(500);
+
+ for(LOW = 100; LOW>0;LOW--)
+ {
+ var response1 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000400 | 0x3EC, LOW+1);//Low 8 bit
+ var response2 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x60000400 | 0x3EE, 101 - LOW);//High 8 bit
+ Thread.Sleep(14-((LOW*10+50)/100)); //Sleep for 10 milli.
+ }
+
+ }
+
+ // low + high = 100 % in order use the same freq
+ // there is option to change only the high (low + freq constasnt) this will chnga the freq
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/ElectricalEnclosure_Fans1.cs b/Software/Stubs Collection/stubs/ElectricalEnclosure_Fans1.cs
new file mode 100644
index 000000000..f1d218964
--- /dev/null
+++ b/Software/Stubs Collection/stubs/ElectricalEnclosure_Fans1.cs
@@ -0,0 +1,43 @@
+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_gpi_FANS: ");
+ var RetVal = Fpga_Read_Reg(FPGA1, 0x170, 0);
+ stubManager.WriteHex(RetVal.Value,4);
+ Temp = RetVal.Value;
+ //stubManager.Write("\nActivate limit switches one-by-one");
+
+ while ( counter != 100)
+ {
+ RetVal = Fpga_Read_Reg(FPGA1, 0x170, 0);
+ stubManager.Write("\nReading register F1_gpi_FANS: ");
+ stubManager.WriteHex(RetVal.Value,4);
+ counter = counter + 1;
+
+ Thread.Sleep(100);
+ }
+
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/FAN_Drawer_RPM.cs b/Software/Stubs Collection/stubs/FAN_Drawer_RPM.cs
new file mode 100644
index 000000000..adb60d09f
--- /dev/null
+++ b/Software/Stubs Collection/stubs/FAN_Drawer_RPM.cs
@@ -0,0 +1,40 @@
+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 "C:\Users\avi\Documents\Tango_stub_exe_tests\Stubs from mati\Scripts\Defines\Tango_Defines_Basic.cs"
+include "C:\Users\avi\Documents\Tango_stub_exe_tests\Stubs from mati\Scripts\Defines\Tango_Defines_Tacho.cs"
+
+const Int32 PPR = 0X02; // Pulse/Round
+const Int32 OSC_IN = 25000000; // Oscilator IN
+
+Int32 V_rpm;
+
+public void OnExecute(StubManager stubManager)
+{
+ Int32 temp;
+
+ var Prescaler = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" , FPGA1 + F1_Prescaler1_reg5);
+ Prescaler.Value = Prescaler.Value & 0xffff;
+
+ var Tacho = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" , FPGA1 + F1_Tacho_reg0);
+ Tacho.Value = Tacho.Value & 0xffff;
+
+ temp = 60 / PPR;//60 Sec
+ temp = temp * OSC_IN;
+ temp = temp / (Int32)Tacho.Value;
+ V_rpm = temp / (Int32)Prescaler.Value;
+
+ stubManager.Write("\nThe drawer big fan speed is ");
+ stubManager.Write(V_rpm);
+ stubManager.Write(" [RPM]");
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Load_F1_Tango_Full_Vme.cs b/Software/Stubs Collection/stubs/Load_F1_Tango_Full_Vme.cs
new file mode 100644
index 000000000..0ab61704b
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Load_F1_Tango_Full_Vme.cs
@@ -0,0 +1,73 @@
+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.IO;
+using Tango.Stubs;
+using Google.Protobuf;
+using System.IO;
+
+public void OnExecute(StubManager stubManager)
+{
+
+GetStorageInfoRequest getStorageInfoRequest = new GetStorageInfoRequest();
+ var response = stubManager.Run<GetStorageInfoResponse>(getStorageInfoRequest);
+
+
+CreateRequest createRequest = new CreateRequest();
+createRequest.Attribute = Tango.PMR.IO.FileAttribute.Directory;
+createRequest.Path = "0://FPGAJTAG";
+ var response1 = stubManager.Run<CreateResponse>(createRequest);
+
+DeleteRequest deleteRequest = new DeleteRequest();
+deleteRequest.Path = "0://FPGAJTAG//F1TangoF.vme";
+ var response5 = stubManager.Run<DeleteResponse>(deleteRequest);
+//deleteRequest.Path = "0://FPGAJTAG//F1_Tango.vme";
+// response5 = stubManager.Run<DeleteResponse>(deleteRequest);
+
+ createRequest.Attribute = 0;
+createRequest.Path = "0://FPGAJTAG//F1TangoF.vme";
+ response1 = stubManager.Run<CreateResponse>(createRequest);
+//createRequest.Attribute = 0;
+//createRequest.Path = "0://FPGAJTAG//FPGAJTAG2.txt";
+// response1 = stubManager.Run<CreateResponse>(createRequest);
+
+
+byte[] fileBytes = File.ReadAllBytes("C:\\FileSystemTests\\F1TangoF.vme");
+
+FileUploadRequest fileUploadRequest = new FileUploadRequest();
+fileUploadRequest.Path = "0://FPGAJTAG//F1TangoF.vme";
+fileUploadRequest.Length = (int)fileBytes.Length;
+FileUploadResponse response2 = stubManager.Run<FileUploadResponse>(fileUploadRequest);
+
+long chunk_size = response2.MaxChunkLength;
+
+FileStream fs = new FileStream("C:\\FileSystemTests\\F1TangoF.vme",FileMode.Open);
+
+while (fs.Position < fs.Length)
+{
+ stubManager.Write("Position "+ fs.Position+ " Length "+ fs.Length +"\n\n");
+ FileChunkUploadRequest fileChunkUploadRequest = new FileChunkUploadRequest();
+ fileChunkUploadRequest.UploadID = response2.UploadID;
+ byte[] chunk = new byte[Math.Min(chunk_size,fs.Length - fs.Position)];
+ fs.Read(chunk,0,chunk.Length);
+ fileChunkUploadRequest.Path = "0://FPGAJTAG//F1TangoF.vme";
+ fileChunkUploadRequest.Buffer = ByteString.CopyFrom(chunk);
+ var response3 = stubManager.Run<FileChunkUploadResponse>(fileChunkUploadRequest);
+ Thread.Sleep(300);//nedded for big files
+
+}
+
+
+GetFilesRequest getFilesRequest = new GetFilesRequest();
+getFilesRequest.Path = "0://FPGAJTAG";
+
+ var response4 = stubManager.Run<GetFilesResponse>(getFilesRequest);
+
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Load_F2_Tango_Full_Vme.cs b/Software/Stubs Collection/stubs/Load_F2_Tango_Full_Vme.cs
new file mode 100644
index 000000000..81266e65c
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Load_F2_Tango_Full_Vme.cs
@@ -0,0 +1,73 @@
+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.IO;
+using Tango.Stubs;
+using Google.Protobuf;
+using System.IO;
+
+public void OnExecute(StubManager stubManager)
+{
+
+GetStorageInfoRequest getStorageInfoRequest = new GetStorageInfoRequest();
+ var response = stubManager.Run<GetStorageInfoResponse>(getStorageInfoRequest);
+
+
+CreateRequest createRequest = new CreateRequest();
+createRequest.Attribute = Tango.PMR.IO.FileAttribute.Directory;
+createRequest.Path = "0://FPGAJTAG";
+ var response1 = stubManager.Run<CreateResponse>(createRequest);
+
+DeleteRequest deleteRequest = new DeleteRequest();
+deleteRequest.Path = "0://FPGAJTAG//F2TangoF.vme";
+ var response5 = stubManager.Run<DeleteResponse>(deleteRequest);
+//deleteRequest.Path = "0://FPGAJTAG//F1_Tango.vme";
+// response5 = stubManager.Run<DeleteResponse>(deleteRequest);
+
+ createRequest.Attribute = 0;
+createRequest.Path = "0://FPGAJTAG//F2TangoF.vme";
+ response1 = stubManager.Run<CreateResponse>(createRequest);
+//createRequest.Attribute = 0;
+//createRequest.Path = "0://FPGAJTAG//FPGAJTAG2.txt";
+// response1 = stubManager.Run<CreateResponse>(createRequest);
+
+
+byte[] fileBytes = File.ReadAllBytes("C:\\FileSystemTests\\F2TangoF.vme");
+
+FileUploadRequest fileUploadRequest = new FileUploadRequest();
+fileUploadRequest.Path = "0://FPGAJTAG//F2TangoF.vme";
+fileUploadRequest.Length = (int)fileBytes.Length;
+FileUploadResponse response2 = stubManager.Run<FileUploadResponse>(fileUploadRequest);
+
+long chunk_size = response2.MaxChunkLength;
+
+FileStream fs = new FileStream("C:\\FileSystemTests\\F2TangoF.vme",FileMode.Open);
+
+while (fs.Position < fs.Length)
+{
+ stubManager.Write("Position "+ fs.Position+ " Length "+ fs.Length +"\n\n");
+ FileChunkUploadRequest fileChunkUploadRequest = new FileChunkUploadRequest();
+ fileChunkUploadRequest.UploadID = response2.UploadID;
+ byte[] chunk = new byte[Math.Min(chunk_size,fs.Length - fs.Position)];
+ fs.Read(chunk,0,chunk.Length);
+ fileChunkUploadRequest.Path = "0://FPGAJTAG//F2TangoF.vme";
+ fileChunkUploadRequest.Buffer = ByteString.CopyFrom(chunk);
+ var response3 = stubManager.Run<FileChunkUploadResponse>(fileChunkUploadRequest);
+ Thread.Sleep(300);//nedded for big files
+
+}
+
+
+GetFilesRequest getFilesRequest = new GetFilesRequest();
+getFilesRequest.Path = "0://FPGAJTAG";
+
+ var response4 = stubManager.Run<GetFilesResponse>(getFilesRequest);
+
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Load_F3_Tango_Full_Vme.cs b/Software/Stubs Collection/stubs/Load_F3_Tango_Full_Vme.cs
new file mode 100644
index 000000000..eea895b88
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Load_F3_Tango_Full_Vme.cs
@@ -0,0 +1,73 @@
+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.IO;
+using Tango.Stubs;
+using Google.Protobuf;
+using System.IO;
+
+public void OnExecute(StubManager stubManager)
+{
+
+GetStorageInfoRequest getStorageInfoRequest = new GetStorageInfoRequest();
+ var response = stubManager.Run<GetStorageInfoResponse>(getStorageInfoRequest);
+
+
+CreateRequest createRequest = new CreateRequest();
+createRequest.Attribute = Tango.PMR.IO.FileAttribute.Directory;
+createRequest.Path = "0://FPGAJTAG";
+ var response1 = stubManager.Run<CreateResponse>(createRequest);
+
+DeleteRequest deleteRequest = new DeleteRequest();
+deleteRequest.Path = "0://FPGAJTAG//F3TangoF.vme";
+ var response5 = stubManager.Run<DeleteResponse>(deleteRequest);
+//deleteRequest.Path = "0://FPGAJTAG//F1_Tango.vme";
+// response5 = stubManager.Run<DeleteResponse>(deleteRequest);
+
+ createRequest.Attribute = 0;
+createRequest.Path = "0://FPGAJTAG//F3TangoF.vme";
+ response1 = stubManager.Run<CreateResponse>(createRequest);
+//createRequest.Attribute = 0;
+//createRequest.Path = "0://FPGAJTAG//FPGAJTAG2.txt";
+// response1 = stubManager.Run<CreateResponse>(createRequest);
+
+
+byte[] fileBytes = File.ReadAllBytes("C:\\FileSystemTests\\F3TangoF.vme");
+
+FileUploadRequest fileUploadRequest = new FileUploadRequest();
+fileUploadRequest.Path = "0://FPGAJTAG//F3TangoF.vme";
+fileUploadRequest.Length = (int)fileBytes.Length;
+FileUploadResponse response2 = stubManager.Run<FileUploadResponse>(fileUploadRequest);
+
+long chunk_size = response2.MaxChunkLength;
+
+FileStream fs = new FileStream("C:\\FileSystemTests\\F3TangoF.vme",FileMode.Open);
+
+while (fs.Position < fs.Length)
+{
+ stubManager.Write("Position "+ fs.Position+ " Length "+ fs.Length +"\n\n");
+ FileChunkUploadRequest fileChunkUploadRequest = new FileChunkUploadRequest();
+ fileChunkUploadRequest.UploadID = response2.UploadID;
+ byte[] chunk = new byte[Math.Min(chunk_size,fs.Length - fs.Position)];
+ fs.Read(chunk,0,chunk.Length);
+ fileChunkUploadRequest.Path = "0://FPGAJTAG//F3TangoF.vme";
+ fileChunkUploadRequest.Buffer = ByteString.CopyFrom(chunk);
+ var response3 = stubManager.Run<FileChunkUploadResponse>(fileChunkUploadRequest);
+ Thread.Sleep(300);//nedded for big files
+
+}
+
+
+GetFilesRequest getFilesRequest = new GetFilesRequest();
+getFilesRequest.Path = "0://FPGAJTAG";
+
+ var response4 = stubManager.Run<GetFilesResponse>(getFilesRequest);
+
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Motors drivers SPI clock Prescaler.cs b/Software/Stubs Collection/stubs/Motors drivers SPI clock Prescaler.cs
new file mode 100644
index 000000000..a1c6070ac
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Motors drivers SPI clock Prescaler.cs
@@ -0,0 +1,41 @@
+using System;
+using System.Text;
+using System.Linq;
+using System.Drawing;
+using System.Diagnostics;
+using System.Windows.Forms;
+using System.Threading;
+using System.Threading.Tasks;
+using System.Collections.Generic;
+using Tango.PMR.Stubs;
+using Tango.Stubs;
+
+const Int32 F1_Prescaler1_reg3 = 0x60000000 + 0x3E4;//LOW
+const Int32 F1_Prescaler1_reg4 = 0x60000000 + 0x3E6;//HIGH
+
+const Int32 F2_Prescaler1_reg5 = 0x60000400 + 0x3E8;//LOW
+const Int32 F2_Prescaler1_reg6 = 0x60000400 + 0x3EA;//HIGH
+
+const Int32 F3_Prescaler1_reg3 = 0x60000800 + 0x3E4;//LOW
+const Int32 F3_Prescaler1_reg4 = 0x60000800 + 0x3E6;//HIGH
+
+
+public void OnExecute(StubManager stubManager)
+{
+ //var response = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,F1_Prescaler1_reg3, 0x03);//High FPGA1 MOTORS
+ var response1 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,F1_Prescaler1_reg4, 0x03);//Low FPGA1 MOTORS
+
+ //var response2 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,F2_Prescaler1_reg4, 0x03);//High FPGA2 MOTORS
+ var response3 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,F2_Prescaler1_reg5, 0x03);//Low FPGA2 MOTORS
+
+ //var response4 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,F3_Prescaler1_reg3, 0x03);//High FPGA3 MOTORS
+ var response5 = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,F3_Prescaler1_reg3, 0x03);//Low FPGA3 MOTORS
+
+
+ var response6 = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F1_Prescaler1_reg4);
+ stubManager.WriteLineHex(response6.Value,2);
+ var response7 = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F2_Prescaler1_reg5);
+ stubManager.WriteLineHex(response7.Value,2);
+ var response8 = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,F3_Prescaler1_reg3);
+ stubManager.WriteLineHex(response8.Value,2);
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Read_Tacho.cs b/Software/Stubs Collection/stubs/Read_Tacho.cs
new file mode 100644
index 000000000..971d89005
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Read_Tacho.cs
@@ -0,0 +1,25 @@
+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.UI;
+
+
+
+
+
+
+public void OnExecute(StubManager stubManager)
+{
+ for (int i = 0; i < 8; i++)
+ {
+ var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,0x60000000 | 0x3C0 | (i*2)); // F1_Tacho_reg0 .. F1_Tacho_reg7
+ }
+ var response1 = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,0x60000000 | 0x3C0 );//F2_Tacho_reg0
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/Screw_Loop.cs b/Software/Stubs Collection/stubs/Screw_Loop.cs
new file mode 100644
index 000000000..21b09ed70
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Screw_Loop.cs
@@ -0,0 +1,70 @@
+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)
+{
+ // FALSE - to the body
+ //TRUE out
+ //stubManager.Run("StubMotorRunRequest" ,15, false, 4000 ); //5000 fidder (18 TESTED)
+ //Thread.Sleep(1000);
+
+ for (int i = 0; i < 20000; i++)
+ {
+ var response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,14, true, 500);
+ Thread.Sleep(1000);
+ //var response2 = stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,14,2);
+ //Thread.Sleep(300);
+ var response3 = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,14, false, 500);
+ Thread.Sleep(1000);
+ }
+ //var response1 = stubManager.Run<StubMotorMovResponse>("StubMotorMovRequest" ,14, false, 500);
+ // Request ----
+// UInt32 : Address
+
+// Response ----
+// UInt32 : Address
+// UInt32 : Value
+// String : Status
+// UInt32 : StatusWord
+ /*{
+
+ var response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,14, false, 20);
+ Thread.Sleep(600);
+ var response1 = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,14, true, 20);
+ Thread.Sleep(600);
+ }
+
+//var response1 = stubManager.Run<StubMotorStatusResponse>("StubMotorStatusRequest" ,14, true);
+//Thread.Sleep(1000);
+// var response = stubManager.Run<StubMotorRunResponse>("StubMotorRunRequest" ,24, false, 20);
+// Thread.Sleep(700);
+
+var response2 = stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,15, 0);
+var response4 = stubManager.Run<StubMotorStopResponse>("StubMotorStopRequest" ,14, 0);*/
+// Request ----
+// UInt32 : Address
+// UInt32 : Value
+
+// Response ----
+// String : Status
+// UInt32 : StatusWord
+//var response = stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,0x600008e2, 0);
+// Request ----
+// UInt32 : Address
+
+// Response ----
+// UInt32 : Address
+// UInt32 : Value
+// String : Status
+// UInt32 : StatusWord
+//var response1 = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,0x600008e2);
+}
diff --git a/Software/Stubs Collection/stubs/Valves2wy OFF.cs b/Software/Stubs Collection/stubs/Valves2wy OFF.cs
new file mode 100644
index 000000000..ab1adde8d
--- /dev/null
+++ b/Software/Stubs Collection/stubs/Valves2wy OFF.cs
@@ -0,0 +1,47 @@
+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 FPGA3 = 0x60000800;
+const Int32 F3_VALVE_OUT = 0x0E2;
+
+const Int32 MIDTANK2MANIF4_VALVE_2 = 1 << 0;
+const Int32 MIDTANK2MANIF4_VALVE_1 = 1 << 1;
+const Int32 MIDTANK2MANIF3_VALVE_2 = 1 << 2;
+const Int32 MIDTANK2MANIF3_VALVE_1 = 1 << 3;
+const Int32 MIDTANK2MANIF2_VALVE_2 = 1 << 4;
+const Int32 MIDTANK2MANIF2_VALVE_1 = 1 << 5;
+const Int32 MIDTANK2MANIF1_VALVE_2 = 1 << 6;
+const Int32 MIDTANK2MANIF1_VALVE_1 = 1 << 7;
+const Int32 CART2MIDTANK4_VALVE_2 = 1 << 8;
+const Int32 CART2MIDTANK4_VALVE_1 = 1 << 9;
+const Int32 CART2MIDTANK3_VALVE_2 = 1 << 10;
+const Int32 CART2MIDTANK3_VALVE_1 = 1 << 11;
+const Int32 CART2MIDTANK2_VALVE_2 = 1 << 12;
+const Int32 CART2MIDTANK2_VALVE_1 = 1 << 13;
+const Int32 CART2MIDTANK1_VALVE_2 = 1 << 14;
+const Int32 CART2MIDTANK1_VALVE_1 = 1 << 15;
+
+
+
+public void OnExecute(StubManager stubManager)
+{
+ //ON
+ //var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" , FPGA3 + F3_VALVE_OUT);
+ //stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,FPGA3 | F3_VALVE_OUT, response | MIDTANK2MANIF4_VALVE_2); // ON
+ //stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,FPGA3 | F3_VALVE_OUT, MIDTANK2MANIF4_VALVE_2); // ON
+
+
+ //OFF
+ //var response1 = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" , FPGA3 + F3_VALVE_OUT);
+ //stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,FPGA3 + F3_VALVE_OUT, response1 & ~MIDTANK2MANIF4_VALVE_2); // OFF
+ stubManager.Run<StubFpgaWriteRegResponse>("StubFpgaWriteRegRequest" ,FPGA3 + F3_VALVE_OUT, 0); // OFF
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/read_f2_ctrl.cs b/Software/Stubs Collection/stubs/read_f2_ctrl.cs
new file mode 100644
index 000000000..adeb17017
--- /dev/null
+++ b/Software/Stubs Collection/stubs/read_f2_ctrl.cs
@@ -0,0 +1,26 @@
+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)
+{
+// Request ----
+// UInt32 : Address
+
+// Response ----
+// UInt32 : Address
+// UInt32 : Value
+// String : Status
+// UInt32 : StatusWord
+var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" ,0x60000400 | 0x0E2);
+stubManager.WriteLineHex(response.Value,2);
+
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/screw_LS.cs b/Software/Stubs Collection/stubs/screw_LS.cs
new file mode 100644
index 000000000..cff60fd8f
--- /dev/null
+++ b/Software/Stubs Collection/stubs/screw_LS.cs
@@ -0,0 +1,30 @@
+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 UInt32 F1_LS_SCREW_LEFT = 0x02;
+const UInt32 F1_LS_SCREW_RIGHT = 0x01;
+
+const Int32 F1_GPI_LS3_D = 0x40;
+Int32 loop = 1;
+
+public void OnExecute(StubManager stubManager)
+{
+ while(loop == 1)
+ {
+ var response = stubManager.Run<StubFpgaReadRegResponse>("StubFpgaReadRegRequest" , FPGA1 + F1_GPI_LS3_D);
+ Thread.Sleep(1000);
+ stubManager.WriteLineHex(response.Value,4);
+ }
+} \ No newline at end of file
diff --git a/Software/Stubs Collection/stubs/valve3 OFF.cs b/Software/Stubs Collection/stubs/valve3 OFF.cs
new file mode 100644
index 000000000..89ca942a3
--- /dev/null
+++ b/Software/Stubs Collection/stubs/valve3 OFF.cs
@@ -0,0 +1,32 @@
+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)
+{
+
+//bool flag = true; //for (int i=0;i<8;i++)
+ //{
+ // Request ----
+ // UInt32 : ValveId
+ // UInt32 : Inkflow
+ // Boolean : ValveOn
+
+ // Response ----
+ // String : Status
+ // UInt32 : StatusWord
+ //var response = stubManager.Run<StubValveResponse>("StubValveRequest" ,6, 0, true);
+ //Thread.Sleep(5000);
+
+ var response1 = stubManager.Run<StubValveResponse>("StubValveRequest" ,7, 0, false);//MIDTANK
+//Thread.Sleep(5000);
+ //}
+} \ No newline at end of file