AHAT.java [src/java/m/ahat] Revision: default  Date:
/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package m.ahat;

import csip.ServiceException;
import csip.SessionLogger;
import data.table.Table;
import data.table.column.ColumnBoolean;
import data.table.column.ColumnDouble;
import data.table.column.ColumnGeometry;
import data.table.column.ColumnInteger;
import database.ahat.AHATDatabase;
import database.ahat.AHATcrdb;
import java.sql.SQLException;

/**
 *
 * @author Brad
 * @author <a href="mailto:shaun.case@colostate.edu">Shaun Case</a>
 */
public class AHAT extends Table {

    public static final String AHAT_DB_CONFIG_STRING = "ahat.db.source";

    public static final String LOCATION = "location";
    public static final String ANIMAL_TYPE = "animal_type";
    public static final String UNIT_FUEL_COST = "unit_fuel_cost";

    protected AHATDairy dairy_model;
    protected AHATPoultry poultry_model;
    protected AHATSwine swine_model;
    

    private Lighting currentLighting;

    AHATcrdb db;

    public AHAT(Class<?> c, SessionLogger log) throws SQLException, ServiceException {
        db = new AHATcrdb(c, log);

        addDataColumn(LOCATION, new ColumnGeometry(LOCATION, "Location is a geoJSON object representing a location for the land unit containing the animal housing facility under study.  The prefered shape is a POINT location.  Multi-point shapes will have their centroid used for the location value."), true);
        addDataColumn(UNIT_FUEL_COST, new ColumnDouble(UNIT_FUEL_COST, "electricity:  Dollars per kilowatt - hour $/kwh (minimum $0.001 and maximum $0.50.)\n natural gas:  Dollars per thousand cubic feet $/MCF (minimum $1.00 and maximum $50.00)\n        propane:  Dollars per gallon $/gallon (minimum $1.00 and maximum $9.99)\n        fuel oil:  Dollars per gallon $/gallon (minimum $1.00 and maximum $9.99)"), true);
        addDataColumn(ANIMAL_TYPE, new ColumnInteger(ANIMAL_TYPE, "The database id of the animal type chosen for this housing facility."), true);
        
    }


//    public void setLighting(int lightingType, boolean ldl) {
//        currentLighting = new Lighting(db, lightingType, ldl);
//    }
//
//    public double getCurrentElectricCost() {
//        return currentLighting.getCurrentElectricCost(getLightingKilowattHours());
//    }
//
//    public double getBetterEstimatedCost() {
//        return currentLighting.getCurrentElectricCost(getBetterEstimatedKilowattHours());
//    }
//
//    public double getLightingEsimatedKilowattHours() {
//        // THis is the actual code from DairyAnalysis.aspx.cs - Brad Jakobitz
//        // ELF = most efficient lighting coefficent for same lighting group
//        //double ELF = AHATDAL.Components.Code.AHATDataReader.GetDairyLightingGroupEfficientUseFactor(GetGroupInListForLightingId(lightingId));
//        //double BLF = AHATDAL.Components.Code.AHATDataReader.GetLightingTypeBaseFactor(AnimalId, lightingId, regimeId);
//        //return RoundDownStefStyle( (BLF*ELF) * NumberDairyCows);
//        //just to compile
//        return 0;
//    }
//
//    public double getBetterEstimatedKilowattHours() {
//        return currentLighting.getBetterEstimatedKilowattHours(house) * confinedCows;
//    }
//
//    public double getEstimatedElectricCost() {
//        return currentLighting.getEstimatedElectricCost(getLightingKilowattHours());
//    }
//
//    public double getLightingKilowattHours() {
//        return currentLighting.getLightingKilowattHours(house) * confinedCows;
//    }
//
//    public double getEstimatedSavings() {
//        return getCurrentElectricCost() - getBetterEstimatedCost();
//    }
}