thermostat.java

来自「这是一个以JAVA编写的程序,本人还没有试过,是一个简单的温度控制系统」· Java 代码 · 共 143 行

JAVA
143
字号
package net.sf.dz.device.model;import java.util.Iterator;import java.util.HashSet;import java.util.Set;import org.freehold.jukebox.conf.Configurable;import org.freehold.jukebox.conf.Configuration;import org.freehold.jukebox.logger.LogAware;import org.freehold.jukebox.logger.LogChannel;import org.freehold.jukebox.logger.Logger;import org.freehold.jukebox.service.PassiveService;import net.sf.dz.controller.ProcessController;import net.sf.dz.device.sensor.TemperatureSensor;import net.sf.dz.event.TemperatureSensorListener;import net.sf.dz.event.ThermostatListener;/** * The virtual thermostat. * * <p> * * Takes the notification from the {@link #sensor temperature sensor}, and * if it is {@link #isOn enabled}, passes it to the {@link #controller * controller}. The thermostat may not be {@link #isVoting() voting}, in * this case the {@link ZoneController zone controller} will not start the * A/C if just this thermostat is unhappy, however, it will not shut it down * until it is happy once it is started. * * <p> * * Note that this interface doesn't have mutator methods. To control the * thermostat implementation state and behavior, use {@link * ThermostatControl ThermostatControl}. * * <p> * * It is an interface to allow the adapters to be implemented - in * particular, for remote access. * * @author Copyright &copy; <a href="mailto:vt@freehold.crocodile.org">Vadim Tkachenko</a> 2001-2002 * @version $Id: Thermostat.java,v 1.11 2002/08/04 07:09:43 vtt Exp $ */public interface Thermostat extends TemperatureSensorListener, Comparable {    /**     * Get the thermostat name.     */    public String getName();    /**     * Is this thermostat allowed to initiate the A/C startup.     *     * If the thermostat is not allowed to initiate the A/C startup, then     * the temperature in the room will be allowed to raise or drop     * (depending on the mode) unrestricted. However, as soon as the A/C     * unit is on, the temperature in the room will be brought to setpoint     * exactly as for the voting room, and only after this the A/C will be     * stopped.     *     * @return <code>true</code> if the thermostat is allowed to initiate the A/C     * startup, <code>false</code> otherwise.     */    public boolean isVoting();        /**     * Is this thermostat requested to hold the temperature regardless of     * the scheduled changes.     *     * @return <code>true</code> if this thermostat is on hold,     * <code>false</code> otherwise.     */    public boolean isOnHold();        /**     * Is this thermostat enabled.     *     * If the thermostat is not enabled, the dampers for the zone are closed     *     * @return <code>true</code> if it is enabled, <code>false</code>     * otherwise.     */    public boolean isOn();        /**     * Get the dump priority.     *     * The dump priority determines the order in which the dampers will     * close when the excessive static pressure has to be relieved.     *     * @param mode -1 for cooling, 0 for off, 1 for heating.     *     * @return Dump priority, 0 being off, 1 being highest and so on.     */    public int getDumpPriority(int mode);    /**     * Get the control signal value.     *     * <p>     *     * <strong>NOTE:</strong> The value returned here is different from the     * value returned by the {@link #getController controller} - it is     * adjusted based on whether this thermostat is {@link #isOn enabled} or     * not.     *     * @return If {@link #isOn enabled}, the value of     * the control signal, otherwise 0.     */    public double getControlSignal();        /**     * Get the controller.     *     * @return The controller instance.     */    public ProcessController getController();        /**     * Add the listener.     *     * @param listener Listener to add.     */    public void addListener(ThermostatListener listener);        /**     * Get the sensor.     *     * @return The instance of the temperature sensor this thermostat is     * connected to.     */    public TemperatureSensor getSensor();        /**     * Get the unit this thermostat is attached to.     *     * This method violates the rule of minimal knowledge, but simplifies     * the implementation, so it's allowed to exist.     */    public Unit getUnit();}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?