
Il sistema
Il sistema è formato da 4
ventilatori che simulano i 4 compressori/caldaie.
La temperatura viene
simulata attraverso un potenziometro(da 6 a 13°C supponendo il caso dei
compressori).
Nel caso di compressori
l’intervallo di temperatura è quello di mandata-ritorno dell’acqua refrigerata.
All’aumentare della temperatura si accendono i compressori, nel caso specifico:
i compressori si
disattivano :
la temperatura sul canale
analogico 4
i ventilatori ai canali
digitali 9,10,11,12
Const Device = CB280
Dim vett(5) As Byte
Dim n As
Integer
Dim temp As Single
Dim nadc As Byte
Dim delta As Single
Dim deltat As Single
Dim estate As Byte
Dim r As Single
Dim numc As Byte
Dim I As Byte
Dim sp1 As
String
Dim intervallo As Integer
Dim mint As Single
Dim maxt As Single
Dim fan As Integer
Dim s As String
Dim DIFF As Single
Dim MINP As Single
Dim MAXP As Single
Dim PORTA_in As Byte
Dim supc As Integer
supc=1
Set
Debug Off
Debug CLR
'NUMERO
COMPRESSORI/CALDAIE
numc=4
'IN
ESTATE AUMENTO TEMPERATURA=ON
'IN
INVERNO AUMENTO TEMPERATURA =OFF
estate=1
'TEMPERATURA
MINIMA E MASSIMA
If
estate=1 Then
mint=7
maxt=12
End If
If estate=0 Then
mint=70
maxt=75
End If
'DIFFERENZIALE TEMPERATURA
DIFF=maxt-mint
'DIFFERENZIALE
DI GRADINO
delta=DIFF/numc
'PORTA
INIZIALE
PORTA_in=8
Do
n=Adin(4)
r=(maxt-mint+2)*n
r=r/1023
temp=mint+r-1
sp1="temp="
scrivi
3,sp1,temp,2
For I=1 To 4
r=7+delta*(I-1)
s=Dec I
If estate=1 Then sp1="COMPRESSORE="
If estate=0 Then sp1="CALDAIA="
If temp<r Then
sp1=sp1+s+" OFF"
scrivist 3+I,sp1
If estate=1 Then Out PORTA_in+I,0
If estate=0 Then Out PORTA_in+I,1
vett(I)=0
End If
r=7+delta*I
If temp>r Then
If estate=1 Then
Out PORTA_in+I,1
If estate=0 Then
Out PORTA_in+I,0
vett(I)=1
sp1=sp1+s+" ON "
scrivist 3+I,sp1
End If
Next
If supc=0 Then Delay 1000
seriale
Loop
'provaseriale
Sub
seriale()
Bclr 0,1
Opencom 0,9600,18,9,54
Bclr 1,2
For I=1 To 9
If I=1 Then r=temp*100
If I=2 Then r=estate
If I=3 Then r=numc
If I=4 Then r=vett(1)
If I=5 Then r=vett(2)
If I=6 Then r=vett(3)
If I=7 Then r=vett(4)
If I=8 Then r=88888
If I=9 Then r=99999
sp1=Fp(r,5,0)
Putstr 0,sp1
Next
Delay 300
End
Sub
'soubroutine che visualizza alla riga
'il
numero=num Con decimali=decim
's=testo
Sub scrivi(riga As Integer,ss As String,num As Single,decim As
Integer)
Debug Goxy,1,riga
Debug ss
Debug Fp(num,10,decim)
Debug Goxy,1,riga
End
Sub
'soubroutine che visualizza alla riga
'il testo=s
Sub scrivist(riga As Integer,ss As String)
Debug Goxy,1,riga
Debug ss
End Sub
'lettura
termocoppia con amplificatore
Function termocoppia_1(porta As Integer)As
Single
Dim
nn As Integer
nn=Adin(porta)
r=732*nn
r=r/10000
r=14+r
termocoppia_1=r
End
Function

La videata del programma sul PC