<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>eQuest: macro for extracting data from a sim file</TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.6000.16544" name=GENERATOR></HEAD>
<BODY>
<DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=218152616-06112007>Here's 
an Excel VBA example you may find useful.</SPAN></FONT></DIV>
<DIV><FONT face=Arial color=#0000ff size=2><SPAN class=218152616-06112007>
<P><FONT size=2>Shaun Martin LEED AP<BR>Principal<BR>Shaun Martin 
Consulting<BR>504 - 318 Homer Street<BR>Vancouver, BC V6B 2V2<BR>tel 
604-789-1095<BR>email smartin@shaunmartinconsulting.com<BR>member CAGBC, 
ASHRAE</FONT> </P></SPAN></FONT></DIV>
<DIV><FONT face=Tahoma size=2><SPAN 
class=218152616-06112007></SPAN></FONT> </DIV>
<DIV><FONT face=Tahoma size=2><SPAN class=218152616-06112007>Sub 
list_ssa_for_systems()</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Tahoma size=2><SPAN class=218152616-06112007>    
<BR>    ' macro to list system consumption and peak 
load<BR>    '         
1         
2         
3         
4         
5         
6         
7         
8         9<BR>    
'1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890<BR>    
'<BR>    '    REPORT- SS-A  SYSTEM MONTHLY 
LOADS SUMMARY 
FOR              
SYSTEM-1                        
WEATHER FILE- Vancouver BC CWEC<BR>    
'---------------------------------------------------------------------------------------------------------------------------------<BR>    
'<BR>    '<BR>    '<BR>    
'       - - - - - - - - C O O L I N G - - - - - - 
- -      - - - - - - - - H E A T I N G - - - - - - - 
-      - - - E L E C - - -<BR>    
'<BR>    
'                                             
MAXIMUM                                            
MAXIMUM         ELEC-    
MAXIMUM<BR>    '         
COOLING     TIME   DRY-  
WET-       
COOLING        
HEATING     TIME   DRY-  
WET-       
HEATING        
TRICAL       ELEC<BR>    
'          ENERGY   OF 
MAX   BULB  
BULB          
LOAD         ENERGY   OF 
MAX   BULB  
BULB          
LOAD        
ENERGY       LOAD<BR>    
'MONTH     (MBTU)   DY  HR   
TEMP  TEMP     
(KBTU/HR)         (MBTU)   
DY  HR   TEMP  TEMP     
(KBTU/HR)         
(KWH)       (KW)<BR>    ' 
...<BR>    'TOTAL     
86.978                                           
-243.864                                           
135121.<BR>    '<BR>    
'MAX                                          
186.640                                           
-200.771                   
26.850</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Tahoma size=2><SPAN 
class=218152616-06112007><BR>    <BR>    
source_file = "FINAL-CORE-proposed.SIM"<BR>    
<BR>    Close<BR>    Open source_file For Input As 
1<BR>    <BR>    zi = 5<BR>    
<BR>    ' clear sheets<BR>    
ThisWorkbook.Activate<BR>    <BR>    
Sheets("ssa_list").Select<BR>    
Cells.Clear<BR>    <BR>    
'titles<BR>    Cells(3, 1) = "system"<BR>    
Cells(3, 2) = "total cooling MBTU"<BR>    Cells(3, 3) = "total 
heating MBTU"<BR>    Cells(3, 4) = "max cooling 
KBTU/HR"<BR>    Cells(3, 5) = "max heating 
KBTU/HR"<BR>    <BR>    <BR>    ' 
read each line in the SIM 
file<BR>    <BR>    While Not 
EOF(1)<BR>    <BR>        Line 
Input #1, textline$<BR>        linenum = 
linenum + 1<BR>        
<BR>        
<BR>        textline$ = 
clean_text(textline$)<BR>               
<BR>        If InStr(1, textline$, 
"SS-A  SYSTEM MONTHLY LOADS SUMMARY", vbTextCompare) > 0 
Then<BR>            
<BR>            'found 
report<BR>            
<BR>            Cells(zi, 
1).Select<BR>            
Cells(zi, 1) = Mid(textline$, 60, 
20)<BR>            
systemactive = 
True<BR>            
<BR>            
<BR>        End 
If<BR>        
<BR>        'grab the first "TOTAL" 
line<BR>        
<BR>        If Left$(textline$, 5) = "TOTAL" 
And systemactive = True 
Then<BR>            
<BR>            tc = 
Val(Trim(Mid(textline$, 6, 
20)))<BR>            th = 
Val(Trim(Mid(textline$, 54, 
20)))<BR>            
<BR>            Cells(zi, 
2) = tc<BR>            
Cells(zi, 3) = 
th<BR>            
<BR>        End 
If<BR>        'grab the first "MAX" 
line<BR>        
<BR>        If Left$(textline$, 3) = "MAX" 
And systemactive = True 
Then<BR>            
<BR>            mc = 
Val(Trim(Mid(textline$, 40, 
20)))<BR>            mh = 
Val(Trim(Mid(textline$, 90, 
20)))<BR>            
<BR>            Cells(zi, 
4) = mc<BR>            
Cells(zi, 5) = 
mh<BR>            
systemactive = 
False<BR>            zi = 
zi + 1<BR>            
<BR>        End 
If<BR>        <BR>    
<BR>    Wend<BR>    <BR>    
Close<BR>    <BR>    zi = zi + 
1<BR>    Cells(zi, 1) = 
source_file<BR>    <BR>    
[a1].Select<BR>   <BR>End Sub<BR></SPAN></FONT></DIV></DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
  <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
  size=2>-----Original Message-----<BR><B>From:</B> BLDG-SIM@gard.com 
  [mailto:BLDG-SIM@gard.com]<B>On Behalf Of </B>McCready, 
  Jessica<BR><B>Sent:</B> November 2, 2007 2:35 PM<BR><B>To:</B> 
  BLDG-SIM@gard.com<BR><B>Subject:</B> [BLDG-SIM] eQuest: macro for extracting 
  data from a sim file<BR><BR></FONT></DIV><!-- Converted from text/rtf format -->
  <P><FONT face="Times New Roman">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...</FONT></P>
  <P><FONT face="Times New Roman">Thanks, Jessica</FONT> </P><BR>
  <P><FONT face=Arial size=2>Jessica E. McCready</FONT> <BR><FONT face=Arial 
  size=2>Energy Engineer</FONT> <BR><FONT face=Arial size=2>KEMA Services 
  Inc.</FONT> <BR><FONT face=Arial size=2>492 Ninth Street, Suite 220</FONT> 
  <BR><FONT face=Arial size=2>Oakland, CA 94607</FONT><FONT face=Arial size=1> 
  </FONT><BR><FONT face=Arial size=2>T 510-891-0446</FONT> <BR><FONT face=Arial 
  size=2>F 510-891-0440</FONT> <BR><FONT face=Arial 
  size=2>jessica.mccready@kema.com</FONT> <BR><FONT face=Arial size=2>Please 
  visit our website </FONT><A href="file://www.kema.com"><U><FONT face=Arial 
  color=#0000ff size=2>www.kema.com</FONT></U></A> </P><PRE>
==================
You received this e-mail because you are subscribed 
to the BLDG-SIM@GARD.COM mailing list.  To unsubscribe 
from this mailing list send a blank message to 
BLDG-SIM-UNSUBSCRIBE@GARD.COM
</PRE></BLOCKQUOTE><PRE>

===========================
You received this e-mail because you are subscribed 
to the BLDG-SIM@GARD.COM mailing list.  To unsubscribe 
from this mailing list send a blank message to 
BLDG-SIM-UNSUBSCRIBE@GARD.COM
</PRE></BODY></HTML>