BAS-440 · Lesson 9 of 12 · 23 min

Review: programming and sequences

▶ Video coming soon A video version of this lesson is on the way.

Sophie took the second review, on control theory, programming and sequences, the material of BAS-130, BAS-220 and BAS-230. She used the whiteboard in the programmers' room and the Sandmere draft sequence Callie had written on Sunday, November 15. "Every question on this part of the program comes back to one thing," she said. "Can you read what a system is supposed to do, see what it is actually doing, and explain the difference?"

Loops: the language of control

BAS-130 began with Prakash's Friday loops: open and closed loops, setpoint, process variable and error, and the controller's output. A closed loop measures the result and corrects; an open loop acts without measuring the result, like a reset schedule that sets hot water temperature from outdoor air without knowing whether rooms are warm enough.

Control modes reviewed from BAS-130.
Control modeHow it actsStrengthWeakness
Two-positionOn or off around a differentialSimple, robustCycling; swing around setpoint
FloatingDrives an actuator open or closed in stepsCheap actuatorsNeeds the actuator's real stroke time configured
Proportional (P)Output proportional to errorStable, predictableSteady offset from setpoint
Proportional plus integral (PI)Adds output in proportion to error over timeRemoves offsetWindup if left running when it cannot act
PIDAdds a term for rate of changeFaster response on slow processesSensitive to noise; rarely needed in HVAC

Callie explained the cases that taught each mode. The east stair cabinet fan coils were two-position, cycling about eight times an hour. A second-floor VAV box's floating reheat actuator had been configured for 60 seconds when its real stroke was 150, so the controller thought the valve had moved further than it had. Nell's P-only experiment on the Tilden converter left an offset of about 3.6 °F. And on Friday, October 9, AHU-1's heating loop had wound up overnight with the fan off, slamming the valve at the 6:00 start, which was fixed by disabling the loop with the fan off, holding its output at zero, and enabling it 30 seconds after fan proof.

Tuning

Tuning chooses the gain and integral time so that the loop is fast enough without hunting. BAS-130 used a step test and lambda tuning. The method is to make a small step in output with the loop in manual, measure how much and how fast the process responds, and calculate settings from the process gain, dead time and time constant and a chosen closed-loop response time, lambda.

\[K_c = \frac{\tau}{K_p\,(\lambda + \theta)} \qquad T_i = \tau\]

Here Kc is the controller gain, τ the process time constant, Kp the process gain, θ the dead time, λ the desired closed-loop time constant and Ti the integral time.

Worked problem

The Tilden converter step test

On Friday, October 16, with the converter loop in manual, Prakash and Nell stepped the valve from 40 to 50 in 100. Hot water supply rose from 150.8 °F to 154.4 °F, with a dead time of 30 s and a time constant of 120 s. With λ chosen equal to τ, what gain and integral time does lambda tuning give?

Show solution
  1. Process gain: 3.6 °F ÷ 10 = 0.36 °F per unit of output.
  2. Kc = 120 ÷ (0.36 × (120 + 30)) = 120 ÷ 54 = 2.22 per °F.
  3. Ti = τ = 120 s = 2 min.

Answer: A gain of 2.22 output units per °F, a throttling range of 45 °F, and an integral time of 2 minutes. Nell watched the new values for a week before keeping them.

The lecture wing case at the end of BAS-130 showed that tuning cannot fix a bad measurement. AHU-2's discharge air loop hunted with a period of about 96 seconds after a September change had raised its gain and shortened its integral time for faster warm-up; the probe sat in stratified air just after the coil. Moving the probe downstream of the supply fan, then retuning from a new step test, fixed it. Sophie asked Callie for the order of checks on a hunting loop, and Callie gave it: the measurement, the actuator and valve, recent changes, then the tuning.

How programs run

BAS-220 moved from loops to the programs that contain them. A controller runs its program in a repeating scan: read inputs, solve the logic in order, write outputs. The order matters, as Sophie's first workshop had shown with an AHU fan start section placed after the logic that used its result.

  • Graphical block programs connect function blocks on a sheet; they are easy to read but can hide execution order.
  • Line programs and structured text read like code; every case must be handled, as the Morrow House fan coil rebuild showed when a deadband case left the fan command unset.
  • Boolean logic and timers build interlocks, delays and minimum on and off times, such as the rooftop unit compressors' 3-minute minimum on and 5-minute minimum off.
  • Math and scaling convert signals and build resets.
  • Schedules, trends and alarms turn a program into something operators can use.

Worked problem

A reset schedule

Tilden's hot water reset runs from 176 °F at an outdoor temperature of −4 °F to 113 °F at 59 °F. What is the setpoint at 32 °F and at 14 °F?

