Skip to content
/ apus Public

A R package to advice optimal mix of fertilizers

License

Notifications You must be signed in to change notification settings

AgroCares/apus

Repository files navigation

apus

Lifecycle: experimental R-CMD-check Codecov test coverage

The R packageapusoptimizes the fertilizer mix for a farm based on the nutrient requirements, legal norms, cultivation response curves, available fertilizers and tries to achieve the best economic result within the provided boundaries.

Note

Currently this package is in an early stage of development and not suitable to be used in the real world yet.

Installation

Currently theapuspackage is in development and only available to install via GitHub. Use the following command to install the latest development version:

remotes::install_github('AgroCares/apus')

Getting started

apusmakes use ofR6to keep track of data of a farm. First step is to initialize anapusobject

library(apus)
apus <- apus::Apus$new(farm_name = 'my farm')

Then you can add fields to your farm with theaddField()function. Multiple fields can be added by using again theaddField()function

apus$addField(
b_id_field = 1L,
b_area = 10000,
b_lu = 'nl_2014',
d_n_req = 270,
d_p_req = 120,
d_k_req = 50,
d_n_norm = 230,
d_n_norm_man = 170,
d_p_norm = 75,
b_lu_yield = 40000,
b_lu_price = 0.3
)

# Add a second field
apus$addField(
b_id_field = 2L,
b_area = 5000,
b_lu = 'nl_262',
d_n_req = 270,
d_p_req = 120,
d_k_req = 50,
d_n_norm = 230,
d_n_norm_man = 170,
d_p_norm = 75,
b_lu_yield = 66000,
b_lu_price = 0.1
)

To get a fertilizer advice you need a model first. A model can be trained with with the functiontrainModel()

apus$trainModel()

After the model has been trained the advice can be generated with theoptimizeFertilizerChoice()function of theapusobject.

advice = apus$optimizeFertilizerChoice()

Theadviceis a table with adviced dose per fertilizer and field in kg /ha.

Roadmap

For the v1 version ofapuswe plan to develop to following features:

  • Import and export trained models
  • Include a trained base model
  • Add function to train model
  • Enable fine-tuning of (base) models
  • Include cost function for module 1: Purchase of fertilizers
  • Include cost function for module 2: Disposal of manure
  • Include cost function for module 3: Cost of storing fertilizers
  • Include cost function for module 4: Cost of applying fertilizers
  • Include cost function for module 5: Revenue of harvest
  • Include cost function for module 6: Penalties in case of exceeding legal limits
  • Include cost function for module 7: Cost of greenhouse gas emissions
  • Include realistic cultivation response curves from module 5
  • Add other nutrients than NPK to module 5
  • Add custom fertilizers
  • Add custom cultivations
  • Add details of the optimization to the result

Contributing

If you would like to contribute toapusyou are very welcome! Please create an issue with your idea or a pull request with your contribution.

Contact

  • Maintainer: @SvenVw

Made possible by

The packageapusis developed by theNutriënten Management Instituutas part of the Horizon Europe project:NutriBudget

Logo of NutriBudget

Logo of EU

Logo of NMI