Filtering out unnecessary data
By default, all the data specified in Python API in Ashes is exchanged between Ashes and the Python client during every time step. This might induce a significant slowdown for increasingly more complex models as the amount of data transferred linearly scales with the model size. To solve this problem, it is possible to filter out unneccesary data by flagging unwanted data in the first timestep.
1 Flagging data
When first sent to the python client, several entries come with a flag called "keep" set to True. The entries are the following:
- Each RNA
- Each Support Section
- Each Element in the Support Section
- Each Node in the Suport Section
Once an entry has been filtered out, it is not possible to reenable the data to be sent during runtime.
2 Example
Lets imagine an example turbine with 2 rotors, 2 support sections (TubularTowers) and several nodes and elements in each support section.
We now want to filter:
- The first RNA
- The second Support Section
- Node 3 and Element 2 from the first support section.
1
2
3
4
5
6
7
8
9
def notify(self, model: Model):
if not self.is_initialized:
model.RNA1.keep = False
model.Tubulartower2.keep = False
model.Tubulartower1.Node3.keep = False
model.Tubulartower1.Element2.keep = False
self.is_initialized = True
# ... Rest of code
The notify method gets called by the Simis package every timestep.
The "is_initialized" flag is used by the client to make sure the flags are only accessed in the first timestep, as these will not be available anymore once they have been removed and another access will cause an error.