-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchargeFromGrid.sh
More file actions
executable file
·36 lines (28 loc) · 1.05 KB
/
chargeFromGrid.sh
File metadata and controls
executable file
·36 lines (28 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh
# The error against actual of MultivariateLinearRegerression interquartile range
# is -11 to 32
# Therefore the suggested override is -11 to +32 of the plan.
planDir="/home/rwb/Luxopus/plans"
f=$(ls "$planDir" | tail -1)
if [ -z "$1" ]; then
echo "Parameter is required."
exit 1
fi
if [ "$1" -eq "$1" ] 2>/dev/null; then
# ok
z="z"
else
echo "Parameter must be a number."
exit 1
fi
if [ $1 -lt 0 ]; then
echo "Parameter 0 is new charge from grid cut-off. Must be at least 0. (Suggested -11 to +32 of plan.)"
exit 1
elif [ $1 -gt 100 ]; then
echo "Parameter 0 is new charge from grid cut-off. Must be at most 100. (Suggested -11 to +32 of plan.)"
exit 1
fi
echo "Plan is: ${planDir}/${f}"
echo "(Suggested adjustment is -11 to +32 of plan.)"
cat "${planDir}/$f" | jq ".Plans[] | select( .Action != null ) | .Action.ChargeFromGrid |= if . > 0 then $1 else . end" | jq -n " .Plans |= [inputs]" | sponge "${planDir}/${f}"
cat "${planDir}/$f" | jq '.Plans[] | select(.Action.ChargeFromGrid > 0)' | jq '"\(.Start) \(.Buy) -> \(.Action.ChargeFromGrid)%"'