Similar to 2 heat and 2 cool but only one stage heat in this example
Here’s the 2 heat/2cool example for reference:
Similar to 2 heat and 2 cool but only one stage heat in this example
Here’s the 2 heat/2cool example for reference:
INPUTS:
The only input in this example is the room temperature and we’ll use the internal temperature sensor on the Tstat10 connected to input 9. GIve it a short name as ROOMTEMP, if there’s a lot of rooms in the system you will want to call it RM101 or similar. This short name is used in the programs, alarms and so on so keep things orgnaized. Set the range to DegF or DegC at Tab3, the on board sensor is a Type 2, 10k thermistor which is already selected for you just below Tab3.
OUTPUTS:
Give the outputs a long and a short name as shown, again if there’s more than one air handler in the system you will want to call them RTU1FAN, RTU1HET1, RTU1COL1 and so on. Set the range of the outputs at Tab4, and select OFF/ON at Tab5.
Note that if you are using external Bacnt tools to watch these changes you will need to re-discover the device and its objects. When the outputs are set to the default of unused the bacnet object is not created by the Tstat10.
VARIABLES:
Borrowing from the Tstat10 Two heat, Two cool example here’s an overview of the variables. Its important to remember that the first three variables of the VARS table (At Tab11) on a Tstat10 are hardwired to the display and since there’s only room for three characters (at Tab12) its important to pick some simple names which the users at the thermostat can understand.
Range: We will create a Multi-State Variable (MSV) to store several states for the fan at Tab13. Type in the various states for the fan mode at Tab14 and the system mode at Tab15. In the ‘Value’ column you type in a numeric value for each of these states to be used in the control basic programs.
States:
Customization: If you have a multi speed fan or other modes in mind you might pick
Note: If you go with fan speeds, you might eliminate the ON state to keep the interface simpler.
By maintaining this structure, you can create a user-friendly and effective thermostat system that aligns with familiar conventions.
VARIABLES: Continued
As your programs become more complicated the programming can become difficult to maintain. One thing I often emphasize is to modularize your code which involves breaking it into distinct, manageable sections, each responsible for specific tasks.
Modularized code will be:
Setpoints are created as variables with a range of DegC or DegF, there’s several setpoints required to manage the system in heating and cooling in both occupied and unoccupied modes.
The setpoint ‘target’ for the system is displayed on the LCD, and the user adjusts this single setpoint via the keypad. The heating and cooling setpoints are programmed as small offsets from the center ‘target setpoint’. Additionally, there are occupied and unoccupied setpoints that require separate variables and logic.
The Tstat8 has these parameters hard-coded, making it quick but less flexible for custom logic, unlike the programmable Tstat10. But we can borrow the user interface form the Tstat8 to illustrate the setpoint discussion. We’ll need heating and cooling setpoints for both the daytime (occupied) and nighttime (unoccupied) modes. Here’s a preview of variables for these setpoints.
To set up the occupied schedule, first assign a long and short name at Tab18 for programming purposes. Use the “Ins” key or click at Tab19 to open the detailed dialog and enter Monday’s times, then use the copy button at Tab20 to streamline entry for other days. For residential settings, skip the Holidays at Tab21, but for commercial buildings, use this section to add special schedules for holidays like Christmas.
At Tab22, the system feedback is displayed. Here, we’re using the onboard temperature sensor, though an external sensor (e.g., wired to input1) or a combination of multiple sensors could also be used, with logic tied to a variable. At Tab23, the setpoint is shown, with separate variables for heating and cooling to create a deadband between modes. In Tab4, set the action to ‘+’ for cooling so that feedback increases when the sensor reading exceeds the setpoint. Heating is the opposite; a popup reminder appears if settings are incorrect.
Both P terms are initially set to 1, meaning the system will respond 100% when the temperature deviates by 1°C from the setpoint. You can start with this value, regardless of whether you’re using °F or °C, and adjust it as needed. The I term is initially set to zero to keep it simple during initial testing; this integral term corrects the temperature over time by compensating for ongoing errors, as explained earlier.
With this setup, PID1 controls cooling, and PID2 handles heating. Next, a brief program is needed to link the outputs to these PID controllers.
Here’s a quick program for two stages of cooling and one stage of heating.
10 REM ******HEATING OUTPUT *********
20 IF PID1 > 50 THEN START 101HT1 < Start heating output if PID1 exceeds 50
30 IF PID1 < 30 THEN STOP 101HT1 < Stop heating output if PID1 falls below 30
40 IF NOT 101HM THEN STOP 101HT1 < Stop heating output if the heating mode is not active
80 REM ******COOLING OUTPUTS *********
90 IF PID2 > 50 THEN START 101CL1 < Start stage1 cooling if PID2 exceeds 50
100 IF PID2 > 80 THEN START 101CL2 < Start stage 2 cooling if PID2 exceeds 80
110 IF PID2 < 30 THEN STOP 101CL1 < Stop stage1 cooling if PID2 falls below 30
120 IF PID2 < 60 THEN STOP 101CL2 < Stop stage2 cooling if PID2 falls below 60
130 IF NOT 101CM THEN STOP 101CL1 < Stop cooling stage1 if cooling mode is not active
140 IF NOT 101CM THEN STOP 101CL2 < Stop cooling stage2 if cooling mode is not active
150 REM ***** FAN CONTROL *****
160 IF 101CL1 OR 101HT1 THEN START 101FAN
170 IF NOT 101CL1 AND NOT 101HT1 THEN STOP 101FAN < Stop the fan if heating or cooling is not active
180 IF SYS = 0 THEN STOP FAN <Stop the fan is the system is in OFF mode at the keypad.
The only difference between this program and the two stage heat, two stage cool example is we have left out the lines related to stage2 heating.
There’s a bit more logic in this latest completed program than is discussed here but my test run at passing it through GPT gave some really good feedback about what’s going on.
10 REM ********** ENABLE FAN ACCORDING TO SCHEDULE *********
20 IF OCCUPIED THEN START FANENABL ELSE STOP FANENABL
30 IF NOT OCCUPIED AND HEAT1 THEN START FANENABL
40 IF NOT OCCUPIED AND COOL1 THEN START FANENABL
50 IF FANMODE = 1 THEN START FANENABL
60 IF FANMODE = 0 THEN STOP FANENABL
70 IF NOT OCCUPIED AND NOT COOL1 AND NOT HEAT1 THEN STOP FANENABL
80 REM ********** COOLING ****************
90 IF PID1 > 30 THEN START COOL1
100 IF PID1 > 50 THEN START COOL2
110 IF PID1 < 25 THEN STOP COOL1
120 IF PID1 < 45 THEN STOP COOL2
130 IF NOT COOLOK THEN STOP COOL1 , STOP COOL2
140 IF SYS = 1 THEN STOP COOL1 , STOP COOL2
150 IF NOT OCCUPIED AND NOT NITEC_OK THEN STOP COOL1 , STOP COOL2
160 REM ********** HEATING ****************
170 IF PID2 > 30 THEN START HEAT1
180 REM IF PID2 > 50 THEN START OUT5 < NO HEAT2 ON THIS EXAMPLE
190 IF PID2 < 25 THEN STOP HEAT1
200 REM IF PID2 < 45 THEN STOP OUT5 < NO HEAT2 ON THIS EXAMPLE
210 IF NOT HEATOK THEN STOP HEAT1 , STOP HEAT2
220 IF SYS = 0 THEN STOP HEAT1 , STOP HEAT2
230 IF NOT OCCUPIED AND NOT NITEH_OK THEN STOP HEAT1 , STOP HEAT2
240 REM *************** SETPOINTS ***************
250 IF SET > MAXSETPT THEN SET = MAXSETPT
260 IF SET < MINSETPT THEN SET = MINSETPT
270 COOLSP = SET + COOLDB
280 HEATSP = SET - HEATDB
290 IF NOT OCCUPIED THEN COOLSP = CLSPUNOC
300 IF NOT OCCUPIED THEN HEATSP = HSPUNOCC
310 REM RESET THE USER DISPLY SETPT ONCE PER DAY
320 IF- OCCUPIED THEN SET = DEFALTSP
330 REM *************CHANGEOVER DELAY AND HEAT/COOL OVERRIDES *******
340 TOFFCOOL = TIME-OFF ( COOL1 )
350 TOFFHEAT = TIME-OFF ( HEAT1 )
360 IF TOFFHEAT > CHANGOVR THEN START COOLOK ELSE STOP COOLOK
370 IF SYS = 0 OR SYS = 1 THEN STOP COOLOK
380 IF TOFFCOOL > CHANGOVR THEN START HEATOK ELSE STOP HEATOK
390 IF SYS = 0 OR SYS = 2 THEN STOP HEATOK
TBD: Graphics, search this forum on how to do graphics.
TBD: Alarms
Here’s a copy of the program:
https://temcocontrols.com/ftp/software/29_1HEAT2COOLRev1.prog