Search in sources :

Example 36 with Window

use of org.concord.energy3d.model.Window in project energy3d by concord-consortium.

the class DataViewer method viewRawData.

static void viewRawData(final java.awt.Window parent, final Graph graph, final List<HousePart> selectedParts) {
    if (selectedParts == null || selectedParts.isEmpty()) {
        JOptionPane.showMessageDialog(MainFrame.getInstance(), "No part is selected.", "Error", JOptionPane.ERROR_MESSAGE);
        return;
    }
    final ArrayList<String> headers = new ArrayList<String>();
    if (graph instanceof PartEnergyDailyGraph) {
        headers.add("Hour");
    } else if (graph instanceof PartEnergyAnnualGraph) {
        headers.add("Month");
    }
    for (final HousePart p : selectedParts) {
        if (p instanceof SolarPanel || p instanceof Rack || p instanceof Mirror) {
            headers.add("Solar " + p.getId());
        } else if (p instanceof Wall || p instanceof Roof || p instanceof Door) {
            headers.add("Heat Gain " + p.getId());
        } else if (p instanceof Window) {
            headers.add("Solar " + p.getId());
            headers.add("Heat Gain " + p.getId());
        } else if (p instanceof Foundation) {
            final Foundation foundation = (Foundation) p;
            switch(foundation.getProjectType()) {
                case Foundation.TYPE_PV_PROJECT:
                    headers.add("PV " + p.getId());
                    break;
                case Foundation.TYPE_CSP_PROJECT:
                    headers.add("CSP " + p.getId());
                    break;
                case Foundation.TYPE_BUILDING:
                    headers.add("Building " + p.getId());
                    break;
            }
        }
    }
    final String[] headersArray = new String[headers.size()];
    for (int i = 0; i < headersArray.length; i++) {
        headersArray[i] = headers.get(i);
    }
    final int m = headersArray.length;
    final int n = graph.getLength();
    final Object[][] column = new Object[n][m + 1];
    for (int i = 0; i < n; i++) {
        column[i][0] = (i + 1);
    }
    for (int j = 1; j < m; j++) {
        final List<Double> list = graph.getData(headersArray[j]);
        for (int i = 0; i < n; i++) {
            column[i][j] = list.get(i);
        }
    }
    showDataWindow("Data", column, headersArray, parent);
}
Also used : Window(org.concord.energy3d.model.Window) Wall(org.concord.energy3d.model.Wall) ArrayList(java.util.ArrayList) Door(org.concord.energy3d.model.Door) Rack(org.concord.energy3d.model.Rack) Roof(org.concord.energy3d.model.Roof) SolarPanel(org.concord.energy3d.model.SolarPanel) Foundation(org.concord.energy3d.model.Foundation) Mirror(org.concord.energy3d.model.Mirror) HousePart(org.concord.energy3d.model.HousePart)

Example 37 with Window

use of org.concord.energy3d.model.Window in project energy3d by concord-consortium.

the class EnergyAnnualAnalysis method updateGraph.

