Changing space electrical load value

Hi all,

I am new to Dynamo and now stuck at dead end, hope you guys can help me.
The idea what I’m trying to do is to change Specified Lighting Value in Space parameters (electrical loads). I have measured actual values in real building and now want to automatically load it to Revit model from external source i.e. Excel. And after that to perform energy analysis with loaded data.
The problem is that I can manually change specified lighting or power load, but I can’t find a way to change it through Dynamo.
What I was able to do is to use GetParemeterValueByName, and the values are correct to the model, but when I try to change it, error “The parameter is read-only” occurs. I searched a lot, but was unable to find a solution, also my knowledge at Dynamo is really limited at the beginning.

Any comments are appreciated!

hi
this parameter has a calculated value and you cant change it by entry values, it depend on the electrical loads and areas …etc.

Thanks for answering!

This parameter can be changed manually in this section:
image

Values can be chosen from the followings:
By type - as you mentioned, it depends on space type
Specified - changing the value, after changing it appears in energy analysis report as well
Actual - depends on energy consumers in that area and are calculated

So the challenge for me is to find a way to change specified values not manually, but automatically as much as possible.

When I was searching for answer I saw some quite similar problems. In other cases when Revit database had few parameters named the same name, maybe there is another parameter like Electric loads which can’t be changed? But I can’t find a way to check it…

you can change it if it is specified
parameter names :
Specified Lighting Load
Specified Power Load

but if it is actual it is related to the actual load within the space as i mention before

Thanks!

You were right, I changed this parameter to specified in spaces, but there was one space left with By type parameter and of course, I was trying the code with this space… My bad…

Concerning the next question which arises from this problem, is there any way with Dynamo or Python to set Electric loads parameter to all spaces from By type (default) to Specified?

Hello
here an example with Python

import clr
import sys
import System
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
uiapp = DocumentManager.Instance.CurrentUIApplication
uidoc = uiapp.ActiveUIDocument
app = uiapp.Application
sdkNumber = int(app.VersionNumber)

def convertWatt(value):
    if sdkNumber < 2021:
        UIunit = doc.GetUnits().GetFormatOptions(UnitType.UT_Electrical_Wattage).DisplayUnits
    else:
        UIunit = doc.GetUnits().GetFormatOptions(SpecTypeId.ElectricalPower).GetUnitTypeId()
    convertTo = UnitUtils.ConvertToInternalUnits(value, UIunit)
    return convertTo    
	
toList = lambda x : x if hasattr(x, '__iter__') else [x]	
lstSpace = toList(UnwrapElement(IN[0]))	
powerValue = convertWatt(IN[1])	
	
fecSpace = FilteredElementCollector(doc).OfCategory(BuiltInCategory.OST_MEPSpaces).WhereElementIsNotElementType().ToElements()
TransactionManager.Instance.EnsureInTransaction(doc)
for _space in lstSpace:
	_space.LightingLoadUnit = BaseLoadOn.kUseEnteredLoad
	para = _space.get_Parameter(BuiltInParameter.ROOM_LIGHTING_LOAD_UNITS_PARAM)
	para.Set(1)
	paraload = _space.get_Parameter(BuiltInParameter.ROOM_DESIGN_LIGHTING_LOAD_PARAM)
	paraload.Set(powerValue) 


TransactionManager.Instance.TransactionTaskDone
OUT = lstSpace
1 Like