public static MessageBody CreateTemperatureData(int counter, DataGenerationPolicy policy, bool reset = false) { if (reset) { TemperatureDataFactory.CurrentMachineTemperature = policy.CalculateMachineTemperature(); } else { TemperatureDataFactory.CurrentMachineTemperature = policy.CalculateMachineTemperature(TemperatureDataFactory.CurrentMachineTemperature); } var machinePressure = policy.CalculatePressure(TemperatureDataFactory.CurrentMachineTemperature); var ambientTemperature = policy.CalculateAmbientTemperature(); var ambientHumidity = policy.CalculateHumidity(); var messageBody = new MessageBody { Machine = new Machine { Temperature = TemperatureDataFactory.CurrentMachineTemperature, Pressure = machinePressure }, Ambient = new Ambient { Temperature = ambientTemperature, Humidity = ambientHumidity }, TimeCreated = string.Format("{0:O}", DateTime.Now) }; return(messageBody); }
public static MessageBody CreateTemperatureData(int counter, DataGenerationPolicy policy, bool resetTemperature = false, bool resetOverhaul = false) { if (resetTemperature) { TemperatureDataFactory.CurrentMachineTemperature = policy.CalculateMachineTemperature(); } else { TemperatureDataFactory.CurrentMachineTemperature = policy.CalculateMachineTemperature(TemperatureDataFactory.CurrentMachineTemperature); } var machinePressure = policy.CalculatePressure(TemperatureDataFactory.CurrentMachineTemperature); var ambientTemperature = policy.CalculateAmbientTemperature(); var ambientHumidity = policy.CalculateHumidity(); TemperatureDataFactory.CurrentRunTimeSinceProduction = policy.CalculateRunTimeSinceProduction(TemperatureDataFactory.CurrentRunTimeSinceProduction); TemperatureDataFactory.CurrentRunTimeSinceMaintenance = policy.CalculateRunTimeSinceMaintenance(TemperatureDataFactory.CurrentRunTimeSinceMaintenance); if (resetOverhaul) { TemperatureDataFactory.CurrentRunTimeSinceOverhaul = policy.CalculateRunTimeSinceOverhaul(1); } else { TemperatureDataFactory.CurrentRunTimeSinceOverhaul = policy.CalculateRunTimeSinceOverhaul(TemperatureDataFactory.CurrentRunTimeSinceOverhaul); } var messageBody = new MessageBody { Machine = new Machine { Temperature = TemperatureDataFactory.CurrentMachineTemperature, Pressure = machinePressure, RunTimeSinceProduction = TemperatureDataFactory.CurrentRunTimeSinceProduction, RunTimeSinceMaintenance = TemperatureDataFactory.CurrentRunTimeSinceMaintenance, RunTimeSinceOverhaul = TemperatureDataFactory.CurrentRunTimeSinceOverhaul, }, Ambient = new Ambient { Temperature = ambientTemperature, Humidity = ambientHumidity }, TimeCreated = string.Format("{0:O}", DateTime.Now) }; return(messageBody); }