Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VIPSWeb
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VIPS
VIPSWeb
Commits
150bcf3a
Commit
150bcf3a
authored
3 years ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
Removing Yp (Yield potential) from the formula
parent
3dff38c1
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
calculators/static/calculators/js/eil.js
+6
-9
6 additions, 9 deletions
calculators/static/calculators/js/eil.js
calculators/templates/calculators/eil.html
+3
-5
3 additions, 5 deletions
calculators/templates/calculators/eil.html
with
9 additions
and
14 deletions
calculators/static/calculators/js/eil.js
+
6
−
9
View file @
150bcf3a
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
calculators/templates/calculators/eil.html
+
3
−
5
View file @
150bcf3a
...
...
@@ -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
()
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment