Skip to content

Commit f97094c

Browse files
committed
Add page notes and input highlighting options to SfA macro
1 parent bb6b076 commit f97094c

1 file changed

Lines changed: 64 additions & 36 deletions

File tree

deploy/runtime/macros/Residential/Solar for All Calculator.lk

Lines changed: 64 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
<p>For detailed instructions and how-to videos, see [<em><strong>link to Box folder</strong></em>].</p>
44
<p><em>THIS IS A DRAFT VERSION FOR DEMONSTRATION PURPOSES ONLY</em></p>
55

6+
<p>
7+
<table style="width: 100%; background-color: #f2f2f2; border: 30px 30px 30px 30px;">
8+
<tr><td style="padding: 15px;">
9+
If you are new to SAM, use the check boxes at right to help guide you through the macro:
10+
<ul>
11+
<li><strong>Create page notes</strong> creates permanent instructions on each input page that has inputs required to run the macro.</li>
12+
<li><strong>Highight inputs</strong> walks you through the input pages showing you where the inputs are.</li>
13+
</tr></td>
14+
</table>
15+
</p>
16+
617
<h5 id="overall-steps">Overall Steps</h5>
718

819
<ol>
@@ -64,66 +75,84 @@
6475
//@ name=generate_pagenotes;type=checkbox;label=Create page notes;value=0*/
6576
//@ name=highlight_inputs;type=checkbox;label=Highlight inputs;value=0*/
6677

