NREL / BuildingMOTIF

Building Metadata OnTology Interoperability Framework (BuildingMOTIF)
https://buildingmotif.readthedocs.io/
Other
48 stars 6 forks source link

Modeling of mapsTo in S223 using parameters of dependencies #237

Open lazlop opened 1 year ago

lazlop commented 1 year ago

For s223 models, connection points at different levels of containment that correspond to each other use the s223:mapsTo relation. The mapsTo relation goes from the connection point on the contained equipment to the connection point on the containing equipment. I'm not sure how to incorporate this relation into a template.

For example:

:VAV a s223:SingleDuctTerminal ;
    s223:contains :Damper ;
    s223:hasConnectionPoint :vav-cp-in, :vav-cp-out ;
.

:Damper a s223:Damper; 
    s223:hasConnectionPoint :damper-cp-in, :damper-cp-out ;
.
:damper-cp-in s223:mapsTo :vav-cp-in .
:damper-cp-out s223:mapsTo :vav-cp-out .

This could probably be pretty simply addressed by being providing the ability to refer to parameters of dependent templates.

For example:

damper:
  body: >
    @prefix P: <urn:___param___#> .
    @prefix s223: <http://data.ashrae.org/standard223#> .
    P:name a s223:Damper ;
      s223:hasConnectionPoint P:in, P:out .
  dependencies:
    - template: air-inlet-cp
      args: {"name": "in"}
    - template: air-outlet-cp
      args: {"name": "out"}

vav:
  body: >
    @prefix P: <urn:___param___#> .
    @prefix s223: <http://data.ashrae.org/standard223#> .
    P:name a s223:SingleDuctTerminal ;
      s223:contains P:Damper ;
      s223:hasConnectionPoint P:in, P:out ;
    .
    P:Damper(in) s223:mapsTo P:in .
    p:Damper(out) s223:mapsTo P:out .
  dependencies:
    - template: damper
      args: {"name": "damper"}
    - template: fan
      args: {"name": "fan"}
    - template: air-outlet-cp
      args: {"name": "out"}
    - template: air-inlet-cp
      args: {"name": "in"}
lazlop commented 1 year ago

Hmm, I see how this can kind of be done using inline dependencies. Sorry for potentially silly issues, still figuring it out! However, with inline dependencies it seems that optional parameters are no longer ignored, and explicitly stating require_optional_args = False doesn't seem to change anything.

gtfierro commented 1 year ago

Thanks for pointing this out! My new PR should hopefully raise warnings when parameters are not provided (and do the right thing with optional arguments too)

This is also the intended use of inline_dependencies(); it resolves those joins between templates so that you can compose templates together. This is not covered in our documentation yet, but something we should consider adding soon