Here's the code :
clear;
channel = ddeinit('view','tagname');
temperature = ddereq(channel,'temperature');
poistka = 0;
time = 0;
kvas = 0;
ohrev= 1;
steam=300;
pressure=100;
steam2= 50;
tempom = 1;
pom = 0;
while time<3600
ventil = ddereq(channel,'ventil');
pause(0.1);
time= time+1;
pom = pom+1;
if (kvas<=100)
kvas = kvas+1;
end;
if (kvas>=100 && temperature<95 && ohrev==1)
temperature = temperature+1;
tempom=0;
end;
if (temperature==95)
ohrev=0;
end;
if (ohrev==0)
temperature = temperature -0.1;
tempom = 1;
end;
if (temperature==70)
ohrev=1;
end;
end;
I'm comunnicating with matlab and doing visualisation in intouch but I can't figure out why the variable ohrev
won't became 1
when temperature
reaches 70
value.
It goes up to the 95
, then goes down to 0
but it should stop at 70
and again go to 95
and so on but it doesn't work. Any advices? Thank you very much