MultiEdit & Regular Expressions
Topic: Using the MultiEdit text editor and regular expressions to clean up DOE2 .inp files generated by the eQuest wizard.
MultiEdit
There are a number of adequate text editors out there -- many of them are free. My favorite text editor is not free, but IMHO MultiEdit stands a professional cut above the freeware pack. A partial list of features that makes it particularly suitable to working with DOE2 files is as follows:
- Multiple tabbed windows, allowing rapid file switching
- Remembered windows, from the last time the program was open
- Multiple sessions. Most useful if you wear additional hats like 'CAD Guru' or 'Systems Integrator' -- each named session recalls a group of files in exactly the same window state as when last worked upon.
- Split windows, permitting two different parts of the same file to be edited
- Line numbers and a handy 'go to line number' function
- Scrolling side-by-side on-screen file comparisons, highlighting the location and nature of differences between files
- An undo buffer that will take you back to the beginning of an editing session, even after a massively botched search and replacement.
- Backup files saved in a common directory on the local hard drive, off-network. This has saved many hours of rework more than once in my brief career so far with eQuest.
- ...more features to be listed as time permits
- And last but not least, search and replacements using 'regular expressions'
Regular Expression Examples
Regular expressions enable powerful search and replacements in a single operation that would otherwise require many operations using 'literal' search and replace strings. The syntax is necessarily cryptic for utilitarian compactness; however comprehensive free learning resources are just a google away, such as this tutorial site.
Expect a bit of a learning curve, but once you've accomplished a search and replacement in a single line that would've taken a dozen or more literal iterations, there's no going back.
Further, regular expression syntax is applicable to scripting utilities such as Perl and SED, meaning that once your approach to search and replacements has become standardized, it can be batched and run without ever opening the input files -- when I get to this point with .inp and .sim files I'll be sure to post some examples.
First and foremost, make backup files religiously when working with eQuest in general, and in particular do not fail to do so before tackling a relatively risky editing task such as this -- it's always easier (and better for your social life) to restart from the last waypoint than to rebuild a disaster.
Schedules
REMINDER: Make sure you change the type of "Regular Expression" from Perl to Unix on the "Search and Replace" Option tab.
Following are MultiEdit search and replace strings using regular expressions applicable to DOE2 schedules; be sure to uncheck the radio button entitled 'Search All Windows' (refer to screenshot below) until you're sure you know what you're doing.
Regular expressions enable powerful search and replacements in a single operation that would otherwise require many operations using 'literal' search and replace strings. The syntax is necessarily cryptic for utilitarian compactness; however comprehensive free learning resources are just a google away, such as this tutorial site.
Expect a bit of a learning curve, but once you've accomplished a search and replacement in a single line that would've taken a dozen or more literal iterations, there's no going back.
Further, regular expression syntax is applicable to scripting utilities such as Perl and SED, meaning that once your approach to search and replacements has become standardized, it can be batched and run without ever opening the input files -- when I get to this point with .inp and .sim files I'll be sure to post some examples.
First and foremost, make backup files religiously when working with eQuest in general, and in particular do not fail to do so before tackling a relatively risky editing task such as this -- it's always easier (and better for your social life) to restart from the last waypoint than to rebuild a disaster.
Schedules
REMINDER: Make sure you change the type of "Regular Expression" from Perl to Unix on the "Search and Replace" Option tab.
Following are MultiEdit search and replace strings using regular expressions applicable to DOE2 schedules; be sure to uncheck the radio button entitled 'Search All Windows' (refer to screenshot below) until you're sure you know what you're doing.
- System Fan Schedules: Replace all auto-generated system fan schedules with a single fan schedule named 'EMS Fan Sch'
- Search String: (")S.* Fan Sch
- Replace String: \0EMS Fan Sch
- System Cooling Schedules: Replace all auto-generated system cooling schedules with a single cooling schedule named 'EMS Cool Sch'
- Search String: (")S.* Cool Sch
- Replace String: \0EMS Cool Sch
- System Heating Schedules: Replace all auto-generated system heating schedules with a single heating schedule named 'EMS Heat Sch'
- Search String: (")S.* Heat Sch
- Replace String: \0EMS Heat Sch
- Infiltration Schedules: Replace all auto-generated perimeter infiltration schedules with a single infiltration schedule named 'EMS P-Inf Sch'
- Search String: (")Z.* P-Inf Sch
- Replace String: \0EMS P-Inf Sch
- Infiltration Schedules: Replace all auto-generated core infiltration schedules with a single infiltration schedule named 'EMS C-Inf Sch'
- Search String: (")Z.* C-Inf Sch
- Replace String: \0EMS C-Inf Sch
- Building Occupancy Schedules: Replace all auto-generated building occupancy schedules with a single building occupancy schedule named 'EMS Occup Sch'
- Search String: (")E.* Bldg Occup Sch
- Replace String: \0EMS Occup Sch
- Building Office Equipment Schedules: Replace all auto-generated office equipment schedules with a single office equipment schedule named 'EMS OffEq Sch'
- Search String: (")E.* Bldg OffEq Sch
- Replace String: \0EMS OffEq Sch
- Building Inside Lighting Schedules: Replace all auto-generated inside lighting schedules with a single inside lighting schedule named 'EMS InsLt Sch'
- Search String: (")E.* Bldg InsLt Sch
- Replace String: \0EMS InsLt Sch
- Building Cooking Schedules: Replace all auto-generated cooking schedules with a single cooking schedule named 'EMS Cook Sch'
- Search String: (")E.* Bldg Cook Sch
- Replace String: \0EMS Cook Sch
- Exterior Lighting Schedules (same as literal): Replace the string 'Ext Lighting Sch' with the string 'EMS Ext Lighting Sch'
- Search String: "Ext Lighting Sch
- Replace String: "EMS Ext Lighting Sch
- Domestic Hot Water Schedules (same as literal): Replace the string 'DHW Eqp NRes Sch' with the string 'EMS DHW Eqp NRes Sch'
- Search String: "DHW Eqp NRes Sch
- Replace String: "EMS DHW Eqp NRes Sch
Envelope
Following are MultiEdit search and replace strings using regular expressions applicable to DOE2 envelope components; be sure to uncheck the radio button entitled 'Search All Windows' (refer to screenshot below) until you're sure you know what you're doing.
- Exterior Walls: Replace all auto-generated exterior wall constructions with a single construction named 'Exterior Wall Construction'
- Search String: = "E.{1,4} EWall Construction"
- Replace String: = "Exterior Wall Construction"
- Roofs: Replace all auto-generated roof constructions with a single construction named 'Exterior Roof Construction'
- Search String: = "E.{1,4} Roof Construction"
- Replace String: = "Exterior Roof Construction"
- Windows: Replace auto-generated 'Window Type #1 GT' glass types in all shells with a single glass type named 'Exterior Glass Type #1'
- Search String: = "E.{1,4} Window Type \#1 GT"
- Replace String: = "Exterior Glass Type \#1"
- Window Frames & Spacers: Eliminate frames and install insulated spacers on all 'Exterior Glass Type' permutations
- Search String: ("Exterior Glass Type \#.*$).*FRAME-WIDTH =.*$
- Replace String: \0$ SPACER-TYPE = INSULATED
The following MultiEdit search and replace strings using regular expressions are applicable to DOE2 systems, loops and equipment; be sure to uncheck the radio button entitled 'Search All Windows' (refer to screenshot below) until you're sure you know what you're doing.
- Hot Water Loop: Replace assignments to the HW-LOOP keyword with 'Hot Water Loop'; note leading space to prevent matching the DHW-LOOP keyword.
- Search String: ( HW-LOOP *= ).*$
- Replace String: \0"Hot Water Loop"
A very handy tool for learning regular expressions is RegExBuddy, available from the author's site for a nominal fee. MultiEdit also includes some regular expression help built into the search and replace dialog box; click the left-arrows to the right of the search and replace fields when the regular expression radio button is selected:
1 comment:
Brandon I have been enjoying your posts both here and on the BLDG_SIM mail feed. I use eQuest Daily and I have been in a constant pursuit of streamlining redundant tasks from day one of using it. I haven't worked with SED and AWK yet but I made use of multiple search and replace programs and text editors. One that has become quite useful is:
Multiple File Search Replace.
http://www.internet-soft.com/replace.htm
I plan to look at the SED coding included here because data extraction from the .sim files is time intensive and cumbersome with out some level of automation. Keep posting!
Post a Comment