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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
using System;
using System.Text;
using System.IO;
using System.Linq;
using System.Drawing;
using System.Diagnostics;
using System.Windows.Forms;
using System.Threading;
using System.Threading.Tasks;
using System.Collections.Generic;
using Tango.PMR.Stubs;
using Tango.Stubs;
const int Mixer_UNDER_TEST=3;
float MixerTemp ;
string [,] Units_status_Mixer = new string[Mixer_UNDER_TEST,2] {
{"Pt100_Mixer","Not Test"},
{"Heater_Mixer","Not Test"},
{"VALVE_Mixer","Not Test"},
};
//--------------------------------------------------------------------------------
public Task<decimal> Mixer_test( Action<string> settext, CancellationToken cancellationToken, string SN, string Location)
{
Task<decimal> task = null;
// Start a task and return it
task = Task.Run(() =>
{
stubManager.Write("S/N:" +SN+ "\n");
stubManager.Write("Location:" +Location+ "\n");
copy_table (Mixer_UNDER_TEST,Units_status_Mixer);
//------------------------------- start test -----------
settext("Test heaters & pt100");
Test_Mixer_heaters_pt100 ();
settext("Test VALVE Mixer");
Test_VALVE_Mixer ();
Status=write_to_file(SN,Location,Mixer_UNDER_TEST,"Mixer");
settext("End Test");
decimal result = 0;
return result;
});
return task;
}
//--------------------------------------------
int Test_VALVE_Mixer ()
{
SetBit (F1_gpo_01, 7, 1); //set bit F1_VALVE_MIXCHIP_WASTECH
DialogResult result = MessageBox.Show("MixCHIP Valve Open ?", "Warning",MessageBoxButtons.YesNo);
if(result == DialogResult.No)
{
Units_status[2,1]="Fail";
stubManager.Write("VALVE_MIXCHIP_WASTECH Not open\n");
return 0;
}
SetBit (F1_gpo_01, 7, 0); //clear bit F1_VALVE_MIXCHIP_WASTECH
DialogResult result1 = MessageBox.Show("MixCHIP Valve close ?", "Warning",MessageBoxButtons.YesNo);
if(result1 == DialogResult.No)
{
Units_status[2,1]="Fail";
stubManager.Write("VALVE_MIXCHIP_WASTECH Not close\n");
return 0;
}
Units_status[2,1]="Pass";
return 0;
}
//------------------------------------
public int Test_Mixer_heaters_pt100()
{
// uint utemp=0;
uint temp=0;
float ftemp=0;
float ftemp1=0;
float current=0;
stubManager.Write("\nTemp Befor heating \n");
ftemp=Read_pt100(0);
if ((ftemp>100)|| (ftemp<10))
{
Units_status[0,1]="Fail";
return 0;
}
stubManager.Write("Temp Befor heating is"+ ftemp.ToString("F2"));
stubManager.Write("°C\n");
//Write F2_GPO_MIXCHIP_SSR4_CTRL SSR/SSR no. 4
SetBit (F2_CTRL, 7, 1);
stubManager.Write("Testing SSR no. 4\tMIXCHIP \t");
delay(10000);
adc_configuration(0x46,0x08); //a2d_address 0x46 channel 4
adc_set_for_read_ch(0x46);
temp=adc_read_ch(0x46);
current= (float)(temp);
current=( float) (0.001221) * current;
SetBit (F2_CTRL, 7, 0);
ftemp1=Read_pt100(0);
stubManager.Write("After heating " + ftemp1 +"c\tCurrent is "+ current + "\n");
ftemp = ftemp1 - ftemp;
if ((current>2.5)|| (current<1.5)||(ftemp<5)||(ftemp>25))
{
Units_status[0,1]="Fail";
Units_status[1,1]="Fail";
}
else
{
Units_status[0,1]="Pass";
Units_status[1,1]="Pass";
}
return 0;
}
|