⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 hysteresiscontroller.java

📁 这是一个以JAVA编写的程序,本人还没有试过,是一个简单的温度控制系统
💻 JAVA
字号:
package net.sf.dz.controller;import org.freehold.jukebox.logger.LogChannel;/** * A hysteresis controller. * * <p> * * The controller output becomes positive when the process variable becomes * higher than the setpoint plus hysteresis, and it becomes negative when * the process variable becomes lower than the setpoint minus hysteresis. * * @author Copyright &copy; <a href="mailto:vt@freehold.crocodile.org"> Vadim Tkachenko</a> 2001 * @version $Id: HysteresisController.java,v 1.5 2004/06/28 20:35:46 vtt Exp $ */public class HysteresisController extends AbstractProcessController {    /**     * Log channel to use.     */    public static final LogChannel CH_HYSTERESIS = new LogChannel("Hysteresis");    /**     * The process variable hysteresis.     */    private double hysteresis;    /**     * The controller state.     *     * Initial state is off.     */    private boolean state = false;    /**     * This constructor has to exist so the instance can be created via     * <code>Class.newInstance()</code>.     */    public HysteresisController() {    }    /**     * Read the hysteresis value from the configuration.     *     * @exception Throwable if there's a problem with configuration.     */    protected final void configure2() throws Throwable {        // VT: NOTE: Hysteresis of +-1 seems to be a reasonable default        hysteresis = getConfiguration().getDouble(getConfigurationRoot() + ".hysteresis", 1.0);        complain(LOG_DEBUG, CH_HYSTERESIS, "Hysteresis: " + hysteresis);    }    /**     * {@inheritDoc}     */    public final synchronized double compute() {        double pv = getProcessVariable();        double setpoint = getSetpoint();        if (state) {            if (pv + hysteresis < setpoint) {                state = false;            }        } else {            if (pv - hysteresis > setpoint) {                state = true;            }        }        return state ? 1 : -1;    }    /**     * {@inheritDoc}     */    protected final boolean needsDataSet() {        return false;    }}

⌨️ 快捷键说明

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