energyplus 0.1.1 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -11,3 +11,5 @@ require 'energyplus/SlabGtpFile'
11
11
  require 'energyplus/SlabIdfFile'
12
12
  require 'energyplus/StatFile'
13
13
  require 'energyplus/version'
14
+ require 'energyplus/WaterMains'
15
+
@@ -0,0 +1,70 @@
1
+ ######################################################################
2
+ # Copyright (c) 2008-2013, Alliance for Sustainable Energy.
3
+ # All rights reserved.
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+ ######################################################################
19
+
20
+ module EnergyPlus
21
+ class IdfText
22
+ def initialize(path)
23
+ @path = path
24
+ @lines = []
25
+ if @path.exist?
26
+ File.open(@path) do |f|
27
+ while line = f.gets
28
+ @lines << line.chomp
29
+ end
30
+ end
31
+ end
32
+ end
33
+
34
+ def objects
35
+ objects = []
36
+ object_fields = []
37
+ object_type = ''
38
+ inobject = false
39
+ object_comment = nil
40
+ @lines.each_index do |i|
41
+ if not inobject and @lines[i] =~ /^\s*\w/
42
+ object_fields = []
43
+ inobject = true
44
+ object_type = @lines[i]
45
+ if @lines[i-1] =~ /^\s*!/
46
+ object_comment = @lines[i-1]
47
+ end
48
+ elsif inobject and @lines[i] =~ /^[^!]*;/
49
+ object_fields << @lines[i]
50
+ inobject = false
51
+ objects << IdfObject.new(object_type,object_fields,object_comment)
52
+ elsif inobject
53
+ object_fields << @lines[i]
54
+ else
55
+ end
56
+ end
57
+ return objects
58
+ end
59
+
60
+ def findObjectByComment(comment)
61
+ comment = Regexp.new(comment)
62
+ objects().each do |object|
63
+ if object.comment =~ comment
64
+ return object
65
+ end
66
+ end
67
+ return nil
68
+ end
69
+ end
70
+ end #module
@@ -0,0 +1,70 @@
1
+ ######################################################################
2
+ # Copyright (c) 2008-2013, Alliance for Sustainable Energy.
3
+ # All rights reserved.
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
+ ######################################################################
19
+
20
+ module EnergyPlus
21
+
22
+ class WaterMainsFile
23
+ require 'pathname'
24
+
25
+ attr_accessor :valid
26
+ attr_accessor :ave_outdoor_db_t
27
+ attr_accessor :max_diff_outdoor_db_t
28
+
29
+ def initialize
30
+ @ave_outdoor_db_t = -9999
31
+ @max_diff_outdoor_db_t = -9999
32
+ end
33
+
34
+ def valid?
35
+ if @ave_outdoor_db_t != -9999 and @max_diff_outdoor_db_t != -9999
36
+ result = true
37
+ else
38
+ result = false
39
+ end
40
+ end
41
+
42
+ def idf_snippet
43
+ result = nil
44
+
45
+ if valid?
46
+ result = "Site:WaterMainsTemperature,\n"
47
+ result += " CORRELATION, !- Calculation Method\n"
48
+ result += " , !- Temperature Schedule Name\n"
49
+ result += " #{@ave_outdoor_db_t}, !- Annual Average Outdoor Air Temperature {C}\n"
50
+ result += " #{@max_diff_outdoor_db_t}; !- Maximum Difference In Monthly Average Outdoor Air Temperatures {deltaC}\n"
51
+ end
52
+
53
+ return result
54
+ end
55
+
56
+ def write_idf_snippet(filename)
57
+ if valid?
58
+ File.delete(filename) if File.exists?(filename)
59
+ File.open(filename, 'w') do |fl|
60
+ #add version identifier to file
61
+ fl << "\nVersion,\n 7.1; ! Version Identifier \n\n"
62
+ fl << idf_snippet
63
+ end
64
+ else
65
+ puts "[WaterMains] ERROR ****** No Temperatures #{filename}"
66
+ end
67
+ end
68
+ end
69
+
70
+ end #module
@@ -18,5 +18,5 @@
18
18
  ######################################################################
19
19
 
20
20
  module EnergyPlus
