Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Revision history [back]

How to use python actor in BCVTB

Hi, I was trying to learn how to use python actor in BCVTB. So I tried to take two constants ( x and y ), pass them as variables to python actor, add them using python script and plot a graph which should be a constant line. But it seems my python actor is not able to output the addition result and give it to the plotter. I also updated the ports for python actor, wherin I take two variables. I am also attaching the screenshots of individual actors and the system xml file. Can you please tell me where my problem lies ? My python script looks like: class Main : def addition(x,y) : print x+yC:\fakepath\pythonactor.PNG(/upfiles/14972645896070884.png)(/upfiles/14972645769414122.png)(/upfiles/14972645508520555.png)

How to use python actor in BCVTB

Hi, I was trying to learn how to use python actor in BCVTB. So I tried to take two constants ( x and y ), pass them as variables to python actor, add them using python script and plot a graph which should be a constant line. But it seems my python actor is not able to output the addition result and give it to the plotter. I also updated the ports for python actor, wherin I take two variables. I am also attaching the screenshots of individual actors and the system xml file. Can you please tell me where my problem lies ? My python script looks like: class Main : def addition(x,y) : print x+y

C:\fakepath\plotter.PNG C:\fakepath\pythonactor.PNG(/upfiles/14972645896070884.png)(/upfiles/14972645769414122.png)(/upfiles/14972645508520555.png) C:\fakepath\pythonports.PNG C:\fakepath\systemxmlpage.PNG

How to use python actor in BCVTB

Hi, I was trying to learn how to use python actor in BCVTB. So I tried to take two constants ( x and y ), pass them as variables to python actor, add them using python script and plot a graph which should be a constant line. But it seems my The python actor script that I have below gives me a TypeError. I can't seem to understand why '+' is not able to output the addition result and give it to the plotter. I also updated the ports for python actor, wherin I take two variables. being recognised as an operand. I am also attaching the screenshots of individual actors and the system xml file. Can you please tell me where my problem lies ? My python script looks like: class Main : def addition(x,y) fire(self) :

if not self.input.hasToken(0) :
    print x+yreturn
t = self.input.get(0)
x = self.cons2.get(0)
y = int(t) + int(x)
self.output.broadcast(t)

But this gives me a TypeError.

C:\fakepath\plotter.PNG C:\fakepath\pythonactor.PNG C:\fakepath\pythonports.PNG C:\fakepath\systemxmlpage.PNG

How to use python actor in BCVTB

Hi, I was trying to learn how to use python actor in BCVTB. So I tried to take two constants ( x and y ), pass them as variables to python actor, add them using python script and plot a graph which should be a constant line. The python script that I have below gives me a TypeError. I can't seem to understand why '+' is not being recognised as an operand. I am also attaching the screenshots of individual actors and the system xml file. Can you please tell me where my problem lies ? My python script looks like: like:

class Main :
  def fire(self) :

:

    if not self.input.hasToken(0) :
   return
 t = self.input.get(0)
 x = self.cons2.get(0)
 y = int(t) + int(x)
 self.output.broadcast(t)

But this gives me a TypeError.

C:\fakepath\plotter.PNG C:\fakepath\pythonactor.PNG C:\fakepath\pythonports.PNG C:\fakepath\systemxmlpage.PNGC:\fakepath\plotter.PNG

C:\fakepath\pythonactor.PNG

C:\fakepath\pythonports.PNG

C:\fakepath\systemxmlpage.PNG