@Override
public void updateGraph() {
    final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
    if (selectedPart instanceof Foundation) {
        if (graph instanceof BuildingEnergyAnnualGraph) {
            final Foundation selectedBuilding = (Foundation) selectedPart;
            final double window = selectedBuilding.getPassiveSolarToday();
            final double solarPanel = selectedBuilding.getPhotovoltaicToday();
            final double heater = selectedBuilding.getHeatingToday();
            final double ac = selectedBuilding.getCoolingToday();
            final double net = selectedBuilding.getTotalEnergyToday();
            graph.addData("Windows", window);
            graph.addData("Solar Panels", solarPanel);
            graph.addData("Heater", heater);
            graph.addData("AC", ac);
            graph.addData("Net", net);
        } else {
            graph.addData("Solar", selectedPart.getSolarPotentialToday());
        }
    } else if (selectedPart instanceof Window) {
        final Window window = (Window) selectedPart;
        final double solar = selectedPart.getSolarPotentialToday() * window.getSolarHeatGainCoefficient();
        graph.addData("Solar", solar);
        final double[] loss = selectedPart.getHeatLoss();
        double sum = 0;
        for (final double x : loss) {
            sum += x;
        }
        graph.addData("Heat Gain", -sum);
    } else if (selectedPart instanceof Wall || selectedPart instanceof Roof || selectedPart instanceof Door) {
        final double[] loss = selectedPart.getHeatLoss();
        double sum = 0;
        for (final double x : loss) {
            sum += x;
        }
        graph.addData("Heat Gain", -sum);
    } else if (selectedPart instanceof SolarPanel) {
        graph.addData("Solar", ((SolarPanel) selectedPart).getYieldToday());
    } else if (selectedPart instanceof Rack) {
        graph.addData("Solar", ((Rack) selectedPart).getYieldToday());
    }
    graph.repaint();
}
Also used : Window(org.concord.energy3d.model.Window) Rack(org.concord.energy3d.model.Rack) Roof(org.concord.energy3d.model.Roof) Wall(org.concord.energy3d.model.Wall) SolarPanel(org.concord.energy3d.model.SolarPanel) Foundation(org.concord.energy3d.model.Foundation) HousePart(org.concord.energy3d.model.HousePart) Door(org.concord.energy3d.model.Door)

Example 38 with Window

use of org.concord.energy3d.model.Window in project energy3d by concord-consortium.

the class EnergyDailyAnalysis method updateGraph.

@Override
public void updateGraph() {
    final int n = (int) Math.round(60.0 / Scene.getInstance().getTimeStep());
    for (int i = 0; i < 24; i++) {
        SolarRadiation.getInstance().computeEnergyAtHour(i);
        final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
        if (selectedPart instanceof Foundation) {
            if (graph instanceof BuildingEnergyDailyGraph) {
                final Foundation selectedBuilding = (Foundation) selectedPart;
                final double window = selectedBuilding.getPassiveSolarNow();
                final double solarPanel = selectedBuilding.getPhotovoltaicNow();
                final double heater = selectedBuilding.getHeatingNow();
                final double ac = selectedBuilding.getCoolingNow();
                final double net = selectedBuilding.getTotalEnergyNow();
                graph.addData("Windows", window);
                graph.addData("Solar Panels", solarPanel);
                graph.addData("Heater", heater);
                graph.addData("AC", ac);
                graph.addData("Net", net);
            } else {
                graph.addData("Solar", selectedPart.getSolarPotentialNow());
            }
        } else if (selectedPart instanceof Window) {
            final Window window = (Window) selectedPart;
            final double solar = selectedPart.getSolarPotentialNow() * window.getSolarHeatGainCoefficient();
            graph.addData("Solar", solar);
            final double[] loss = selectedPart.getHeatLoss();
            final int t0 = n * i;
            double sum = 0;
            for (int k = t0; k < t0 + n; k++) {
                sum += loss[k];
            }
            graph.addData("Heat Gain", -sum);
        } else if (selectedPart instanceof Wall || selectedPart instanceof Roof || selectedPart instanceof Door) {
            final double solar = selectedPart.getSolarPotentialNow();
            graph.addData("Solar", solar);
            final double[] loss = selectedPart.getHeatLoss();
            final int t0 = n * i;
            double sum = 0;
            for (int k = t0; k < t0 + n; k++) {
                sum += loss[k];
            }
            graph.addData("Heat Gain", -sum);
        } else if (selectedPart instanceof SolarPanel) {
            graph.addData("Solar", ((SolarPanel) selectedPart).getYieldNow());
        } else if (selectedPart instanceof Rack) {
            graph.addData("Solar", ((Rack) selectedPart).getYieldNow());
        }
    }
    graph.repaint();
}
Also used : Window(org.concord.energy3d.model.Window) Rack(org.concord.energy3d.model.Rack) Roof(org.concord.energy3d.model.Roof) Wall(org.concord.energy3d.model.Wall) SolarPanel(org.concord.energy3d.model.SolarPanel) Foundation(org.concord.energy3d.model.Foundation) HousePart(org.concord.energy3d.model.HousePart) Door(org.concord.energy3d.model.Door)

