1 |
0da0ac88
|
A-Konig
|
using System;
|
2 |
|
|
|
3 |
734533a8
|
A-Konig
|
namespace ServerApp.Parser.OutputInfo
|
4 |
0da0ac88
|
A-Konig
|
{
|
5 |
734533a8
|
A-Konig
|
/// <summary>
|
6 |
|
|
/// Class representing the weather in a given interval at ZCU
|
7 |
|
|
/// - shortest possible interval is 1h
|
8 |
|
|
/// </summary>
|
9 |
0da0ac88
|
A-Konig
|
class WeatherInfo
|
10 |
|
|
{
|
11 |
734533a8
|
A-Konig
|
/// <summary> Temperature in °C </summary>
|
12 |
|
|
public double temp;
|
13 |
|
|
/// <summary> Probability of rain in % </summary>
|
14 |
|
|
public int rain;
|
15 |
|
|
/// <summary> Wind in m/s </summary>
|
16 |
|
|
public double wind;
|
17 |
|
|
/// <summary> Luminance </summary>
|
18 |
|
|
public double lum;
|
19 |
|
|
/// <summary> General weather conditions </summary>
|
20 |
|
|
public WeatherConditions condition;
|
21 |
0da0ac88
|
A-Konig
|
|
22 |
734533a8
|
A-Konig
|
/// <summary> Start of interval </summary>
|
23 |
0da0ac88
|
A-Konig
|
DateTime startTime;
|
24 |
734533a8
|
A-Konig
|
/// <summary> Length of interval in hours </summary>
|
25 |
|
|
int intervalLength;
|
26 |
0da0ac88
|
A-Konig
|
|
27 |
734533a8
|
A-Konig
|
/// <summary>
|
28 |
|
|
/// Constructor
|
29 |
|
|
/// </summary>
|
30 |
|
|
/// <param name="startTime">Start of the interval</param>
|
31 |
|
|
/// <param name="temp">Temperature in °C</param>
|
32 |
|
|
/// <param name="rain">Probability of rain in %</param>
|
33 |
|
|
/// <param name="wind">Wind in m/w</param>
|
34 |
|
|
/// <param name="lum">Luminance in lux</param>
|
35 |
|
|
/// <param name="intervalLength">Interval length</param>
|
36 |
|
|
public WeatherInfo(DateTime startTime, double temp, int rain, double wind, double lum, int intervalLength)
|
37 |
0da0ac88
|
A-Konig
|
{
|
38 |
|
|
this.startTime = startTime;
|
39 |
|
|
this.temp = temp;
|
40 |
|
|
this.rain = rain;
|
41 |
|
|
this.wind = wind;
|
42 |
|
|
this.lum = lum;
|
43 |
734533a8
|
A-Konig
|
this.intervalLength = intervalLength;
|
44 |
|
|
|
45 |
|
|
condition = LuxToConditions.TransferLuxToConditions(lum);
|
46 |
|
|
}
|
47 |
|
|
|
48 |
|
|
/// <summary>
|
49 |
|
|
/// Constructor
|
50 |
|
|
/// </summary>
|
51 |
|
|
/// <param name="startTime">Start of the interval</param>
|
52 |
|
|
/// <param name="temp">Temperature in °C</param>
|
53 |
|
|
/// <param name="rain">Probability of rain in %</param>
|
54 |
|
|
/// <param name="wind">Wind in m/s</param>
|
55 |
|
|
/// <param name="condition">Weather conditions</param>
|
56 |
|
|
/// <param name="intervalLength">Interval length</param>
|
57 |
|
|
public WeatherInfo(DateTime startTime, double temp, int rain, double wind, WeatherConditions condition, int intervalLength)
|
58 |
|
|
{
|
59 |
|
|
this.startTime = startTime;
|
60 |
|
|
this.temp = temp;
|
61 |
|
|
this.rain = rain;
|
62 |
|
|
this.wind = wind;
|
63 |
|
|
this.condition = condition;
|
64 |
|
|
this.intervalLength = intervalLength;
|
65 |
|
|
|
66 |
|
|
lum = LuxToConditions.TransferConditionsToLux(condition);
|
67 |
0da0ac88
|
A-Konig
|
}
|
68 |
|
|
|
69 |
734533a8
|
A-Konig
|
/// <summary>
|
70 |
|
|
/// To string
|
71 |
|
|
/// </summary>
|
72 |
|
|
/// <returns>interval start temperature probability of rain wind weather condition</returns>
|
73 |
0da0ac88
|
A-Konig
|
public override string ToString()
|
74 |
|
|
{
|
75 |
734533a8
|
A-Konig
|
return $"{startTime.ToString()} \t {temp}°C \t {rain}% \t {wind}m/s \t {condition.ToString()}";
|
76 |
0da0ac88
|
A-Konig
|
}
|
77 |
|
|
|
78 |
|
|
}
|
79 |
|
|
}
|