Search in sources :

Example 26 with ParabolicDish

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

the class SolarRadiation method resetTrackables.

public void resetTrackables() {
    Heliodon.getInstance().getCalendar().set(Calendar.HOUR_OF_DAY, hourOfDay);
    Heliodon.getInstance().getCalendar().set(Calendar.MINUTE, minuteOfHour);
    for (final HousePart part : Scene.getInstance().getParts()) {
        if (part instanceof Mirror) {
            final Mirror m = (Mirror) part;
            if (m.getReceiver() != null) {
                m.draw();
            }
        } else if (part instanceof FresnelReflector) {
            final FresnelReflector fr = (FresnelReflector) part;
            if (fr.getReceiver() != null) {
                fr.draw();
            }
        } else if (part instanceof ParabolicTrough) {
            final ParabolicTrough pt = (ParabolicTrough) part;
            pt.draw();
        } else if (part instanceof ParabolicDish) {
            final ParabolicDish pd = (ParabolicDish) part;
            pd.draw();
        } else if (part instanceof SolarPanel) {
            final SolarPanel sp = (SolarPanel) part;
            if (sp.getTracker() != Trackable.NO_TRACKER) {
                sp.draw();
            }
        } else if (part instanceof Rack) {
            final Rack rack = (Rack) part;
            if (rack.getTracker() != Trackable.NO_TRACKER) {
                rack.draw();
            }
        }
    }
}
Also used : ParabolicDish(org.concord.energy3d.model.ParabolicDish) Rack(org.concord.energy3d.model.Rack) FresnelReflector(org.concord.energy3d.model.FresnelReflector) ParabolicTrough(org.concord.energy3d.model.ParabolicTrough) SolarPanel(org.concord.energy3d.model.SolarPanel) Mirror(org.concord.energy3d.model.Mirror) HousePart(org.concord.energy3d.model.HousePart)

Example 27 with ParabolicDish

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

the class SolarRadiation method computeToday.

