Search in sources :

Example 16 with SolarPanel

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

the class EnergyAngularAnalysis method updateGraph.

@Override
public void updateGraph() {
    final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
    if (selectedPart instanceof Foundation) {
        if (graph instanceof BuildingEnergyAngularGraph) {
            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 17 with SolarPanel

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

the class GroupAnnualAnalysis method updateGraph.

@Override
public void updateGraph() {
    for (final HousePart p : selectedParts) {
        final String customText = p.getLabelCustomText();
        if (p instanceof Window) {
            final Window window = (Window) p;
            final double solar = p.getSolarPotentialToday() * window.getSolarHeatGainCoefficient();
            graph.addData("Solar " + p.getId(), solar);
            final double[] loss = p.getHeatLoss();
            double sum = 0;
            for (final double x : loss) {
                sum += x;
            }
            graph.addData("Heat Gain " + p.getId(), -sum);
        } else if (p instanceof Wall || p instanceof Roof) {
            final double[] loss = p.getHeatLoss();
            double sum = 0;
            for (final double x : loss) {
                sum += x;
            }
            graph.addData("Heat Gain " + p.getId(), -sum);
        } else if (p instanceof SolarPanel) {
            if (customText != null) {
                graph.addData("Solar " + p.getId() + graph.getDataNameDelimiter() + customText, ((SolarPanel) p).getYieldToday());
            } else {
                graph.addData("Solar " + p.getId(), ((SolarPanel) p).getYieldToday());
            }
        } else if (p instanceof Rack) {
            if (customText != null) {
                graph.addData("Solar " + p.getId() + graph.getDataNameDelimiter() + customText, ((Rack) p).getYieldToday());
            } else {
                graph.addData("Solar " + p.getId(), ((Rack) p).getYieldToday());
            }
        } else if (p instanceof Mirror) {
            final Mirror mirror = (Mirror) p;
            final double solar = mirror.getSolarPotentialToday() * mirror.getSystemEfficiency();
            if (customText != null) {
                graph.addData("Solar " + p.getId() + graph.getDataNameDelimiter() + customText, solar);
            } else {
                graph.addData("Solar " + p.getId(), solar);
            }
        } else if (p instanceof ParabolicTrough) {
            final ParabolicTrough trough = (ParabolicTrough) p;
            final double solar = trough.getSolarPotentialToday() * trough.getSystemEfficiency();
            if (customText != null) {
                graph.addData("Solar " + p.getId() + graph.getDataNameDelimiter() + customText, solar);
            } else {
                graph.addData("Solar " + p.getId(), solar);
            }
        } else if (p instanceof ParabolicDish) {
            final ParabolicDish dish = (ParabolicDish) p;
            final double solar = dish.getSolarPotentialToday() * dish.getSystemEfficiency();
            if (customText != null) {
                graph.addData("Solar " + p.getId() + graph.getDataNameDelimiter() + customText, solar);
            } else {
                graph.addData("Solar " + p.getId(), solar);
            }
        } else if (p instanceof FresnelReflector) {
            final FresnelReflector reflector = (FresnelReflector) p;
            final double solar = reflector.getSolarPotentialToday() * reflector.getSystemEfficiency();
            if (customText != null) {
                graph.addData("Solar " + p.getId() + graph.getDataNameDelimiter() + customText, solar);
            } else {
                graph.addData("Solar " + p.getId(), solar);
            }
        } else if (p instanceof Foundation) {
            final boolean mean = group.getType().endsWith("(Mean)");
            final Foundation foundation = (Foundation) p;
            switch(foundation.getProjectType()) {
                case Foundation.TYPE_PV_PROJECT:
                    double pv = foundation.getPhotovoltaicToday();
                    if (mean) {
                        pv /= foundation.getNumberOfSolarPanels();
                        if (customText != null) {
                            graph.addData("PV " + p.getId() + graph.getDataNameDelimiter() + customText + " mean", pv);
                        } else {
                            graph.addData("PV " + p.getId() + " mean", pv);
                        }
                    } else {
                        if (customText != null) {
                            graph.addData("PV " + p.getId() + graph.getDataNameDelimiter() + customText, pv);
                        } else {
                            graph.addData("PV " + p.getId(), pv);
                        }
                    }
                    break;
                case Foundation.TYPE_CSP_PROJECT:
                    double csp = foundation.getCspToday();
                    if (mean) {
                        csp /= foundation.countParts(new Class[] { Mirror.class, ParabolicTrough.class, ParabolicDish.class });
                        if (customText != null) {
                            graph.addData("CSP " + p.getId() + graph.getDataNameDelimiter() + customText + " mean", csp);
                        } else {
                            graph.addData("CSP " + p.getId() + " mean", csp);
                        }
                    } else {
                        if (customText != null) {
                            graph.addData("CSP " + p.getId() + graph.getDataNameDelimiter() + customText, csp);
                        } else {
                            graph.addData("CSP " + p.getId(), csp);
                        }
                    }
                    break;
                case Foundation.TYPE_BUILDING:
                    final double totalEnergy = foundation.getTotalEnergyToday();
                    graph.addData("Building " + p.getId(), totalEnergy);
                    break;
            }
        }
    }
    graph.repaint();
}
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) 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 18 with SolarPanel

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

the class BuildingCost method getPartCost.

/* The material and installation costs are partly based on http://www.homewyse.com, but should be considered as largely fictitious. */
public static double getPartCost(final HousePart part) {
    // The baseline cost for a wall is set to be $300/m^2, close to homewyse's estimates of masonry walls, interior framing, etc.
    if (part instanceof Wall) {
        final double uFactor = ((Wall) part).getUValue();
        final double unitPrice = 300.0 + 8.0 / uFactor;
        return part.getArea() * unitPrice;
    }
    // A storm window of about 1 m^2 costs about $500. A double-pane window of about 1 m^2 costs about $700.
    if (part instanceof Window) {
        final double uFactor = ((Window) part).getUValue();
        final double unitPrice = 500.0 + 800.0 / uFactor;
        return part.getArea() * unitPrice;
    }
    // The baseline (that is, the structure without insulation) cost for a roof is set to be $100/m^2.
    if (part instanceof Roof) {
        final double uFactor = ((Roof) part).getUValue();
        final double unitPrice = 100.0 + 10.0 / uFactor;
        return part.getArea() * unitPrice;
    }
    // The foundation cost is set to be $200/m^2.
    if (part instanceof Foundation) {
        final Foundation foundation = (Foundation) part;
        final Building b = new Building(foundation);
        if (b.isWallComplete()) {
            b.calculate();
            final double uFactor = foundation.getUValue();
            final double unitPrice = 300.0 + 8.0 / uFactor;
            return b.getArea() * unitPrice;
        }
        // the building is incomplete yet, so we can assume the floor insulation isn't there yet
        return -1;
    }
    if (part instanceof Floor) {
        final double area = part.getArea();
        if (area > 0) {
            return part.getArea() * 100.0;
        }
        return -1;
    }
    // According to http://www.homewyse.com/costs/cost_of_exterior_doors.html
    if (part instanceof Door) {
        final double uFactor = ((Door) part).getUValue();
        final double unitPrice = 500.0 + 100.0 / uFactor;
        return part.getArea() * unitPrice;
    }
    if (part instanceof SolarPanel) {
        return Scene.getInstance().getPvCustomPrice().getTotalCost((SolarPanel) part);
    }
    if (part instanceof Rack) {
        return Scene.getInstance().getPvCustomPrice().getTotalCost((Rack) part);
    }
    if (part instanceof Tree) {
        switch(((Tree) part).getTreeType()) {
            case Tree.LINDEN:
                return 3000;
            case Tree.COTTONWOOD:
                return 2500;
            case Tree.ELM:
                return 2000;
            case Tree.OAK:
                return 2000;
            case Tree.PINE:
                return 1500;
            case Tree.MAPLE:
                return 1000;
            default:
                return 500;
        }
    }
    return 0;
}
Also used : Window(org.concord.energy3d.model.Window) Building(org.concord.energy3d.model.Building) Floor(org.concord.energy3d.model.Floor) Rack(org.concord.energy3d.model.Rack) Roof(org.concord.energy3d.model.Roof) Wall(org.concord.energy3d.model.Wall) SolarPanel(org.concord.energy3d.model.SolarPanel) Tree(org.concord.energy3d.model.Tree) Foundation(org.concord.energy3d.model.Foundation) Door(org.concord.energy3d.model.Door)

Example 19 with SolarPanel

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

the class SolarRadiation method computeEnergyOfToday.

public void computeEnergyOfToday() {
    updateTextures();
    if (Scene.getInstance().getAlwaysComputeHeatFluxVectors()) {
        for (final HousePart part : Scene.getInstance().getParts()) {
            part.drawHeatFlux();
        }
    }
    final Calendar today = Heliodon.getInstance().getCalendar();
    final String city = (String) EnergyPanel.getInstance().getCityComboBox().getSelectedItem();
    final double[] outsideTemperatureRange = Weather.computeOutsideTemperature(today, city);
    for (final HousePart part : Scene.getInstance().getParts()) {
        if (part instanceof Foundation) {
            final Foundation foundation = (Foundation) part;
            final int n = foundation.getHeatLoss().length;
            final double[] heatLoss = new double[n];
            final double[] passiveSolar = new double[n];
            final double[] photovoltaic = new double[n];
            final double[] csp = new double[n];
            for (int i = 0; i < n; i++) {
                final double groundHeatLoss = foundation.getHeatLoss()[i];
                // In other words, geothermal energy is good in hot conditions. This is similar to passive solar energy, which is good in the winter but bad in the summer.
                if (groundHeatLoss > 0) {
                    final double outsideTemperature = Weather.getInstance().getOutsideTemperatureAtMinute(outsideTemperatureRange[1], outsideTemperatureRange[0], i * Scene.getInstance().getTimeStep());
                    if (outsideTemperature >= foundation.getThermostat().getTemperature(today.get(Calendar.MONTH), today.get(Calendar.DAY_OF_WEEK) - Calendar.SUNDAY, today.get(Calendar.HOUR_OF_DAY))) {
                        heatLoss[i] -= groundHeatLoss;
                    }
                } else {
                    heatLoss[i] += groundHeatLoss;
                }
            }
            double solarPotentialTotal = 0;
            for (final HousePart child : Scene.getInstance().getParts()) {
                if (child.getTopContainer() == foundation) {
                    child.setSolarPotentialToday(0);
                    if (child instanceof SolarCollector) {
                        ((SolarCollector) child).setYieldToday(0);
                    }
                    for (int i = 0; i < n; i++) {
                        solarPotentialTotal += child.getSolarPotential()[i];
                        child.setSolarPotentialToday(child.getSolarPotentialToday() + child.getSolarPotential()[i]);
                        if (child instanceof Wall || child instanceof Door || child instanceof Window || child instanceof Roof) {
                            heatLoss[i] += child.getHeatLoss()[i];
                        }
                        if (child instanceof Window) {
                            final Window window = (Window) child;
                            passiveSolar[i] += child.getSolarPotential()[i] * window.getSolarHeatGainCoefficient();
                        } else if (child instanceof SolarPanel) {
                            final SolarPanel sp = (SolarPanel) child;
                            // distributed efficiency must be handled for each individual cell
                            final double yield = sp.getSolarPotential()[i];
                            sp.setYieldToday(sp.getYieldToday() + yield);
                            photovoltaic[i] += yield;
                        } else if (child instanceof Rack) {
                            final Rack rack = (Rack) child;
                            // distributed efficiency must be handled for each individual cell
                            final double yield = rack.getSolarPotential()[i];
                            rack.setYieldToday(rack.getYieldToday() + yield);
                            photovoltaic[i] += yield;
                        } else if (child instanceof Mirror) {
                            final Mirror mirror = (Mirror) child;
                            final double yield = mirror.getSolarPotential()[i] * mirror.getSystemEfficiency();
                            mirror.setYieldToday(mirror.getYieldToday() + yield);
                            csp[i] += yield;
                        } else if (child instanceof ParabolicTrough) {
                            final ParabolicTrough trough = (ParabolicTrough) child;
                            final double yield = trough.getSolarPotential()[i] * trough.getSystemEfficiency();
                            trough.setYieldToday(trough.getYieldToday() + yield);
                            csp[i] += yield;
                        } else if (child instanceof ParabolicDish) {
                            final ParabolicDish dish = (ParabolicDish) child;
                            final double yield = dish.getSolarPotential()[i] * dish.getSystemEfficiency();
                            dish.setYieldToday(dish.getYieldToday() + yield);
                            csp[i] += yield;
                        } else if (child instanceof FresnelReflector) {
                            final FresnelReflector reflector = (FresnelReflector) child;
                            final double yield = reflector.getSolarPotential()[i] * reflector.getSystemEfficiency();
                            reflector.setYieldToday(reflector.getYieldToday() + yield);
                            csp[i] += yield;
                        }
                    }
                }
            }
            if (foundation.getImportedNodes() != null) {
                for (int i = 0; i < n; i++) {
                    solarPotentialTotal += foundation.getSolarPotential()[i];
                    foundation.setSolarPotentialToday(foundation.getSolarPotentialToday() + foundation.getSolarPotential()[i]);
                }
            }
            double heatingTotal = 0.0;
            double coolingTotal = 0.0;
            double passiveSolarTotal = 0.0;
            double photovoltaicTotal = 0.0;
            double cspTotal = 0.0;
            for (int i = 0; i < n; i++) {
                if (heatLoss[i] < 0) {
                    heatLoss[i] -= passiveSolar[i];
                } else {
                    heatLoss[i] = Math.max(0, heatLoss[i] - passiveSolar[i]);
                }
                if (heatLoss[i] > 0) {
                    heatingTotal += heatLoss[i];
                } else {
                    coolingTotal -= heatLoss[i];
                }
                passiveSolarTotal += passiveSolar[i];
                photovoltaicTotal += photovoltaic[i];
                cspTotal += csp[i];
            }
            foundation.setSolarPotentialToday(solarPotentialTotal);
            foundation.setPassiveSolarToday(passiveSolarTotal);
            foundation.setPhotovoltaicToday(photovoltaicTotal);
            foundation.setCspToday(cspTotal);
            foundation.setHeatingToday(heatingTotal);
            foundation.setCoolingToday(coolingTotal);
            foundation.setTotalEnergyToday(heatingTotal + coolingTotal - photovoltaicTotal);
        }
    }
}
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) Calendar(java.util.Calendar) CullHint(com.ardor3d.scenegraph.hint.CullHint) TPoint(org.poly2tri.triangulation.point.TPoint) Point(org.poly2tri.geometry.primitives.Point) Door(org.concord.energy3d.model.Door) ParabolicDish(org.concord.energy3d.model.ParabolicDish) Rack(org.concord.energy3d.model.Rack) Roof(org.concord.energy3d.model.Roof) SolarCollector(org.concord.energy3d.model.SolarCollector) 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 20 with SolarPanel

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

the class PvAnnualAnalysis method updateGraph.

@Override
public void updateGraph() {
    final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
    if (selectedPart != null) {
        if (selectedPart instanceof SolarPanel) {
            graph.addData("Solar", ((SolarPanel) selectedPart).getYieldToday());
        } else if (selectedPart instanceof Rack) {
            graph.addData("Solar", ((Rack) selectedPart).getYieldToday());
        } else if (selectedPart instanceof Foundation) {
            double output = 0;
            for (final HousePart p : Scene.getInstance().getParts()) {
                if (p.getTopContainer() == selectedPart) {
                    if (p instanceof SolarPanel) {
                        output += ((SolarPanel) p).getYieldToday();
                    } else if (p instanceof Rack) {
                        output += ((Rack) p).getYieldToday();
                    }
                }
            }
            graph.addData("Solar", output);
        } else if (selectedPart.getTopContainer() instanceof Foundation) {
            double output = 0;
            for (final HousePart p : Scene.getInstance().getParts()) {
                if (p.getTopContainer() == selectedPart.getTopContainer()) {
                    if (p instanceof SolarPanel) {
                        output += ((SolarPanel) p).getYieldToday();
                    } else if (p instanceof Rack) {
                        output += ((Rack) p).getYieldToday();
                    }
                }
            }
            graph.addData("Solar", output);
        }
    } else {
        double output = 0;
        for (final HousePart p : Scene.getInstance().getParts()) {
            if (p instanceof SolarPanel) {
                output += ((SolarPanel) p).getYieldToday();
            } else if (p instanceof Rack) {
                output += ((Rack) p).getYieldToday();
            }
        }
        graph.addData("Solar", output);
    }
    graph.repaint();
}
Also used : Rack(org.concord.energy3d.model.Rack) SolarPanel(org.concord.energy3d.model.SolarPanel) Foundation(org.concord.energy3d.model.Foundation) HousePart(org.concord.energy3d.model.HousePart)

Aggregations

SolarPanel (org.concord.energy3d.model.SolarPanel)109 Rack (org.concord.energy3d.model.Rack)66 HousePart (org.concord.energy3d.model.HousePart)58 Foundation (org.concord.energy3d.model.Foundation)43 Window (org.concord.energy3d.model.Window)25 Roof (org.concord.energy3d.model.Roof)24 Wall (org.concord.energy3d.model.Wall)23 Mirror (org.concord.energy3d.model.Mirror)20 Door (org.concord.energy3d.model.Door)17 FresnelReflector (org.concord.energy3d.model.FresnelReflector)14 ParabolicTrough (org.concord.energy3d.model.ParabolicTrough)14 ActionEvent (java.awt.event.ActionEvent)13 ActionListener (java.awt.event.ActionListener)13 ParabolicDish (org.concord.energy3d.model.ParabolicDish)13 Vector3 (com.ardor3d.math.Vector3)11 ReadOnlyVector3 (com.ardor3d.math.type.ReadOnlyVector3)11 JMenuItem (javax.swing.JMenuItem)10 JDialog (javax.swing.JDialog)9 JPanel (javax.swing.JPanel)9 Tree (org.concord.energy3d.model.Tree)9