Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
Variables:
Quantity Harvested: How much harvested crops in a farm
Refuse: % Refuse for each crop
Protein Content: Crop Protein 
Factor to Convert From Protein to Nitrogen = 0.16
Moisture Factor = 1

Total Nitrogen In Crop = quantityHarvested * (1 - refuse) * proteinContent * factorToConvertFromProteinToNitrogen * moistureFactor;

Explanation (by Brandon Tai (Unlicensed) )

The nitrogen balance insight acts as an indicator to a farmer on the balance of nitrogen in the soil of a location on their farm, as the name entails. The calculation can be summed up as simply being the difference between how much nitrogen is going into the soil (typically through the application of fertilizers) and how much nitrogen is being taken out (usually through harvests). As such, this can be broken down as the calculations of the nitrogen in value and the nitrogen out value.

Nitrogen In

There are three factors that play into the addition of nitrogen content into the soil:

  • Fertilizer (e.g. manure)

  • Cover crops

  • Legumes

Fertilizers is accounted for through fertilizer logs. The algorithm will take fertilizer logs that exist for a location and use the nitrogen percentage (denoted by n_percentage in the fertilizer table), ammonium content measured in ppm (denoted by nh4_n_ppm in the fertilizer table), and the mineralization rate (denoted by mineralization_rate in the fertilizer table). Usually, nitrate content is taken into account, but since most fertilizers have negligible amounts of nitrate, this value is set to zero in the code’s calculations.

After consulting with a specialist, an improvement that can be made to the fertilizer’s part of the nitrogen in calculation is calculating the dry weight of a given fertilizer when calculating currentTotalNitrogen. Currently, the code calculates this value as quantity_kg * n_percentage / 100 instead of accounting for the moisture percentage of the fertilizer:

Code Block
quantity_kg * moisture_percentage / 100 * n_percentage / 100

Cover crops are defined as “plants that are planted to cover the soil rather than for the purpose of being harvested” (taken from Wikipedia). Once cover crops are finished growing, they will be crunched into the ground for the benefit of the soil. One such benefit is adding nitrogen content, and this value can be derived by calculating how much cover crop is being planted in a location (usually calculated upon location crop creation) and multiplying that value by some factor of the amount of nitrogen credits that the cover crop provides. Currently, LiteFarm does not support the tracking of cover crops and does not have nitrogen credit values assigned to the various crops in the database. A more accurate calculation can be achieved once a system has been designed for cover crop tracking in the future.

Legumes are subgroup of crops that possess a unique property of taking nitrogen from the air and into the soil in the duration between their seeding and their harvest. That is the say, when a legume is planted and harvested, some amount of nitrogen content will be restored to the soil. This is one method through which extra nitrogen content, known as nitrogen credits, can be gained (the other method being cover crops). Currently, any crop that has a non-zero nutrient credit value (denoted by nutrient_credits in the crop table) will factor into the nitrogen in calculation if it is at some point planted and harvested in a location.

Here is a list of crops that have non-zero nutrient credit values, from the seeded data only:

Labour Happiness

Code Block
Variables:
Shifts based on a persons farm
- Mood (1-5)

The algorithm parses each mood from 1-5 if the worker decided to not submit their task, it is not weighted in this system

The algorithm uses a "weighted sum" determined on the duration of the workers shift

For example: 
If a worker does two tasks:
Harvesting: 5 mins
Plowing: 20 mins
Rating: 3/5

The rating is shifted more in favour of plowing (As the worker spent more time plowing)

...