Example 39 with Window

use of org.concord.energy3d.model.Window in project energy3d by concord-consortium.

the class GroupAnnualAnalysis method toJson.

@Override
public String toJson() {
    String type = "Unknown";
    final ArrayList<String> names = new ArrayList<String>();
    for (final HousePart p : selectedParts) {
        if (p instanceof SolarPanel) {
            names.add("Solar " + p.getId());
            type = "Solar Panel";
        } else if (p instanceof Rack) {
            names.add("Solar " + p.getId());
            type = "Rack";
        } else if (p instanceof Mirror) {
            names.add("Solar " + p.getId());
            type = "Mirror";
        } else if (p instanceof ParabolicTrough) {
            names.add("Solar " + p.getId());
            type = "Parabolic Trough";
        } else if (p instanceof ParabolicDish) {
            names.add("Solar " + p.getId());
            type = "Parabolic Dish";
        } else if (p instanceof FresnelReflector) {
            names.add("Solar " + p.getId());
            type = "Fresnel Reflector";
        } else if (p instanceof Wall) {
            names.add("Heat Gain " + p.getId());
            type = "Wall";
        } else if (p instanceof Roof) {
            names.add("Heat Gain " + p.getId());
            type = "Roof";
        } else if (p instanceof Door) {
            names.add("Heat Gain " + p.getId());
            type = "Door";
        } else if (p instanceof Window) {
            names.add("Solar " + p.getId());
            names.add("Heat Gain " + p.getId());
            type = "Window";
        } else if (p instanceof Foundation) {
            final Foundation foundation = (Foundation) p;
            switch(foundation.getProjectType()) {
                case Foundation.TYPE_PV_PROJECT:
                    names.add("PV " + p.getId());
                    break;
                case Foundation.TYPE_CSP_PROJECT:
                    names.add("CSP " + p.getId());
                    break;
                case Foundation.TYPE_BUILDING:
                    names.add("Building " + p.getId());
                    break;
            }
            type = "Foundation";
        }
    }
    String s = "{\"Type\": \"" + type + "\", \"Months\": " + getNumberOfDataPoints();
    for (final String name : names) {
        final List<Double> data = graph.getData(name);
        if (data == null) {
            continue;
        }
        s += ", \"" + name + "\": {";
        s += "\"Monthly\": [";
        for (final Double x : data) {
            s += Graph.ENERGY_FORMAT.format(x) + ",";
        }
        s = s.substring(0, s.length() - 1);
        s += "]\n";
        s += ", \"Total\": " + Graph.ENERGY_FORMAT.format(getResult(name));
        s += "}";
    }
    s += "}";
    return s;
}
Also used : Window(org.concord.energy3d.model.Window) ParabolicTrough(org.concord.energy3d.model.ParabolicTrough) FresnelReflector(org.concord.energy3d.model.FresnelReflector) Wall(org.concord.energy3d.model.Wall) ArrayList(java.util.ArrayList) Door(org.concord.energy3d.model.Door) ParabolicDish(org.concord.energy3d.model.ParabolicDish) Rack(org.concord.energy3d.model.Rack) Roof(org.concord.energy3d.model.Roof) SolarPanel(org.concord.energy3d.model.SolarPanel) Foundation(org.concord.energy3d.model.Foundation) Mirror(org.concord.energy3d.model.Mirror) HousePart(org.concord.energy3d.model.HousePart)

Example 40 with Window

use of org.concord.energy3d.model.Window in project energy3d by concord-consortium.

the class GroupDailyAnalysis method toJson.

