use of org.concord.energy3d.model.ParabolicDish in project energy3d by concord-consortium.
the class ParabolicDishAnnualAnalysis method toJson.
@Override
public String toJson() {
String s = "{\"Months\": " + getNumberOfDataPoints();
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 += "\"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.ParabolicDish in project energy3d by concord-consortium.
the class ParabolicDishDailyAnalysis method updateGraph.
@Override
public void updateGraph() {
for (int i = 0; i < 24; i++) {
SolarRadiation.getInstance().computeEnergyAtHour(i);
final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
if (selectedPart != null) {
if (selectedPart instanceof ParabolicDish) {
final ParabolicDish d = (ParabolicDish) selectedPart;
graph.addData("Solar", d.getSolarPotentialNow() * 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.getSolarPotentialNow() * 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.getSolarPotentialNow() * 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.getSolarPotentialNow() * d.getSystemEfficiency();
}
}
graph.addData("Solar", output);
}
}
graph.repaint();
}
use of org.concord.energy3d.model.ParabolicDish in project energy3d by concord-consortium.
the class ParabolicDishDailyAnalysis method show.
public void show() {
final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
String s = null;
int cost = -1;
String title = "Daily Yield of All Parabolic Dishes (" + Scene.getInstance().countParts(ParabolicDish.class) + " Dishes)";
if (selectedPart != null) {
if (selectedPart instanceof ParabolicDish) {
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(ParabolicDish.class) + " Parabolic Dishes)";
} else if (selectedPart.getTopContainer() instanceof Foundation) {
title = "Daily Yield of Selected Foundation (" + selectedPart.getTopContainer().countParts(ParabolicDish.class) + " Parabolic Dishes)";
}
}
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.ParabolicDish in project energy3d by concord-consortium.
the class SetPartSizeCommand method undo.
@Override
public void undo() throws CannotUndoException {
super.undo();
if (part instanceof Mirror) {
final Mirror m = (Mirror) part;
newWidth = m.getMirrorWidth();
newHeight = m.getMirrorHeight();
m.setMirrorWidth(oldWidth);
m.setMirrorHeight(oldHeight);
} else if (part instanceof ParabolicTrough) {
final ParabolicTrough t = (ParabolicTrough) part;
newWidth = t.getApertureWidth();
newHeight = t.getTroughLength();
newModuleLength = t.getModuleLength();
t.setApertureWidth(oldWidth);
t.setTroughLength(oldHeight);
t.setModuleLength(oldModuleLength);
} else if (part instanceof ParabolicDish) {
final ParabolicDish d = (ParabolicDish) part;
newWidth = d.getRimRadius();
d.setRimRadius(oldWidth);
} else if (part instanceof FresnelReflector) {
final FresnelReflector r = (FresnelReflector) part;
newWidth = r.getModuleWidth();
newHeight = r.getLength();
newModuleLength = r.getModuleLength();
r.setModuleWidth(oldWidth);
r.setLength(oldHeight);
r.setModuleLength(oldModuleLength);
} else if (part instanceof Rack) {
final Rack r = (Rack) part;
newWidth = r.getRackWidth();
newHeight = r.getRackHeight();
r.setRackWidth(oldWidth);
r.setRackHeight(oldHeight);
} else if (part instanceof Window) {
final Window w = (Window) part;
newWidth = w.getWindowWidth();
newHeight = w.getWindowHeight();
w.setWindowWidth(oldWidth);
w.setWindowHeight(oldHeight);
w.getContainer().draw();
} else if (part instanceof Door) {
final Door d = (Door) part;
newWidth = d.getDoorWidth();
newHeight = d.getDoorHeight();
d.setDoorWidth(oldWidth);
d.setDoorHeight(oldHeight);
d.getContainer().draw();
}
part.draw();
SceneManager.getInstance().refresh();
}
use of org.concord.energy3d.model.ParabolicDish in project energy3d by concord-consortium.
the class SetRibsForParabolicDishesOnFoundationCommand 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.getNumberOfRibs();
d.setNumberOfRibs(oldValues[i]);
d.draw();
}
SceneManager.getInstance().refresh();
}
Aggregations