private void ensureSeeds () { if (null == evalSeed) { evalSeed = service.getRandomSeedRepo() .getRandomSeed(Battery.class.getName() + "-" + name, 0, "eval"); } }
/** * Pre-loads seeds from an existing server logfile, or from a stripped-down * logfile containing only the RandomSeed lines. */ public void loadSeeds (File inputFile) throws FileNotFoundException { log.info("Loading seeds from file" + inputFile.getPath()); loadSeeds(new FileReader(inputFile)); }
pendingSeedMap.put(composeName(fields[3], Long.parseLong(fields[4]), fields[5]),
/** * Initializes the instance. Called after configuration, and after * a call to setServices(). * TODO -- do we really want this here? */ public void initialize () { rs1 = service.getRandomSeedRepo().getRandomSeed(name, 0, "TariffChooser"); }
private void loadSeedsMaybe () { if (seedSource == null) return; log.info("Reading random seeds from " + seedSource); InputStreamReader stream; try { stream = new InputStreamReader(makeUrl(seedSource).openStream()); randomSeedRepo.loadSeeds(stream); } catch (Exception e) { log.error("Cannot load seeds from " + seedSource); } }
String name = composeName(classname, id, purpose); RandomSeed result = seedMap.get(name); if (null == result) {
public void init (BrokerProxy proxy, int seedId, RandomSeedRepo randomSeedRepo) { log.info("init(" + seedId + ") " + getUsername()); this.brokerProxyService = proxy; this.seed = randomSeedRepo.getRandomSeed(Genco.class.getName(), seedId, "update"); currentCapacity = nominalCapacity; }
private void ensureSeeds () { if (null == opSeed) { RandomSeedRepo repo = service.getRandomSeedRepo(); opSeed = repo.getRandomSeed( ColdStorage.class.getName() + "-" + name, 0, "model"); evalSeed = repo.getRandomSeed( ColdStorage.class.getName() + "-" + name, 0, "eval"); normal01 = new NormalDistribution(0.0, 1.0); normal01.reseedRandomGenerator(opSeed.nextLong()); } }
private void ensureSeeds () { if (null == opSeed) { RandomSeedRepo repo = service.getRandomSeedRepo(); opSeed = repo.getRandomSeed( LiftTruck.class.getName() + "-" + name, 0, "model"); evalSeed = repo.getRandomSeed( LiftTruck.class.getName() + "-" + name, 0, "eval"); normal = new NormalDistribution(0.0, 1.0); normal.reseedRandomGenerator(opSeed.nextLong()); } }
@Override public void initialize (String household, Properties conf, int seed) { // Filling the base variables name = household + " Stove"; randomSeedRepo = (RandomSeedRepo) SpringApplicationContext.getBean("randomSeedRepo"); gen = randomSeedRepo.getRandomSeed(toString(), seed, "Appliance Model" + seed); saturation = Double.parseDouble(conf.getProperty("StoveSaturation")); power = (int) (VillageConstants.STOVE_POWER_VARIANCE * gen.nextGaussian() + VillageConstants.STOVE_POWER_MEAN); cycleDuration = VillageConstants.STOVE_DURATION_CYCLE; times = Integer.parseInt(conf.getProperty("StoveDailyTimes")); }
@Override public void initialize (String office, Properties conf, int seed) { // Filling the base variables name = office + " Computers"; saturation = Double.parseDouble(conf.getProperty("ComputersSaturation")); randomSeedRepo = (RandomSeedRepo) SpringApplicationContext.getBean("randomSeedRepo"); gen = randomSeedRepo.getRandomSeed(toString(), seed, "Appliance Model" + seed); power = (int) (OfficeComplexConstants.COMPUTERS_POWER_VARIANCE * gen.nextGaussian() + OfficeComplexConstants.COMPUTERS_POWER_MEAN); cycleDuration = OfficeComplexConstants.COMPUTERS_DURATION_CYCLE; operationPercentage = Double.parseDouble(conf.getProperty("ComputersWorking")); }
@Override public void initialize (String household, Properties conf, int seed) { // Filling the base variables name = household + " CirculationPump"; randomSeedRepo = (RandomSeedRepo) SpringApplicationContext.getBean("randomSeedRepo"); gen = randomSeedRepo.getRandomSeed(toString(), seed, "Appliance Model" + seed); saturation = Double.parseDouble(conf.getProperty("CirculationPumpSaturation")); operationPercentage = Double.parseDouble(conf.getProperty("CirculationPumpPercentage")); power = (int) (VillageConstants.CIRCULATION_PUMP_POWER_VARIANCE * gen.nextGaussian() + VillageConstants.CIRCULATION_PUMP_POWER_MEAN); cycleDuration = VillageConstants.CIRCULATION_PUMP_DURATION_CYCLE; }
@Override public void initialize (String office, Properties conf, int seed) { // Filling the base variables name = office + " Refrigerator"; randomSeedRepo = (RandomSeedRepo) SpringApplicationContext.getBean("randomSeedRepo"); gen = randomSeedRepo.getRandomSeed(toString(), seed, "Appliance Model" + seed); saturation = Double.parseDouble(conf.getProperty("RefrigeratorSaturation")); power = (int) (VillageConstants.REFRIGERATOR_POWER_VARIANCE * gen.nextGaussian() + VillageConstants.REFRIGERATOR_POWER_MEAN); cycleDuration = VillageConstants.REFRIGERATOR_DURATION_CYCLE; }
@Override public void initialize (String household, Properties conf, int seed) { // Filling the base variables name = household + " Dryer"; randomSeedRepo = (RandomSeedRepo) SpringApplicationContext.getBean("randomSeedRepo"); gen = randomSeedRepo.getRandomSeed(toString(), seed, "Appliance Model" + seed); saturation = Double.parseDouble(conf.getProperty("DryerSaturation")); power = (int) (VillageConstants.DRYER_POWER_VARIANCE * gen.nextGaussian() + VillageConstants.DRYER_POWER_MEAN); cycleDuration = VillageConstants.DRYER_DURATION_CYCLE; }
@Override public void initialize (String household, Properties conf, int seed) { // Filling the base variables name = household + " Freezer"; randomSeedRepo = (RandomSeedRepo) SpringApplicationContext.getBean("randomSeedRepo"); gen = randomSeedRepo.getRandomSeed(toString(), seed, "Appliance Model" + seed); saturation = Double.parseDouble(conf.getProperty("FreezerSaturation")); power = (int) (VillageConstants.FREEZER_POWER_VARIANCE * gen.nextGaussian() + VillageConstants.FREEZER_POWER_MEAN); cycleDuration = VillageConstants.FREEZER_DURATION_CYCLE; }
@Override public void initialize (String office, Properties conf, int seed) { // Filling the base variables name = office + " MicrowaveOven"; saturation = Double.parseDouble(conf.getProperty("MicrowaveOvenSaturation")); randomSeedRepo = (RandomSeedRepo) SpringApplicationContext.getBean("randomSeedRepo"); gen = randomSeedRepo.getRandomSeed(toString(), seed, "Appliance Model" + seed); power = (int) (OfficeComplexConstants.MICROWAVE_OVEN_POWER_VARIANCE * gen.nextGaussian() + OfficeComplexConstants.MICROWAVE_OVEN_POWER_MEAN); cycleDuration = OfficeComplexConstants.MICROWAVE_OVEN_DURATION_CYCLE; operationPercentage = OfficeComplexConstants.MICROWAVE_OVEN_OPERATION_PERCENTAGE; times = Integer.parseInt(conf.getProperty("MicrowaveOvenDailyTimes")); }
@Override public void initialize (String office, Properties conf, int seed) { // Filling the base variables name = office + " Refrigerator"; saturation = Double.parseDouble(conf.getProperty("RefrigeratorSaturation")); randomSeedRepo = (RandomSeedRepo) SpringApplicationContext.getBean("randomSeedRepo"); gen = randomSeedRepo.getRandomSeed(toString(), seed, "Appliance Model" + seed); power = (int) (OfficeComplexConstants.REFRIGERATOR_POWER_VARIANCE * gen.nextGaussian() + OfficeComplexConstants.REFRIGERATOR_POWER_MEAN); cycleDuration = OfficeComplexConstants.REFRIGERATOR_DURATION_CYCLE; }
@Override public void initialize (String office, Properties conf, int seed) { // Filling the base variables name = office + " CoffeeMachine"; saturation = Double.parseDouble(conf.getProperty("RefrigeratorSaturation")); randomSeedRepo = (RandomSeedRepo) SpringApplicationContext.getBean("randomSeedRepo"); gen = randomSeedRepo.getRandomSeed(toString(), seed, "Appliance Model" + seed); power = (int) (OfficeComplexConstants.COFFEE_MACHINE_POWER_VARIANCE * gen.nextGaussian() + OfficeComplexConstants.COFFEE_MACHINE_POWER_MEAN); cycleDuration = OfficeComplexConstants.COFFEE_MACHINE_DURATION_CYCLE; standByPower = (int) (power / (cycleDuration - 1)); }
@Override public void initialize (String office, Properties conf, int seed) { // Filling the base variables name = office + " Vending Machine"; saturation = Double.parseDouble(conf.getProperty("VendingMachineSaturation")); randomSeedRepo = (RandomSeedRepo) SpringApplicationContext.getBean("randomSeedRepo"); gen = randomSeedRepo.getRandomSeed(toString(), seed, "Appliance Model" + seed); power = (int) (OfficeComplexConstants.VENDING_MACHINE_POWER_VARIANCE * gen.nextGaussian() + OfficeComplexConstants.VENDING_MACHINE_POWER_MEAN); cycleDuration = OfficeComplexConstants.VENDING_MACHINE_DURATION_CYCLE; }
@Override public void initialize (String office, Properties conf, int seed) { // Filling the base variables name = office + " ConsumerElectronics"; saturation = 1; randomSeedRepo = (RandomSeedRepo) SpringApplicationContext.getBean("randomSeedRepo"); gen = randomSeedRepo.getRandomSeed(toString(), seed, "Appliance Model" + seed); power = (int) (OfficeComplexConstants.CONSUMER_ELECTRONICS_POWER_VARIANCE * gen.nextGaussian() + OfficeComplexConstants.CONSUMER_ELECTRONICS_POWER_MEAN); cycleDuration = OfficeComplexConstants.CONSUMER_ELECTRONICS_DURATION_CYCLE; operationPercentage = Double.parseDouble(conf.getProperty("ConsumerElectronicsWorking")); }