Search in sources :

Example 31 with ParabolicDish

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

the class GroupDailyAnalysis 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);
        for (final HousePart p : selectedParts) {
            final String customText = p.getLabelCustomText();
            if (p instanceof Window) {
                final Window window = (Window) p;
                final double solar = p.getSolarPotentialNow() * window.getSolarHeatGainCoefficient();
                graph.addData("Solar " + p.getId(), solar);
                final double[] loss = p.getHeatLoss();
                final int t0 = n * i;
                double sum = 0;
                for (int k = t0; k < t0 + n; k++) {
                    sum += loss[k];
                }
                graph.addData("Heat Gain " + p.getId(), -sum);
            } else if (p instanceof Wall || p instanceof Roof) {
                final double[] loss = p.getHeatLoss();
                final int t0 = n * i;
                double sum = 0;
                for (int k = t0; k < t0 + n; k++) {
                    sum += loss[k];
                }
                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).getYieldNow());
                } else {
                    graph.addData("Solar " + p.getId(), ((SolarPanel) p).getYieldNow());
                }
            } else if (p instanceof Rack) {
                if (customText != null) {
                    graph.addData("Solar " + p.getId() + graph.getDataNameDelimiter() + customText, ((Rack) p).getYieldNow());
                } else {
                    graph.addData("Solar " + p.getId(), ((Rack) p).getYieldNow());
                }
            } else if (p instanceof Mirror) {
                final Mirror mirror = (Mirror) p;
                final double solar = mirror.getSolarPotentialNow() * 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.getSolarPotentialNow() * 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.getSolarPotentialNow() * 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.getSolarPotentialNow() * 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.getPhotovoltaicNow();
                        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.getCspNow();
                        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.getTotalEnergyNow();
                        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 32 with ParabolicDish

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

the class ParabolicDishAnnualAnalysis method updateGraph.

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

Example 33 with ParabolicDish

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

the class ParabolicDishDailyAnalysis method toJson.

@Override
public String toJson() {
    String s = "{";
    final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
    if (selectedPart != null) {
        if (selectedPart instanceof ParabolicDish) {
            s += "\"Parabolic Dish\": \"" + 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 += "\"Parabolic Dish\": \"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 : ParabolicDish(org.concord.energy3d.model.ParabolicDish) Foundation(org.concord.energy3d.model.Foundation) HousePart(org.concord.energy3d.model.HousePart)

Example 34 with ParabolicDish

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

the class ChangeFoundationParabolicDishStructureTypeCommand method undo.

@Override
public void undo() throws CannotUndoException {
    super.undo();
    final int n = dishes.size();
    newValues = new int[n];
    for (int i = 0; i < n; i++) {
        final ParabolicDish d = dishes.get(i);
        newValues[i] = d.getStructureType();
        d.setStructureType(oldValues[i]);
        d.draw();
    }
    SceneManager.getInstance().refresh();
}
Also used : ParabolicDish(org.concord.energy3d.model.ParabolicDish)

Example 35 with ParabolicDish

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

the class ChangeFoundationParabolicDishStructureTypeCommand method redo.

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

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