Skip to main content

!include

Description

You can use !include to separate your model into several files. !include can be used as value in a KEY: VALUE mapping, or as a value in a list.

Format

!include <some_yaml_file.yaml>
tip

You can use ecalc show yaml <model_file> to see the read yaml with !include processed.

New in v7.2.

Example 1 - include map/object into list item

!include can be used to insert a map/object as a single list element

main.yaml
 INSTALLATIONS:
- !include installationA.yaml
- NAME: installationB
...
installationA.yaml
    NAME: installationA
...

This is the same as

main.yaml
     INSTALLATIONS:
- NAME: installationA
...
- NAME: installationB
...

Example 2 - include map/object into object value

!include can be used to insert a map/object as a value in a KEY: VALUE mapping

main.yaml
 INSTALLATIONS:
- NAME: installationA
FUELCONSUMERS:
- NAME: consumerB
ENERGY_USAGE_MODEL: !include consumerB.yaml
consumerB.yaml
    TYPE: COMPRESSOR
...

This is the same as

main.yaml
     INSTALLATIONS:
- NAME: installationA
FUELCONSUMERS:
- NAME: consumerB
ENERGY_USAGE_MODEL:
TYPE: COMPRESSOR
...

Example 3 - include list into object value

!include can be used to insert a list as a value in a KEY: VALUE mapping

main.yaml
INSTALLATIONS: !include installations.yaml

installations.yaml
    - NAME: installationA
...
- NAME: installationB
...

This is the same as

main.yaml
     INSTALLATIONS:
- NAME: installationA
...
- NAME: installationB
...