There is a method in openstudio-standards-gem
named space_type_apply_internal_loads
. This is used in our Space Type and Construction Set Wizard measure. That measure now uses code in the openstudio-extension-gem
which also ships with OpenStudio along side the standards gem.
The extension gem calls the method under a wizard
method.
https://github.com/NREL/openstudio-extension-gem/blob/develop/lib/openstudio/extension/core/os_lib_model_generation.rb#L3148
Not that for this to work on a space type, you need to first tag the space type so the gem recognized the intended building type and space type and the target standard. That is done here right after the space type is made
https://github.com/NREL/openstudio-extension-gem/blob/develop/lib/openstudio/extension/core/os_lib_model_generation.rb#L3140-L3141
space_type_apply_internal_loads
adds internal loads but not the schedules, shortly after the prior method space_type_apply_internal_load_schedules
is called, which adds the schedules.
https://github.com/NREL/openstudio-extension-gem/blob/develop/lib/openstudio/extension/core/os_lib_model_generation.rb#L3154
Both methods have a series of bools allowing you to control what types of interior loads this is applied to. This gives you the ability to selectively apply loads and schedules. You could for example not touch plug loads, use 90.1 2004 for other loads, but 2013 for lighting.
You can see more detailed documentation on space_type_apply_internal_loads
in the standards gem repository. Link to the method is below
https://github.com/NREL/openstudio-standards/blob/master/lib/openstudio-standards/standards/Standards.SpaceType.rb#L63-L79
If you want a very simple example instead that doesn't use the standards gem, here is a measure that takes an existing electric equipment definition, schedule, and space already in the model and creates an electric equipment instance of that definition in the space. The link below points to 5 lines that add the object. This could easily be extended to make a new definition instead of expecting it to already be in the model, with one or more arguments to define the new electric equipment definition. My use case here was to pre-load elevators descriptions in th model but have the modeler hook them up as needed.
https://github.com/DavidGoldwasser/PAT_projects/blob/master/PAT_SDDC_PrimarySchool/measures/add_electric_equipment_instance_to_space/measure.rb#L87-L91