In a Python volttron agent, I get an error on the function return when trying to load a config file through def ahutrimrespond(config_path, **kwargs)
. TypeError: unsupported operand type(s) for ** or pow(): 'int' and 'dict'
def ahutrimrespond(config_path, **kwargs):
"""
Parses the Agent configuration and returns an instance of
the agent created using that configuration.
:param config_path: Path to a configuration file.
:type config_path: str
:returns: Ahutrimrespond
:rtype: Ahutrimrespond
"""
try:
config = utils.load_config(config_path)
except Exception:
config = {}
if not config:
_log.info("Using Agent defaults for starting configuration.")
# setpoints for AHU trim respond agent
ahu_static_sp_start = float(config.get('ahu_static_sp_start', 1))
ahu_static_sp_min = float(config.get('ahu_static_sp_min', 1))
ahu_static_sp_max = float(config.get('ahu_static_sp_max', 1))
static_sp_trim = float(config.get('static_sp_trim', 1))
static_sp_increase = float(config.get('static_sp_increase', 1))
time_delay_startup = float(config.get('time_delay_startup', 1))
time_delay_normal = int(config.get('time_delay_normal', 1))
ignore_requests = int(config.get('ignore_requests', 1))
num_of_vav_above_hi_stp = int(config.get('num_of_vav_above_hi_stp', 1))
high_vav_dpr_stp = int(config.get('high_vav_dpr_stp', 1))
return Ahutrimrespond(ahu_static_sp_start, ahu_static_sp_min, ahu_static_sp_max, static_sp_trim, static_sp_increase, time_delay_startup, time_delay_normal, ignore_requests, num_of_vav_above_hi_stp, high_vav_dpr_stp **kwargs)
This is the config file below and entire agent script on a gist. Any newbie tips greatly appreciated.
{
# setpoints for AHU trim respond agent
"ahu_static_sp_start": 0.1, # "WC - AHU duct pressure start
"ahu_static_sp_min": 0.15, # "WC - AHU duct pressure start min
"ahu_static_sp_max": 1.5, # "WC - AHU duct pressure start max
"static_sp_trim": -0.04, # "WC - AHU duct pressure setpoint trim amount
"static_sp_increase": 0.06, # "WC - AHU duct pressure setpoint increase amount
"time_delay_startup": 300, # seconds - wait time when agent is started before control
"time_delay_normal": 120, # - seconds time delay between check of VAV dpr positions & trim respond
"ignore_requests": 1, # - high end VAVs to discard immediately before trim respond calc
"num_of_vav_above_hi_stp": 2, # - of VAVs above high_vav_dpr_stp to req to trim or resp AHU duct pressure stp
"high_vav_dpr_stp": 90 # % - setpoint for num_of_vav_above_hi_stp to raise or lower duct pressure
}
This is the entire error trace back.
The OP forgot a comma between an argument and
**kwargs
, so it is interpreted ashigh_vav_dpr_stp
to the power ofkwargs
, which doesn't work.kwargs
is a dictionary.