Customized Add Photovoltaics User Script

asked 2022-07-22 12:22:57 -0600

Saulius's avatar

updated 2023-04-22 08:12:07 -0600

I use Sketchup OpenStudio Plug-in for BIPV system energy production estimates. Most simulations consist of BIPV surfaces on multiple building facades. Therefore it would be very handy to be able to add customs names to the "Choose Electric Load Center Distribution." drop down list. This is part of the "Add Photovoltaics" User Script – Extensions->OpenStudio User Scripts->Alter or Add Model Elements->Add Photovoltaics. This way after simulation is done, in DView I could easier read the timeseries graphs with the legend containing the custom names instead of "ELECTRIC LOAD CENTER INVERTER SIMPLE 1."

I have located the "Add Photovoltaics" ruby script code here C:\Users\%userprofile%\AppData\Roaming\SketchUp\SketchUp 2019\SketchUp\Plugins\openstudio\user_scripts\Alter or Add Model Elements

It would seem to me that I could simply add another field into the "Add Photovoltaics" User Script and use this field to append the StringVector (elcd_names) with my own custom string value (mock-up)?

This is the part of the "Add Photovoltaics" User Ruby Script that deals with the "Choose Electric Load Center Distribution." drop down list:

def arguments(model)
result = OpenStudio::Ruleset::OSArgumentVector.new

elcd_hash = Hash.new
model.getElectricLoadCenterDistributions.each do |elcd|
  elcd_hash[elcd.name.get] = elcd
end

elcd_handles = OpenStudio::StringVector.new
elcd_names = OpenStudio::StringVector.new

elcd_handles << OpenStudio::toUUID("").to_s
elcd_names << "*New Electric Load Center Distribution*"

elcd_hash.sort.map do |elcd_name, elcd|
  elcd_handles << elcd.handle.to_s
  elcd_names << elcd_name
end

elcd = OpenStudio::Ruleset::OSArgument::makeChoiceArgument("elcd", elcd_handles, elcd_names, true)
elcd.setDisplayName("Choose Electric Load Center Distribution.")
elcd.setDefaultValue("*New Electric Load Center Distribution*")
result << elcd
edit retag flag offensive close merge delete

Comments

I have adapted the original "Add_Photovoltaics.rb" user script, so that it only creates Electric Load Center Distribution (ELCD). Sadly have not yet figured out how to add custom ELCD names. Therefore advise on how to achieve that would be greatly appreciated. The User Script is available on GitHub

Saulius's avatar Saulius  ( 2022-08-05 08:12:27 -0600 )edit