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