use of org.concord.energy3d.model.FresnelReflector in project energy3d by concord-consortium.
the class FresnelReflectorAnnualAnalysis method updateGraph.
@Override
public void updateGraph() {
final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
if (selectedPart != null) {
if (selectedPart instanceof FresnelReflector) {
final FresnelReflector r = (FresnelReflector) selectedPart;
graph.addData("Solar", r.getSolarPotentialToday() * r.getSystemEfficiency());
} else if (selectedPart instanceof Foundation) {
double output = 0;
for (final HousePart p : Scene.getInstance().getParts()) {
if (p instanceof FresnelReflector && p.getTopContainer() == selectedPart) {
final FresnelReflector r = (FresnelReflector) p;
output += r.getSolarPotentialToday() * r.getSystemEfficiency();
}
}
graph.addData("Solar", output);
} else if (selectedPart.getTopContainer() instanceof Foundation) {
double output = 0;
for (final HousePart p : Scene.getInstance().getParts()) {
if (p instanceof FresnelReflector && p.getTopContainer() == selectedPart.getTopContainer()) {
final FresnelReflector r = (FresnelReflector) p;
output += r.getSolarPotentialToday() * r.getSystemEfficiency();
}
}
graph.addData("Solar", output);
}
} else {
double output = 0;
for (final HousePart p : Scene.getInstance().getParts()) {
if (p instanceof FresnelReflector) {
final FresnelReflector r = (FresnelReflector) p;
output += r.getSolarPotentialToday() * r.getSystemEfficiency();
}
}
graph.addData("Solar", output);
}
graph.repaint();
}
use of org.concord.energy3d.model.FresnelReflector in project energy3d by concord-consortium.
the class FresnelReflectorDailyAnalysis method toJson.
@Override
public String toJson() {
String s = "{";
final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
if (selectedPart != null) {
if (selectedPart instanceof FresnelReflector) {
s += "\"Fresnel Reflector\": \"" + 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 += "\"Fresnel Reflector\": \"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.FresnelReflector in project energy3d by concord-consortium.
the class FresnelReflectorDailyAnalysis method show.
public void show() {
final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
String s = null;
int cost = -1;
String title = "Daily Yield of All Fresnel Reflectors (" + Scene.getInstance().countParts(FresnelReflector.class) + " Fresnel Reflectors)";
if (selectedPart != null) {
if (selectedPart instanceof FresnelReflector) {
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(FresnelReflector.class) + " Fresnel Reflectors)";
} else if (selectedPart.getTopContainer() instanceof Foundation) {
title = "Daily Yield of Selected Foundation (" + selectedPart.getTopContainer().countParts(FresnelReflector.class) + " Fresnel Reflectors)";
}
}
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.FresnelReflector in project energy3d by concord-consortium.
the class GroupAnnualAnalysis method toJson.
@Override
public String toJson() {
String type = "Unknown";
final ArrayList<String> names = new ArrayList<String>();
for (final HousePart p : selectedParts) {
if (p instanceof SolarPanel) {
names.add("Solar " + p.getId());
type = "Solar Panel";
} else if (p instanceof Rack) {
names.add("Solar " + p.getId());
type = "Rack";
} else if (p instanceof Mirror) {
names.add("Solar " + p.getId());
type = "Mirror";
} else if (p instanceof ParabolicTrough) {
names.add("Solar " + p.getId());
type = "Parabolic Trough";
} else if (p instanceof ParabolicDish) {
names.add("Solar " + p.getId());
type = "Parabolic Dish";
} else if (p instanceof FresnelReflector) {
names.add("Solar " + p.getId());
type = "Fresnel Reflector";
} else if (p instanceof Wall) {
names.add("Heat Gain " + p.getId());
type = "Wall";
} else if (p instanceof Roof) {
names.add("Heat Gain " + p.getId());
type = "Roof";
} else if (p instanceof Door) {
names.add("Heat Gain " + p.getId());
type = "Door";
} else if (p instanceof Window) {
names.add("Solar " + p.getId());
names.add("Heat Gain " + p.getId());
type = "Window";
} else if (p instanceof Foundation) {
final Foundation foundation = (Foundation) p;
switch(foundation.getProjectType()) {
case Foundation.TYPE_PV_PROJECT:
names.add("PV " + p.getId());
break;
case Foundation.TYPE_CSP_PROJECT:
names.add("CSP " + p.getId());
break;
case Foundation.TYPE_BUILDING:
names.add("Building " + p.getId());
break;
}
type = "Foundation";
}
}
String s = "{\"Type\": \"" + type + "\", \"Months\": " + getNumberOfDataPoints();
for (final String name : names) {
final List<Double> data = graph.getData(name);
if (data == null) {
continue;
}
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.FresnelReflector in project energy3d by concord-consortium.
the class GroupDailyAnalysis method toJson.
@Override
public String toJson() {
String type = "Unknown";
final ArrayList<String> names = new ArrayList<String>();
for (final HousePart p : selectedParts) {
if (p instanceof SolarPanel) {
names.add("Solar " + p.getId());
type = "Solar Panel";
} else if (p instanceof Rack) {
names.add("Solar " + p.getId());
type = "Rack";
} else if (p instanceof Mirror) {
names.add("Solar " + p.getId());
type = "Mirror";
} else if (p instanceof ParabolicTrough) {
names.add("Solar " + p.getId());
type = "Parabolic Trough";
} else if (p instanceof ParabolicDish) {
names.add("Solar " + p.getId());
type = "Parabolic Dish";
} else if (p instanceof FresnelReflector) {
names.add("Solar " + p.getId());
type = "Fresnel Reflector";
} else if (p instanceof Wall) {
names.add("Heat Gain " + p.getId());
type = "Wall";
} else if (p instanceof Roof) {
names.add("Heat Gain " + p.getId());
type = "Roof";
} else if (p instanceof Door) {
names.add("Heat Gain " + p.getId());
type = "Door";
} else if (p instanceof Window) {
names.add("Solar " + p.getId());
names.add("Heat Gain " + p.getId());
type = "Window";
} else if (p instanceof Foundation) {
final Foundation foundation = (Foundation) p;
switch(foundation.getProjectType()) {
case Foundation.TYPE_PV_PROJECT:
names.add("PV " + p.getId());
break;
case Foundation.TYPE_CSP_PROJECT:
names.add("CSP " + p.getId());
break;
case Foundation.TYPE_BUILDING:
names.add("Building " + p.getId());
break;
}
type = "Foundation";
}
}
String s = "{\"Type\": \"" + type + "\"";
for (final String name : names) {
final List<Double> data = graph.getData(name);
if (data == null) {
continue;
}
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;
}
Aggregations