Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix[AGRI-NMP-721]: Fertigation Calculation Fixes #722

Merged
merged 8 commits into from
Jan 30, 2025
Merged

Conversation

lunamoonmoon
Copy link
Contributor

@lunamoonmoon lunamoonmoon commented Jan 23, 2025

Pull Request Standards

  • The title of the PR is accurate
  • The title includes the type of change [HOTFIX, FEATURE, etc]
  • The PR title includes the ticket number in format of [NMP-###]
  • Documentation is updated to reflect change [README, functions, team documents]

Description

This PR includes the following proposed change(s):

  • Corrected unit conversions on solubility assessment
    - ("amountToDissolve <= tankVolume * solInWater/1000 * 0.65") Josh to get back to us on coefficient for marginal error like cold vs warm water.
    Screenshot 2025-01-09 at 4 19 23 PM

  • Change to the solubility of Ammonium nitrate to 19.02 as per Ahmed's correction

  • Correction to Applied Nutrients calculation, was N * tank vol / fert area now N/100 * amount to dissolve / fert area

  • Corrected total product volume calculations to match user's selected application rate unit, added conversion factor (these now match the fert calculation values expected)
    Screenshot 2025-01-28 at 11 53 19 AM
    Screenshot 2025-01-28 at 11 53 47 AM

  • Added a second Nutrient Concentration In Stock Solution calculation in kg/L, for Dry Fertilizer and Dry Fertilizer Custom.
    Screenshot 2025-01-29 at 10 27 24 AM

  • Added solubility tooltip for Dry Fertilizer and Dry Fertilizer Custom. (Tooltips are still being wacky not always showing when clicked, previously Ariel and I tried to fix but couldn't figure out why. In the ppt Josh mentions it's happened before and fixed when goes to prod?)
    Screenshot 2025-01-29 at 2 20 53 PM

@lunamoonmoon lunamoonmoon changed the title solubility fixed! [FIX] Jan 23, 2025
@lunamoonmoon lunamoonmoon changed the title [FIX] Fix[AGRI-NMP-###]: Fertigation Updates 2 Jan 23, 2025
@lunamoonmoon lunamoonmoon changed the title Fix[AGRI-NMP-###]: Fertigation Updates 2 Fix[AGRI-NMP-721]: Fertigation Updates 2 Jan 28, 2025
@lunamoonmoon lunamoonmoon changed the title Fix[AGRI-NMP-721]: Fertigation Updates 2 Fix[AGRI-NMP-721]: Fertigation Calculation Fixes Jan 28, 2025
@lunamoonmoon lunamoonmoon marked this pull request as ready for review January 28, 2025 21:55
@@ -269,7 +269,7 @@
"Id": 6,
"FertilizerId": 6,
"SolubilityUnitId": 3,
"Value": 15.86,
"Value": 19.02,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change to the solubility of Ammonium nitrate to 19.02 as per Ahmed's correction in the fert ppt

if (amountToDissolve <= tankVolume * solInWater/1000){
//convert tankVolume from imp gal to litres
//convert amountToDissolve from lbs to kgs
if ((amountToDissolve * 0.45359237m) <= ((tankVolume * 4.54609m) * solInWater / 1000 * 0.65m))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per Ahmed fert ppt changed solubility assessment to "Multilply by 0.65 ("amountToDissolve <= tankVolume * solInWater/1000 * 0.65") to give room to error in solubility such as using colder water etc."

@lunamoonmoon lunamoonmoon marked this pull request as draft January 28, 2025 22:45
@@ -817,5 +817,12 @@
"Text": "Enter the volume of fertilizer mixture to be applied; do not enter the fertigation system's total output volume.",
"UserPromptPage": "Calculate",
"UserJourney": "Mixed"
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New tooltip for solubilty

@@ -308,6 +309,9 @@ public IActionResult FertigationDetails(string fldName, int? id, string? groupID
fgvm.nutrientConcentrationN = nf.nutrientConcentrationN.ToString("#.##");
fgvm.nutrientConcentrationP205 = nf.nutrientConcentrationP205.ToString("#.##");
fgvm.nutrientConcentrationK2O = nf.nutrientConcentrationK2O.ToString("#.##");
fgvm.kglNutrientConcentrationN = (nf.nutrientConcentrationN * 0.119826m).ToString("#.##");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kg/l nutrient concentration in stock to be displayed

</div>
<div class="form-group col-sm-4" style="display:flex; align-items: center;">
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

New nutrient concentration in stock table in kg/l

fgvm.calcN = Convert.ToString(Math.Round(Convert.ToDecimal(fgvm.nutrientConcentrationN) * tankVolume / fertArea, 2));
fgvm.calcK2o = Convert.ToString(Math.Round(Convert.ToDecimal(fgvm.nutrientConcentrationK2O) * tankVolume / fertArea, 2));
fgvm.calcP2o5 = Convert.ToString(Math.Round(Convert.ToDecimal(fgvm.nutrientConcentrationP205) * tankVolume / fertArea, 2));
// dont show nutrient concentration calculations if need to reduce amount to dissolve
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changes to 0 if user needs to reduce amount to dissolve.

fgvm.dryAction = "Soluble";
}
else{
//Need in lb/us gallon
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if soluble then calculate nutrient concentration in stock in imperial and metric

fgvm.calcTotalN = Convert.ToString(Convert.ToInt32(fertilizerNutrients.fertilizer_N) * Convert.ToInt32(fgvm.eventsPerSeason));
fgvm.calcTotalK2o = Convert.ToString(Convert.ToInt32(fertilizerNutrients.fertilizer_P2O5) * Convert.ToInt32(fgvm.eventsPerSeason));
fgvm.calcTotalP2o5 = Convert.ToString(Convert.ToInt32(fertilizerNutrients.fertilizer_K2O) * Convert.ToInt32(fgvm.eventsPerSeason));
fgvm.calcTotalN = Convert.ToString(Convert.ToInt32(fertilizerNutrients.fertilizer_N)/100 * Convert.ToInt32(fgvm.eventsPerSeason));
Copy link
Contributor Author

@lunamoonmoon lunamoonmoon Jan 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correction to Applied Nutrients calculation, was N * tank vol / fert area now N/100 * amount to dissolve / fert area

decimal convertedProductRate = Convert.ToDecimal(fgvm.productRate) * _fU.ConversionToImperialGallonsPerAcre;

// Method to get conversion factor based on user's selected unit for product rate
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change total product units and conversion factor based on users application rate units

@lunamoonmoon lunamoonmoon linked an issue Jan 29, 2025 that may be closed by this pull request
@PaulGarewal PaulGarewal requested a review from a team January 30, 2025 16:01
Copy link
Contributor

@PaulGarewal PaulGarewal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lunamoonmoon lunamoonmoon marked this pull request as ready for review January 30, 2025 17:39
@lunamoonmoon lunamoonmoon merged commit ce60d00 into master Jan 30, 2025
4 checks passed
@lunamoonmoon lunamoonmoon deleted the fixfert2 branch January 30, 2025 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fertigation Calculation issues and Updates
2 participants