From e7164b82b9039295c25520a8dbeb53881b786598 Mon Sep 17 00:00:00 2001 From: Tom Remeeus Date: Mon, 13 Oct 2014 20:56:17 +0200 Subject: [PATCH] Zonsterkte --- Calculator.ctxt | 34 ++++++++++++++++++++++++++++++++++ Weerstation.java | 1 + Zonsterkte.java | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 Calculator.ctxt create mode 100644 Zonsterkte.java diff --git a/Calculator.ctxt b/Calculator.ctxt new file mode 100644 index 0000000..bc36a2c --- /dev/null +++ b/Calculator.ctxt @@ -0,0 +1,34 @@ +#BlueJ class context +comment0.params=mval +comment0.target=double\ luchtdruk(short) +comment1.params=mval +comment1.target=double\ temperatuur(short) +comment10.params=sunRaw +comment10.target=java.lang.String\ sun(short) +comment11.params=mval +comment11.target=double\ solarRad(short) +comment12.params=grdnFh\ mph +comment12.target=double\ windChill(short,\ short) +comment13.params=RH\ T +comment13.target=double\ heatIndex(double,\ double) +comment14.params=omgevingsTemp\ luchtVochtigheid +comment14.target=double\ dewPoint(double,\ short) +comment15.params=temp\ luchtVochtigheid +comment15.target=double\ cloudHeight(double,\ short) +comment2.params=mval +comment2.target=double\ luchtVochtigheid(short) +comment3.params=mval +comment3.target=double\ windSnelheid(short) +comment4.params=mval +comment4.target=java.lang.String\ windRichting(short) +comment5.params=mval +comment5.target=double\ regenmeter(short) +comment6.params=mval +comment6.target=double\ uvIndex(short) +comment7.params=mval +comment7.target=double\ batterySpanning(short) +comment8.params=mval +comment8.target=java.lang.String\ sunRise(short) +comment9.params=mval +comment9.target=java.lang.String\ sunSet(short) +numComments=16 diff --git a/Weerstation.java b/Weerstation.java index c470052..ca4f1b8 100644 --- a/Weerstation.java +++ b/Weerstation.java @@ -36,6 +36,7 @@ public class Weerstation { lstScreens.add(new InsideHum(meting1, meting2)); lstScreens.add(new CloudHeight(meting1, meting2)); lstScreens.add(new UVLevel(meting1, meting2)); + lstScreens.add(new Zonsterkte(meting1, meting2)); lstScreens.add(new DewPoint(meting1, meting2)); diff --git a/Zonsterkte.java b/Zonsterkte.java new file mode 100644 index 0000000..f6e753d --- /dev/null +++ b/Zonsterkte.java @@ -0,0 +1,44 @@ +import java.util.ArrayList; + +public class Zonsterkte extends Grootheid{ + public ArrayList list; + + //constructor + public Zonsterkte(Measurement measurement1, ArrayList measurement2){ + list = new ArrayList(); + updateRecent(measurement1); + update24Hour(measurement2); + } + + + public void updateRecent(Measurement measurement1){ + setCurrent(measurement1.getSolarRad()); + } + public void update24Hour(ArrayList measurement2){ + createList(measurement2); + calculateMaxMinAvg(list); + } + + public void display(){ + super.display(); + GUIboard.writePageToMatrix("Zonsterkte", "Gemiddelde: " + getAvg(), ""); + } + + public void displayGraph() + { + GUIboard.writeGraphToMatrix(list, getMin(), getMax()); + } + + private void createList(ArrayList measurement2) + { + if(!list.isEmpty()) + { + list.clear(); + } + + for(Measurement ms : measurement2) + { + list.add(ms.getSolarRad()); + } + } +} \ No newline at end of file