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

Revision history [back]

click to hide/show revision 1
initial version

BCVTB Data Conversion

Hello All,

I am making a simple PID controller in BCVTB using EnergyPlus. In my model, I have a Simulator actor(called HouseModel in the image) that connects to EnergyPlus (v9.0.1). It takes setpoint temperature for cooling an heating thermostat as inputs array (for example, [16; 20]). image description

In the SystemCommnad actor (called PyController in the image), I have written a P-controller in Python file, as shown below,

import sys

setRef = sys.argv[1]
currTemp = sys.argv[2]

error = float(setRef) - float(currTemp)

# P-Controller
kP = 10
out = kP*error

value = {out, 20}
print(value)

sys.exit(0)

As the EnergyPlus model is expecting an array input, how do I convert the Output of the PyController to a usable array for HouseModel?

I also thought of using FileReader actor in Ptolemy and write the values in the file and then read it from them, but I could not find any good example of that to see how exactly I can use it.

If you have any good examples, I will love to try them.

BCVTB Data Conversion

Hello All,

I am making a simple PID controller in BCVTB using EnergyPlus. In my model, I have a Simulator actor(called HouseModel in the image) that connects to EnergyPlus (v9.0.1). It takes setpoint temperature for cooling an heating thermostat as inputs array (for example, [16; 20]). image description

In the SystemCommnad actor (called PyController in the image), I have written a P-controller in Python file, as shown below,

import sys

setRef = sys.argv[1]
currTemp = sys.argv[2]

error = float(setRef) - float(currTemp)

# P-Controller
kP = 10
out = kP*error

value = {out, 20}
print(value)

sys.exit(0)

As the EnergyPlus model is expecting an array input, how do I convert the Output of the PyController to a usable array for HouseModel?

I also thought of using FileReader actor in Ptolemy and write the values in the file and then read it from them, but I could not find any good example of that to see how exactly I can use it.

If you have any good examples, I will love to try them.