mrsonne / hubit

BSD 3-Clause "New" or "Revised" License
3 stars 0 forks source link

Wrap multiple components #56

Open mrsonne opened 2 years ago

mrsonne commented 2 years ago

Solver node in model connecting components. User implements solver eg using numpy

mrsonne commented 2 years ago

May a "wrapper" component could consume other components in the configuration

components:
  - name: C1
       consumes_results: x
       provides_results: a
  - name: C2
       consumes_results: x, a
       provides_results: y
  - name: wrapper
     consumes_components: [ID1, ID2] 

Then Hubit would pass in the relevant configuration nodes, create a model for those nodes and execute it. In a scenario where iteration is required

def obj(x):
  model.set_input(x)
  r = model.get("x*")
  return r["x*"] / x - 1

def main(i, o):
  xini = i[xini]
  sol = root(obj, xini)
  o["x"]

There is probably an issue here regarding variable naming since the "wrapper" component would create and call a submodel using internal names while the components in the sub-model would expect query paths as shared names

mrsonne commented 2 years ago

started work on branch "circular-refs" in files

examples/wall/model_1.yml examples/wall/run_solver.py