use of org.concord.energy3d.model.Wall in project energy3d by concord-consortium.
the class DataViewer method viewRawData.
static void viewRawData(final java.awt.Window parent, final Graph graph, final boolean selectAll) {
String[] header = null;
if (graph instanceof BuildingEnergyDailyGraph) {
header = new String[] { "Hour", "Windows", "Solar Panels", "Heater", "AC", "Net" };
} else if (graph instanceof BuildingEnergyAnnualGraph) {
header = new String[] { "Month", "Windows", "Solar Panels", "Heater", "AC", "Net" };
} else if (graph instanceof PartEnergyDailyGraph) {
final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
if (selectAll || selectedPart instanceof SolarPanel || selectedPart instanceof Rack || selectedPart instanceof Mirror || selectedPart instanceof Foundation) {
header = new String[] { "Hour", "Solar" };
} else if (selectedPart instanceof Wall || selectedPart instanceof Roof || selectedPart instanceof Door) {
header = new String[] { "Hour", "Heat Gain" };
} else if (selectedPart instanceof Window) {
header = new String[] { "Hour", "Solar", "Heat Gain" };
}
if (graph.instrumentType == Graph.SENSOR) {
final List<HousePart> parts = Scene.getInstance().getParts();
final List<String> sensorList = new ArrayList<String>();
for (final HousePart p : parts) {
if (p instanceof Sensor) {
final Sensor sensor = (Sensor) p;
sensorList.add("Light: #" + sensor.getId());
sensorList.add("Heat Flux: #" + sensor.getId());
}
}
if (!sensorList.isEmpty()) {
header = new String[1 + sensorList.size()];
header[0] = "Hour";
for (int i = 1; i < header.length; i++) {
header[i] = sensorList.get(i - 1);
}
}
}
} else if (graph instanceof PartEnergyAnnualGraph) {
final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
if (selectAll || selectedPart instanceof SolarPanel || selectedPart instanceof Rack || selectedPart instanceof Mirror || selectedPart instanceof Foundation) {
header = new String[] { "Month", "Solar" };
} else if (selectedPart instanceof Wall || selectedPart instanceof Roof || selectedPart instanceof Door) {
header = new String[] { "Month", "Heat Gain" };
} else if (selectedPart instanceof Window) {
header = new String[] { "Month", "Solar", "Heat Gain" };
}
if (graph.instrumentType == Graph.SENSOR) {
final List<HousePart> parts = Scene.getInstance().getParts();
final List<String> sensorList = new ArrayList<String>();
for (final HousePart p : parts) {
if (p instanceof Sensor) {
final Sensor sensor = (Sensor) p;
sensorList.add("Light: #" + sensor.getId());
sensorList.add("Heat Flux: #" + sensor.getId());
}
}
if (!sensorList.isEmpty()) {
header = new String[1 + sensorList.size()];
header[0] = "Month";
for (int i = 1; i < header.length; i++) {
header[i] = sensorList.get(i - 1);
}
}
}
} else if (graph instanceof BuildingEnergyAngularGraph) {
header = new String[] { "Degree", "Windows", "Solar Panels", "Heater", "AC", "Net" };
} else if (graph instanceof PartEnergyAngularGraph) {
final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
if (selectedPart instanceof SolarPanel || selectedPart instanceof Rack || selectedPart instanceof Mirror || selectedPart instanceof Foundation) {
header = new String[] { "Degree", "Solar" };
} else if (selectedPart instanceof Wall || selectedPart instanceof Roof || selectedPart instanceof Door) {
header = new String[] { "Degree", "Heat Gain" };
} else if (selectedPart instanceof Window) {
header = new String[] { "Degree", "Solar", "Heat Gain" };
}
}
if (header == null) {
JOptionPane.showMessageDialog(MainFrame.getInstance(), "Problem in finding data.", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
final int m = header.length;
final int n = graph.getLength();
final Object[][] column = new Object[n][m + 1];
for (int i = 0; i < n; i++) {
column[i][0] = header[0].equals("Hour") ? i : (i + 1);
}
for (int j = 1; j < m; j++) {
final List<Double> list = graph.getData(header[j]);
for (int i = 0; i < n; i++) {
column[i][j] = list.get(i);
}
}
showDataWindow("Data", column, header, parent);
}
use of org.concord.energy3d.model.Wall in project energy3d by concord-consortium.
the class EnergyAngularAnalysis method updateGraph.
@Override
public void updateGraph() {
final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
if (selectedPart instanceof Foundation) {
if (graph instanceof BuildingEnergyAngularGraph) {
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.Wall in project energy3d by concord-consortium.
the class GroupAnnualAnalysis method updateGraph.
@Override
public void updateGraph() {
for (final HousePart p : selectedParts) {
final String customText = p.getLabelCustomText();
if (p instanceof Window) {
final Window window = (Window) p;
final double solar = p.getSolarPotentialToday() * window.getSolarHeatGainCoefficient();
graph.addData("Solar " + p.getId(), solar);
final double[] loss = p.getHeatLoss();
double sum = 0;
for (final double x : loss) {
sum += x;
}
graph.addData("Heat Gain " + p.getId(), -sum);
} else if (p instanceof Wall || p instanceof Roof) {
final double[] loss = p.getHeatLoss();
double sum = 0;
for (final double x : loss) {
sum += x;
}
graph.addData("Heat Gain " + p.getId(), -sum);
} else if (p instanceof SolarPanel) {
if (customText != null) {
graph.addData("Solar " + p.getId() + graph.getDataNameDelimiter() + customText, ((SolarPanel) p).getYieldToday());
} else {
graph.addData("Solar " + p.getId(), ((SolarPanel) p).getYieldToday());
}
} else if (p instanceof Rack) {
if (customText != null) {
graph.addData("Solar " + p.getId() + graph.getDataNameDelimiter() + customText, ((Rack) p).getYieldToday());
} else {
graph.addData("Solar " + p.getId(), ((Rack) p).getYieldToday());
}
} else if (p instanceof Mirror) {
final Mirror mirror = (Mirror) p;
final double solar = mirror.getSolarPotentialToday() * mirror.getSystemEfficiency();
if (customText != null) {
graph.addData("Solar " + p.getId() + graph.getDataNameDelimiter() + customText, solar);
} else {
graph.addData("Solar " + p.getId(), solar);
}
} else if (p instanceof ParabolicTrough) {
final ParabolicTrough trough = (ParabolicTrough) p;
final double solar = trough.getSolarPotentialToday() * trough.getSystemEfficiency();
if (customText != null) {
graph.addData("Solar " + p.getId() + graph.getDataNameDelimiter() + customText, solar);
} else {
graph.addData("Solar " + p.getId(), solar);
}
} else if (p instanceof ParabolicDish) {
final ParabolicDish dish = (ParabolicDish) p;
final double solar = dish.getSolarPotentialToday() * dish.getSystemEfficiency();
if (customText != null) {
graph.addData("Solar " + p.getId() + graph.getDataNameDelimiter() + customText, solar);
} else {
graph.addData("Solar " + p.getId(), solar);
}
} else if (p instanceof FresnelReflector) {
final FresnelReflector reflector = (FresnelReflector) p;
final double solar = reflector.getSolarPotentialToday() * reflector.getSystemEfficiency();
if (customText != null) {
graph.addData("Solar " + p.getId() + graph.getDataNameDelimiter() + customText, solar);
} else {
graph.addData("Solar " + p.getId(), solar);
}
} else if (p instanceof Foundation) {
final boolean mean = group.getType().endsWith("(Mean)");
final Foundation foundation = (Foundation) p;
switch(foundation.getProjectType()) {
case Foundation.TYPE_PV_PROJECT:
double pv = foundation.getPhotovoltaicToday();
if (mean) {
pv /= foundation.getNumberOfSolarPanels();
if (customText != null) {
graph.addData("PV " + p.getId() + graph.getDataNameDelimiter() + customText + " mean", pv);
} else {
graph.addData("PV " + p.getId() + " mean", pv);
}
} else {
if (customText != null) {
graph.addData("PV " + p.getId() + graph.getDataNameDelimiter() + customText, pv);
} else {
graph.addData("PV " + p.getId(), pv);
}
}
break;
case Foundation.TYPE_CSP_PROJECT:
double csp = foundation.getCspToday();
if (mean) {
csp /= foundation.countParts(new Class[] { Mirror.class, ParabolicTrough.class, ParabolicDish.class });
if (customText != null) {
graph.addData("CSP " + p.getId() + graph.getDataNameDelimiter() + customText + " mean", csp);
} else {
graph.addData("CSP " + p.getId() + " mean", csp);
}
} else {
if (customText != null) {
graph.addData("CSP " + p.getId() + graph.getDataNameDelimiter() + customText, csp);
} else {
graph.addData("CSP " + p.getId(), csp);
}
}
break;
case Foundation.TYPE_BUILDING:
final double totalEnergy = foundation.getTotalEnergyToday();
graph.addData("Building " + p.getId(), totalEnergy);
break;
}
}
}
graph.repaint();
}
use of org.concord.energy3d.model.Wall in project energy3d by concord-consortium.
the class BuildingCost method getPartCost.
/* The material and installation costs are partly based on http://www.homewyse.com, but should be considered as largely fictitious. */
public static double getPartCost(final HousePart part) {
// The baseline cost for a wall is set to be $300/m^2, close to homewyse's estimates of masonry walls, interior framing, etc.
if (part instanceof Wall) {
final double uFactor = ((Wall) part).getUValue();
final double unitPrice = 300.0 + 8.0 / uFactor;
return part.getArea() * unitPrice;
}
// A storm window of about 1 m^2 costs about $500. A double-pane window of about 1 m^2 costs about $700.
if (part instanceof Window) {
final double uFactor = ((Window) part).getUValue();
final double unitPrice = 500.0 + 800.0 / uFactor;
return part.getArea() * unitPrice;
}
// The baseline (that is, the structure without insulation) cost for a roof is set to be $100/m^2.
if (part instanceof Roof) {
final double uFactor = ((Roof) part).getUValue();
final double unitPrice = 100.0 + 10.0 / uFactor;
return part.getArea() * unitPrice;
}
// The foundation cost is set to be $200/m^2.
if (part instanceof Foundation) {
final Foundation foundation = (Foundation) part;
final Building b = new Building(foundation);
if (b.isWallComplete()) {
b.calculate();
final double uFactor = foundation.getUValue();
final double unitPrice = 300.0 + 8.0 / uFactor;
return b.getArea() * unitPrice;
}
// the building is incomplete yet, so we can assume the floor insulation isn't there yet
return -1;
}
if (part instanceof Floor) {
final double area = part.getArea();
if (area > 0) {
return part.getArea() * 100.0;
}
return -1;
}
// According to http://www.homewyse.com/costs/cost_of_exterior_doors.html
if (part instanceof Door) {
final double uFactor = ((Door) part).getUValue();
final double unitPrice = 500.0 + 100.0 / uFactor;
return part.getArea() * unitPrice;
}
if (part instanceof SolarPanel) {
return Scene.getInstance().getPvCustomPrice().getTotalCost((SolarPanel) part);
}
if (part instanceof Rack) {
return Scene.getInstance().getPvCustomPrice().getTotalCost((Rack) part);
}
if (part instanceof Tree) {
switch(((Tree) part).getTreeType()) {
case Tree.LINDEN:
return 3000;
case Tree.COTTONWOOD:
return 2500;
case Tree.ELM:
return 2000;
case Tree.OAK:
return 2000;
case Tree.PINE:
return 1500;
case Tree.MAPLE:
return 1000;
default:
return 500;
}
}
return 0;
}
use of org.concord.energy3d.model.Wall in project energy3d by concord-consortium.
the class SolarRadiation method initCollidables.
private void initCollidables() {
collidables.clear();
collidablesToParts.clear();
for (final HousePart part : Scene.getInstance().getParts()) {
if (part instanceof SolarCollector || part instanceof Tree || part instanceof Window) {
if (part instanceof Rack) {
final Rack rack = (Rack) part;
if (rack.isMonolithic()) {
final Spatial s = part.getRadiationCollisionSpatial();
collidables.add(s);
collidablesToParts.put(s, rack);
}
} else {
final Spatial s = part.getRadiationCollisionSpatial();
collidables.add(s);
collidablesToParts.put(s, part);
}
} else if (part instanceof Foundation) {
final Foundation foundation = (Foundation) part;
for (int i = 0; i < 4; i++) {
final Spatial s = foundation.getRadiationCollisionSpatial(i);
collidables.add(s);
collidablesToParts.put(s, foundation);
}
final List<Node> importedNodes = foundation.getImportedNodes();
if (importedNodes != null) {
for (final Node node : importedNodes) {
for (final Spatial s : node.getChildren()) {
collidables.add(s);
collidablesToParts.put(s, foundation);
}
}
}
} else if (part instanceof Wall) {
final Wall wall = (Wall) part;
if (wall.getType() == Wall.SOLID_WALL) {
final Spatial s = part.getRadiationCollisionSpatial();
collidables.add(s);
collidablesToParts.put(s, wall);
}
} else if (part instanceof Door) {
final Door door = (Door) part;
final Spatial s = door.getRadiationCollisionSpatial();
collidables.add(s);
collidablesToParts.put(s, door);
} else if (part instanceof Floor) {
final Floor floor = (Floor) part;
final Spatial s = floor.getRadiationCollisionSpatial();
collidables.add(s);
collidablesToParts.put(s, floor);
} else if (part instanceof Roof) {
final Roof roof = (Roof) part;
for (final Spatial roofPart : roof.getRoofPartsRoot().getChildren()) {
if (roofPart.getSceneHints().getCullHint() != CullHint.Always) {
final Spatial s = ((Node) roofPart).getChild(6);
collidables.add(s);
collidablesToParts.put(s, roof);
}
}
}
}
}
Aggregations