|
|||||||||||||
Style, Tips, and TechniquesThe NFCS provides a very limited set of choices for programming in that there are only three types of rules. Sometimes, it may take several rules to accomplish a simple task. However, there are techniques that can reduce the number of rules and make system behavior easier to understand. Tip #1: Use discrete outputs to hold true / false informationVery often there will be rules which result in a true / false value which will be used by subsequent rules. For instance, there might be a rule that determines that the outlet of the wood boiler is hot enough to be useful. You could create a variable named WoodBoilerHot and set it using a differential rule something like this: Set WoodBoilerHot if WoodBoilerOutlet is at least ZeroDegrees greater than UsefulTemp with a deadband of CoupleDegreesThis works, and because differential rules have an implied default of FALSE, the WoodBoilerHot variable will be set to false if the condition is not met. The situation is a bit more complex if you're using logical rules, since you'll need an initial rule to set the variable to false: Set WoodBoilerHot to FALSE if WoodBoilerHot is trueSet WoodBoilerHot to TRUE if WoodBoilerAquastat is true While both of these rule sets work, there are two reasons to use a discrete output instead of a variable to hold the WoodBoilerHot value:
Tip #2: Think about important system statesChances are that there are many system states, conditions, or modes that are important in defining or describing system operation. In programming, it helps to create variables or use discrete outputs (see above) to carry information about those system states. For instance, one very common and important question is whether there is any heat demand. There may be many rules which depend on the question of whether any zone is calling for heat. For example, there might be a circulator that needs to run if any zone needs heat. With three zones and no system state logic, the rule set might look something like this: Set PrimaryCirculator to TRUE if ZoneTstat1 is trueSet PrimaryCirculator to TRUE if ZoneTstat2 is true Set PrimaryCirculator to TRUE if ZoneTstat3 is true That's not too bad, but the rules do look a bit repetitive. The situation becomes much worse if the circulator is only supposed to run if there is heat available form the wood boiler or heat storage. Assuming an aquastat on the boiler and storage tanks to indicate that here is heat available, the rules now look like this: Set PrimaryCirculator to TRUE if ZoneTstat1 is true and BoilerAquastat is trueSet PrimaryCirculator to TRUE if ZoneTstat1 is true and StorageAquastat is true Set PrimaryCirculator to TRUE if ZoneTstat2 is true and BoilerAquastat is true Set PrimaryCirculator to TRUE if ZoneTstat2 is true and StorageAquastat is true Set PrimaryCirculator to TRUE if ZoneTstat3 is true and BoilerAquastat is true Set PrimaryCirculator to TRUE if ZoneTstat3 is true and StorageAquastat is true While this achieves the desired results, it's is now starting to feel cumbersome and difficult to understand. It only gets worse as additional rules and conditions are added. A better approach is to use two discrete outputs to carry system state information. The first will be true if there's any demand, and the second will be true if heat is available from storage or the wood boiler. Here's the resulting rule set: Set Demand to TRUE if ZoneTstat1 is trueSet Demand to TRUE if ZoneTstat2 is true Set Demand to TRUE if ZoneTstat3 is true Set HeatAvailable to TRUE if BoilerAquastat is true Set HeatAvailable to TRUE if StorageAquastat is true Set PrimaryCirculator to TRUE if Demand is true and HeatAvailable is true As an added bonus, we can get a visual indication of these states if we use a discrete output that's connected to an LED. In this example, we could use LED1 and LED2 on the controller front panel and rename them to 'Demand' and 'HeatAvailable'.
|