The HVAC and zoning logic is built into the ZoneController class. In a minimal implementation, you will write and instantiate an implementation of IHvacSystem and pass it to an instance of ZoneController

    IHvacSystem mySystem = new SimpleConsoleSystem();
    ZoneController z = new ZoneController(mySystem);
    z.Enabled = true;


The IHvacSystem interface acts as a simple container for the hardware implementation of a HVAC system.

    public interface IHvacSystem
    {
        IHvacController HvacController { get; }
        IEnumerable<Zone> Zones { get; }
    }

A typical implementation of IHvacSystem will have a constructor instantiate a customized IHvacController and instantiate a Zone for each room to be controlled.

An implementation of the IHvacController will turn on/off heating/cooling. A negative value passed to Demand should turn on cooling mode (i.e. energize a relay). A zero passed to Demand should turn the system off (i.e. de-energize a relay).

    public interface IHvacController
    {
        // Demand conditioned air. negative values request cooling, positive values request heat
        void Demand(double factor);

        // Get or set the current operating mode
        // -1 == cool, 0 == off, 1 == heat
        int Mode;

        // true if running
        bool IsRunning;
    }

Implement ITemperatureSensor to provide temperature readings. Raise the TemperatureChanged event whenever the temperature changes. Typically, ITemperatureSensor will be returned from another class that manages the polling of temperature sensors.

    public interface ITemperatureSensor
    {
        // Gets the current temperature.
        double Temperature { get; }

        /// Occurs when the temperature changes.
        event EventHandler<TemperatureChangedEventArgs> TemperatureChanged;
    }

Finally, the IAirVolumeController represents the hardware that controls the volume of air into a zone. A typical implemenation will adjust the position of a servo attached to a duct's balancing damper or a vent.

    public interface IAirVolumeController
    {
        // Set the percentage of air volume from 0 (closed/off) to 1 (100% open/on)
        void SetVolume(double volume);
    }

The source code includes two implemenations of these interfaces. SimpleConsoleSample includes the simplest possible implementation and simply displays activities to the console. Simulator is more complex and manipulates onscreen representations of these interfaces.

Last edited Mar 17, 2009 at 1:46 PM by KevinJStricklin, version 3

Comments

No comments yet.