Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* $Id: DDS.java d6756d6a2987 2013-06-10 [email protected] $
*
* This file is part of the Object Modeling System (OMS),
* 2007-2012, Olaf David and others, Colorado State University.
*
* OMS is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, version 2.1.
*
* OMS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with OMS. If not, see .
*/
package oms3.dsl.cosu;
import oms3.dsl.AbstractSimulation;
import oms3.dsl.*;
import java.io.File;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import oms3.Notification.*;
import ngmf.util.OutputStragegy;
import ngmf.util.UnifiedParams;
import ngmf.util.cosu.luca.ParameterData;
import oms3.ComponentAccess;
import oms3.Conversions;
import oms3.annotations.Execute;
import oms3.annotations.Finalize;
import oms3.annotations.Initialize;
import oms3.io.CSTable;
import oms3.io.DataIO;
/**
*
* @author od
*/
public class DDS extends AbstractSimulation {
int samples = 2000;
int terms = 4;
Params params = new Params();
Date sens_start;
Date sens_end;
int startMonthOfYear = 0;
List ofs = new ArrayList();
@Override
public Buildable create(Object name, Object value) {
if (name.equals("parameter")) {
return params;
} else if (name.equals("objfunc")) {
ObjFunc of = new ObjFunc();
ofs.add(of);
return of;
} else if (name.equals("samples")) {
samples = (Integer) value;
// if (samples<2000) {
// throw new IllegalArgumentException("samples<2000");
// }
} else if (name.equals("terms")) {
terms = (Integer) value;
if (terms != 4 && terms != 6) {
throw new IllegalArgumentException("terms 4 or 6 !");
}
} else if (name.equals("sens_start")) {
sens_start = Conversions.convert(value, Date.class);
} else if (name.equals("sens_end")) {
sens_end = Conversions.convert(value, Date.class);
} else if (name.equals("start_month_of_year")) {
startMonthOfYear = (Integer) value-1;
if ((startMonthOfYear<0) || (startMonthOfYear>11)) throw new IllegalArgumentException("start_month_of_year must be between 1-12 for Jan-Dec.");
} else {
return super.create(name, value);
}
return LEAF;
}
@Override
public Object run() throws Exception {
final File lastFolder = getOutputPath();
lastFolder.mkdirs();
Logger.getLogger("oms3.model").setLevel(Level.WARNING);
ObjFunc.adjustWeights(ofs);
run(getModelElement(), getOut(), lastFolder, getName());
return null;
}
/// DDS
void run(Model model, List