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;
}
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;
}
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);
}
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;
}
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();
}
Aggregations