use of org.concord.energy3d.model.Foundation in project energy3d by concord-consortium.
the class MainFrame method getDailyEnergyAnalysisForSelectionMenuItem.
private JMenuItem getDailyEnergyAnalysisForSelectionMenuItem() {
if (dailyEnergyAnalysisForSelectionMenuItem == null) {
dailyEnergyAnalysisForSelectionMenuItem = new JMenuItem("Daily Energy Analysis for Selected Part...");
dailyEnergyAnalysisForSelectionMenuItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent e) {
if (EnergyPanel.getInstance().checkCity()) {
if (EnergyPanel.getInstance().adjustCellSize()) {
return;
}
final HousePart selectedPart = SceneManager.getInstance().getSelectedPart();
if (selectedPart instanceof Window || selectedPart instanceof Wall || selectedPart instanceof Roof || selectedPart instanceof Door || selectedPart instanceof SolarPanel || selectedPart instanceof Rack || selectedPart instanceof Foundation) {
new EnergyDailyAnalysis().show("Daily Energy for Selected Part");
} else {
JOptionPane.showMessageDialog(MainFrame.this, "You must select a building part first.", "No Selection", JOptionPane.INFORMATION_MESSAGE);
}
}
}
});
}
return dailyEnergyAnalysisForSelectionMenuItem;
}
use of org.concord.energy3d.model.Foundation in project energy3d by concord-consortium.
the class EnergyPanel method compute.
public void compute(final UpdateRadiation updateRadiation) {
if (!computeEnabled) {
return;
}
computingStartMillis = System.currentTimeMillis();
EventQueue.invokeLater(new // must run this Swing UI update in the event queue to avoid a possible deadlock
Runnable() {
@Override
public void run() {
// TODO: There got to be a better way to do this.
updateWeatherData();
((Component) SceneManager.getInstance().getCanvas()).setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
}
});
final boolean doCompute = updateRadiation == UpdateRadiation.ALWAYS || (SceneManager.getInstance().getSolarHeatMap() && (!alreadyRenderedHeatmap || autoRecomputeEnergy));
if (!doCompute && computing) {
cancel();
return;
}
SceneManager.getTaskManager().update(new Callable<Object>() {
@Override
public Object call() throws Exception {
computing = true;
computeRequest = false;
cancel = false;
try {
if (doCompute) {
alreadyRenderedHeatmap = true;
computeNow();
if (!cancel) {
SceneManager.getInstance().getSolarLand().setVisible(Scene.getInstance().getSolarMapForLand());
SceneManager.getInstance().refresh();
} else if (!autoRecomputeEnergy) {
turnOffCompute();
}
} else {
turnOffCompute();
}
} catch (final Throwable e) {
e.printStackTrace();
BugReporter.report(e);
return null;
} finally {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
((Component) SceneManager.getInstance().getCanvas()).setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
});
}
EventQueue.invokeLater(new // must run this Swing UI update in the event queue to avoid a possible deadlock
Runnable() {
@Override
public void run() {
progress(0);
if (SceneManager.getInstance().getSolarHeatMap()) {
final HousePart p = SceneManager.getInstance().getSelectedPart();
if (p instanceof Foundation) {
final Foundation f = (Foundation) p;
switch(f.getProjectType()) {
case Foundation.TYPE_BUILDING:
Util.setSilently(buildingTabbedPane, buildingDailyEnergyGraph);
buildingDailyEnergyGraph.addGraph(f);
TimeSeriesLogger.getInstance().logAnalysis(buildingDailyEnergyGraph);
MainApplication.addEvent(new AnalysisEvent(Scene.getURL(), System.currentTimeMillis(), buildingDailyEnergyGraph.getClass().getSimpleName(), buildingDailyEnergyGraph.getData()));
break;
case Foundation.TYPE_PV_PROJECT:
Util.setSilently(pvProjectTabbedPane, pvProjectDailyEnergyGraph);
pvProjectDailyEnergyGraph.addGraph(f);
TimeSeriesLogger.getInstance().logAnalysis(pvProjectDailyEnergyGraph);
MainApplication.addEvent(new AnalysisEvent(Scene.getURL(), System.currentTimeMillis(), pvProjectDailyEnergyGraph.getClass().getSimpleName(), pvProjectDailyEnergyGraph.getData()));
break;
case Foundation.TYPE_CSP_PROJECT:
Util.setSilently(cspProjectTabbedPane, cspProjectDailyEnergyGraph);
cspProjectDailyEnergyGraph.addGraph(f);
TimeSeriesLogger.getInstance().logAnalysis(cspProjectDailyEnergyGraph);
MainApplication.addEvent(new AnalysisEvent(Scene.getURL(), System.currentTimeMillis(), cspProjectDailyEnergyGraph.getClass().getSimpleName(), cspProjectDailyEnergyGraph.getData()));
break;
}
}
}
computing = false;
}
});
return null;
}
});
}
use of org.concord.energy3d.model.Foundation in project energy3d by concord-consortium.
the class CspProjectCostGraph method calculateCost.
private void calculateCost() {
landSum = 0;
collectorSum = 0;
receiverSum = 0;
if (foundation.hasSolarReceiver()) {
receiverSum = CspProjectCost.getPartCost(foundation);
} else {
landSum = CspProjectCost.getPartCost(foundation);
final List<Mirror> mirrors = foundation.getHeliostats();
if (!mirrors.isEmpty()) {
final ArrayList<Foundation> towers = new ArrayList<Foundation>();
for (final Mirror m : mirrors) {
if (m.getReceiver() != null) {
if (!towers.contains(m.getReceiver())) {
towers.add(m.getReceiver());
}
}
}
if (!towers.isEmpty()) {
for (final Foundation tower : towers) {
receiverSum += CspProjectCost.getPartCost(tower);
}
}
} else {
final List<FresnelReflector> reflectors = foundation.getFresnelReflectors();
if (!reflectors.isEmpty()) {
final ArrayList<Foundation> absorbers = new ArrayList<Foundation>();
for (final FresnelReflector r : reflectors) {
if (r.getReceiver() != null) {
if (!absorbers.contains(r.getReceiver())) {
absorbers.add(r.getReceiver());
}
}
}
if (!absorbers.isEmpty()) {
for (final Foundation absorber : absorbers) {
receiverSum += CspProjectCost.getPartCost(absorber);
}
}
}
}
}
for (final HousePart p : Scene.getInstance().getParts()) {
if (p.getTopContainer() == foundation) {
if (p instanceof SolarCollector) {
// assuming that sensor doesn't cost anything
collectorSum += CspProjectCost.getPartCost(p);
}
}
}
totalCost = landSum + collectorSum + receiverSum;
}
use of org.concord.energy3d.model.Foundation in project energy3d by concord-consortium.
the class Scene method upgradeSceneToNewVersion.
private void upgradeSceneToNewVersion() {
if (textureMode == null) {
textureMode = TextureMode.Full;
for (final HousePart p : parts) {
if (p instanceof Roof) {
((Roof) p).setOverhangLength(0.2);
}
}
}
if (version < 1) {
for (final HousePart part : parts) {
if (part instanceof Foundation) {
((Foundation) part).scaleHouseForNewVersion(10);
}
}
cameraLocation = cameraLocation.multiply(10, null);
setAnnotationScale(1.0);
}
version = currentVersion;
}
use of org.concord.energy3d.model.Foundation in project energy3d by concord-consortium.
the class Scene method paste.
public void paste() {
if (copyBuffer == null) {
return;
}
if (copyBuffer instanceof Foundation) {
return;
}
if (SceneManager.getInstance().getSolarHeatMap()) {
EnergyPanel.getInstance().updateRadiationHeatMap();
}
final HousePart c = copyBuffer.copy(true);
if (c == null) {
return;
}
add(c, true);
copyBuffer = c;
SceneManager.getInstance().setSelectedPart(c);
SceneManager.getInstance().getUndoManager().addEdit(new PastePartCommand(c));
EnergyPanel.getInstance().update();
}
Aggregations