aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Stubs Collection/stubs/Scripts/Assemblies/Dryer/Dryer_SSR.cs
blob: b059a170f6d93f3cb3eb45ee53d6914ba860742b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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)
{  
float temp=0;
float temp1=4096*95*5;

	//Write GPO_DRYER_SSR1_CTRL SSR/SSR no. 1
   	var response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,6); //
	stubManager.WriteHex(response.TemperatureCMultBy100,4);
   SetBit (FPGA2, F2_CTRL, 10, 1);
   stubManager.Write("\tTesting SSR no. 1\t");
   Thread.Sleep(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");
   temp=temp*60;
   stubManager.Write("Voltage = "+ temp + " Volt\n");


   SetBit (FPGA2, F2_CTRL, 10, 0);
    response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,6); //
	stubManager.WriteHex(response.TemperatureCMultBy100,4);
   stubManager.Write("\n");

  
   //Write GPO_DRYER_SSR2_CTRL SSR/SSR no. 2
   	response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,7); //
	stubManager.WriteHex(response.TemperatureCMultBy100,4);
   SetBit (FPGA2, F2_CTRL, 9, 1);
   stubManager.Write("\tTesting SSR no. 2\t");
   Thread.Sleep(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);
   stubManager.Write("Current = "+ temp + "A\n");
   temp=temp*120;
   stubManager.Write("Voltage = "+ temp + " Volt\n");
   
   
   SetBit (FPGA2, F2_CTRL, 9, 0);
    response = stubManager.Run<StubTempSensorResponse>("StubTempSensorRequest" ,7); //
	stubManager.WriteHex(response.TemperatureCMultBy100,4);
  	stubManager.Write("\n");


}