private void computeToday() {
    // save current calendar for restoring at the end of this calculation
    final Calendar today = (Calendar) Heliodon.getInstance().getCalendar().clone();
    hourOfDay = today.get(Calendar.HOUR_OF_DAY);
    minuteOfHour = today.get(Calendar.MINUTE);
    today.set(Calendar.SECOND, 0);
    today.set(Calendar.MINUTE, 0);
    today.set(Calendar.HOUR_OF_DAY, 0);
    final String city = (String) EnergyPanel.getInstance().getCityComboBox().getSelectedItem();
    dailyAirTemperatures = Weather.computeOutsideTemperature(today, city);
    final int timeStep = Scene.getInstance().getTimeStep();
    final ReadOnlyVector3[] sunLocations = new ReadOnlyVector3[SolarRadiation.MINUTES_OF_DAY / timeStep];
    int totalSteps = 0;
    for (int minute = 0; minute < SolarRadiation.MINUTES_OF_DAY; minute += timeStep) {
        final ReadOnlyVector3 sunLocation = Heliodon.getInstance().computeSunLocation(today).normalizeLocal();
        sunLocations[minute / timeStep] = sunLocation;
        if (sunLocation.getZ() > 0) {
            totalSteps++;
        }
        today.add(Calendar.MINUTE, timeStep);
    }
    totalSteps -= 2;
    final double dayLength = totalSteps * timeStep / 60.0;
    int step = 1;
    setupImportedMeshes();
    // for (int minute = MINUTES_OF_DAY / 2; minute < MINUTES_OF_DAY / 2 + timeStep; minute += timeStep) { // test for 12 pm for comparison with shadow
    for (int minute = 0; minute < MINUTES_OF_DAY; minute += timeStep) {
        final ReadOnlyVector3 sunLocation = sunLocations[minute / timeStep];
        if (sunLocation.getZ() > 0) {
            final ReadOnlyVector3 directionTowardSun = sunLocation.normalize(null);
            calculatePeakRadiation(directionTowardSun, dayLength);
            for (final HousePart part : Scene.getInstance().getParts()) {
                if (part.isDrawCompleted()) {
                    if (part instanceof Window) {
                        computeOnMesh(minute, directionTowardSun, part, part.getRadiationMesh(), (Mesh) part.getRadiationCollisionSpatial(), part.getNormal());
                    } else if (part instanceof Wall) {
                        if (((Wall) part).getType() == Wall.SOLID_WALL) {
                            computeOnMesh(minute, directionTowardSun, part, part.getRadiationMesh(), (Mesh) part.getRadiationCollisionSpatial(), part.getNormal());
                        }
                    } else if (part instanceof Door || part instanceof Floor) {
                        computeOnMesh(minute, directionTowardSun, part, part.getRadiationMesh(), (Mesh) part.getRadiationCollisionSpatial(), part.getNormal());
                    } else if (part instanceof Foundation) {
                        final Foundation foundation = (Foundation) part;
                        for (int i = 0; i < 5; i++) {
                            final Mesh radiationMesh = foundation.getRadiationMesh(i);
                            final ReadOnlyVector3 normal = i == 0 ? part.getNormal() : ((UserData) radiationMesh.getUserData()).getNormal();
                            computeOnMesh(minute, directionTowardSun, part, radiationMesh, foundation.getRadiationCollisionSpatial(i), normal);
                        }
                        if (!Scene.getInstance().getOnlySolarComponentsInSolarMap()) {
                            final List<Node> importedNodes = foundation.getImportedNodes();
                            if (importedNodes != null) {
                                for (final Node node : importedNodes) {
                                    for (final Spatial s : node.getChildren()) {
                                        final Mesh m = (Mesh) s;
                                        computeOnImportedMesh(minute, directionTowardSun, foundation, m);
                                    }
                                }
                            }
                        }
                    } else if (part instanceof Roof) {
                        for (final Spatial roofPart : ((Roof) part).getRoofPartsRoot().getChildren()) {
                            if (roofPart.getSceneHints().getCullHint() != CullHint.Always) {
                                final ReadOnlyVector3 faceDirection = (ReadOnlyVector3) roofPart.getUserData();
                                final Mesh mesh = (Mesh) ((Node) roofPart).getChild(6);
                                computeOnMesh(minute, directionTowardSun, part, mesh, mesh, faceDirection);
                            }
                        }
                    } else if (part instanceof SolarPanel) {
                        computeOnSolarPanel(minute, directionTowardSun, (SolarPanel) part);
                    } else if (part instanceof Rack) {
                        computeOnRack(minute, directionTowardSun, (Rack) part);
                    } else if (part instanceof Mirror) {
                        computeOnMirror(minute, directionTowardSun, (Mirror) part);
                    } else if (part instanceof FresnelReflector) {
                        computeOnFresnelReflector(minute, directionTowardSun, (FresnelReflector) part);
                    } else if (part instanceof ParabolicTrough) {
                        computeOnParabolicTrough(minute, directionTowardSun, (ParabolicTrough) part);
                    } else if (part instanceof ParabolicDish) {
                        computeOnParabolicDish(minute, directionTowardSun, (ParabolicDish) part);
                    } else if (part instanceof Sensor) {
                        computeOnSensor(minute, directionTowardSun, (Sensor) part);
                    }
                }
            }
            computeOnLand(directionTowardSun);
            EnergyPanel.getInstance().progress((int) Math.round(100.0 * step / totalSteps));
            step++;
        }
    }
    maxValue = Math.round((MINUTES_OF_DAY / timeStep + 1.0) * (1 - 0.01 * Scene.getInstance().getSolarHeatMapColorContrast()));
    // If tracking the sun, the heliodon's calendar has been changed. Restore the time now.
    resetTrackables();
}
Also used : ParabolicTrough(org.concord.energy3d.model.ParabolicTrough) Wall(org.concord.energy3d.model.Wall) UserData(org.concord.energy3d.model.UserData) Node(com.ardor3d.scenegraph.Node) Rack(org.concord.energy3d.model.Rack) Roof(org.concord.energy3d.model.Roof) Foundation(org.concord.energy3d.model.Foundation) List(java.util.List) ArrayList(java.util.ArrayList) HousePart(org.concord.energy3d.model.HousePart) Window(org.concord.energy3d.model.Window) Floor(org.concord.energy3d.model.Floor) FresnelReflector(org.concord.energy3d.model.FresnelReflector) Calendar(java.util.Calendar) Mesh(com.ardor3d.scenegraph.Mesh) 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) ReadOnlyVector3(com.ardor3d.math.type.ReadOnlyVector3) Spatial(com.ardor3d.scenegraph.Spatial) SolarPanel(org.concord.energy3d.model.SolarPanel) Mirror(org.concord.energy3d.model.Mirror) Sensor(org.concord.energy3d.model.Sensor)

Example 28 with ParabolicDish

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

the class SolarRadiation method computeEnergyAtHour.

