SDM-CD16AC 16 Channel AC/DC Controller
11
The program assumes the temperature measurements have been made, and the
average temperature for each greenhouse is computed and residing in the
appropriate variable
Input Location assignments are as follows:
Variable Array
Description
Temp(5)
Avg temp, greenhouse 1..5
Heat(5)
Heater control, greenhouse 1..5 SDM-CD16AC
Port 1..5
Cool(5)
Cooler control, greenhouse 1..5 SDM-CD16AC
Port 6..10
Fan(5)
Fan control, greenhouse 1..5 SDM-CD16AC
Port 11..15
CD16_Output(16)
EXAMPLE 1:
the actual values used to control
the SDM-CD16:
CD16_Output(I), I = 1 to 5 are
for Heat, I = 6 to 10 are for Cooling, I= 11 to 15
are for Fans
CD16_Output as Long
EXAMPLE 2:
the actual value used to control
SDMCD the
CD16_Output bits set the SDM-
CD16AC ports. bits 0 to 4 are for ‘Heat, 5 to 9 are
for Cooling, 10 to 14 are for Fans
uses an array of values to set the SDM-CD16AC control
outputs:
CRBasic Example 8-2. Using an Array to Set SDM-CD16AC Control Outputs
'Program name: SDMCD16Example1.CR1
'\\\\\\\\\\\\\\\\\\\\\\\\\ DECLARATIONS /////////////////////////
Public
Flag(8)
as
boolean
Public
I
Public
Temp(5)
Public
Heat(5)
Public
Cool(5)
Public
Fan(5)
'CD16_Output(I), I = 1 to 5 are for Heat, I = 6 to 10 are for Cooling,
'I = 11 to 15 are for Fans
Dim
CD16_Output(16)
'\\\\\\\\\\\\\\\\\\\\\\\\\\\ PROGRAM ////////////////////////////
BeginProg
Scan
(5,Sec, 3, 0)
For
I = 1
to
5
If
(Temp(I) < 23.5)
Then
Heat(I) = 1
ElseIf
(Temp(I) >= 25.5)
Then
Heat(I) = 0
EndIf
If
(Temp(I) >= 27.5)
Then
Cool(I) = 1
ElseIf
(Temp(I) < 24.5)
Then
Cool(I) = 0
EndIf
If
(Heat(I) <> 0) OR (Cool(I) <> 0)
Then
Fan(I) = 1
Else
Fan(I) = 0