use of org.concord.energy3d.model.Tree in project energy3d by concord-consortium.
the class EnergyAnnualAnalysis method show.
public void show(final String title) {
final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
String s = null;
int cost = -1;
if (selectedPart != null) {
cost = (int) BuildingCost.getPartCost(selectedPart);
if (graph.instrumentType == Graph.SENSOR) {
SceneManager.getInstance().setSelectedPart(null);
} else {
s = selectedPart.toString().substring(0, selectedPart.toString().indexOf(')') + 1);
if (selectedPart instanceof Foundation) {
cost = (int) BuildingCost.getInstance().getCostByFoundation((Foundation) selectedPart);
s = s.replaceAll("Foundation", "Building");
if (selectedPart.getChildren().isEmpty()) {
JOptionPane.showMessageDialog(MainFrame.getInstance(), "There is no building on this foundation.", "No Building", JOptionPane.WARNING_MESSAGE);
return;
}
if (!isBuildingComplete((Foundation) selectedPart)) {
if (JOptionPane.showConfirmDialog(MainFrame.getInstance(), "The selected building has not been completed.\nAre you sure to continue?", "Incomplete Building", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) != JOptionPane.YES_OPTION) {
return;
}
}
} else if (selectedPart instanceof Tree) {
JOptionPane.showMessageDialog(MainFrame.getInstance(), "Energy analysis is not applicable to a tree.", "Not Applicable", JOptionPane.WARNING_MESSAGE);
return;
}
}
}
final JDialog dialog = createDialog(s == null ? title : title + ": " + s + " (Construction cost: $" + cost + ")");
final JMenuBar menuBar = new JMenuBar();
dialog.setJMenuBar(menuBar);
menuBar.add(createOptionsMenu(dialog, null, false, false));
menuBar.add(createTypesMenu());
menuBar.add(createRunsMenu());
dialog.setVisible(true);
}
use of org.concord.energy3d.model.Tree in project energy3d by concord-consortium.
the class EnergyDailyAnalysis method show.
public void show(final String title) {
final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
String s = null;
int cost = -1;
if (selectedPart != null) {
cost = (int) BuildingCost.getPartCost(selectedPart);
if (graph.instrumentType == Graph.SENSOR) {
SceneManager.getInstance().setSelectedPart(null);
} else {
s = selectedPart.toString().substring(0, selectedPart.toString().indexOf(')') + 1);
if (selectedPart instanceof Foundation) {
cost = (int) BuildingCost.getInstance().getCostByFoundation((Foundation) selectedPart);
s = s.replaceAll("Foundation", "Building");
if (selectedPart.getChildren().isEmpty()) {
JOptionPane.showMessageDialog(MainFrame.getInstance(), "There is no building on this foundation.", "No Building", JOptionPane.WARNING_MESSAGE);
return;
}
if (!isBuildingComplete((Foundation) selectedPart)) {
if (JOptionPane.showConfirmDialog(MainFrame.getInstance(), "The selected building has not been completed.\nAre you sure to continue?", "Incomplete Building", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) != JOptionPane.YES_OPTION) {
return;
}
}
} else if (selectedPart instanceof Tree) {
JOptionPane.showMessageDialog(MainFrame.getInstance(), "Energy analysis is not applicable to a tree.", "Not Applicable", JOptionPane.WARNING_MESSAGE);
return;
}
}
}
final JDialog dialog = createDialog(s == null ? title : title + ": " + s + " (Construction cost: $" + cost + ")");
final JMenuBar menuBar = new JMenuBar();
dialog.setJMenuBar(menuBar);
menuBar.add(createOptionsMenu(dialog, null, false));
menuBar.add(createTypesMenu());
menuBar.add(createRunsMenu());
dialog.setVisible(true);
}
use of org.concord.energy3d.model.Tree 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.Tree 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);
}
}
}
}
}
use of org.concord.energy3d.model.Tree in project energy3d by concord-consortium.
the class Scene method removeAllTrees.
public void removeAllTrees() {
final ArrayList<HousePart> trees = new ArrayList<HousePart>();
for (final HousePart part : parts) {
if (part instanceof Tree && !part.getLockEdit()) {
trees.add(part);
}
}
if (trees.isEmpty()) {
JOptionPane.showMessageDialog(MainFrame.getInstance(), "There is no tree to remove.", "No Tree", JOptionPane.INFORMATION_MESSAGE);
return;
}
if (JOptionPane.showConfirmDialog(MainFrame.getInstance(), "Do you really want to remove all " + trees.size() + " trees?", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) != JOptionPane.YES_OPTION) {
return;
}
final RemoveMultiplePartsCommand c = new RemoveMultiplePartsCommand(trees);
for (final HousePart part : trees) {
remove(part, false);
}
redrawAll();
SceneManager.getInstance().getUndoManager().addEdit(c);
edited = true;
}
Aggregations