V1_0.java [src/java/m/hydrotools/efh2] Revision: default Date:
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package m.hydrotools.efh2;
import csip.ModelDataService;
import javax.ws.rs.Path;
import m.efh2.EFH2HydrologyModel;
import oms3.annotations.Description;
import oms3.annotations.Name;
@Name("EFH2")
@Description("Storm runoff model based on conventions in Engineering Field Handbook.")
@Path("m/efh2/1.0")
public class V1_0 extends ModelDataService {
static final String PRECIP = "precip";
static final String RUNOFF = "runoff";
static final String RUNOFFCURVENUMBER = "runoffcurvenumber";
static final String STORMTYPE = "stormtype";
static final String TIMEOFCONCENTRATION = "Tc";
static final String UNITPEAKDISCHARGE = "unitpeakdischarge";
static final String WATERSHEDLENGTH = "watershedlength";
static final String WATERSHEDSLOPE = "watershedslope";
//
EFH2HydrologyModel model = new EFH2HydrologyModel();
@Override
protected void preProcess() throws Exception {
model.setPrecip(parameter().getDouble(PRECIP)); // 14
model.setRunoffCurveNumber(parameter().getInt(RUNOFFCURVENUMBER)); // 90
model.setStormType(parameter().getString(STORMTYPE)); // 'I'
model.setWatershedLength(parameter().getDouble(WATERSHEDLENGTH)); // 1500
model.setWatershedSlope(parameter().getDouble(WATERSHEDSLOPE)); // 0.5
}
@Override
protected void doProcess() throws Exception {
model.simulate();
}
@Override
protected void postProcess() throws Exception {
results().put(RUNOFF, model.getRunoffQ(), "Runoff depth output", "inch");
results().put(TIMEOFCONCENTRATION, model.getTimeOfConcentration(), "Time in hours for runoff to flow from the most hydraulically remote point to the project site", "hours" );
results().put(UNITPEAKDISCHARGE, model.getUnitPeakDischarge(), "Unit Peak Discharge", "cfs/acre/inch");
}
}