VOLTTRON RPC调用机制

时间:2016-07-11 08:08:09

标签: volttron

我阅读了VOLTTRON的文档,我仍然怀疑与伏特通中执行器代理的pubsub机制相关的RPC机制。

例如,我有一个设备主题:" campus / building / unit"我会在星期一下午5点到6点之间将设备预留一小时。 那我该如何为这个事件运行我的代码呢? 我是否需要订阅执行器代理中的某些主题以捕获事件或者我是否需要定期尝试通过rpc使用设定值并查看如果未抛出异常则我们在设备上拥有我们的独占锁定因此现在我们可以在设备上调用getpoint / setpoint吗?

1 个答案:

答案 0 :(得分:2)

When a reserved block of time for a device starts the Actuator Agent will start publishing that fact on the pubsub.

The topic used is

devices/actuators/schedule/announce/<full device path>

or in your case

devices/actuators/schedule/announce/campus/building/unit

The publish has no message and a header with the following format:

{
    'requesterID': <Agent with access>,
    'taskID': <Task associated with the time slot>
    'window': <Seconds remaining in the time slot>
}

(If the fact that this is all in the header seems weird it's because this hearkens back to the VOLTTRON Lite days where we were still deciding what belonged in the header and what went in the message.)

Ideally an agent would schedule a block of time then subscribe to the announce topic. The handler for that topic would trigger the start of activity during the allotted block of time.

It's important to remember that the Actuator Agent will republish the same information with an updated window value at set intervals. (By default this is once a minute and is configurable) You can use the window value to trigger actions over the course of the allotted block of time.

相关问题