public static void main(String[] args) throws BadParameterException { // TODO [TEST] check the getPower method RNG.init(); String p = "{ \"n\" : 0, \"params\" : [{ \"n\" : 1, \"values\" : [ {\"p\" : 140.0, \"d\" : 20, \"s\": 0.0}, {\"p\" : 117.0, \"d\" : 18, \"s\": 0.0}, {\"p\" : 0.0, \"d\" : 73, \"s\": 0.0}]},{ \"n\" : 1, \"values\" : [ {\"p\" : 14.0, \"d\" : 20, \"s\": 0.0}, {\"p\" : 11.0, \"d\" : 18, \"s\": 0.0}, {\"p\" : 5.0, \"d\" : 73, \"s\": 0.0}]}]}"; String q = "{ \"n\" : 0, \"params\" : [{ \"n\" : 1, \"values\" : [ {\"q\" : 140.0, \"d\" : 20, \"s\": 0.0}, {\"q\" : 117.0, \"d\" : 18, \"s\": 0.0}, {\"q\" : 0.0, \"d\" : 73, \"s\": 0.0}]},{ \"n\" : 1, \"values\" : [ {\"q\" : 14.0, \"d\" : 20, \"s\": 0.0}, {\"q\" : 11.0, \"d\" : 18, \"s\": 0.0}, {\"q\" : 5.0, \"d\" : 73, \"s\": 0.0}]}]}"; Appliance freezer = new Appliance.Builder( "id2", "freezer", "A new freezer", "FreezerA", null, new ConsumptionModel(p, "p"), new ConsumptionModel(q, "q"), 2f, true) .build(); System.out.println(freezer.getId()); System.out.println(freezer.getName()); for (int i = 0; i < 200; i++) { System.out.println(freezer.getPower(i, "p")); } }
private Appliance(Builder builder) { id = builder.id; name = builder.name; description = builder.description; type = builder.type; installation = builder.installation; standByConsumption = builder.standByConsumption; pcm = builder.pcm; qcm = builder.qcm; base = builder.base; inUse = (base) ? true : false; onTick = (base) ? -RNG.nextInt(Constants.MIN_IN_DAY) : builder.onTick; who = builder.who; }