1 package misc.temperature;
3 import ca.uqac.lif.cep.Processor;
4 import ca.uqac.lif.cep.ProcessorException;
5 import ca.uqac.lif.cep.tmf.Source;
6 import java.util.Queue;
7 import java.util.Random;
13 private final int maxRackId;
15 private final long pause;
17 private final double temperatureRatio;
19 private final double powerStd;
21 private final double powerMean;
23 private final double temperatureStd;
25 private final double temperatureMean;
29 private Random m_random =
new Random();
32 double temperatureRatio,
35 double temperatureStd,
36 double temperatureMean)
39 this.maxRackId = maxRackId;
41 this.temperatureRatio = temperatureRatio;
42 this.powerMean = powerMean;
43 this.powerStd = powerStd;
44 this.temperatureMean = temperatureMean;
45 this.temperatureStd = temperatureStd;
49 protected boolean compute(Object[] inputs, Queue<Object[]> outputs)
52 int rackId = m_random.nextInt(maxRackId) + offset;
53 if (m_random.nextDouble() >= temperatureRatio)
55 double power = m_random.nextGaussian() * powerStd + powerMean;
56 monitoringEvent =
new PowerEvent(rackId, power);
60 double temperature = m_random.nextGaussian() * temperatureStd + temperatureMean;
61 monitoringEvent =
new TemperatureEvent(rackId, temperature);
63 outputs.add(
new Object[] {monitoringEvent});
68 catch (InterruptedException e)
70 throw new ProcessorException(e);
76 public Processor duplicate(
boolean with_state)
A collection of examples taken from other stream processing software, and redone with BeepBeep...
Parent class of all the input events in this example.
Sub-class of monitoring event containing a temperature reading.
Sub-class of monitoring event containing a voltage reading.