/* Copyright 2000 Charles G. Wright * This software may be distributed under the terms of the * GNU General Public License. * * $Id: Utility.java,v 1.1 2000-06-15 10:15:09-05 chuckles Exp chuckles $ */ /** Represents a utility that provides energy. */ public class Utility{ public static final int GAS = 0; public static final int ELECTRICITY = 1; private int type; // one from the above list. private double rate; // cost per kwh of delivered energy. private double co2_rate = 0.0; private double nox_rate = 0.0; private double so2_rate = 0.0; private double voc_rate = 0.0; private String name; /**

Creates an instance of the Utility class. */ public Utility(int type, double rate, String name){ this.type = type; this.rate = rate; this.name = name; } /** Return the type of energy (eg Utility.ELECTRICITY or Utility.GAS) * provided by this utility. */ public int getType(){ return(type); } /** Set th type of energy (eg Utility.ELECTRICITY or Utility.GAS) * provided by this utility. */ public void setType(int type){ this.type = type; } /** Return utility cost in dollars per Kwh. */ public double getRate(int type){ return(rate); } /** Set the utility rate for this utility. */ public void setRate(int type, double val){ rate = val; } /** Returns the cost (in dollars) of energy used, given * type of energy, and amount used, in Kwh. */ public double getCost(double kwh){ return(kwh * rate); } /** Returns the amount of CO2 (in Kg) emitted for this * Utility, given an amount of delivered energy, in kwh. */ public double getCO2(double kwh){ return(kwh * co2_rate); } /** Sets the amount of CO2 (in Kg) emitted per Kwh for this * Utility. */ public void setUtilityCO2(double val){ co2_rate = val; } public double getNOX(double kwh){ return(kwh * nox_rate); } public void setUtilityNOX(double val){ nox_rate = val; } public double getSO2(double kwh){ return(kwh * so2_rate); } public void setUtilitySO2(double val){ so2_rate = val; } public double getVOC(double kwh){ return(kwh * voc_rate); } public void setUtilityVOC(double val){ voc_rate = val; } }