Search in sources :

Example 11 with Mirror

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

the class HeliostatAnnualAnalysis method toJson.

@Override
public String toJson() {
    String s = "{\"Months\": " + getNumberOfDataPoints();
    final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
    if (selectedPart != null) {
        if (selectedPart instanceof Mirror) {
            s += ", \"Heliostat\": \"" + selectedPart.toString().substring(0, selectedPart.toString().indexOf(')') + 1) + "\"";
        } else if (selectedPart instanceof Foundation) {
            s += ", \"Foundation\": \"" + selectedPart.toString().substring(0, selectedPart.toString().indexOf(')') + 1) + "\"";
        } else if (selectedPart.getTopContainer() instanceof Foundation) {
            s += ", \"Foundation\": \"" + selectedPart.getTopContainer().toString().substring(0, selectedPart.getTopContainer().toString().indexOf(')') + 1) + "\"";
        }
    } else {
        s += ", \"Heliostat\": \"All\"";
    }
    final String name = "Solar";
    final List<Double> data = graph.getData(name);
    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 : Foundation(org.concord.energy3d.model.Foundation) Mirror(org.concord.energy3d.model.Mirror) HousePart(org.concord.energy3d.model.HousePart)

Example 12 with Mirror

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

the class HeliostatDailyAnalysis method toJson.

@Override
public String toJson() {
    String s = "{";
    final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
    if (selectedPart != null) {
        if (selectedPart instanceof Mirror) {
            s += "\"Heliostat\": \"" + selectedPart.toString().substring(0, selectedPart.toString().indexOf(')') + 1) + "\"";
        } else if (selectedPart instanceof Foundation) {
            s += "\"Foundation\": \"" + selectedPart.toString().substring(0, selectedPart.toString().indexOf(')') + 1) + "\"";
        } else if (selectedPart.getTopContainer() instanceof Foundation) {
            s += "\"Foundation\": \"" + selectedPart.getTopContainer().toString().substring(0, selectedPart.getTopContainer().toString().indexOf(')') + 1) + "\"";
        }
    } else {
        s += "\"Heliostat\": \"All\"";
    }
    final String name = "Solar";
    final List<Double> data = graph.getData(name);
    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 : Foundation(org.concord.energy3d.model.Foundation) Mirror(org.concord.energy3d.model.Mirror) HousePart(org.concord.energy3d.model.HousePart)

Example 13 with Mirror

use of org.concord.energy3d.model.Mirror 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 14 with Mirror

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

the class ChangeAzimuthForAllHeliostatsCommand method redo.

@Override
public void redo() throws CannotRedoException {
    super.redo();
    final int n = mirrors.size();
    for (int i = 0; i < n; i++) {
        final Mirror m = mirrors.get(i);
        m.setRelativeAzimuth(newValues[i]);
        m.draw();
    }
    SceneManager.getInstance().refresh();
}
Also used : Mirror(org.concord.energy3d.model.Mirror)

Example 15 with Mirror

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

the class ChangeFoundationHeliostatAzimuthCommand method redo.

@Override
public void redo() throws CannotRedoException {
    super.redo();
    final int n = mirrors.size();
    for (int i = 0; i < n; i++) {
        final Mirror m = mirrors.get(i);
        m.setRelativeAzimuth(newValues[i]);
        m.draw();
    }
    SceneManager.getInstance().refresh();
}
Also used : Mirror(org.concord.energy3d.model.Mirror)

Aggregations

Mirror (org.concord.energy3d.model.Mirror)55 HousePart (org.concord.energy3d.model.HousePart)35 Foundation (org.concord.energy3d.model.Foundation)29 FresnelReflector (org.concord.energy3d.model.FresnelReflector)21 Rack (org.concord.energy3d.model.Rack)21 SolarPanel (org.concord.energy3d.model.SolarPanel)19 ParabolicDish (org.concord.energy3d.model.ParabolicDish)17 ParabolicTrough (org.concord.energy3d.model.ParabolicTrough)17 Window (org.concord.energy3d.model.Window)16 Wall (org.concord.energy3d.model.Wall)14 Door (org.concord.energy3d.model.Door)11 Roof (org.concord.energy3d.model.Roof)11 ArrayList (java.util.ArrayList)10 Calendar (java.util.Calendar)5 List (java.util.List)5 JDialog (javax.swing.JDialog)5 Human (org.concord.energy3d.model.Human)5 Tree (org.concord.energy3d.model.Tree)5 ActionEvent (java.awt.event.ActionEvent)4 ActionListener (java.awt.event.ActionListener)4