use of org.concord.energy3d.model.Wall in project energy3d by concord-consortium.
the class SolarRadiation method updateTextures.
public void updateTextures() {
EnergyPanel.getInstance().setComputingStartMillis(System.currentTimeMillis());
maxValue = Math.round((MINUTES_OF_DAY / Scene.getInstance().getTimeStep() + 1.0) * (1 - 0.01 * Scene.getInstance().getSolarHeatMapColorContrast()));
applyTexture(SceneManager.getInstance().getSolarLand());
final int totalMeshes = Scene.getInstance().getParts().size() + Scene.getInstance().countMeshes();
int countMesh = 0;
for (final HousePart part : Scene.getInstance().getParts()) {
if (part instanceof SolarCollector) {
applyTexture(part.getRadiationMesh());
} else {
if (!Scene.getInstance().getOnlySolarComponentsInSolarMap()) {
if (part instanceof Wall || part instanceof Door || part instanceof Floor) {
applyTexture(part.getRadiationMesh());
} else if (part instanceof Foundation) {
final Foundation foundation = (Foundation) part;
for (int i = 0; i < 5; i++) {
applyTexture(foundation.getRadiationMesh(i));
}
final List<Node> importedNodes = foundation.getImportedNodes();
if (importedNodes != null) {
for (final Node node : importedNodes) {
for (final Spatial s : node.getChildren()) {
applyTexture((Mesh) s);
EnergyPanel.getInstance().progress((int) Math.round(100.0 * (countMesh++) / totalMeshes));
}
}
}
} else if (part instanceof Roof) {
for (final Spatial roofPart : ((Roof) part).getRoofPartsRoot().getChildren()) {
if (roofPart.getSceneHints().getCullHint() != CullHint.Always) {
final Mesh mesh = (Mesh) ((Node) roofPart).getChild(6);
applyTexture(mesh);
}
}
}
}
}
countMesh++;
}
EnergyPanel.getInstance().progress(0);
}
use of org.concord.energy3d.model.Wall in project energy3d by concord-consortium.
the class SolarRadiation method computeEnergyAtHour.
public void computeEnergyAtHour(final int hour) {
final Calendar today = Heliodon.getInstance().getCalendar();
final String city = (String) EnergyPanel.getInstance().getCityComboBox().getSelectedItem();
final double[] outsideAirTemperatureRange = Weather.computeOutsideTemperature(today, city);
final double outsideAirTemperature = Weather.getInstance().getOutsideTemperatureAtMinute(outsideAirTemperatureRange[1], outsideAirTemperatureRange[0], hour * 60);
for (final HousePart part : Scene.getInstance().getParts()) {
if (part instanceof Foundation) {
final Foundation foundation = (Foundation) part;
if (foundation.getHeatLoss() == null) {
continue;
}
final int n = (int) Math.round(60.0 / Scene.getInstance().getTimeStep());
final double[] heatLoss = new double[n];
final double[] passiveSolar = new double[n];
final double[] photovoltaic = new double[n];
final double[] csp = new double[n];
final int t0 = n * hour;
for (int i = 0; i < n; i++) {
final double groundHeatLoss = foundation.getHeatLoss()[t0 + i];
if (groundHeatLoss > 0) {
final double thermostat = foundation.getThermostat().getTemperature(today.get(Calendar.MONTH), today.get(Calendar.DAY_OF_WEEK) - Calendar.SUNDAY, today.get(Calendar.HOUR_OF_DAY));
if (outsideAirTemperature >= thermostat) {
heatLoss[i] -= groundHeatLoss;
}
} else {
heatLoss[i] += groundHeatLoss;
}
}
double solarPotentialTotal = 0.0;
for (final HousePart child : Scene.getInstance().getParts()) {
if (child.getTopContainer() == foundation) {
child.setSolarPotentialNow(0);
if (child instanceof SolarCollector) {
((SolarCollector) child).setYieldNow(0);
}
for (int i = 0; i < n; i++) {
solarPotentialTotal += child.getSolarPotential()[t0 + i];
child.setSolarPotentialNow(child.getSolarPotentialNow() + child.getSolarPotential()[t0 + i]);
if (child instanceof Wall || child instanceof Door || child instanceof Window || child instanceof Roof) {
heatLoss[i] += child.getHeatLoss()[t0 + i];
}
if (child instanceof Window) {
final Window window = (Window) child;
passiveSolar[i] += window.getSolarPotential()[t0 + i] * window.getSolarHeatGainCoefficient();
} else if (child instanceof Mirror) {
final Mirror mirror = (Mirror) child;
final double yield = mirror.getSolarPotential()[t0 + i] * mirror.getSystemEfficiency();
csp[i] += yield;
mirror.setYieldNow(mirror.getYieldNow() + yield);
} else if (child instanceof ParabolicTrough) {
final ParabolicTrough trough = (ParabolicTrough) child;
final double yield = trough.getSolarPotential()[t0 + i] * trough.getSystemEfficiency();
csp[i] += yield;
trough.setYieldNow(trough.getYieldNow() + yield);
} else if (child instanceof ParabolicDish) {
final ParabolicDish dish = (ParabolicDish) child;
final double yield = dish.getSolarPotential()[t0 + i] * dish.getSystemEfficiency();
csp[i] += yield;
dish.setYieldNow(dish.getYieldNow() + yield);
} else if (child instanceof FresnelReflector) {
final FresnelReflector reflector = (FresnelReflector) child;
final double yield = reflector.getSolarPotential()[t0 + i] * reflector.getSystemEfficiency();
csp[i] += yield;
reflector.setYieldNow(reflector.getYieldNow() + yield);
} else if (child instanceof SolarPanel) {
final SolarPanel sp = (SolarPanel) child;
// distributed efficiency must be handled for each individual cell
final double yield = sp.getSolarPotential()[t0 + i];
photovoltaic[i] += yield;
sp.setYieldNow(sp.getYieldNow() + yield);
} else if (child instanceof Rack) {
final Rack rack = (Rack) child;
if (rack.isMonolithic()) {
// distributed efficiency must be handled for each individual cell
final double yield = rack.getSolarPotential()[t0 + i];
photovoltaic[i] += yield;
rack.setYieldNow(rack.getYieldNow() + yield);
}
}
}
}
}
double heatingTotal = 0.0;
double coolingTotal = 0.0;
double passiveSolarTotal = 0.0;
double photovoltaicTotal = 0.0;
double cspTotal = 0.0;
for (int i = 0; i < n; i++) {
if (heatLoss[i] < 0) {
heatLoss[i] -= passiveSolar[i];
} else {
heatLoss[i] = Math.max(0, heatLoss[i] - passiveSolar[i]);
}
if (heatLoss[i] > 0) {
heatingTotal += heatLoss[i];
} else {
coolingTotal -= heatLoss[i];
}
passiveSolarTotal += passiveSolar[i];
photovoltaicTotal += photovoltaic[i];
cspTotal += csp[i];
}
foundation.setSolarPotentialNow(solarPotentialTotal);
foundation.setPassiveSolarNow(passiveSolarTotal);
foundation.setPhotovoltaicNow(photovoltaicTotal);
foundation.setCspNow(cspTotal);
foundation.setHeatingNow(heatingTotal);
foundation.setCoolingNow(coolingTotal);
foundation.setTotalEnergyNow(heatingTotal + coolingTotal - photovoltaicTotal);
}
}
}
use of org.concord.energy3d.model.Wall in project energy3d by concord-consortium.
the class SceneManager method getPickedLocationOnWall.
Vector3 getPickedLocationOnWall() {
if (pickMouseState != null) {
final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
if (selectedPart instanceof Wall) {
final PickedHousePart pick = SelectUtil.pickPart(pickMouseState.getX(), pickMouseState.getY(), selectedPart);
if (pick != null) {
return pick.getPoint().clone();
}
}
pickMouseState = null;
}
return null;
}
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 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.Wall 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();
}
Aggregations