Search in sources :

Example 61 with Foundation

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

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

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

Example 64 with Foundation

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

the class ProjectCost method getTotalCost.

public double getTotalCost() {
    double cost = 0;
    final List<Foundation> foundations = Scene.getInstance().getAllFoundations();
    if (!foundations.isEmpty()) {
        for (final Foundation f : foundations) {
            cost += getCostByFoundation(f);
        }
    }
    return cost;
}
Also used : Foundation(org.concord.energy3d.model.Foundation)

Example 65 with Foundation

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

Foundation (org.concord.energy3d.model.Foundation)174 HousePart (org.concord.energy3d.model.HousePart)153 Rack (org.concord.energy3d.model.Rack)47 SolarPanel (org.concord.energy3d.model.SolarPanel)45 Window (org.concord.energy3d.model.Window)39 ActionEvent (java.awt.event.ActionEvent)38 ActionListener (java.awt.event.ActionListener)38 Roof (org.concord.energy3d.model.Roof)38 Wall (org.concord.energy3d.model.Wall)37 ArrayList (java.util.ArrayList)35 JDialog (javax.swing.JDialog)35 JMenuItem (javax.swing.JMenuItem)33 Mirror (org.concord.energy3d.model.Mirror)32 FresnelReflector (org.concord.energy3d.model.FresnelReflector)27 Door (org.concord.energy3d.model.Door)24 ParabolicTrough (org.concord.energy3d.model.ParabolicTrough)24 Tree (org.concord.energy3d.model.Tree)24 Vector3 (com.ardor3d.math.Vector3)22 ReadOnlyVector3 (com.ardor3d.math.type.ReadOnlyVector3)22 ParabolicDish (org.concord.energy3d.model.ParabolicDish)22