@Override
public String toJson() {
    String type = "Unknown";
    final ArrayList<String> names = new ArrayList<String>();
    for (final HousePart p : selectedParts) {
        if (p instanceof SolarPanel) {
            names.add("Solar " + p.getId());
            type = "Solar Panel";
        } else if (p instanceof Rack) {
            names.add("Solar " + p.getId());
            type = "Rack";
        } else if (p instanceof Mirror) {
            names.add("Solar " + p.getId());
            type = "Mirror";
        } else if (p instanceof ParabolicTrough) {
            names.add("Solar " + p.getId());
            type = "Parabolic Trough";
        } else if (p instanceof ParabolicDish) {
            names.add("Solar " + p.getId());
            type = "Parabolic Dish";
        } else if (p instanceof FresnelReflector) {
            names.add("Solar " + p.getId());
            type = "Fresnel Reflector";
        } else if (p instanceof Wall) {
            names.add("Heat Gain " + p.getId());
            type = "Wall";
        } else if (p instanceof Roof) {
            names.add("Heat Gain " + p.getId());
            type = "Roof";
        } else if (p instanceof Door) {
            names.add("Heat Gain " + p.getId());
            type = "Door";
        } else if (p instanceof Window) {
            names.add("Solar " + p.getId());
            names.add("Heat Gain " + p.getId());
            type = "Window";
        } else if (p instanceof Foundation) {
            final Foundation foundation = (Foundation) p;
            switch(foundation.getProjectType()) {
                case Foundation.TYPE_PV_PROJECT:
                    names.add("PV " + p.getId());
                    break;
                case Foundation.TYPE_CSP_PROJECT:
                    names.add("CSP " + p.getId());
                    break;
                case Foundation.TYPE_BUILDING:
                    names.add("Building " + p.getId());
                    break;
            }
            type = "Foundation";
        }
    }
    String s = "{\"Type\": \"" + type + "\"";
    for (final String name : names) {
        final List<Double> data = graph.getData(name);
        if (data == null) {
            continue;
        }
        s += ", \"" + name + "\": {";
        s += "\"Hourly\": [";
        for (final Double x : data) {
            s += Graph.FIVE_DECIMALS.format(x) + ",";
        }
        s = s.substring(0, s.length() - 1);
        s += "]\n";
        s += ", \"Total\": " + Graph.ENERGY_FORMAT.format(getResult(name));
        s += "}";
    }
    s += "}";
    return s;
}
Also used : Window(org.concord.energy3d.model.Window) ParabolicTrough(org.concord.energy3d.model.ParabolicTrough) FresnelReflector(org.concord.energy3d.model.FresnelReflector) Wall(org.concord.energy3d.model.Wall) ArrayList(java.util.ArrayList) Door(org.concord.energy3d.model.Door) ParabolicDish(org.concord.energy3d.model.ParabolicDish) Rack(org.concord.energy3d.model.Rack) Roof(org.concord.energy3d.model.Roof) SolarPanel(org.concord.energy3d.model.SolarPanel) Foundation(org.concord.energy3d.model.Foundation) Mirror(org.concord.energy3d.model.Mirror) HousePart(org.concord.energy3d.model.HousePart)

Aggregations

Window (org.concord.energy3d.model.Window)57 HousePart (org.concord.energy3d.model.HousePart)43 Foundation (org.concord.energy3d.model.Foundation)39 Roof (org.concord.energy3d.model.Roof)28 Wall (org.concord.energy3d.model.Wall)28 Rack (org.concord.energy3d.model.Rack)27 Door (org.concord.energy3d.model.Door)25 SolarPanel (org.concord.energy3d.model.SolarPanel)25 Mirror (org.concord.energy3d.model.Mirror)16 ArrayList (java.util.ArrayList)15 FresnelReflector (org.concord.energy3d.model.FresnelReflector)14 ParabolicTrough (org.concord.energy3d.model.ParabolicTrough)14 ParabolicDish (org.concord.energy3d.model.ParabolicDish)13 Tree (org.concord.energy3d.model.Tree)12 List (java.util.List)10 Floor (org.concord.energy3d.model.Floor)10 ReadOnlyVector3 (com.ardor3d.math.type.ReadOnlyVector3)9 SolarCollector (org.concord.energy3d.model.SolarCollector)9 Human (org.concord.energy3d.model.Human)8 Vector3 (com.ardor3d.math.Vector3)7