Search code examples
volttron

VOLTTRON actuator agent RPC revert not working


I have a BACnet system for HVAC controls where I am using the VOLTTRON actuator agent to write @ priority 10 in BACnet to a value of 2 which works good.

result = self.vip.rpc.call('platform.actuator', 'set_multiple_points', self.core.identity, set_multi_topic_values_master).get(timeout=20)
_log.debug(f'*** [Setter Agent INFO] *** -  set_multiple_points ON ALL VAVs WRITE SUCCESS!')

Then the system sleeps for some time period for testing purposes:

_log.debug(f'*** [Setter Agent INFO] *** -  SETTING UP GEVENT SLEEP!')
gevent.sleep(120)
_log.debug(f'*** [Setter Agent INFO] *** -  GEVENT SLEEP DONE!')

Where after the gevent sleep I am running into some issues on the revert point not working. The code below executes just fine but using a BACnet scanning tool the priority 10 value of 2 are still present on the HVAC controls, like the revert point isn't doing anything.

for device in revert_topic_devices_jci:
    response = self.vip.rpc.call('platform.actuator', 'revert_point', self.core.identity, topic_jci, self.jci_setpoint_topic).get(timeout=20)
    _log.debug(f'*** [Setter Agent INFO] *** -  REVERT POINTS ON {device} SUCCESS!')

_log.debug(f'*** [Setter Agent INFO] *** -  REVERT POINTS JCI DONE DEAL SUCCESS!')

One thing I notice is the building automation writes occupancy/unoccupancy to the HVAC controls @ BACnet priority 12. Its either ALWAYS a 1 for occupancy or a 2 for unoccupancy.

What I am trying to do with VOLTTRON is write in BACnet at priority 10 a value of 2, and then release to nothing on the revert. Could this by the revert isnt doing anything because there was nothing to revert too? I was hoping that VOLTTRON could write @ BACnet priority 10 and then just release. On BACnet scan tool I can do the same thing write @ priority 10 then release priority 10 with a priority 10 write null

Should I just be writing at priority 12 same as the building automation system so VOLTTRON can just revert back too whatever the building automation was doing?


Solution

  • I am having a good luck to revert point using set_multiple_points to None

    Something like this:

            self.jci_device_map = {
            'VMA-2-6': '27',
            'VMA-2-4': '29',
            'VMA-2-7': '30',
            'VMA-1-8': '6',
    }
    
    revert_multi_topic_values_master = []
    set_multi_topic_values_master = []
    
            for device in self.jci_device_map.values():
                topic_jci = '/'.join([self.building_topic, device])
                final_topic_jci = '/'.join([topic_jci, self.jci_setpoint_topic])
    
                # BACnet enum point for VAV occ
                # 1 == occ, 2 == unnoc
                
                # create a (topic, value) tuple and add it to our topic values
                set_multi_topic_values_master.append((final_topic_jci, self.unnoccupied_value)) # TO SET UNNOCUPIED
                revert_multi_topic_values_master.append((final_topic_jci, None)) # TO SET FOR REVERT
    
    result = self.vip.rpc.call('platform.actuator', 'set_multiple_points', self.core.identity, revert_multi_topic_values_master).get(timeout=20)