HARPgroup / HSPsquared

Hydrologic Simulation Program Python (HSPsquared)
GNU Affero General Public License v3.0
1 stars 0 forks source link

broadCastObject #36

Closed rburghol closed 8 months ago

rburghol commented 1 year ago

Overview

Broadcast channels are variables that exist on a given object, referred to in the interface as "parent", which means it lives on the objects parent, and "children", which means it is resident on the object itself, and broadcasts to the objects own children). The current implementation has these variables as simple aggregators, that is, if multiple objects broadcast values to the specific channel + variable_name, the broadcasted value will be added to the value of the variable. Note, the variable name is NOT specific to the broadcast channel, in other words, if 2 different broadcast "hub" objects are set up on a given object named "hub1" and "hub2", values broadcast to "hub1" with the broadcast name "Qup", will be added to values sent to "hub2" under the name "Qup". So in this way, the current behavior simply uses separate "hub" objects on a given object as a way of classifying the information coming in, not separating the values that are accumulated by the individual hubs. Future revisions may enable a function that adds a broadcast prefix to the broadcast variable on the hub parent.

Tasks:

Conceptual Design

Class definition

Object Handler

This class will handle:

class ModelBroadcast(modelObject):
    # is this a read or a send?
    broadcast_mode = "send"
    broadcast_params = {'Qout': 'Qtrib'}
    hub_state_path = "/STATE/RCHRES_001/BROADCAST/[channel_name]" # this should be set at parse w/self.hdf5_expand()
    # the local data source if this is "send", the target data source if this is read"

test = ModelBroadcast()
test.broadcast_params = [['ps_refill_pump_mgd', 'wd_mgd'], ['Qout', 'Qtrib']]

# []
# this yields nothing because the object is in "send" mode