public void computeEnergyAtHour(final int hour) {
    final Calendar today = Heliodon.getInstance().getCalendar();
    final String city = (String) EnergyPanel.getInstance().getCityComboBox().getSelectedItem();
    final double[] outsideAirTemperatureRange = Weather.computeOutsideTemperature(today, city);
    final double outsideAirTemperature = Weather.getInstance().getOutsideTemperatureAtMinute(outsideAirTemperatureRange[1], outsideAirTemperatureRange[0], hour * 60);
    for (final HousePart part : Scene.getInstance().getParts()) {
        if (part instanceof Foundation) {
            final Foundation foundation = (Foundation) part;
            if (foundation.getHeatLoss() == null) {
                continue;
            }
            final int n = (int) Math.round(60.0 / Scene.getInstance().getTimeStep());
            final double[] heatLoss = new double[n];
            final double[] passiveSolar = new double[n];
            final double[] photovoltaic = new double[n];
            final double[] csp = new double[n];
            final int t0 = n * hour;
            for (int i = 0; i < n; i++) {
                final double groundHeatLoss = foundation.getHeatLoss()[t0 + i];
                if (groundHeatLoss > 0) {
                    final double thermostat = foundation.getThermostat().getTemperature(today.get(Calendar.MONTH), today.get(Calendar.DAY_OF_WEEK) - Calendar.SUNDAY, today.get(Calendar.HOUR_OF_DAY));
                    if (outsideAirTemperature >= thermostat) {
                        heatLoss[i] -= groundHeatLoss;
                    }
                } else {
                    heatLoss[i] += groundHeatLoss;
                }
            }
            double solarPotentialTotal = 0.0;
            for (final HousePart child : Scene.getInstance().getParts()) {
                if (child.getTopContainer() == foundation) {
                    child.setSolarPotentialNow(0);
                    if (child instanceof SolarCollector) {
                        ((SolarCollector) child).setYieldNow(0);
                    }
                    for (int i = 0; i < n; i++) {
                        solarPotentialTotal += child.getSolarPotential()[t0 + i];
                        child.setSolarPotentialNow(child.getSolarPotentialNow() + child.getSolarPotential()[t0 + i]);
                        if (child instanceof Wall || child instanceof Door || child instanceof Window || child instanceof Roof) {
                            heatLoss[i] += child.getHeatLoss()[t0 + i];
                        }
                        if (child instanceof Window) {
                            final Window window = (Window) child;
                            passiveSolar[i] += window.getSolarPotential()[t0 + i] * window.getSolarHeatGainCoefficient();
                        } else if (child instanceof Mirror) {
                            final Mirror mirror = (Mirror) child;
                            final double yield = mirror.getSolarPotential()[t0 + i] * mirror.getSystemEfficiency();
                            csp[i] += yield;
                            mirror.setYieldNow(mirror.getYieldNow() + yield);
                        } else if (child instanceof ParabolicTrough) {
                            final ParabolicTrough trough = (ParabolicTrough) child;
                            final double yield = trough.getSolarPotential()[t0 + i] * trough.getSystemEfficiency();
                            csp[i] += yield;
                            trough.setYieldNow(trough.getYieldNow() + yield);
                        } else if (child instanceof ParabolicDish) {
                            final ParabolicDish dish = (ParabolicDish) child;
                            final double yield = dish.getSolarPotential()[t0 + i] * dish.getSystemEfficiency();
                            csp[i] += yield;
                            dish.setYieldNow(dish.getYieldNow() + yield);
                        } else if (child instanceof FresnelReflector) {
                            final FresnelReflector reflector = (FresnelReflector) child;
                            final double yield = reflector.getSolarPotential()[t0 + i] * reflector.getSystemEfficiency();
                            csp[i] += yield;
                            reflector.setYieldNow(reflector.getYieldNow() + yield);
                        } else if (child instanceof SolarPanel) {
                            final SolarPanel sp = (SolarPanel) child;
                            // distributed efficiency must be handled for each individual cell
                            final double yield = sp.getSolarPotential()[t0 + i];
                            photovoltaic[i] += yield;
                            sp.setYieldNow(sp.getYieldNow() + yield);
                        } else if (child instanceof Rack) {
                            final Rack rack = (Rack) child;
                            if (rack.isMonolithic()) {
                                // distributed efficiency must be handled for each individual cell
                                final double yield = rack.getSolarPotential()[t0 + i];
                                photovoltaic[i] += yield;
                                rack.setYieldNow(rack.getYieldNow() + yield);
                            }
                        }
                    }
                }
            }
            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.setSolarPotentialNow(solarPotentialTotal);
            foundation.setPassiveSolarNow(passiveSolarTotal);
            foundation.setPhotovoltaicNow(photovoltaicTotal);
            foundation.setCspNow(cspTotal);
            foundation.setHeatingNow(heatingTotal);
            foundation.setCoolingNow(coolingTotal);
            foundation.setTotalEnergyNow(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 29 with ParabolicDish

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

use of org.concord.energy3d.model.ParabolicDish 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

ParabolicDish (org.concord.energy3d.model.ParabolicDish)43 HousePart (org.concord.energy3d.model.HousePart)26 Foundation (org.concord.energy3d.model.Foundation)20 FresnelReflector (org.concord.energy3d.model.FresnelReflector)17 Mirror (org.concord.energy3d.model.Mirror)17 ParabolicTrough (org.concord.energy3d.model.ParabolicTrough)17 Rack (org.concord.energy3d.model.Rack)15 SolarPanel (org.concord.energy3d.model.SolarPanel)13 Window (org.concord.energy3d.model.Window)13 Wall (org.concord.energy3d.model.Wall)10 Door (org.concord.energy3d.model.Door)9 Roof (org.concord.energy3d.model.Roof)9 ArrayList (java.util.ArrayList)5 Calendar (java.util.Calendar)5 ReadOnlyVector3 (com.ardor3d.math.type.ReadOnlyVector3)3 CullHint (com.ardor3d.scenegraph.hint.CullHint)3 List (java.util.List)3 JDialog (javax.swing.JDialog)3 Human (org.concord.energy3d.model.Human)3 SolarCollector (org.concord.energy3d.model.SolarCollector)3