-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBaseCaseSimulation.m
More file actions
64 lines (61 loc) · 1.81 KB
/
Copy pathBaseCaseSimulation.m
File metadata and controls
64 lines (61 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
%% Reset
close all
clear
clc
%% Load data
load('BaseCase.mat');
floorPlanCData = imread('NYSERDA 2ndFloor cropped marked 2683x6313px.jpg');
%% Create figure and render floor plan
[floorPlanY,floorPlanX,~] = size(floorPlanCData);
% Create and format figure
g = groot;
g.Units = 'pixels';
scale = 1/7;
f = figure;
f.ToolBar = 'none';
f.Units = 'pixels';
f.Position(1) = (g.ScreenSize(3)-scale*floorPlanX)/2;
f.Position(2) = (g.ScreenSize(4)-scale*(floorPlanY+300))/2;
f.Position(3) = scale*floorPlanX;
f.Position(4) = scale*(floorPlanY+300);
% Create and format axes
ax = axes;
ax.Units = 'pixels';
ax.Position = scale*[0, 300, floorPlanX, floorPlanY];
ax.XLim = [0, floorPlanX];
ax.YLim = [0, floorPlanY];
% Render image to axes
floorPlanImage = image(ax, floorPlanCData);
ax.Visible = 'off';
% Create second axes
x0 = 200;
y0 = 1096;
pixel2feet = 1/38.9;
ax2 = axes;
ax2.Units = 'pixels';
ax2.Position = scale*[0, 300, floorPlanX, floorPlanY];
ax2.XLim = pixel2feet*[-x0, floorPlanX-x0];
ax2.YLim = pixel2feet*[-y0, floorPlanY-y0];
ax2.Color = 'none';
ax2.XAxisLocation = 'origin'; % Remove
ax2.YAxisLocation = 'origin'; % Remove
ax2.Visible = 'off';
hold on
% Render title block
tBlock = annotation('textbox','Units','pixels','Position', scale*[0, 0, floorPlanX, 300]);
tBlock.EdgeColor = 'none';
tBlock.BackgroundColor = 'white';
tBlock.HorizontalAlignment = 'center';
tBlock.VerticalAlignment = 'middle';
tBlock.FitBoxToText = 'off';
tBlock.Interpreter = 'none';
tBlock.String = {'Simulation: Base Case';'Time Stamp --:--:--'};
for iC = 1:numel(BaseCase.SimRelTime)
BaseCase.Clock = BaseCase.SimRelTime(iC);
render(BaseCase, ax2);
ts = char(BaseCase.Clock);
tBlock.String = {'Simulation: Base Case';['Time Stamp ',ts]};
drawnow;
filename = fullfile('basecase',regexprep(ts,':','-'));
print(filename,'-dtiff','-r336');
end