Faster than real time simulation-network #82
-
Hey all thank you for all the work! We developed a BACnet interface around our building and HVAC simulation engine using BACpypes and so far it works great for real time simulations. However, we have been thinking on how to make the simulation and the network run in faster than real time and what are the nuances around BACpypes / BACpypes3 in order to achieve that. Thank you for your help! |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 2 replies
-
If I understand correctly, you want to just remove networking for a simulation purposes ... so would just be requiring raw data then, right? IE., just as temperature sensor values? I think you could just make something up with Py getters and setters and object orientated programming....
|
Beta Was this translation helpful? Give feedback.
-
thats just whipping something up but you maybe able to get more bacpypes3 like .... |
Beta Was this translation helpful? Give feedback.
-
Thank you Ben for the quick reply, not quite! I will try to be more clear. We have our simulation engine that allows users to read data and send control commands to the simulated HVAC through rest APIs and the co-simulation (simulation engine + external controller object) can run at whatever speed the computational resources allow it to run. We developed a BACnet interface wrap using BACpypes to expose the data and control points to BACnet (by creating a digital BACnet device and connecting all the simulation points to it) so that controllers and interfaces operating in BACnet could interact with our simulation. Apart from exposing the points to BACnet network to the interface advances the simulation in real time and updates the data at a certain frequency. Now I could advance the simulation faster (2X, 5X, 10X, etc...), but the BACnet points timestamp will still be associated with the normal clock time and lag behind. So I am trying to understand if it is possible to accelerate the whole network to follow the simulation time at 2X, 5X, 10X, etc.. the normal flow of time, or if anyone facing a similar problem found a different solution. |
Beta Was this translation helpful? Give feedback.
-
@EttoreZ is the timestamp being applied by bacpypes3, or the application reading the data? |
Beta Was this translation helpful? Give feedback.
-
Or are you referring to a trendLog object and its entries? |
Beta Was this translation helpful? Give feedback.
-
Hey @acedrew , thank you for the responses! I admit that I am new to BACnet and even more so on bacpypes. |
Beta Was this translation helpful? Give feedback.
-
There is a Let's say you have a CVS file that contains a list of The clocked tests in BACpypes3 use this feature, along with state machines to determine the path through combinations of requests and responses. |
Beta Was this translation helpful? Give feedback.
-
Thank you @JoelBender for your answer I will look into clocked_test.py and experiment from there. |
Beta Was this translation helpful? Give feedback.
There is a
clocked_test.py
module in the tests that wraps the asyncio event loop and allows the test to specify an amount of time to "accelerate" or skip forward. For example, if you have a virtual BACnet device that is supposed to wake up every n seconds and send out a Read Property Request, you can write that as a specialized subclass of Application and use awhile True: await asyncio.sleep(1); await app.read_property(...)
loop.Let's say you have a CVS file that contains a list of
timestamp, value, value, ...
rows that you want to feed into a device and see its response. The outer simulation loop reads the row, waits for the timestamp (maybe a delta time), changes some values in an app…