@@ -37,9 +37,9 | |||||
37 |
|
37 | |||
38 | self.commObj.sendTxRxCommand(cmd="CHGB", data=newBeam) |
|
38 | self.commObj.sendTxRxCommand(cmd="CHGB", data=newBeam) | |
39 |
|
39 | |||
40 | def getStatus(self): |
|
40 | def getStatus(self, data): | |
41 |
|
41 | |||
42 |
self.commObj.sendTxRxCommand(cmd="ANST", data= |
|
42 | self.commObj.sendTxRxCommand(cmd="ANST", data = data) | |
43 |
|
43 | |||
44 | ########## |
|
44 | ########## | |
45 |
|
45 | |||
@@ -199,7 +199,7 | |||||
199 | ne=NumeroDeExperimentos(archivo) |
|
199 | ne=NumeroDeExperimentos(archivo) | |
200 |
|
200 | |||
201 | #nombre01 = file1(archivo,'1') |
|
201 | #nombre01 = file1(archivo,'1') | |
202 |
nombre02 = file1(archivo,' |
|
202 | nombre02 = file1(archivo,'2') | |
203 | fichero=open(CarpetaDeTrabajo+'FormatoControlCentral.txt','w') |
|
203 | fichero=open(CarpetaDeTrabajo+'FormatoControlCentral.txt','w') | |
204 | fichero.write(nombre02+'\n') |
|
204 | fichero.write(nombre02+'\n') | |
205 | fichero.write(str(ne)+'\n') |
|
205 | fichero.write(str(ne)+'\n') | |
@@ -253,7 +253,13 | |||||
253 | filename = "experimento1.abs" |
|
253 | filename = "experimento1.abs" | |
254 |
|
254 | |||
255 | absObj = ABSClient() |
|
255 | absObj = ABSClient() | |
256 | absObj.sendFile(filename) |
|
256 | # absObj.sendFile(filename) | |
257 | # absObj.changeBeam("0") |
|
257 | # absObj.changeBeam("0") | |
|
258 | # absObj.changeBeam("1") | |||
258 | # absObj.changeBeam("2") |
|
259 | # absObj.changeBeam("2") | |
259 |
# absObj.changeBeam(" |
|
260 | # absObj.changeBeam("3") | |
|
261 | # absObj.changeBeam("4") | |||
|
262 | # absObj.changeBeam("5") | |||
|
263 | # absObj.changeBeam("6") | |||
|
264 | # absObj.changeBeam("7") | |||
|
265 | absObj.getStatus(5) No newline at end of file |
@@ -7,10 +7,10 | |||||
7 | [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],$ |
|
7 | [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],$ | |
8 | [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ |
|
8 | [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ | |
9 | [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ |
|
9 | [0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ | |
10 |
[1.0,1.0,1.0,1.0,1.0, |
|
10 | [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],$ | |
11 |
[0.5,0.5,0.5,1.0, |
|
11 | [0.5,0.5,0.5,1.0,1.0,1.0,1.0,1.0],$ | |
12 |
[1.0,1.0,1.0,1.0, |
|
12 | [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],$ | |
13 |
[0.5,0.5,0.5,0.5, |
|
13 | [0.5,0.5,0.5,0.5,1.0,1.0,1.0,1.0]] | |
14 |
|
14 | |||
15 | [[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ |
|
15 | [[0.5,0.5,0.5,0.5,0.5,0.5,0.5,0.5],$ | |
16 | [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],$ |
|
16 | [1.0,1.0,1.0,1.0,1.0,1.0,1.0,1.0],$ |
@@ -1,5 +1,6 | |||||
1 | import os |
|
1 | import os | |
2 | import library |
|
2 | import library | |
|
3 | import time | |||
3 |
|
4 | |||
4 | class ABSServer: |
|
5 | class ABSServer: | |
5 |
|
6 | |||
@@ -34,7 +35,13 | |||||
34 | self.changeBeam() |
|
35 | self.changeBeam() | |
35 |
|
36 | |||
36 | if cmd == "ANST": |
|
37 | if cmd == "ANST": | |
37 | self.getStatus() |
|
38 | self.getStatus(10) | |
|
39 | ||||
|
40 | def sendAnswer(self,nbytes = 16384): | |||
|
41 | ||||
|
42 | # ipSource, ipDestino, cmd, self.datarx = self.commServerObj.sendData(nbytes) | |||
|
43 | ||||
|
44 | pass | |||
38 |
|
45 | |||
39 | def EliminaSaltoDeLinea(cadena): |
|
46 | def EliminaSaltoDeLinea(cadena): | |
40 | i = 0 |
|
47 | i = 0 | |
@@ -123,14 +130,54 | |||||
123 | #rpta = self.commClientObj.sendTxRxCommand(cmd='CAMBIA', data="0") |
|
130 | #rpta = self.commClientObj.sendTxRxCommand(cmd='CAMBIA', data="0") | |
124 | self.commClientObj.sendData("CAMBIA:" + self.datarx + ":") |
|
131 | self.commClientObj.sendData("CAMBIA:" + self.datarx + ":") | |
125 |
|
132 | |||
126 | def getStatus(self): |
|
133 | def getStatus(self, base): | |
127 |
|
134 | |||
128 | #rpta = self.commClientObj.sendTxRxCommand(cmd='CHEQUEO', data="0") |
|
135 | #rpta = self.commClientObj.sendTxRxCommand(cmd='CHEQUEO', data="0") | |
129 | self.commClientObj.sendData("CHEQUEO:" + self.datarx + ":") |
|
136 | self.commClientObj.sendData("CHEQUEO:" + self.datarx + ":") | |
|
137 | seconds = int (self.datarx) | |||
|
138 | # Give 5 seconds to the control modules | |||
|
139 | time.sleep(seconds) | |||
|
140 | # Checking the module connection | |||
|
141 | module_list = self.connection_status(10) | |||
|
142 | #Generating the complete report | |||
|
143 | module = 1 | |||
|
144 | number_of_modules = 16 | |||
|
145 | filename1 = "Verificacion" | |||
|
146 | filename2 = "report.txt" | |||
|
147 | fobj2 = open(filename2,"w") | |||
|
148 | fobj2.write("Verification_file\n") | |||
|
149 | fobj2.write("-----------------\n") | |||
|
150 | fobj2.close() | |||
|
151 | while module <= number_of_modules: | |||
|
152 | if module_list[module -1] == "1": | |||
|
153 | #Preparing and doing the tftp command | |||
|
154 | cmd = "tftp -m binary 192.168.1."+ str(base + module) +" 69 -c get " + filename1 | |||
|
155 | print cmd | |||
|
156 | os.system(cmd) | |||
|
157 | # Getting data from the control module file | |||
|
158 | fobj1 = open(filename1,"r") | |||
|
159 | file_list_1 = fobj1.readlines() | |||
|
160 | fobj1.close() | |||
|
161 | content = file_list_1[2:-1] | |||
|
162 | # | |||
|
163 | fobj2 = open(filename2,"a") | |||
|
164 | if base == 10: | |||
|
165 | fobj2.write("S" + str(module) + "\n") | |||
|
166 | else: | |||
|
167 | fobj2.write("N" + str(module) + "\n") | |||
|
168 | fobj2.writelines(content) | |||
|
169 | fobj2.write("------\n") | |||
|
170 | fobj2.close() | |||
|
171 | module = module + 1 | |||
|
172 | # print "\nFinalizado" | |||
|
173 | ||||
|
174 | ||||
|
175 | ||||
130 |
|
176 | |||
131 | if __name__ == '__main__': |
|
177 | if __name__ == '__main__': | |
132 |
|
178 | |||
133 | absObj = ABSServer() |
|
179 | absObj = ABSServer() | |
134 |
|
180 | |||
135 | while 1: |
|
181 | while 1: | |
136 | absObj.waitRequest() No newline at end of file |
|
182 | absObj.waitRequest() | |
|
183 | # absObj.sendAnswer(nbytes) No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now