Show solution
  1. Slope: (113 − 176) ÷ (59 − (−4)) = −63 ÷ 63 = −1 °F per °F of outdoor temperature.
  2. At 32 °F: 176 − 1 × (32 − (−4)) = 176 − 36 = 140 °F.
  3. At 14 °F: 176 − 1 × 18 = 158 °F.

Answer: 140 °F at 32 °F, matching the value Sophie's workshop used on Saturday, September 26, and 158 °F at 14 °F. The program also clamps the output between the end points so that colder or warmer weather cannot push it outside the range.

Schedules and alarms carry as much weight as loops in a working building. Tilden's weekday schedule from 7:00 to 22:00, Saturdays from 8:00 to 17:00 and Sundays off adds up to 84 hours a week; Gus approved separate lecture-wing and office schedules for the winter term. The alarm review for Nell on Saturday, October 24 produced a two-page alarm philosophy and a monthly review of the ten noisiest alarms. And the override report on Saturday, November 14 found 14 points still held at operator priority, a reminder that every manual command needs an end.

Reading and testing programs

Two of Sophie's workshops dealt with programs written by other people. Reading the 2009 VAV-1-08 program on Saturday, October 31 found a single maximum airflow, a minimum of 0.4 times maximum, a heating gain that differed from an undated backup, an orphan variable and a commented-out line for a dual maximum that someone had started and abandoned. Callie's findings list became the basis of her dual-maximum draft on Saturday, November 14.

The test plan for the shared rooftop unit program on Saturday, November 7 had 36 cases, including three regression cases added after RTU-1's checkout. Sophie summarized the rule: every change to a program shared by several units is tested against the whole plan, not just the changed part, because a change that fixes one case can break another.

Sequences of operation

BAS-230 took the program up to the level of the written sequence, the document that says what the system must do. Callie reviewed the sequences she had studied in Sophie's Wednesday sessions.

Sequences reviewed from BAS-230.
SequenceKey ideasProgram example
Air handler start and stopDampers first, then fan, proof, then loops; safeties hardwiredAHU-1: 90 s for dampers, 10 s proof, loops 30 s later, about 130 s in all
Economizer and mixed airFree cooling with a high limit; minimum outdoor air; mixed air low limitAHU-1's minimum position delivered its minimum outdoor air only at full fan speed
Supply air temperature and static resetTrim and respond from zone requests within limitsNinefield retro-commissioning draft
Terminal unitsDual maximum reheat; discharge air limits; requests to the air handlerVAV-1-08 draft
Heating and cooling plantsEnable, staging, rotation, reset, fallback setpointsMorrow House boilers; Ninefield chillers
Hydronic differential pressureRemote sensor, trim and respond, high limit, fallbackNinefield secondary pumps draft
Demand-controlled ventilationVentilation ramp from CO2; failed sensor gives full ventilationT-120 and the Sandmere program room
Guideline 36Standard high-performance sequences with requests and importance multipliersUsed where it fits; referenced by section
A timeline of an air handler start from 0 to 140 seconds. At 0 s the start command opens the outdoor and return dampers. At 90 s the supply fan starts at minimum speed. At 100 s fan status is proven. At 130 s the temperature and static loops are enabled, tracking their start values. A side note shows that if proof is not seen within the timeout, the fan stops, an alarm is raised and the unit locks out. Hardwired safeties are drawn as a separate line that can stop the fan at any time.
AHU-1's start sequence from BAS-230: about 130 seconds from command to loops enabled.

Worked problem

Trim and respond

A static pressure reset uses trim and respond: every 2 minutes it trims the setpoint by 0.05 in. w.c., and responds to requests by adding 0.06 in. w.c. for each request above 2 ignored requests, up to 0.13 in. w.c.. In one interval, 5 boxes request more pressure. How does the setpoint change?

Show solution
  1. Requests counted: 5 − 2 ignored = 3.
  2. Respond: 3 × 0.06 = 0.18 in. w.c., limited to 0.13 in. w.c..
  3. Net change: −0.05 + 0.13 = +0.08 in. w.c..

Answer: The setpoint rises because more boxes are starving than the ignored count allows. When requests stop, the trim slowly lowers it again. All the numbers here are sample values; the engineer's sequence sets the real ones.

Sophie's final question was about the Sandmere draft. Why had Callie listed every point before writing a sentence of sequence? Because every paragraph must refer to points that exist, and writing the points list first had shown her the 78 physical points the controllers and wiring would need. She had also written down every decision the engineer's two-paragraph sequence left open before answering them, which was faster than discovering gaps one by one.

Alarms reviewed

