use of org.concord.energy3d.model.Window in project energy3d by concord-consortium.
the class DataViewer method viewRawData.
static void viewRawData(final java.awt.Window parent, final Graph graph, final List<HousePart> selectedParts) {
if (selectedParts == null || selectedParts.isEmpty()) {
JOptionPane.showMessageDialog(MainFrame.getInstance(), "No part is selected.", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
final ArrayList<String> headers = new ArrayList<String>();
if (graph instanceof PartEnergyDailyGraph) {
headers.add("Hour");
} else if (graph instanceof PartEnergyAnnualGraph) {
headers.add("Month");
}
for (final HousePart p : selectedParts) {
if (p instanceof SolarPanel || p instanceof Rack || p instanceof Mirror) {
headers.add("Solar " + p.getId());
} else if (p instanceof Wall || p instanceof Roof || p instanceof Door) {
headers.add("Heat Gain " + p.getId());
} else if (p instanceof Window) {
headers.add("Solar " + p.getId());
headers.add("Heat Gain " + p.getId());
} else if (p instanceof Foundation) {
final Foundation foundation = (Foundation) p;
switch(foundation.getProjectType()) {
case Foundation.TYPE_PV_PROJECT:
headers.add("PV " + p.getId());
break;
case Foundation.TYPE_CSP_PROJECT:
headers.add("CSP " + p.getId());
break;
case Foundation.TYPE_BUILDING:
headers.add("Building " + p.getId());
break;
}
}
}
final String[] headersArray = new String[headers.size()];
for (int i = 0; i < headersArray.length; i++) {
headersArray[i] = headers.get(i);
}
final int m = headersArray.length;
final int n = graph.getLength();
final Object[][] column = new Object[n][m + 1];
for (int i = 0; i < n; i++) {
column[i][0] = (i + 1);
}
for (int j = 1; j < m; j++) {
final List<Double> list = graph.getData(headersArray[j]);
for (int i = 0; i < n; i++) {
column[i][j] = list.get(i);
}
}
showDataWindow("Data", column, headersArray, parent);
}
use of org.concord.energy3d.model.Window in project energy3d by concord-consortium.
the class EnergyAnnualAnalysis method updateGraph.
@Override
public void updateGraph() {
final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
if (selectedPart instanceof Foundation) {
if (graph instanceof BuildingEnergyAnnualGraph) {
final Foundation selectedBuilding = (Foundation) selectedPart;
final double window = selectedBuilding.getPassiveSolarToday();
final double solarPanel = selectedBuilding.getPhotovoltaicToday();
final double heater = selectedBuilding.getHeatingToday();
final double ac = selectedBuilding.getCoolingToday();
final double net = selectedBuilding.getTotalEnergyToday();
graph.addData("Windows", window);
graph.addData("Solar Panels", solarPanel);
graph.addData("Heater", heater);
graph.addData("AC", ac);
graph.addData("Net", net);
} else {
graph.addData("Solar", selectedPart.getSolarPotentialToday());
}
} else if (selectedPart instanceof Window) {
final Window window = (Window) selectedPart;
final double solar = selectedPart.getSolarPotentialToday() * window.getSolarHeatGainCoefficient();
graph.addData("Solar", solar);
final double[] loss = selectedPart.getHeatLoss();
double sum = 0;
for (final double x : loss) {
sum += x;
}
graph.addData("Heat Gain", -sum);
} else if (selectedPart instanceof Wall || selectedPart instanceof Roof || selectedPart instanceof Door) {
final double[] loss = selectedPart.getHeatLoss();
double sum = 0;
for (final double x : loss) {
sum += x;
}
graph.addData("Heat Gain", -sum);
} else if (selectedPart instanceof SolarPanel) {
graph.addData("Solar", ((SolarPanel) selectedPart).getYieldToday());
} else if (selectedPart instanceof Rack) {
graph.addData("Solar", ((Rack) selectedPart).getYieldToday());
}
graph.repaint();
}
use of org.concord.energy3d.model.Window in project energy3d by concord-consortium.
the class EnergyDailyAnalysis method updateGraph.
@Override
public void updateGraph() {
final int n = (int) Math.round(60.0 / Scene.getInstance().getTimeStep());
for (int i = 0; i < 24; i++) {
SolarRadiation.getInstance().computeEnergyAtHour(i);
final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
if (selectedPart instanceof Foundation) {
if (graph instanceof BuildingEnergyDailyGraph) {
final Foundation selectedBuilding = (Foundation) selectedPart;
final double window = selectedBuilding.getPassiveSolarNow();
final double solarPanel = selectedBuilding.getPhotovoltaicNow();
final double heater = selectedBuilding.getHeatingNow();
final double ac = selectedBuilding.getCoolingNow();
final double net = selectedBuilding.getTotalEnergyNow();
graph.addData("Windows", window);
graph.addData("Solar Panels", solarPanel);
graph.addData("Heater", heater);
graph.addData("AC", ac);
graph.addData("Net", net);
} else {
graph.addData("Solar", selectedPart.getSolarPotentialNow());
}
} else if (selectedPart instanceof Window) {
final Window window = (Window) selectedPart;
final double solar = selectedPart.getSolarPotentialNow() * window.getSolarHeatGainCoefficient();
graph.addData("Solar", solar);
final double[] loss = selectedPart.getHeatLoss();
final int t0 = n * i;
double sum = 0;
for (int k = t0; k < t0 + n; k++) {
sum += loss[k];
}
graph.addData("Heat Gain", -sum);
} else if (selectedPart instanceof Wall || selectedPart instanceof Roof || selectedPart instanceof Door) {
final double solar = selectedPart.getSolarPotentialNow();
graph.addData("Solar", solar);
final double[] loss = selectedPart.getHeatLoss();
final int t0 = n * i;
double sum = 0;
for (int k = t0; k < t0 + n; k++) {
sum += loss[k];
}
graph.addData("Heat Gain", -sum);
} else if (selectedPart instanceof SolarPanel) {
graph.addData("Solar", ((SolarPanel) selectedPart).getYieldNow());
} else if (selectedPart instanceof Rack) {
graph.addData("Solar", ((Rack) selectedPart).getYieldNow());
}
}
graph.repaint();
}
use of org.concord.energy3d.model.Window 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.Window 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