Search in sources :

Example 11 with ParabolicTrough

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

the class ParabolicTroughAnnualAnalysis method show.

public void show() {
    final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
    String s = null;
    int cost = -1;
    String title = "Annual Yield of All Parabolic Troughs (" + Scene.getInstance().countParts(ParabolicTrough.class) + " Troughs)";
    if (selectedPart != null) {
        if (selectedPart instanceof ParabolicTrough) {
            cost = (int) CspProjectCost.getPartCost(selectedPart);
            s = selectedPart.toString().substring(0, selectedPart.toString().indexOf(')') + 1);
            title = "Annual Yield";
        } else if (selectedPart instanceof Foundation) {
            title = "Annual Yield of Selected Foundation (" + ((Foundation) selectedPart).countParts(ParabolicTrough.class) + " Parabolic Troughs)";
        } else if (selectedPart.getTopContainer() instanceof Foundation) {
            title = "Annual Yield of Selected Foundation (" + selectedPart.getTopContainer().countParts(ParabolicTrough.class) + " Parabolic Troughs)";
        }
    }
    final JDialog dialog = createDialog(s == null ? title : title + ": " + s + " (Cost: $" + cost + ")");
    final JMenuBar menuBar = new JMenuBar();
    dialog.setJMenuBar(menuBar);
    menuBar.add(createOptionsMenu(dialog, null, true, true));
    menuBar.add(createRunsMenu());
    dialog.setVisible(true);
}
Also used : ParabolicTrough(org.concord.energy3d.model.ParabolicTrough) Foundation(org.concord.energy3d.model.Foundation) HousePart(org.concord.energy3d.model.HousePart) JDialog(javax.swing.JDialog) JMenuBar(javax.swing.JMenuBar)

Example 12 with ParabolicTrough

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

the class ParabolicTroughAnnualAnalysis method updateGraph.

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

Example 13 with ParabolicTrough

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

the class ParabolicTroughAnnualAnalysis method toJson.

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

Example 14 with ParabolicTrough

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

the class ParabolicTroughDailyAnalysis method toJson.

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

Example 15 with ParabolicTrough

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

the class ParabolicTroughDailyAnalysis method show.

public void show() {
    final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
    String s = null;
    int cost = -1;
    String title = "Daily Yield of All Parabolic Troughs (" + Scene.getInstance().countParts(ParabolicTrough.class) + " Troughs)";
    if (selectedPart != null) {
        if (selectedPart instanceof ParabolicTrough) {
            cost = (int) CspProjectCost.getPartCost(selectedPart);
            s = selectedPart.toString().substring(0, selectedPart.toString().indexOf(')') + 1);
            title = "Daily Yield";
        } else if (selectedPart instanceof Foundation) {
            title = "Daily Yield of Selected Foundation (" + ((Foundation) selectedPart).countParts(ParabolicTrough.class) + " Parabolic Troughs)";
        } else if (selectedPart.getTopContainer() instanceof Foundation) {
            title = "Daily Yield of Selected Foundation (" + selectedPart.getTopContainer().countParts(ParabolicTrough.class) + " Parabolic Troughs)";
        }
    }
    final JDialog dialog = createDialog(s == null ? title : title + ": " + s + " (Cost: $" + cost + ")");
    final JMenuBar menuBar = new JMenuBar();
    dialog.setJMenuBar(menuBar);
    menuBar.add(createOptionsMenu(dialog, null, true));
    menuBar.add(createRunsMenu());
    dialog.setVisible(true);
}
Also used : ParabolicTrough(org.concord.energy3d.model.ParabolicTrough) Foundation(org.concord.energy3d.model.Foundation) HousePart(org.concord.energy3d.model.HousePart) JDialog(javax.swing.JDialog) JMenuBar(javax.swing.JMenuBar)

Aggregations

ParabolicTrough (org.concord.energy3d.model.ParabolicTrough)44 HousePart (org.concord.energy3d.model.HousePart)30 Foundation (org.concord.energy3d.model.Foundation)22 FresnelReflector (org.concord.energy3d.model.FresnelReflector)18 Mirror (org.concord.energy3d.model.Mirror)17 ParabolicDish (org.concord.energy3d.model.ParabolicDish)17 Rack (org.concord.energy3d.model.Rack)16 SolarPanel (org.concord.energy3d.model.SolarPanel)14 Window (org.concord.energy3d.model.Window)14 Roof (org.concord.energy3d.model.Roof)10 Wall (org.concord.energy3d.model.Wall)10 Door (org.concord.energy3d.model.Door)9 ArrayList (java.util.ArrayList)6 Calendar (java.util.Calendar)5 List (java.util.List)5 JDialog (javax.swing.JDialog)4 Tree (org.concord.energy3d.model.Tree)4 ReadOnlyVector3 (com.ardor3d.math.type.ReadOnlyVector3)3 Human (org.concord.energy3d.model.Human)3 UserData (org.concord.energy3d.model.UserData)3