lbl-srg / obc

OpenBuildingControl - Performance Evaluation, Specification, Deployment and Verification of Building Control Sequences
http://obc.lbl.gov
27 stars 14 forks source link

Extract metadata from mo files #94

Closed anandkp92 closed 1 year ago

anandkp92 commented 3 years ago

Develop software to extract Brick representations from Modelica. Build on the work presented here by:

anandkp92 commented 2 years ago

Adding the major takeaways from recent discussions on this topic.

There are two main approaches to extracting metadata from Modelica models

  1. Inference of semantic information (as was done in the Shepherding paper). This work would involve building upon the work done in that paper.

  2. Addition of semantic data annotations to the Modelica file (be it a energy model or just CDL sequences or both).

Diving into the second approach:

Some additional questions/comments that came up during the discussion:

Tagging: @mwetter @gtfierro @marcopritoni @JayHuLBL for comments and thoughts.

gtfierro commented 2 years ago

I couldn't find anything exactly that we could use here, but we could use a text/strings or application/rdf+xml or make one up?

I like the __brick or __haystack style better. Then the MIME type can be text/turtle or whatever.

One question is whether the role of these annotations is to (a) assist in the production of a metadata model from the Modelica/CDL, or to (b) point to the corresponding entities in an existing semantic metadata model that is distributed along with the Modelica/CDL model. This could even be the full Turtle file in some annotation somewhere in the Modelica code. Then, the annotation just needs to indicate which entity it corresponds to. This sidesteps most of the design issues above.

The benefit of the first use-case is that one can distribute self-contained RDF graph descriptions for common, reusable Modelica components. Building the RDF graph from the Modelica model could be as "simple" as stitching those RDF subgraphs together using interpretations of the connect statements between them

mwetter commented 2 years ago

Most of the questions are best to discuss briefly. Here are some short answers. We certainly need use case (a) but (b) is also of interest and likely relevant. If we can handle (a), maybe (b) is a special case where we reconcile the two semantic models similar than in the Shepherding paper.

The tags should be on the block level (and outside of just CDL can also be on the model level) and on the connector level. But not on the connect statements as it can be inferred what connectors are connected by a connect statement.

Each class and each instance can only have one annotation. So there cannot be two annotation tags within one model. But a model (block) can extend another model (block) in which case the higher-level annotation should take precedence if present.

I agree that __brick (or __haystack or _semanticData or whatever we end up calling it) should not be inside the __cdl annotation as a fan model can also have such an annotation but is outside the scope of CDL. (This is a change to the current specification that we have for CDL which we will need to update as we converge.)

I don't think there is a case where we have to "combine metadata models if the CDL model and energy models are two separate Modelica files": We either have only a CDL model, or this CDL model is part of a model that also contains the HVAC system. Some of the HVAC system may be in different files but there is always a top-level .mo file, and that is the file that should be parsed.

anandkp92 commented 2 years ago

Summarizing the recent discussions here.

Use cases

  1. Generating control sequences for real BAS controllers using CDL
  2. FDD and other open loop verification
    • only need input and output points
    • only CDL sequences suffice
    • add annotation tags to CDL blocks (elementary CDL block and composite block) --- higher priority
    • May not need to parse the entire modelica elements. Stop at blocks?
    • User specificies which block or blocks to parse (user input)
    • Output:
    • semantic model with inputs and output
    • eventually these will need to be tied to BACnet points.
    • Questions yet to be answered:
    • who does the BACnet point mapping?
    • How to specify that some points will be need to undergo transformation before mapping to CDL input/output
    • Do we allow annotations to propogate to lower blocks? Current CDL has a mechanism to propogate annotations.
  3. Developing portable analytics applications
  4. Developing portable advanced control sequences
    • Each algorithm would have a BRICK or SPARQL query.
    • Need Energy model and CDL sequences
    • Output:
    • semantic model with equipment and points (inputs and outputs)
    • Questions:
    • When should we stop parsing? Currently, I stop as soon as the element type does not start with Buildings.*
  5. BOPTEST/simulation/Hardware in the loop
    • needs energy model
    • might need external references to BACnet points or other real world variables
    • Output:
    • semantic model with equipment and points (inputs and outputs)

Use cases 1 and 2

anandkp92 commented 1 year ago

Closing with 2 updates: