Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7706cf0

Browse files
committed
Comunicación y control funcionando...corregir error al finalizar la sesión de control
1 parent 11550a4 commit 7706cf0

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

ThreadClient.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,21 +98,22 @@ public void run()
9898
// Enviar Finish y Data Flags
9999
try
100100
{
101+
this.out.flush();
101102
this.out.writeInt(finishFlag);
102103
this.out.writeInt(dataFlag);
103104
}catch(IOException e)
104105
{
105106
System.out.println("Error enviando la señalización al servidor");
106107
e.printStackTrace();
107-
this.alive = false;
108+
//this.alive = false;
108109
}
109110

110111

111112
if(finishFlag == 1)
112113
{
113114
// Terminar todo el hilo adecuadamente (cerrar la conexión)
114115
System.out.println("Cerrando la conexión");
115-
this.alive = false;
116+
//this.alive = false;
116117
}
117118
else if(dataFlag == 1)
118119
{
@@ -130,10 +131,10 @@ else if(dataFlag == 1)
130131
{
131132
System.out.println("Error enviando valores de setpoint");
132133
e.printStackTrace();
133-
this.alive = false;
134+
//this.alive = false;
134135
}
135-
dataFlag = 0;
136-
}
136+
}
137+
dataFlag = 0;
137138

138139
// Lectura de valores provenientes de la planta
139140
if(finishFlag == 0)
@@ -149,9 +150,10 @@ else if(dataFlag == 1)
149150
{
150151
System.out.println("No se pudo hacer la lectura de la señal o la transferencia del finish");
151152
e.printStackTrace();
152-
this.alive = false;
153+
//this.alive = false;
153154
}
154155
}
156+
//System.out.println("u_temp="+u_temp+" u_flow="+u_flow+" outemp="+out_temp+" outFlow="+out_flow+" time="+time_value);
155157
// Actualizar gráficos con los nuevos valores
156158
this.UpdateChart();
157159
}
@@ -182,8 +184,8 @@ public void UpdateChart()
182184
this.gui.output_I.add(time_value, this.out_temp);
183185
this.gui.input_I.add(time_value, this.u_temp);
184186
this.gui.setpoint_I.add(time_value, this.setpoint_temp);
185-
this.gui.output_I.add(time_value, this.out_flow);
186-
this.gui.input_I.add(time_value, this.u_flow);
187-
this.gui.setpoint_I.add(time_value, this.setpoint_flow);
187+
this.gui.output_II.add(time_value, this.out_flow);
188+
this.gui.input_II.add(time_value, this.u_flow);
189+
this.gui.setpoint_II.add(time_value, this.setpoint_flow);
188190
}//UpdateChart
189191
}

0 commit comments

Comments
 (0)