Sophie asked Callie to state the alarm philosophy she had drafted for Nell in BAS-220 in one sentence each. An alarm must need an action by someone; every alarm has a priority that says how soon; alarms are delayed and suppressed so that starts, stops and setpoint changes do not raise them; every alarm has a named recipient; and the ten noisiest alarms are reviewed every month. The Tilden alarm week in BAS-320 had shown what happens without those rules: three chronic points produced more than half the alarms, and the important ones were lost among them.

Callie added the BAS-320 lesson about floods: when a single cause, such as a network fault or a power loss, raises hundreds of alarms, the front end should group or suppress the consequences so that the operator sees the cause first.

Fault detection rules

Fault detection, from BAS-330, is programming applied to the question of whether equipment is working properly rather than whether it is in alarm. Callie's own rule from the room 108 case, VAV-REHEAT-LEAK, was Sophie's example of how a good rule is written: a clear condition, conditions under which it is valid, a persistence time and a clearing rule.

The fault rule Callie wrote after room 108.
RULE VAV-REHEAT-LEAK (Callie's draft, Nov 12)
Flag when ALL are true:
  discharge air temperature > supply air temperature + 5 F
  reheat valve command = 0 for at least 15 min
  air handler fan proven for at least 15 min
  box airflow >= 0.5 x box minimum airflow
for at least 30 min.
Clear after 60 min with the condition false.

Each condition prevents a false result. The fan proof and airflow conditions stop the rule firing when there is no air to measure; the 15-minute valve condition lets the coil cool after heating; the persistence and clearing times stop the rule chattering. A rule like this, running on every box, would have found room 108's stuck valve the first cold morning instead of after a complaint. Sophie's point was that writing fault rules uses exactly the skills of writing sequences: points that exist, conditions that are complete and cases that are tested.

Demand limiting and priorities

One more programming topic connected the sequences to the network: writes from supervisory programs. Demand limiting, from BAS-330, lowers equipment capacity when a building approaches a target peak, and Quillon writes those commands at priority 10, above the equipment programs at priority 16 and below operator commands at priority 8. The choice of priority is part of the program design. A demand limit written at too high a priority would override an operator trying to keep a server room cool; one written at too low a priority would have no effect.

The same rule applies to any program that commands another device: write at the priority agreed in the site's priority plan, relinquish when the reason ends, and log what was written. Ninefield's draft staggered start for the perimeter heaters, which aims to bring the winter billing demand from 760 kW toward 640 kW, follows that rule.

Sophie's summary was short: every write needs a reason, a priority and an end, and a program that cannot say all three should not be writing.

Common mistakes

  • MistakeRetuning a loop before checking its measurement and actuator.

    InsteadCheck the sensor's location and reading, the actuator and valve, and recent changes before tuning.

  • MistakeLeaving an integral loop running while its equipment is off.

    InsteadDisable the loop with the equipment off, hold its output, and enable it after proof.

  • MistakeTesting only the changed part of a shared program.

    InsteadRun the whole test plan, including regression cases.

  • MistakeWriting a sequence without a points list.

    InsteadList the equipment and points first; every paragraph must refer to real points.

  • MistakeLeaving operator overrides without an end.

    InsteadRelease overrides when the reason ends, and report on them regularly.

Summary and key terms

  • Closed loops measure and correct; open loops act without feedback.
  • P control leaves an offset; PI removes it but can wind up; PID is rarely needed in HVAC.
  • Lambda tuning uses a step test's process gain, dead time and time constant.
  • Programs run in scans, and execution order and every logic case matter.
  • Resets, schedules, trends and alarms make a program usable; overrides need an end.
  • Sequences describe start, safeties, resets, terminal units, plants and ventilation; Guideline 36 provides standard versions.
  • A good sequence starts from the points list and answers every open question explicitly.
Process gain
The change in the controlled variable per unit change in controller output.
Dead time
The delay between an output change and the first measured response.
Integral windup
Accumulation of integral action while a loop cannot affect its process.
Scan
One pass of a controller through reading inputs, solving logic and writing outputs.
Trim and respond
A reset method that lowers a setpoint steadily and raises it in response to requests.
Regression test
A test repeated after a change to check that existing behavior still works.

Practice problems

Work each problem on paper first, then reveal the answer to check.

  1. Using Tilden's reset, what is the setpoint at 41 °F outdoor?

    Show answer

    176 − 1 × 45 = 131 °F.

  2. What caused AHU-1's 6:00 valve slam?

    Show answer

    Integral windup: the heating loop ran overnight with the fan off.

  3. How long does AHU-1's start take from command to loops enabled?

    Show answer

    About 130 seconds: 90 s dampers, 10 s proof, 30 s delay.

  4. Why do DCV sequences give full ventilation on a failed CO2 sensor?

    Show answer

    Because a failed sensor could otherwise under-ventilate an occupied space.

Lesson quiz · 5 questions

Score 60% or more to complete this lesson.

Take the quiz