1
|
namespace ServerApp.Parser.OutputInfo
|
2
|
{
|
3
|
/// <summary>
|
4
|
/// Weather conditions in regards to sun level
|
5
|
/// </summary>
|
6
|
public enum WeatherConditions
|
7
|
{
|
8
|
Sunny, Cloudy, Overcast, Dark
|
9
|
}
|
10
|
|
11
|
/// <summary>
|
12
|
/// Transfers lux values to weather conditions and vice versa
|
13
|
/// </summary>
|
14
|
public static class LuxToConditions
|
15
|
{
|
16
|
/// <summary>
|
17
|
/// Lux to weather conditions
|
18
|
/// </summary>
|
19
|
/// <param name="lux">Lux value</param>
|
20
|
/// <returns>Weather conditions</returns>
|
21
|
public static WeatherConditions TransferLuxToConditions(double lux)
|
22
|
{
|
23
|
if (lux > 40_000)
|
24
|
return WeatherConditions.Sunny;
|
25
|
|
26
|
if (lux > 20_000)
|
27
|
return WeatherConditions.Cloudy;
|
28
|
|
29
|
if (lux > 10_000)
|
30
|
return WeatherConditions.Overcast;
|
31
|
|
32
|
return WeatherConditions.Dark;
|
33
|
}
|
34
|
|
35
|
/// <summary>
|
36
|
/// Weather conditions to average lux
|
37
|
/// </summary>
|
38
|
/// <param name="condition">Weather conditions</param>
|
39
|
/// <returns>Lux value</returns>
|
40
|
internal static double TransferConditionsToLux(WeatherConditions condition)
|
41
|
{
|
42
|
if (condition == WeatherConditions.Sunny)
|
43
|
return 50_000;
|
44
|
|
45
|
if (condition == WeatherConditions.Cloudy)
|
46
|
return 30_000;
|
47
|
|
48
|
if (condition == WeatherConditions.Overcast)
|
49
|
return 15_000;
|
50
|
|
51
|
if (condition == WeatherConditions.Dark)
|
52
|
return 5_000;
|
53
|
|
54
|
return -1;
|
55
|
}
|
56
|
}
|
57
|
}
|