[BLDG-SIM] eQuest: macro for extracting data from a sim file
Shaun Martin
smartin at shaunmartinconsulting.com
Tue Nov 6 11:23:22 PST 2007
eQuest: macro for extracting data from a sim fileHere's an Excel VBA example
you may find useful.
Shaun Martin LEED AP
Principal
Shaun Martin Consulting
504 - 318 Homer Street
Vancouver, BC V6B 2V2
tel 604-789-1095
email smartin at shaunmartinconsulting.com
member CAGBC, ASHRAE
Sub list_ssa_for_systems()
' macro to list system consumption and peak load
' 1 2 3 4 5 6 7
8 9
'12345678901234567890123456789012345678901234567890123456789012345678901
23456789012345678901234567890
'
' REPORT- SS-A SYSTEM MONTHLY LOADS SUMMARY FOR
SYSTEM-1 WEATHER FILE- Vancouver BC CWEC
'-----------------------------------------------------------------------
----------------------------------------------------------
'
'
'
' - - - - - - - - C O O L I N
G - - - - - - - - - - - - - - - - H E A T I N
G - - - - - - - - - - - E L E C - - -
'
' MAXIMUM
MAXIMUM ELEC- MAXIMUM
' COOLING TIME DRY- WET- COOLING HEATING
TIME DRY- WET- HEATING TRICAL ELEC
' ENERGY OF MAX BULB BULB LOAD ENERGY
OF MAX BULB BULB LOAD ENERGY LOAD
'MONTH (MBTU) DY HR TEMP TEMP (KBTU/HR) (MBTU)
DY HR TEMP TEMP (KBTU/HR) (KWH) (KW)
' ...
'TOTAL 86.978 -243.864
135121.
'
'MAX
86.640 -200.771
26.850
source_file = "FINAL-CORE-proposed.SIM"
Close
Open source_file For Input As 1
zi = 5
' clear sheets
ThisWorkbook.Activate
Sheets("ssa_list").Select
Cells.Clear
'titles
Cells(3, 1) = "system"
Cells(3, 2) = "total cooling MBTU"
Cells(3, 3) = "total heating MBTU"
Cells(3, 4) = "max cooling KBTU/HR"
Cells(3, 5) = "max heating KBTU/HR"
' read each line in the SIM file
While Not EOF(1)
Line Input #1, textline$
linenum = linenum + 1
textline$ = clean_text(textline$)
If InStr(1, textline$, "SS-A SYSTEM MONTHLY LOADS SUMMARY",
vbTextCompare) > 0 Then
'found report
Cells(zi, 1).Select
Cells(zi, 1) = Mid(textline$, 60, 20)
systemactive = True
End If
'grab the first "TOTAL" line
If Left$(textline$, 5) = "TOTAL" And systemactive = True Then
tc = Val(Trim(Mid(textline$, 6, 20)))
th = Val(Trim(Mid(textline$, 54, 20)))
Cells(zi, 2) = tc
Cells(zi, 3) = th
End If
'grab the first "MAX" line
If Left$(textline$, 3) = "MAX" And systemactive = True Then
mc = Val(Trim(Mid(textline$, 40, 20)))
mh = Val(Trim(Mid(textline$, 90, 20)))
Cells(zi, 4) = mc
Cells(zi, 5) = mh
systemactive = False
zi = zi + 1
End If
Wend
Close
zi = zi + 1
Cells(zi, 1) = source_file
[a1].Select
End Sub
-----Original Message-----
From: BLDG-SIM at gard.com [mailto:BLDG-SIM at gard.com]On Behalf Of McCready,
Jessica
Sent: November 2, 2007 2:35 PM
To: BLDG-SIM at gard.com
Subject: [BLDG-SIM] eQuest: macro for extracting data from a sim file
I need to extract data from a sim file. I have over 1600 runs to make and
need only one piece of data from the SIM file. Has anyone put together a
macro like this before? Examples...
Thanks, Jessica
Jessica E. McCready
Energy Engineer
KEMA Services Inc.
492 Ninth Street, Suite 220
Oakland, CA 94607
T 510-891-0446
F 510-891-0440
jessica.mccready at kema.com
Please visit our website www.kema.com
==================
You received this e-mail because you are subscribed
to the BLDG-SIM at GARD.COM mailing list. To unsubscribe
from this mailing list send a blank message to
BLDG-SIM-UNSUBSCRIBE at GARD.COM
======================================================
You received this e-mail because you are subscribed
to the BLDG-SIM at GARD.COM mailing list. To unsubscribe
from this mailing list send a blank message to
BLDG-SIM-UNSUBSCRIBE at GARD.COM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.onebuilding.org/pipermail/bldg-sim-onebuilding.org/attachments/20071106/74c4477f/attachment-0002.htm>
More information about the Bldg-sim
mailing list