diff --git a/calculators/static/calculators/js/eil.js b/calculators/static/calculators/js/eil.js index 37e60e24c242d389f6102b5e1b13c6df8927d388..e8395adc87fa47777e70e00f4b8629242281d576 100755 --- a/calculators/static/calculators/js/eil.js +++ b/calculators/static/calculators/js/eil.js @@ -31,21 +31,20 @@ * @param K pesticide efficacy, the percentage of pest population killed. Range 0-1 (1=100% killed) * @param D damage per pest, expressed as a percentage of crop yield loss per pest inidividual(?) */ -function calculateEIL(C,V,Yp,K,D) +function calculateEIL(C,V,K,D) { // From Pedigo et al (1986) - return C / (V * Yp * (K/100) * D); + return C / (V * (K/100) * D); //return C / (V * Yp * K * D); } function renderResult(formId) { var theForm = document.getElementById(formId); - var resultParameters = " = " + theForm["C"].value + " / (" + theForm["V"].value + " * " + theForm["Yp"].value + " * (" + theForm["K"].value + "/100) * " + theForm["D"].value + ")"; + var resultParameters = " = " + theForm["C"].value + " / (" + theForm["V"].value + " * (" + theForm["K"].value + "/100) * " + theForm["D"].value + ")"; var resultValue = calculateEIL( theForm["C"].value, theForm["V"].value, - theForm["Yp"].value, theForm["K"].value, theForm["D"].value ); @@ -57,7 +56,7 @@ function renderResult(formId) function renderCharts(formId){ - var chartContainerIds = ["EILvC","EILvV","EILvYp","EILvK"]; + var chartContainerIds = ["EILvC","EILvV","EILvK"]; var theForm = document.getElementById(formId); // Get the settings right var currency = theForm["currency"].value; @@ -65,10 +64,10 @@ function renderCharts(formId){ document.getElementById("currency2").innerHTML=currency; var cropAreaUnit = theForm["cropAreaUnit"].value; document.getElementById("cropAreaUnit1").innerHTML=cropAreaUnit; - document.getElementById("cropAreaUnit2").innerHTML=cropAreaUnit; + //document.getElementById("cropAreaUnit2").innerHTML=cropAreaUnit; var cropMassUnit = theForm["cropMassUnit"].value; document.getElementById("cropMassUnit1").innerHTML=cropMassUnit; - document.getElementById("cropMassUnit2").innerHTML=cropMassUnit; + //document.getElementById("cropMassUnit2").innerHTML=cropMassUnit; document.getElementById("cropMassUnit3").innerHTML=cropMassUnit; var pestMeasuringUnit = theForm["pestMeasuringUnit"].value; document.getElementById("pestMeasuringUnit").innerHTML = pestMeasuringUnit; @@ -82,7 +81,6 @@ function renderCharts(formId){ } renderEILChart(formId, "EILvC", "C", currency + "/" + cropAreaUnit, 0,500,1,chartTitles["EILvC"]); renderEILChart(formId, "EILvV", "V", currency + "/" + cropMassUnit, 1,100,1,chartTitles["EILvV"]); - renderEILChart(formId, "EILvYp", "Yp", cropMassUnit + "/" + cropAreaUnit, 1,200,1,chartTitles["EILvYp"]); renderEILChart(formId, "EILvK", "K", "%", 1,100,0.1,chartTitles["EILvK"]); //document.getElementById("chartContainer").style.display="block"; renderResult(formId); @@ -108,7 +106,6 @@ function renderEILChart(formId, containerId, paramName, paramUnit, paramMin, par data[data.length] = [i,calculateEIL( paramName == "C" ? i : theForm["C"].value, paramName == "V" ? i : theForm["V"].value, - paramName == "Yp" ? i : theForm["Yp"].value, paramName == "K" ? i : theForm["K"].value, paramName == "D" ? i : theForm["D"].value ) diff --git a/calculators/templates/calculators/eil.html b/calculators/templates/calculators/eil.html index 4b8fedb6643d7300fcc5c322a8cf16e62be8332d..37af35784df43263b549624716b9c6e61d37afe3 100755 --- a/calculators/templates/calculators/eil.html +++ b/calculators/templates/calculators/eil.html @@ -44,13 +44,13 @@ <input type="number" name="V" class="form-control" min="0" value="40" onblur="validateField(this);" onchange="renderCharts('{{ form_id }}');"/> <span class="help-block" id="{{ form_id }}_V_validation"></span> </div> - <div class="form-group"> + <!--div class="form-group"> <label for="Yp" data-toggle="tooltip" data-placement="top" title="{% trans "The maximum yield per production unit. Historical values are typically used for this expression." %}" >{% trans "Yield potential" %} (Yp) [<span id="cropMassUnit2">kg</span>/<span id="cropAreaUnit2">daa</span>]</label><br/> <input type="number" name="Yp" class="form-control" min="0" value="1000" onblur="validateField(this);" onchange="renderCharts('{{ form_id }}');"/> <span class="help-block" id="{{ form_id }}_Yp_validation"></span> - </div> + </div--> <div class="form-group"> <label for="K" data-toggle="tooltip" data-placement="top" @@ -90,12 +90,11 @@ <div class="col-md-9"> <h1>{% trans "Results" %}</h1> <div id="result" style="font-weight: bold;"> - {% trans "Calculated EIL" %} = C / (V * Yp * D * (K/100))<span id="resultParameters"></span>: <span id="resultValue"></span> + {% trans "Calculated EIL" %} = C / (V * D * (K/100))<span id="resultParameters"></span>: <span id="resultValue"></span> </div> <div id="EILvC" style="width:50%; height:300px;float: right;"></div> <div id="EILvV" style="width:50%; height:300px; "></div> - <div id="EILvYp" style="width:50%; height:300px;float: right;"></div> <div id="EILvK" style="width:50%; height:300px;"></div> <div id="EILvD" style="width:100%; height:300px;"></div> @@ -115,7 +114,6 @@ var chartTitles = { "EILvD" : "{% trans "EIL as a function of yield loss per pest unit" %}", "EILvC" : "{% trans "EIL as a function of control cost" %}", "EILvV" : "{% trans "EIL as a function of market value" %}", - "EILvYp" : "{% trans "EIL as a function of yield potential" %}", "EILvK" : "{% trans "EIL as a function of insecticide efficacy" %}", }; $(document).ready(function() {