21
- VERSION = "0.1.1"
21
+ VERSION = "0.1.2"
22
22
  end
metadata CHANGED
@@ -1,46 +1,55 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: energyplus
3
- version: !ruby/object:Gem::Version
4
- version: 0.1.1
3
+ version: !ruby/object:Gem::Version
4
+ hash: 31
5
5
  prerelease:
6
+ segments:
7
+ - 0
8
+ - 1
9
+ - 2
10
+ version: 0.1.2
6
11
  platform: ruby
7
- authors:
12
+ authors:
8
13
  - Daniel Macumber
9
14
  - Nicholas Long
10
15
  - Kyle Benne
11
16
  autorequire:
12
17
  bindir: bin
13
18
  cert_chain: []
14
- date: 2013-02-08 00:00:00.000000000 Z
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
19
+
20
+ date: 2013-02-08 00:00:00 -07:00
21
+ default_executable:
22
+ dependencies:
23
+ - !ruby/object:Gem::Dependency
17
24
  name: builder
18
- requirement: !ruby/object:Gem::Requirement
19
- none: false
20
- requirements:
21
- - - ! '>='
22
- - !ruby/object:Gem::Version
23
- version: '0'
24
- type: :runtime
25
25
  prerelease: false
26
- version_requirements: !ruby/object:Gem::Requirement
26
+ requirement: &id001 !ruby/object:Gem::Requirement
27
27
  none: false
28
- requirements:
29
- - - ! '>='
30
- - !ruby/object:Gem::Version
31
- version: '0'
28
+ requirements:
29
+ - - ">="
30
+ - !ruby/object:Gem::Version
31
+ hash: 3
32
+ segments:
33
+ - 0
34
+ version: "0"
35
+ type: :runtime
36
+ version_requirements: *id001
32
37
  description: Classes for reading and writing various EnergyPlus files
33
38
  email: Nicholas.Long@nrel.gov
34
39
  executables: []
40
+
35
41
  extensions: []
42
+
36
43
  extra_rdoc_files: []
37
- files:
44
+
45
+ files:
38
46
  - lib/energyplus/DDYFile.rb
39
47
  - lib/energyplus/EpErrFile.rb
40
48
  - lib/energyplus/EpImfFile.rb
41
49
  - lib/energyplus/EpwFile.rb
42
50
  - lib/energyplus/EsoFile.rb
43
51
  - lib/energyplus/IdfObject.rb
52
+ - lib/energyplus/IdfText.rb
44
53
  - lib/energyplus/KmlFile.rb
45
54
  - lib/energyplus/ResultsLog.rb
46
55
  - lib/energyplus/SchedulesCSV.rb
@@ -48,30 +57,41 @@ files:
48
57
  - lib/energyplus/SlabIdfFile.rb
49
58
  - lib/energyplus/StatFile.rb
50
59
  - lib/energyplus/version.rb
60
+ - lib/energyplus/WaterMains.rb
51
61
  - lib/energyplus.rb
62
+ has_rdoc: true
52
63
  homepage: http://www.energyplus.gov
53
- licenses:
64
+ licenses:
54
65
  - LGPL
55
66
  post_install_message:
56
67
  rdoc_options: []
57
- require_paths:
68
+
69
+ require_paths:
58
70
  - lib
59
- required_ruby_version: !ruby/object:Gem::Requirement
71
+ required_ruby_version: !ruby/object:Gem::Requirement
60
72
  none: false
61
- requirements:
62
- - - ! '>='
63
- - !ruby/object:Gem::Version
64
- version: '0'
65
- required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ hash: 3
77
+ segments:
78
+ - 0
79
+ version: "0"
80
+ required_rubygems_version: !ruby/object:Gem::Requirement
66
81
  none: false
67
- requirements:
68
- - - ! '>='
69
- - !ruby/object:Gem::Version
70
- version: '0'
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ hash: 3
86
+ segments:
87
+ - 0
88
+ version: "0"
71
89
  requirements: []
90
+
72
91
  rubyforge_project:
73
- rubygems_version: 1.8.23
92
+ rubygems_version: 1.6.2
74
93
  signing_key:
75
94
  specification_version: 3
76
95
  summary: Classes for reading and writing various EnergyPlus files
77
96
  test_files: []
97
+