67-
function highlight( widget_name ) {
78+
function highlight( widget_name, message ) {
6879
g = widgetpos(widget_name);
6980
transp(g, highlight_color, highlight_transparency);
70-
g[1] = g[1] + 30;
71-
msgbox('Click OK to continue.',g);
81+
g[1] = g[1] + g[3]+5;
82+
g[2] = 400;
83+
msgbox( message + '\nClick OK or press Enter to continue.',g);
7284
}
7385

7486
function highlight_inputs() {
7587

76-
generate_pagenotes();
77-
7888
highlight_color = 'yellow';
7989
highlight_transparency = 70;
8090
transp();
8191

92+
go = yesno( 'Highlight Inputs Instructions.\nIf you click Yes below, SAM will switch to each input page required to run the macro, highlight each minimum required input on the page, and show brief explanation of the input. It then runs and displays results based on the current inputs so you can see how the macro works.\n\nAfter the macro finishes, you can clear the Highlight Inputs check box and go back to those pages to enter the data for your project and rerun the macro.\n\nContinue?', [100,100,400,200]);
93+
if (!go) {
94+
outln('Exiting script');
95+
exit;
96+
}
97+
8298
ok = show_page('Location and Resource');
8399
if (ok) {
84-
highlight('in_location');
85-
highlight('btn_download');
100+
highlight('in_location', 'Type the project street address or city and state.');
101+
highlight('btn_download', 'Click Download and Add to Library to download the weather file.');
86102
}
87103
else {
88104
msgbox('Input page error!\nThis case does not have a Location and Resource page. The Solar for All Calculator macro is designed to work with the PVWatts/Residential configuration.');
89105
}
90106
ok = show_page('System Design');
91107
if (ok) {
92-
highlight('system_capacity');
93-
highlight('tilt');
94-
highlight('azimuth');
95-
highlight('array_type');
108+
highlight('system_capacity', 'Type the system size in DC kilowatts.');
109+
highlight('tilt', 'Type the array tilt angle from horizontal (20 is a typical value).');
110+
highlight('azimuth', 'Type the array azimuth angle in degrees east of north. (180 is south-facing).');
111+
highlight('array_type', 'For a ground- or roof-mounted array that allows air to flow beneath the array, choose Fixed Open Rack.');
96112
}
97113
else {
98114
msgbox('Input page error!\nThis case does not have a System Design page. The Solar for All Calculator macro is designed to work with the PVWatts/Residential configuration.');
99115
}
100116
ok = show_page('Electricity Rates');
101117
if (ok) {
102-
highlight('btnQueryOpenEI');
118+
highlight('btnQueryOpenEI', 'Click Search for Rates to download electricity rate data for the project location. If data is not available, enter the rates for fixed, energy, and demand charges data by hand.');
119+
highlight('ur_metering_option', 'Choose the correct option for compensation of excess generation. See Help for a detailed description of each option.');
120+
highlight('ur_monthly_fixed_charge', 'Verify the fixed monthly charge value.');
121+
// energy charge table requires special treatment
122+
g = widgetpos('ur_ec_tou_mat');
123+
g[2] = g[2]*0.66; // highlight width
124+
g[3] = g[3]*0.33; // highlight height
125+
transp(g, 'yellow', 70);
126+
g[0] = g[0] + g[2]+5; // popup horizontal position (position to right of highlight)
127+
g[1] = g[1] - g[3]*0.9; // popup vertical position (position above highlight to minimize risk of hiding popup)
128+
g[2] = 400; // popup width
129+
msgbox( 'Verify the rates for energy charges.\nIf your rate structure also includes demand charges, scroll to the bottom of the page and expand the Demand Charges panel to verify those values.' + '\n\nClick OK or press Enter to continue.',g);
103130
}
104131
else {
105132
msgbox('Input page error!\nThis case does not have an Electricity Rates page. The Solar for All Calculator macro is designed to work with the PVWatts/Residential configuration.');
106133
}
107134
ok = show_page('Electric Load');
108135
if (ok) {
109-
highlight('load_user_data');
110-
highlight('normalize_to_utility_bill');
111-
highlight('utility_bill_data');
136+
highlight('load_user_data', 'Click Edit Array to import hourly load data.');
137+
highlight('normalize_to_utility_bill', 'Check Scale Electric Load Profile to Monthly Usage if you have monthly total consumption data.');
138+
highlight('utility_bill_data', 'Click Edit Values to enter the total consumption in kWh for each month.');
112139
}
113140
else {
114141
msgbox('Input page error!\nThis case does not have an Electricity Rates page. The Solar for All Calculator macro is designed to work with the PVWatts/Residential configuration.');
115142
}
116143
transp(); // clear highight
144+
show_page('Macros');
117145
}
118146

119147
function generate_pagenotes() {
148+
120149
ok = show_page('Location and Resource');
121150
if (ok) {
122151
pagenote('## Solar for All Macro Instructions ##\n\n' +
123152
'Location and Resource Page\n\n' +
124-
'1. Type the project street address or city and state in the box under Download Weather Files.\n' +
125-
'2. Click Download and Add to Library.\n' +
126-
'3. When the download finishes, review the data under Weather Data Information to verify the data.\n' +
153+
'1. Type the project street address or city and state in the box under Download Weather Files.\n\n' +
154+
'2. Click Download and Add to Library.\n\n' +
155+
'3. When the download finishes, review the data under Weather Data Information to verify the data.\n\n' +
127156
'4. Go to the System Design page.');
128157

129158
}
@@ -134,10 +163,10 @@ function generate_pagenotes() {
134163
if (ok) {
135164
pagenote('## Solar for All Macro Instructions ##\n\n' +
136165
'System Design Page\n\n' +
137-
'1. For System Nameplate Capacity, type the system size in DC kilowatts.\n' +
138-
'2. For Tilt, type the photovoltaic array tilt angle in degrees from horizontal (20 degrees is a typical value).\n' +
139-
'3. For Azimuth, type the photovoltaic array azimuth angle in degrees East of North (180 degrees, or facing south, is a typical value).\n' +
140-
'4. If you are modeling a ground-mounted or roof-mounted array that allows air to flow beneath the array, for Array Type, choose Fixed Open Rack.\n' +
166+
'1. For System Nameplate Capacity, type the system size in DC kilowatts.\n\n' +
167+
'2. For Tilt, type the photovoltaic array tilt angle in degrees from horizontal (20 degrees is a typical value).\n\n' +
168+
'3. For Azimuth, type the photovoltaic array azimuth angle in degrees East of North (180 degrees, or facing south, is a typical value).\n\n' +
169+
'4. If you are modeling a ground-mounted or roof-mounted array that allows air to flow beneath the array, for Array Type, choose Fixed Open Rack.\n\n' +
141170
'5. Go to the Electricity Rates page.');
142171
}
143172
else {
@@ -147,11 +176,11 @@ function generate_pagenotes() {
147176
if (ok) {
148177
pagenote('## Solar for All Macro Instructions ##\n\n' +
149178
'Electricity Rates Page\n\n' +
150-
'1. Click Search for Rates.\n' +
151-
'2. Type the project zip code and click Search by Zip Code, or if you know the name of the electric service provider, type a few letters of the provider name to filter the list.\n' +
152-
'3. Click the name of the electric service provider in the list, you should see a list of residential rates appear.\n' +
153-
'4. Choose the appropriate rate from the list.\n' +
154-
' If the service provider or rate is not available, you will need to enter rate data manually from the appropriate rate sheet.\n' +
179+
'1. Click Search for Rates.\n\n' +
180+
'2. Type the project zip code and click Search by Zip Code, or if you know the name of the electric service provider, type a few letters of the provider name to filter the list.\n\n' +
181+
'3. Click the name of the electric service provider in the list, you should see a list of residential rates appear.\n\n' +
182+
'4. Choose the appropriate rate from the list.\n\n' +
183+
' If the service provider or rate is not available, you will need to enter rate data manually from the appropriate rate sheet.\n\n' +
155184
'5. Go to the Electric Load page.');
156185
}
157186
else {
@@ -161,11 +190,11 @@ function generate_pagenotes() {
161190
if (ok) {
162191
pagenote('## Solar for All Macro Instructions ##\n\n' +
163192
'Electricity Load Page\n\n' +
164-
'1. Click Search for Rates.\n' +
165-
'2. Type the project zip code and click Search by Zip Code, or if you know the name of the electric service provider, type a few letters of the provider name to filter the list.\n' +
166-
'3. Click the name of the electric service provider in the list, you should see a list of residential rates appear.\n' +
167-
'4. Choose the appropriate rate from the list.\n' +
168-
' If the service provider or rate is not available, you will need to enter rate data manually from the appropriate rate sheet.\n' +
193+
'1. Click Search for Rates.\n\n' +
194+
'2. Type the project zip code and click Search by Zip Code, or if you know the name of the electric service provider, type a few letters of the provider name to filter the list.\n\n' +
195+
'3. Click the name of the electric service provider in the list, you should see a list of residential rates appear.\n\n' +
196+
'4. Choose the appropriate rate from the list.\n\n' +
197+
' If the service provider or rate is not available, you will need to enter rate data manually from the appropriate rate sheet.\n\n' +
169198
'5. Go to the Electric Load page.');
170199
}
171200
else {
@@ -191,15 +220,14 @@ if (!ok) {
191220
exit;
192221
}
193222

223+
if ( macro.highlight_inputs == true ) {
224+
highlight_inputs();
225+
}
194226

195227
if ( macro.generate_pagenotes == true ) {
196228
generate_pagenotes();
197229
}
198230

199-
if ( macro.highlight_inputs == true ) {
200-
highlight_inputs();
201-
}
202-
203231
// run simulation
204232
out('Running simulation...');
205233
sim_msg = '';

0 commit comments

Comments
 (0)