FNCS_Volttron_Bridge.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:volttron-applications 作者: VOLTTRON 项目源码 文件源码
def start(self, sender, **kwargs):
        self.vip.pubsub.subscribe(peer = 'pubsub',
                                  prefix = 'fncs/input/',
                                  #prefix = '',
                                  callback = self.onmessage).get(timeout=5)
        #Register with FNCS
        cfg = "name = {0[name]}\ntime_delta = {0[time_delta]}\nbroker = {0[broker]}\n".format(self.fncs_zpl)
        if 'values' in self.fncs_zpl.keys():
            cfg += "values"
            for x in self.fncs_zpl['values'].keys():
                cfg += "\n    {0}\n        topic = {1[topic]}\n        defualt = {1[default]}\n        type = {1[type]}\n        list = {1[list]}".format(x,self.fncs_zpl['values'][x])
        fncs.initialize(cfg)
        if not fncs.is_initialized():
            raise RuntimeError("FNCS connection failed!")
        self.publish_heartbeat()
        print(self.heartbeat_period)
        self.core.periodic(self.heartbeat_period, self.publish_heartbeat)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号