Thermostat example – Echelon Mini FX User Manual

Page 102

Advertising
background image

Mini FX User's Guide

89

// and make sure the timer is stopped:

//

nvoSwitch.state ^= 1;

autoOffTimer = 0;

}

// Finally, set the switch value according to its state:

nvoSwitch.value = nvoSwitch.state ? 200u : 0;

}

//
// when(timer_expires(....)) executes when the timer specified in
// the event condition has expired. In this example, this happens
// when the auto-off timer expires
//
when(timer_expires(autoOffTimer)) {
// Shut down the light
nvoSwitch.state = nvoSwitch.value = 0;
}

when(reset) {
InitializeIO();

LcdDisplayString(0,0, "Second Digital");
LcdDisplayString(1,0, "Sensor Example");
LcdDisplayString(2,0, "-+-+-+-+-+-+-+-+-+-+");
LcdDisplayString(3,0, "SW1 drives nvoSwitch");
}

Thermostat Example

The Thermostat example expands the previous digital sensor and actuator examples by

implementing more aspects of Neuron C programming. The Thermostat example works
not only once it is integrated with other devices in the network like the digital sensor and

actuator examples, but it automatically switches to standalone mode, if necessary, and

runs as a single, independent device.

The application implements the SFPTthermostat standard functional profile. The

application samples the local ambient temperature through the temperature sensor

supplied with both the FT 5000 EVB and the Mini Gizmo I/O board. Current ambient
temperature and setpoint values are shown on the display (where available). The

application drives the nvoCool and nvoHeat network variables using a simple
proportional controller algorithm, which is parameterized through SCPTgain

configuration properties, implements a hysteresis through the nciMinDelta

configuration property, and indicates whether the application is currently heating or
cooling through LED1 and LED2, respectively.
For brevity, the example implementation of SCPTthermostat ignores the
SCPTsetPnts (nciSetPnts) configuration property. This configuration property holds a

number of temperature setpoints, subject to the occupancy state of the controlled

environment. This example ignores this setpoint vector, and draws the temperature
setpoint from the nviSetpoint input network variable. To support standalone mode,

this application defaults the nviSetpoint variable to 21°C (69.8F).

The application first defines the device interface by declaring functional blocks, network

variables, and configuration properties. The declaration of the nvoCool and nvoHeat
output network variables use the bind_info() modifier to request that this network

variable shall use the unacknowledged service when connected with other network

variables, as required by the SFPTthermostat functional profile. Each of these
network variables has a proportional control coefficient with individually assigned

default values applied.

#include <stdlib.h>

Advertising