2020-05-06 16:22:30 +02:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class SoilProperties
|
|
|
|
|
{
|
|
|
|
|
static Random r = new Random();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public string soilType = "potato";
|
2020-05-06 22:47:56 +02:00
|
|
|
|
public float Temperature;
|
2020-05-06 16:22:30 +02:00
|
|
|
|
public float Humidity;
|
|
|
|
|
public float Moisture;
|
|
|
|
|
public float Nitrogen;
|
|
|
|
|
public float Potassium;
|
|
|
|
|
public float Phosphorous;
|
|
|
|
|
|
|
|
|
|
public void setSoilProperties()
|
|
|
|
|
{
|
2020-05-06 22:37:04 +02:00
|
|
|
|
int soilTypeRandomizer = r.Next(0, 1000);
|
|
|
|
|
if (soilTypeRandomizer < 210)
|
|
|
|
|
{
|
|
|
|
|
soilType = "Loamy";
|
|
|
|
|
}
|
|
|
|
|
else if (soilTypeRandomizer < 400)
|
|
|
|
|
{
|
|
|
|
|
soilType = "Red";
|
|
|
|
|
}
|
|
|
|
|
else if (soilTypeRandomizer < 600)
|
|
|
|
|
{
|
|
|
|
|
soilType = "Black";
|
|
|
|
|
}
|
|
|
|
|
else if (soilTypeRandomizer < 800)
|
|
|
|
|
{
|
|
|
|
|
soilType = "Sandy";
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
soilType = "Clayey";
|
|
|
|
|
}
|
2020-05-06 16:22:30 +02:00
|
|
|
|
Temparature = GetRandomNumber(22, 30);
|
2020-05-06 22:37:04 +02:00
|
|
|
|
Humidity = Temparature * 2 + GetRandomNumber(1.9, 2.2);
|
2020-05-06 22:47:56 +02:00
|
|
|
|
Moisture = GetRandomNumber(20, 70);
|
|
|
|
|
Nitrogen = GetRandomNumber(4 , 55);
|
|
|
|
|
Potassium = GetRandomNumber(0, 28);
|
|
|
|
|
Phosphorous = GetRandomNumber(0, 60);
|
2020-05-06 16:22:30 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public float GetRandomNumber(double minimum, double maximum)
|
|
|
|
|
{
|
|
|
|
|
return (float)(Math.Round(r.NextDouble() * (maximum - minimum) + minimum, 2));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|