Question-and-Answer Resource for the Building Energy Modeling Community
Get s tarted with the Help page
Ask Your Question
1

Swap construction set by command line interface

asked 2019-03-05 07:53:31 -0500

Eyal zilber gravatar image

updated 2019-03-05 10:07:48 -0500

Hello, I want to simulate several cases of external wall thickness change. I decided to use the "Swap Construction In Construction Set" measure using the workflow https://github.com/UnmetHours/openstu....

Hence, I made several construction sets with changed material width, as can be seen below. The problem is that I cannot understand what is the variable of which the measure is executed. while entering to the measure.rb file no coherent data regarding this issue is obtained.

I try to run this code: with "*new_construction * as variable

cons = ["concrete0.2", "concrete0.3", "concrete0.4"].

**new_construction**.each **do** |con|
  run_name = "**new_construction**_#{new_construction.to_s.delete(".")}"
  **new_construction** = make_cons_change(**con**)
  makeOSW(run_name, example_osm_filepath, example_epw_filepath, [**new_construction**, add_hourly_meters], [], [os_results])
end

I get the error:

"undefined local variable or method `new_construction' for main:Object"

What is the correct way to assign variable into this code? Thanks

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-03-05 10:19:05 -0500

You need to iterate over your cons array instead of **new_construction**

Also, it is best practice to use snake_case for variable names and avoid special characters. **new_construction** should just be new_construction.

The new code should look like:

cons = ['concrete0.2', 'concrete0.3', 'concrete0.4']
cons.each do |con|
  run_name = "new_construction_#{con.to_s.delete('.')}"
  new_construction = make_cons_change(con)
  makeOSW(run_name, example_osm_filepath, example_epw_filepath, [new_construction, add_hourly_meters], [], [os_results])
end
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

 

Question Tools

1 follower

Stats

Asked: 2019-03-05 07:53:31 -0500

Seen: 50 times

Last updated: Mar 05 '19