├── CHANGELOG.md ├── thirdparty ├── parser │ ├── README.md │ ├── Modelica.tokens │ ├── ModelicaLexer.tokens │ ├── modelica_listener.go │ ├── ModelicaLexer.interp │ └── modelica_base_listener.go ├── Dockerfile-Antlr └── Modelica.g4 ├── .gitignore ├── go.mod ├── generate_parser.sh ├── update_examples.sh ├── .github └── workflows │ ├── ci.yml │ └── publish.yml ├── examples ├── example-no-within.mo ├── functions.mo ├── example-no-within-out.mo ├── functions-out.mo ├── example-arrays-out.mo ├── example-arrays.mo ├── gmt-building.mo ├── gmt-building-out.mo ├── gmt-building-empty-lines-out.mo ├── gmt-building-80-out.mo ├── gmt-coolingtower.mo └── gmt-coolingtower-out.mo ├── docs └── release.md ├── .goreleaser.yml ├── go.sum ├── LICENSE ├── modelicafmt_test.go ├── README.md ├── main.go └── modelicafmt.go /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Version 0.1 2 | 3 | * Support formatting of Modelica files 4 | -------------------------------------------------------------------------------- /thirdparty/parser/README.md: -------------------------------------------------------------------------------- 1 | These files are automatically generated using Antlr. Do not manipulate directly. 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .python-version 2 | .idea/ 3 | .antlr/ 4 | dist/ 5 | test_output/ 6 | 7 | modelicafmt 8 | modelicafmt.exe 9 | modelica-fmt 10 | modelica-fmt.exe 11 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/urbanopt/modelica-fmt 2 | 3 | go 1.13 4 | 5 | require ( 6 | github.com/antlr/antlr4 v0.0.0-20200503195918-621b933c7a7f 7 | github.com/stretchr/testify v1.6.1 8 | ) 9 | -------------------------------------------------------------------------------- /generate_parser.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | docker build -t antlr4:latest -f thirdparty/Dockerfile-Antlr . 4 | 5 | docker run --rm -v "$(pwd)/thirdparty":/var/antlrResult \ 6 | antlr4:latest \ 7 | -Dlanguage=Go -o /var/antlrResult/parser /var/antlrResult/Modelica.g4 8 | -------------------------------------------------------------------------------- /thirdparty/Dockerfile-Antlr: -------------------------------------------------------------------------------- 1 | FROM openjdk:7-alpine 2 | 3 | WORKDIR /usr/local/lib 4 | RUN wget https://www.antlr.org/download/antlr-4.8-complete.jar 5 | ENV CLASSPATH=".:/usr/local/lib/antlr-4.8-complete.jar:$CLASSPATH" 6 | 7 | ENTRYPOINT ["java", "-jar", "/usr/local/lib/antlr-4.8-complete.jar"] 8 | CMD [] 9 | -------------------------------------------------------------------------------- /update_examples.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | go build . 5 | 6 | for file in ./examples/*.mo; do 7 | if [[ $file == *-out.mo ]]; then 8 | continue 9 | fi 10 | filename=$(basename -- $file) 11 | outfile="${filename%.*}-out.mo" 12 | ./modelica-fmt $file > ./examples/${outfile} 13 | done 14 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: 4 | pull_request: 5 | 6 | jobs: 7 | test: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - 11 | name: Checkout Repo 12 | uses: actions/checkout@v2 13 | - 14 | name: Set up Go 15 | uses: actions/setup-go@v2 16 | with: 17 | go-version: 1.15 18 | - 19 | name: Run Go Tests 20 | run: go test ./... 21 | -------------------------------------------------------------------------------- /examples/example-no-within.mo: -------------------------------------------------------------------------------- 1 | class MyClass 2 | "Class to demo function definitions" 3 | extends Modelica.Icons.BasesPackage; 4 | 5 | function constructor 6 | "Construct to connect to a schedule in EnergyPlus" 7 | extends Modelica.Icons.Function; 8 | 9 | input Integer input1 "input 1 comment"; 10 | output MyClass adapter; 11 | external "C" adapter = ExternalFunctionCall(param1, param2, param3); 12 | end constructor; 13 | 14 | function destructor "Some comment" 15 | extends Modelica.Icons.Function; 16 | 17 | input Integer input2; 18 | external "C" EnergyPlusInputVariableFree(input2); 19 | end destructor; 20 | end MyClass; 21 | -------------------------------------------------------------------------------- /examples/functions.mo: -------------------------------------------------------------------------------- 1 | within Somewhere; 2 | class MyClass 3 | "Class to demo function definitions" 4 | extends Modelica.Icons.BasesPackage; 5 | 6 | function constructor 7 | "Construct to connect to a schedule in EnergyPlus" 8 | extends Modelica.Icons.Function; 9 | 10 | input Integer input1 "input 1 comment"; 11 | output MyClass adapter; 12 | external "C" adapter = ExternalFunctionCall(param1, param2, param3); 13 | end constructor; 14 | 15 | function destructor "Some comment" 16 | extends Modelica.Icons.Function; 17 | 18 | input Integer input2; 19 | external "C" EnergyPlusInputVariableFree(input2); 20 | end destructor; 21 | end MyClass; 22 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: goreleaser 2 | 3 | on: 4 | push: 5 | tags: 6 | - '*' 7 | 8 | jobs: 9 | goreleaser: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - 13 | name: Checkout 14 | uses: actions/checkout@v2 15 | with: 16 | fetch-depth: 0 17 | - 18 | name: Set up Go 19 | uses: actions/setup-go@v2 20 | with: 21 | go-version: 1.15 22 | - 23 | name: Run GoReleaser 24 | uses: goreleaser/goreleaser-action@v2 25 | with: 26 | version: latest 27 | args: release --rm-dist 28 | env: 29 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 30 | -------------------------------------------------------------------------------- /examples/example-no-within-out.mo: -------------------------------------------------------------------------------- 1 | class MyClass 2 | "Class to demo function definitions" 3 | extends Modelica.Icons.BasesPackage; 4 | function constructor 5 | "Construct to connect to a schedule in EnergyPlus" 6 | extends Modelica.Icons.Function; 7 | input Integer input1 8 | "input 1 comment"; 9 | output MyClass adapter; 10 | external "C" adapter=ExternalFunctionCall( 11 | param1, 12 | param2, 13 | param3); 14 | end constructor; 15 | function destructor 16 | "Some comment" 17 | extends Modelica.Icons.Function; 18 | input Integer input2; 19 | external "C" EnergyPlusInputVariableFree( 20 | input2); 21 | end destructor; 22 | end MyClass; 23 | -------------------------------------------------------------------------------- /examples/functions-out.mo: -------------------------------------------------------------------------------- 1 | within Somewhere; 2 | class MyClass 3 | "Class to demo function definitions" 4 | extends Modelica.Icons.BasesPackage; 5 | function constructor 6 | "Construct to connect to a schedule in EnergyPlus" 7 | extends Modelica.Icons.Function; 8 | input Integer input1 9 | "input 1 comment"; 10 | output MyClass adapter; 11 | external "C" adapter=ExternalFunctionCall( 12 | param1, 13 | param2, 14 | param3); 15 | end constructor; 16 | function destructor 17 | "Some comment" 18 | extends Modelica.Icons.Function; 19 | input Integer input2; 20 | external "C" EnergyPlusInputVariableFree( 21 | input2); 22 | end destructor; 23 | end MyClass; 24 | -------------------------------------------------------------------------------- /docs/release.md: -------------------------------------------------------------------------------- 1 | # Releases 2 | Modelica formatter uses [GoReleaser](https://goreleaser.com/) for building assets and documenting tags for release. This is run automatically by GitHub Actions whenever a new tag is pushed to remote. See [.goreleaser.yml](/.goreleaser.yml) and [publish.yml](/.github/workflows/publish.yml) for the configuration. 3 | 4 | ## How to make a release 5 | First, create a tag: 6 | ```bash 7 | git tag -a v -m "" [SHA] 8 | ``` 9 | Where `v` is a valid [semantic version](https://semver.org/) (e.g. `v1.2` or `v1.2-pr.1`) and `` is the tagging message (e.g. "First official release") 10 | 11 | Next, push the tag up to remote, triggering a GitHub Actions workflow build which runs GoReleaser: 12 | ```bash 13 | git push origin v 14 | ``` 15 | 16 | After the build successfully finishes, go to the releases page on Github, check that it looks good, and publish it. 17 | -------------------------------------------------------------------------------- /.goreleaser.yml: -------------------------------------------------------------------------------- 1 | # Make sure to check the documentation at http://goreleaser.com 2 | before: 3 | hooks: 4 | - go mod download 5 | builds: 6 | - 7 | binary: modelicafmt 8 | env: 9 | - CGO_ENABLED=0 10 | goos: 11 | - darwin 12 | - linux 13 | - windows 14 | goarch: 15 | - amd64 16 | archives: 17 | - replacements: 18 | darwin: Darwin 19 | linux: Linux 20 | windows: Windows 21 | amd64: x86_64 22 | checksum: 23 | name_template: 'checksums.txt' 24 | snapshot: 25 | name_template: "{{ .Tag }}-next" 26 | changelog: 27 | sort: asc 28 | filters: 29 | exclude: 30 | - '^docs:' 31 | - '^test:' 32 | release: 33 | draft: true 34 | # If set to auto, will mark the release as not ready for production 35 | # in case there is an indicator for this in the tag e.g. v1.0.0-rc1 36 | # If set to true, will mark the release as not ready for production. 37 | # Default is false. 38 | prerelease: auto 39 | -------------------------------------------------------------------------------- /examples/example-arrays-out.mo: -------------------------------------------------------------------------------- 1 | within Somewhere; 2 | class MyClass 3 | "Class to demo formatting arrays and matrices" 4 | extends Modelica.Icons.BasesPackage; 5 | parameter Real var1=3.14; 6 | parameter Real x[3]; 7 | parameter Real y[3]={1.0,0.0,-1.0}; 8 | parameter Real z[5]={1.0,0.0,-1.0,2.0,0.0}; 9 | parameter Real A[2,3]={{1.0,2.0,3.0},{5.0,6.0,7.0}}; 10 | parameter Real B[:,3]={{1.0,2.0,3.0},{5.0,6.0,7.0},{1.0,2.0,3.0},{5.0,6.0,7.0},{1.0,2.0,3.0},{5.0,6.0,7.0},{1.0,2.0,3.0},{5.0,6.0,7.0}}; 11 | parameter Real C[2,3]=[ 12 | 1.0,2.0,3.0; 13 | 5.0,6.0,7.0]; 14 | parameter Integer D[4,3]=[ 15 | 0,1,1; 16 | 2,3,5; 17 | 8,13,21; 18 | 34,55,89]; 19 | parameter Real fraPFan_nominal( 20 | unit="W/(kg/s)")=275/0.15 21 | "Fan power divided by water mass flow rate at design condition" 22 | annotation (Dialog(group="Fan")); 23 | parameter Modelica.SIunits.Power PFan_nominal=fraPFan_nominal*m_flow_nominal 24 | "Fan power" 25 | annotation (Dialog(group="Fan")); 26 | end MyClass; 27 | -------------------------------------------------------------------------------- /examples/example-arrays.mo: -------------------------------------------------------------------------------- 1 | within Somewhere; 2 | class MyClass 3 | "Class to demo formatting arrays and matrices" 4 | extends Modelica.Icons.BasesPackage; 5 | 6 | parameter Real var1 = 3.14; 7 | 8 | parameter Real x[3]; 9 | parameter Real y[3] = {1.0, 0.0, -1.0}; 10 | parameter Real z[5] = {1.0, 0.0, -1.0, 2.0, 0.0}; 11 | 12 | parameter Real A[2,3] = {{1.0, 2.0, 3.0}, {5.0, 6.0, 7.0}}; 13 | 14 | parameter Real B[:,3] = {{1.0, 2.0, 3.0}, {5.0, 6.0, 7.0}, {1.0, 2.0, 3.0}, {5.0, 6.0, 7.0}, {1.0, 2.0, 3.0}, {5.0, 6.0, 7.0}, {1.0, 2.0, 3.0}, {5.0, 6.0, 7.0}}; 15 | 16 | 17 | parameter Real C[2,3] = [1.0, 2.0, 3.0; 5.0, 6.0, 7.0]; 18 | 19 | parameter Integer D[4,3] = [ 20 | 0, 1, 1; 21 | 2, 3, 5; 22 | 8, 13, 21; 23 | 34, 55, 89 24 | ]; 25 | 26 | parameter Real fraPFan_nominal(unit="W/(kg/s)") = 275/0.15 27 | "Fan power divided by water mass flow rate at design condition" 28 | annotation (Dialog(group="Fan")); 29 | parameter Modelica.SIunits.Power PFan_nominal = fraPFan_nominal*m_flow_nominal 30 | "Fan power" 31 | annotation (Dialog(group="Fan")); 32 | 33 | end MyClass; 34 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/antlr/antlr4 v0.0.0-20200503195918-621b933c7a7f h1:0cEys61Sr2hUBEXfNV8eyQP01oZuBgoMeHunebPirK8= 2 | github.com/antlr/antlr4 v0.0.0-20200503195918-621b933c7a7f/go.mod h1:T7PbCXFs94rrTttyxjbyT5+/1V8T2TYDejxUfHJjw1Y= 3 | github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= 4 | github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 5 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 6 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 7 | github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= 8 | github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= 9 | github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= 10 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 11 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= 12 | gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= 13 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2020, Alliance for Sustainable Energy, LLC, and other contributors. 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without modification, are permitted 5 | provided that the following conditions are met: 6 | 7 | Redistributions of source code must retain the above copyright notice, this list of conditions 8 | and the following disclaimer. 9 | 10 | Redistributions in binary form must reproduce the above copyright notice, this list of conditions 11 | and the following disclaimer in the documentation and/or other materials provided with the 12 | distribution. 13 | 14 | Neither the name of the copyright holder nor the names of its contributors may be used to endorse 15 | or promote products derived from this software without specific prior written permission. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 18 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND 19 | FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 20 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 23 | IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 24 | OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | -------------------------------------------------------------------------------- /modelicafmt_test.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "bytes" 5 | "os" 6 | "os/exec" 7 | "path" 8 | "testing" 9 | 10 | "github.com/stretchr/testify/require" 11 | ) 12 | 13 | const outputDir = "test_output" 14 | 15 | func TestMain(m *testing.M) { 16 | _ = os.Mkdir(outputDir, 0755) 17 | code := m.Run() 18 | os.Exit(code) 19 | } 20 | 21 | func diffFiles(a, b string) (string, error) { 22 | cmd := exec.Command("git", "diff", "--no-index", a, b) 23 | var out bytes.Buffer 24 | cmd.Stdout = &out 25 | _ = cmd.Run() 26 | return out.String(), nil 27 | } 28 | 29 | var exampleFileTests = []struct { 30 | sourceFile string 31 | outFile string 32 | formatterConfig Config 33 | }{ 34 | {"gmt-coolingtower.mo", "gmt-coolingtower-out.mo", Config{-1, false}}, 35 | {"functions.mo", "functions-out.mo", Config{-1, false}}, 36 | {"example-no-within.mo", "example-no-within-out.mo", Config{-1, false}}, 37 | {"example-arrays.mo", "example-arrays-out.mo", Config{-1, false}}, 38 | {"gmt-building.mo", "gmt-building-out.mo", Config{-1, false}}, 39 | {"gmt-building.mo", "gmt-building-80-out.mo", Config{80, false}}, 40 | {"gmt-building.mo", "gmt-building-empty-lines-out.mo", Config{-1, true}}, 41 | } 42 | 43 | func TestFormattingExamples(t *testing.T) { 44 | a := require.New(t) 45 | for _, testCase := range exampleFileTests { 46 | t.Run(testCase.sourceFile, func(t *testing.T) { 47 | // Setup 48 | testSourceFile := path.Join("examples", testCase.sourceFile) 49 | expectedOutFile := path.Join("examples", testCase.outFile) 50 | actualOutFile := path.Join(outputDir, testCase.outFile) 51 | file, err := os.Create(actualOutFile) 52 | a.NoError(err) 53 | defer file.Close() 54 | 55 | // Act 56 | err = processFile( 57 | testSourceFile, 58 | file, 59 | testCase.formatterConfig, 60 | ) 61 | 62 | // Assert 63 | a.NoError(err) 64 | diff, err := diffFiles(expectedOutFile, actualOutFile) 65 | a.NoError(err) 66 | a.Len(diff, 0, "File diff should be empty") 67 | }) 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # modelica-fmt 2 | 3 | The Modelica Formatter provides the ability to automatically format Modelica code providing a consistent file structure to aid in the readability of the files and the ability to compare the difference between similar files. 4 | 5 | ## Running 6 | 7 | ```bash 8 | modelica-fmt [-w] [-help] ... 9 | Options: 10 | -w overwrite source with formatted output. If flag is not present print to stdout 11 | Arguments: 12 | sources one or more files or directories to format 13 | ``` 14 | 15 | To run the examples: 16 | 17 | ```bash 18 | ./modelica-fmt examples/gmt-building.mo > examples/gmt-building-out.mo 19 | ./modelica-fmt examples/gmt-coolingtower.mo > examples/gmt-coolingtower-out.mo 20 | ``` 21 | 22 | The resulting .mo file can be diffed to the previous file to compare how the modelica-fmt updates the file. 23 | 24 | ## Usage with pre-commit framework 25 | 26 | After adding modelicafmt to your system path, add the following lines to your .pre-commit-config.yaml file under the `repos:` section. 27 | Also, make sure to allow modelicafmt to run (especially on Mac). 28 | 29 | ```yaml 30 | - 31 | repo: local 32 | hooks: 33 | - 34 | id: modelica-fmt 35 | name: Modelica Formatter 36 | types: [file] 37 | files: \.(mo)$ 38 | entry: modelicafmt 39 | args: ["-w"] 40 | language: system 41 | ``` 42 | See https://pre-commit.com/ for more information about the framework. 43 | 44 | ## Building 45 | 46 | ```bash 47 | # install go with brew, or follow instructions here: https://golang.org/doc/install 48 | brew install go 49 | 50 | # if you have an older version of the go tool, you may need to explicitly 51 | # download the dependencies (in repo root directory) 52 | go get -d ./... 53 | 54 | # in the repository root directory 55 | go build . 56 | 57 | # optionally, with `-o` you can specify a custom name for your executable 58 | # (on Windows remember to add `.exe` to the name) 59 | go build -o modelicafmt 60 | ``` 61 | 62 | 63 | ## Updating Parser (Modelica Grammar) 64 | 65 | If the grammar file (Modelica.g4) has been edited, you'll need to regenerate the parser by running the following commmand which runs Antlr in a Docker container. 66 | ```bash 67 | ./generate_parser.sh 68 | ``` 69 | 70 | ## Known Issues 71 | 72 | 73 | 74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /main.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020, Alliance for Sustainable Energy, LLC. 2 | // All rights reserved. 3 | 4 | // Package main runs the formatter 5 | package main 6 | 7 | import ( 8 | "bufio" 9 | "bytes" 10 | "flag" 11 | "fmt" 12 | "io/ioutil" 13 | "os" 14 | "path/filepath" 15 | "strings" 16 | ) 17 | 18 | var ( 19 | write = flag.Bool("w", false, "overwrite the file(s)") 20 | versionFlag = flag.Bool("v", false, "display tool version") 21 | emptyLineFlag = flag.Bool("extra-padding", false, "BETA: adds empty lines for padding") 22 | lineLength = flag.Int("line-length", -1, "how many characters allowed per line; -1 means no max") 23 | // build information added by goreleaser 24 | version = "dev" 25 | commit = "none" 26 | date = "unknown" 27 | builtBy = "unknown" 28 | ) 29 | 30 | func usage() { 31 | fmt.Fprintln(os.Stderr, "usage: modelicafmt [path ...]") 32 | flag.PrintDefaults() 33 | } 34 | 35 | func isModelicaFile(f os.FileInfo) bool { 36 | name := f.Name() 37 | return !f.IsDir() && !strings.HasPrefix(name, ".") && strings.HasSuffix(name, ".mo") 38 | } 39 | 40 | func processAndWriteFile(filename string) { 41 | var b bytes.Buffer 42 | err := processFile(filename, bufio.NewWriter(&b), Config{*lineLength, *emptyLineFlag}) 43 | if err != nil { 44 | panic(err) 45 | } 46 | if *write { 47 | err := ioutil.WriteFile(filename, b.Bytes(), 777) 48 | if err != nil { 49 | panic(err) 50 | } 51 | } else { 52 | b.WriteTo(os.Stdout) 53 | } 54 | } 55 | 56 | func visitFile(filename string, f os.FileInfo, err error) error { 57 | if err != nil && !os.IsNotExist(err) { 58 | fmt.Fprintln(os.Stderr, err.Error()) 59 | return nil 60 | } 61 | 62 | if isModelicaFile(f) { 63 | processAndWriteFile(filename) 64 | } 65 | 66 | return nil 67 | } 68 | 69 | func walkDir(path string) { 70 | filepath.Walk(path, visitFile) 71 | } 72 | 73 | func main() { 74 | flag.Usage = usage 75 | flag.Parse() 76 | if *versionFlag { 77 | fmt.Printf("modelicafmt v%s (SHA %s)\nBuilt %s by %s\n", version, commit, date, builtBy) 78 | return 79 | } 80 | if flag.NArg() == 0 { 81 | fmt.Fprintln(os.Stderr, "error: must provide at least one file or directory") 82 | usage() 83 | os.Exit(2) 84 | } 85 | 86 | for i := 0; i < flag.NArg(); i++ { 87 | path := flag.Arg(i) 88 | switch dir, err := os.Stat(path); { 89 | case err != nil: 90 | fmt.Fprintln(os.Stderr, "error: "+err.Error()) 91 | os.Exit(2) 92 | case dir.IsDir(): 93 | walkDir(path) 94 | default: 95 | processAndWriteFile(path) 96 | } 97 | } 98 | } 99 | -------------------------------------------------------------------------------- /thirdparty/parser/Modelica.tokens: -------------------------------------------------------------------------------- 1 | T__0=1 2 | T__1=2 3 | T__2=3 4 | T__3=4 5 | T__4=5 6 | T__5=6 7 | T__6=7 8 | T__7=8 9 | T__8=9 10 | T__9=10 11 | T__10=11 12 | T__11=12 13 | T__12=13 14 | T__13=14 15 | T__14=15 16 | T__15=16 17 | T__16=17 18 | T__17=18 19 | T__18=19 20 | T__19=20 21 | T__20=21 22 | T__21=22 23 | T__22=23 24 | T__23=24 25 | T__24=25 26 | T__25=26 27 | T__26=27 28 | T__27=28 29 | T__28=29 30 | T__29=30 31 | T__30=31 32 | T__31=32 33 | T__32=33 34 | T__33=34 35 | T__34=35 36 | T__35=36 37 | T__36=37 38 | T__37=38 39 | T__38=39 40 | T__39=40 41 | T__40=41 42 | T__41=42 43 | T__42=43 44 | T__43=44 45 | T__44=45 46 | T__45=46 47 | T__46=47 48 | T__47=48 49 | T__48=49 50 | T__49=50 51 | T__50=51 52 | T__51=52 53 | T__52=53 54 | T__53=54 55 | T__54=55 56 | T__55=56 57 | T__56=57 58 | T__57=58 59 | T__58=59 60 | T__59=60 61 | T__60=61 62 | T__61=62 63 | T__62=63 64 | T__63=64 65 | T__64=65 66 | T__65=66 67 | T__66=67 68 | T__67=68 69 | T__68=69 70 | T__69=70 71 | T__70=71 72 | T__71=72 73 | T__72=73 74 | T__73=74 75 | T__74=75 76 | T__75=76 77 | T__76=77 78 | T__77=78 79 | T__78=79 80 | T__79=80 81 | T__80=81 82 | T__81=82 83 | T__82=83 84 | T__83=84 85 | T__84=85 86 | T__85=86 87 | T__86=87 88 | T__87=88 89 | IDENT=89 90 | STRING=90 91 | UNSIGNED_NUMBER=91 92 | WS=92 93 | COMMENT=93 94 | LINE_COMMENT=94 95 | 'within'=1 96 | ';'=2 97 | 'final'=3 98 | 'encapsulated'=4 99 | 'partial'=5 100 | 'class'=6 101 | 'model'=7 102 | 'operator'=8 103 | 'record'=9 104 | 'block'=10 105 | 'expandable'=11 106 | 'connector'=12 107 | 'type'=13 108 | 'package'=14 109 | 'pure'=15 110 | 'impure'=16 111 | 'function'=17 112 | 'end'=18 113 | 'extends'=19 114 | '='=20 115 | 'enumeration'=21 116 | '('=22 117 | ':'=23 118 | ')'=24 119 | 'der'=25 120 | ','=26 121 | 'public'=27 122 | 'protected'=28 123 | 'external'=29 124 | 'redeclare'=30 125 | 'inner'=31 126 | 'outer'=32 127 | 'replaceable'=33 128 | 'import'=34 129 | '.*'=35 130 | '.{'=36 131 | '}'=37 132 | 'constrainedby'=38 133 | 'flow'=39 134 | 'stream'=40 135 | 'discrete'=41 136 | 'parameter'=42 137 | 'constant'=43 138 | 'input'=44 139 | 'output'=45 140 | 'if'=46 141 | ':='=47 142 | 'each'=48 143 | 'initial'=49 144 | 'equation'=50 145 | 'algorithm'=51 146 | 'break'=52 147 | 'return'=53 148 | 'then'=54 149 | 'elseif'=55 150 | 'else'=56 151 | 'for'=57 152 | 'loop'=58 153 | 'in'=59 154 | 'while'=60 155 | 'when'=61 156 | 'elsewhen'=62 157 | 'connect'=63 158 | 'or'=64 159 | 'and'=65 160 | 'not'=66 161 | '<'=67 162 | '<='=68 163 | '>'=69 164 | '>='=70 165 | '=='=71 166 | '<>'=72 167 | '+'=73 168 | '-'=74 169 | '.+'=75 170 | '.-'=76 171 | '*'=77 172 | '/'=78 173 | './'=79 174 | '^'=80 175 | '.^'=81 176 | 'false'=82 177 | 'true'=83 178 | '['=84 179 | ']'=85 180 | '{'=86 181 | '.'=87 182 | 'annotation'=88 183 | -------------------------------------------------------------------------------- /thirdparty/parser/ModelicaLexer.tokens: -------------------------------------------------------------------------------- 1 | T__0=1 2 | T__1=2 3 | T__2=3 4 | T__3=4 5 | T__4=5 6 | T__5=6 7 | T__6=7 8 | T__7=8 9 | T__8=9 10 | T__9=10 11 | T__10=11 12 | T__11=12 13 | T__12=13 14 | T__13=14 15 | T__14=15 16 | T__15=16 17 | T__16=17 18 | T__17=18 19 | T__18=19 20 | T__19=20 21 | T__20=21 22 | T__21=22 23 | T__22=23 24 | T__23=24 25 | T__24=25 26 | T__25=26 27 | T__26=27 28 | T__27=28 29 | T__28=29 30 | T__29=30 31 | T__30=31 32 | T__31=32 33 | T__32=33 34 | T__33=34 35 | T__34=35 36 | T__35=36 37 | T__36=37 38 | T__37=38 39 | T__38=39 40 | T__39=40 41 | T__40=41 42 | T__41=42 43 | T__42=43 44 | T__43=44 45 | T__44=45 46 | T__45=46 47 | T__46=47 48 | T__47=48 49 | T__48=49 50 | T__49=50 51 | T__50=51 52 | T__51=52 53 | T__52=53 54 | T__53=54 55 | T__54=55 56 | T__55=56 57 | T__56=57 58 | T__57=58 59 | T__58=59 60 | T__59=60 61 | T__60=61 62 | T__61=62 63 | T__62=63 64 | T__63=64 65 | T__64=65 66 | T__65=66 67 | T__66=67 68 | T__67=68 69 | T__68=69 70 | T__69=70 71 | T__70=71 72 | T__71=72 73 | T__72=73 74 | T__73=74 75 | T__74=75 76 | T__75=76 77 | T__76=77 78 | T__77=78 79 | T__78=79 80 | T__79=80 81 | T__80=81 82 | T__81=82 83 | T__82=83 84 | T__83=84 85 | T__84=85 86 | T__85=86 87 | T__86=87 88 | T__87=88 89 | IDENT=89 90 | STRING=90 91 | UNSIGNED_NUMBER=91 92 | WS=92 93 | COMMENT=93 94 | LINE_COMMENT=94 95 | 'within'=1 96 | ';'=2 97 | 'final'=3 98 | 'encapsulated'=4 99 | 'partial'=5 100 | 'class'=6 101 | 'model'=7 102 | 'operator'=8 103 | 'record'=9 104 | 'block'=10 105 | 'expandable'=11 106 | 'connector'=12 107 | 'type'=13 108 | 'package'=14 109 | 'pure'=15 110 | 'impure'=16 111 | 'function'=17 112 | 'end'=18 113 | 'extends'=19 114 | '='=20 115 | 'enumeration'=21 116 | '('=22 117 | ':'=23 118 | ')'=24 119 | 'der'=25 120 | ','=26 121 | 'public'=27 122 | 'protected'=28 123 | 'external'=29 124 | 'redeclare'=30 125 | 'inner'=31 126 | 'outer'=32 127 | 'replaceable'=33 128 | 'import'=34 129 | '.*'=35 130 | '.{'=36 131 | '}'=37 132 | 'constrainedby'=38 133 | 'flow'=39 134 | 'stream'=40 135 | 'discrete'=41 136 | 'parameter'=42 137 | 'constant'=43 138 | 'input'=44 139 | 'output'=45 140 | 'if'=46 141 | ':='=47 142 | 'each'=48 143 | 'initial'=49 144 | 'equation'=50 145 | 'algorithm'=51 146 | 'break'=52 147 | 'return'=53 148 | 'then'=54 149 | 'elseif'=55 150 | 'else'=56 151 | 'for'=57 152 | 'loop'=58 153 | 'in'=59 154 | 'while'=60 155 | 'when'=61 156 | 'elsewhen'=62 157 | 'connect'=63 158 | 'or'=64 159 | 'and'=65 160 | 'not'=66 161 | '<'=67 162 | '<='=68 163 | '>'=69 164 | '>='=70 165 | '=='=71 166 | '<>'=72 167 | '+'=73 168 | '-'=74 169 | '.+'=75 170 | '.-'=76 171 | '*'=77 172 | '/'=78 173 | './'=79 174 | '^'=80 175 | '.^'=81 176 | 'false'=82 177 | 'true'=83 178 | '['=84 179 | ']'=85 180 | '{'=86 181 | '.'=87 182 | 'annotation'=88 183 | -------------------------------------------------------------------------------- /examples/gmt-building.mo: -------------------------------------------------------------------------------- 1 | // Model copied from GeoJSON to Modelica Translator project (https://github.com/urbanopt/geojson-modelica-translator) 2 | within a_project.B5a6b99ec37f4de7f94020090; 3 | model building 4 | "n-zone RC building model based on URBANopt's use of TEASER export, with distribution pumps" 5 | extends PartialBuilding( 6 | redeclare package Medium = MediumW, have_fan=false, have_eleHea=false, have_eleCoo=false); 7 | 8 | package MediumW = Buildings.Media.Water "Source side medium"; 9 | package MediumA = Buildings.Media.Air 10 | "Load side medium"; 11 | parameter Integer nZon = 6 12 | "Number of thermal zones"; 13 | parameter Integer facSca = 3 14 | "Scaling factor to be applied to on each extensive quantity"; 15 | parameter Modelica.SIunits.TemperatureDifference delTBuiCoo=5 16 | "Nominal building supply and return chilled water temperature difference"; 17 | 18 | Buildings.Controls.OBC.CDL.Continuous.Sources.Constant minTSet[nZon]( 19 | k=fill(293.15, nZon), y(each final unit="K", each displayUnit="degC")) 20 | "Minimum temperature set point" 21 | 22 | annotation (Placement(transformation(extent={{-290,230},{-270,250}}))); 23 | 24 | Buildings.Controls.OBC.CDL.Continuous.Sources.Constant maxTSet[nZon]( 25 | k=fill(297.15, nZon), 26 | y(each final unit="K",each displayUnit="degC")) 27 | "Maximum temperature set point" 28 | 29 | 30 | 31 | annotation (Placement(transformation(extent={{-290,190},{-270,210}}))); 32 | 33 | 34 | Meeting meeting 35 | annotation (Placement(transformation(extent={{-160,-20},{-140,0}}))); 36 | 37 | Floor floor 38 | annotation (Placement(transformation(extent={{-120,-20},{-100,0}}))); 39 | 40 | Storage storage 41 | annotation (Placement(transformation(extent={{-80,-20},{-60,0}}))); 42 | 43 | Office office 44 | annotation (Placement(transformation(extent={{-40,-20},{-20,0}}))); 45 | 46 | Restroom restroom 47 | annotation (Placement(transformation(extent={{0,-20},{20,0}}))); 48 | 49 | ICT ict 50 | annotation (Placement(transformation(extent={{40,-20},{60,0}}))); 51 | 52 | Buildings.Controls.OBC.CDL.Continuous.MultiSum mulSum(nin=2) if have_pum 53 | 54 | annotation (Placement(transformation(extent={{260,70},{280,90}}))); 55 | 56 | Buildings.Applications.DHC.Loads.Examples.BaseClasses.FanCoil4PipeHeatPorts 57 | terUni[nZon]( 58 | redeclare each package Medium1 = MediumW, 59 | redeclare each package Medium2 = MediumA, 60 | each facSca=facSca, 61 | QHea_flow_nominal={10000,10000,10000, 10000,10000,10000}, 62 | QCoo_flow_nominal={-10000,-10000, -10000,-10000,-10000,-50000}, 63 | each T_aLoaHea_nominal=293.15, 64 | each T_aLoaCoo_nominal=297.15, 65 | each T_bHeaWat_nominal=35+273.15, 66 | each T_bChiWat_nominal=12 + 273.15, 67 | each T_aHeaWat_nominal=40 + 273.15, 68 | each T_aChiWat_nominal=7 + 273.15, 69 | each mLoaHea_flow_nominal=5, each mLoaCoo_flow_nominal=5) "Terminal unit" 70 | 71 | annotation (Placement(transformation(extent={{-200,-60},{-180,-40}}))); 72 | 73 | Buildings.Applications.DHC.Loads.BaseClasses.FlowDistribution disFloHea( 74 | redeclare package Medium = MediumW, 75 | m_flow_nominal=sum(terUni.mHeaWat_flow_nominal .* terUni.facSca), 76 | dp_nominal(displayUnit="Pa")=100000, 77 | have_pum=have_pum, 78 | nPorts_a1=nZon, 79 | nPorts_b1=nZon) 80 | "Heating water distribution system" 81 | 82 | annotation (Placement(transformation(extent={{-140, -100},{-120,-80}}))); 83 | 84 | Buildings.Applications.DHC.Loads.BaseClasses.FlowDistribution disFloCoo( 85 | redeclare package Medium = MediumW, 86 | m_flow_nominal=sum(terUni.mChiWat_flow_nominal .* terUni.facSca), 87 | typDis=Buildings.Applications.DHC.Loads.Types.DistributionType.ChilledWater, 88 | dp_nominal(displayUnit="Pa")=100000, 89 | have_pum=have_pum, 90 | nPorts_a1=nZon, 91 | nPorts_b1=nZon) 92 | "Chilled water distribution system" 93 | 94 | annotation (Placement(transformation(extent={{-140, -160},{-120,-140}}))); 95 | 96 | equation 97 | 98 | connect(disFloHea.port_b, secHeaRet[1]) 99 | annotation (Line(points={{140,-70},{240,-70},{240,32},{300,32}}, color={0,127,255})); 100 | connect(disFloHea.port_a, secHeaSup[1]) 101 | annotation (Line(points={{120,-70},{-242,-70},{-242,32},{-300,32}}, color={0,127,255})); 102 | connect(disFloCoo.port_b, secCooRet[1]) 103 | annotation (Line(points={{140,-110},{252,-110},{252,-30},{300,-30}}, color={0,127,255})); 104 | connect(disFloCoo.port_a, secCooSup[1]) 105 | annotation (Line(points={{120,-110},{-280,-110},{-280,-30},{-300,-30}}, color={0,127,255})); 106 | connect(disFloHea.ports_a1, terUni.port_bHeaWat) 107 | 108 | 109 | annotation (Line(points={{-120, 110 | -80.6667},{-104,-80.6667},{-104,-58.3333},{-180,-58.3333}}, 111 | color={0,127,255})); 112 | connect(disFloHea.ports_b1, terUni.port_aHeaWat) annotation (Line(points={{-140, 113 | -80.6667},{-216,-80.6667},{-216,-58.3333},{-200,-58.3333}}, 114 | color={0,127,255})); 115 | connect(disFloCoo.ports_a1, terUni.port_bChiWat) annotation (Line(points={{-120, 116 | -144},{-94,-144},{-94,-56},{-180,-56},{-180,-56.6667}}, color={0,127,255})); 117 | connect(disFloCoo.ports_b1, terUni.port_aChiWat) annotation (Line(points={{-140, 118 | -144},{-226,-144},{-226,-56.6667},{-200,-56.6667}}, 119 | color={0,127,255})); 120 | 121 | 122 | 123 | connect(weaBus, meeting.weaBus) 124 | annotation ( 125 | Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}}, color={255,204,51},thickness=0.5), 126 | Text(string="%first",index=-1,extent={{6,3},{6,3}},horizontalAlignment=TextAlignment.Left)); 127 | connect(terUni[0+1].heaPorCon, meeting.port_a) 128 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}}, color={191,0,0})); 129 | connect(terUni[0+1].heaPorRad, meeting.port_a) 130 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}}, color={191,0,0})); 131 | 132 | connect(weaBus, floor.weaBus) 133 | annotation ( 134 | Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}}, color={255,204,51},thickness=0.5), 135 | Text(string="%first",index=-1,extent={{6,3},{6,3}},horizontalAlignment=TextAlignment.Left)); 136 | connect(terUni[1+1].heaPorCon, floor.port_a) 137 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}}, color={191,0,0})); 138 | connect(terUni[1+1].heaPorRad, floor.port_a) 139 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}}, color={191,0,0})); 140 | 141 | connect(weaBus, storage.weaBus) 142 | annotation ( 143 | Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}}, color={255,204,51},thickness=0.5), 144 | Text(string="%first",index=-1,extent={{6,3},{6,3}},horizontalAlignment=TextAlignment.Left)); 145 | connect(terUni[2+1].heaPorCon, storage.port_a) 146 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}}, color={191,0,0})); 147 | connect(terUni[2+1].heaPorRad, storage.port_a) 148 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}}, color={191,0,0})); 149 | 150 | connect(weaBus, office.weaBus) 151 | annotation ( 152 | Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}}, color={255,204,51},thickness=0.5), 153 | Text(string="%first",index=-1,extent={{6,3},{6,3}},horizontalAlignment=TextAlignment.Left)); 154 | connect(terUni[3+1].heaPorCon, office.port_a) 155 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}}, color={191,0,0})); 156 | connect(terUni[3+1].heaPorRad, office.port_a) 157 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}}, color={191,0,0})); 158 | 159 | connect(weaBus, restroom.weaBus) 160 | annotation ( 161 | Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}}, color={255,204,51},thickness=0.5), 162 | Text(string="%first",index=-1,extent={{6,3},{6,3}},horizontalAlignment=TextAlignment.Left)); 163 | connect(terUni[4+1].heaPorCon, restroom.port_a) 164 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}}, color={191,0,0})); 165 | connect(terUni[4+1].heaPorRad, restroom.port_a) 166 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}}, color={191,0,0})); 167 | 168 | connect(weaBus, ict.weaBus) 169 | annotation ( 170 | Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}}, color={255,204,51},thickness=0.5), 171 | Text(string="%first",index=-1,extent={{6,3},{6,3}},horizontalAlignment=TextAlignment.Left)); 172 | connect(terUni[5+1].heaPorCon, ict.port_a) 173 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}}, color={191,0,0})); 174 | connect(terUni[5+1].heaPorRad, ict.port_a) 175 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}}, color={191,0,0})); 176 | 177 | 178 | 179 | connect(terUni.mReqHeaWat_flow, disFloHea.mReq_flow) 180 | annotation (Line(points={{-179.167,-53.3333},{-179.167,-54},{-170,-54},{-170,-94},{-141,-94}}, color={0,0,127})); 181 | connect(terUni.mReqChiWat_flow, disFloCoo.mReq_flow) 182 | annotation (Line(points={{-179.167,-55},{-179.167,-56},{-172,-56},{-172,-154},{-141,-154}}, color={0,0,127})); 183 | connect(mulSum.y, PPum) 184 | annotation (Line(points={{282,80},{320,80}}, color={0,0,127})); 185 | connect(disFloHea.PPum, mulSum.u[1]) 186 | annotation (Line(points={{-119,-98},{240,-98},{240,81},{258,81}}, color={0,0,127})); 187 | connect(disFloCoo.PPum, mulSum.u[2]) 188 | annotation (Line(points={{-119,-158},{240,-158},{240,79},{258,79}}, color={0,0,127})); 189 | connect(disFloHea.QActTot_flow, QHea_flow) 190 | annotation (Line(points={{-119,-96},{223.5,-96},{223.5,280},{320,280}}, color={0,0,127})); 191 | connect(disFloCoo.QActTot_flow, QCoo_flow) 192 | annotation (Line(points={{-119,-156},{230,-156},{230,240},{320,240}}, color={0,0,127})); 193 | connect(maxTSet.y, terUni.TSetCoo) 194 | annotation (Line(points={{-268,200},{-240,200},{-240,-46.6667},{-200.833,-46.6667}}, color={0,0,127})); 195 | connect(minTSet.y, terUni.TSetHea) 196 | annotation (Line(points={{-268,240},{-220,240},{-220,-45},{-200.833,-45}}, color={0,0,127})); 197 | 198 | annotation ( 199 | Documentation(info=" 200 | 201 |

202 | Building wrapper for running n-zone thermal zone models generated by TEASER. 203 | 204 | The heating and cooling loads are computed with a four-pipe 205 | fan coil unit model derived from 206 | 207 | Buildings.Applications.DHC.Loads.BaseClasses.PartialTerminalUnit 208 | and connected to the room model by means of heat ports. 209 |

210 | ", 211 | revisions= 212 | " 213 |
    214 |
  • 215 | May 29, 2020, by Nicholas Long:
    216 | Template model for use in GeoJSON to Modelica Translator. 217 |
  • 218 |
  • 219 | February 21, 2020, by Antoine Gautier:
    220 | First implementation. 221 |
  • 222 |
223 | "),Icon( 224 | graphics={Rectangle(lineColor={200,200,200},fillColor={248,248,248},fillPattern=FillPattern.HorizontalCylinder,extent={{-100,-100},{100,100}},radius=25.0),Polygon(points={{0,76},{-80,-64},{80,-64},{0,76}},fillColor={0,0,0},fillPattern=FillPattern.Solid,pattern=LinePattern.None,lineColor={0,0,0}),Polygon(points={{0,68},{-72,-60},{72,-60},{0,68}},lineColor={0,0,0},fillColor={255,255,170},fillPattern=FillPattern.Solid),Ellipse(extent={{-6,-36},{4,-46}},pattern=LinePattern.None,fillColor={0,0,0},fillPattern=FillPattern.Solid),Rectangle(extent={{-4,34},{2,-28}},fillColor={0,0,0},fillPattern=FillPattern.Solid,pattern=LinePattern.None)})); 225 | end building; 226 | /* trailing comment */ -------------------------------------------------------------------------------- /examples/gmt-building-out.mo: -------------------------------------------------------------------------------- 1 | // Model copied from GeoJSON to Modelica Translator project (https://github.com/urbanopt/geojson-modelica-translator) 2 | within a_project.B5a6b99ec37f4de7f94020090; 3 | model building 4 | "n-zone RC building model based on URBANopt's use of TEASER export, with distribution pumps" 5 | extends PartialBuilding( 6 | redeclare package Medium=MediumW, 7 | have_fan=false, 8 | have_eleHea=false, 9 | have_eleCoo=false); 10 | package MediumW=Buildings.Media.Water 11 | "Source side medium"; 12 | package MediumA=Buildings.Media.Air 13 | "Load side medium"; 14 | parameter Integer nZon=6 15 | "Number of thermal zones"; 16 | parameter Integer facSca=3 17 | "Scaling factor to be applied to on each extensive quantity"; 18 | parameter Modelica.SIunits.TemperatureDifference delTBuiCoo=5 19 | "Nominal building supply and return chilled water temperature difference"; 20 | Buildings.Controls.OBC.CDL.Continuous.Sources.Constant minTSet[nZon]( 21 | k=fill( 22 | 293.15, 23 | nZon), 24 | y( 25 | each final unit="K", 26 | each displayUnit="degC")) 27 | "Minimum temperature set point" 28 | annotation (Placement(transformation(extent={{-290,230},{-270,250}}))); 29 | Buildings.Controls.OBC.CDL.Continuous.Sources.Constant maxTSet[nZon]( 30 | k=fill( 31 | 297.15, 32 | nZon), 33 | y( 34 | each final unit="K", 35 | each displayUnit="degC")) 36 | "Maximum temperature set point" 37 | annotation (Placement(transformation(extent={{-290,190},{-270,210}}))); 38 | Meeting meeting 39 | annotation (Placement(transformation(extent={{-160,-20},{-140,0}}))); 40 | Floor floor 41 | annotation (Placement(transformation(extent={{-120,-20},{-100,0}}))); 42 | Storage storage 43 | annotation (Placement(transformation(extent={{-80,-20},{-60,0}}))); 44 | Office office 45 | annotation (Placement(transformation(extent={{-40,-20},{-20,0}}))); 46 | Restroom restroom 47 | annotation (Placement(transformation(extent={{0,-20},{20,0}}))); 48 | ICT ict 49 | annotation (Placement(transformation(extent={{40,-20},{60,0}}))); 50 | Buildings.Controls.OBC.CDL.Continuous.MultiSum mulSum( 51 | nin=2) if have_pum 52 | annotation (Placement(transformation(extent={{260,70},{280,90}}))); 53 | Buildings.Applications.DHC.Loads.Examples.BaseClasses.FanCoil4PipeHeatPorts terUni[nZon]( 54 | redeclare each package Medium1=MediumW, 55 | redeclare each package Medium2=MediumA, 56 | each facSca=facSca, 57 | QHea_flow_nominal={10000,10000,10000,10000,10000,10000}, 58 | QCoo_flow_nominal={-10000,-10000,-10000,-10000,-10000,-50000}, 59 | each T_aLoaHea_nominal=293.15, 60 | each T_aLoaCoo_nominal=297.15, 61 | each T_bHeaWat_nominal=35+273.15, 62 | each T_bChiWat_nominal=12+273.15, 63 | each T_aHeaWat_nominal=40+273.15, 64 | each T_aChiWat_nominal=7+273.15, 65 | each mLoaHea_flow_nominal=5, 66 | each mLoaCoo_flow_nominal=5) 67 | "Terminal unit" 68 | annotation (Placement(transformation(extent={{-200,-60},{-180,-40}}))); 69 | Buildings.Applications.DHC.Loads.BaseClasses.FlowDistribution disFloHea( 70 | redeclare package Medium=MediumW, 71 | m_flow_nominal=sum( 72 | terUni.mHeaWat_flow_nominal .* terUni.facSca), 73 | dp_nominal( 74 | displayUnit="Pa")=100000, 75 | have_pum=have_pum, 76 | nPorts_a1=nZon, 77 | nPorts_b1=nZon) 78 | "Heating water distribution system" 79 | annotation (Placement(transformation(extent={{-140,-100},{-120,-80}}))); 80 | Buildings.Applications.DHC.Loads.BaseClasses.FlowDistribution disFloCoo( 81 | redeclare package Medium=MediumW, 82 | m_flow_nominal=sum( 83 | terUni.mChiWat_flow_nominal .* terUni.facSca), 84 | typDis=Buildings.Applications.DHC.Loads.Types.DistributionType.ChilledWater, 85 | dp_nominal( 86 | displayUnit="Pa")=100000, 87 | have_pum=have_pum, 88 | nPorts_a1=nZon, 89 | nPorts_b1=nZon) 90 | "Chilled water distribution system" 91 | annotation (Placement(transformation(extent={{-140,-160},{-120,-140}}))); 92 | equation 93 | connect(disFloHea.port_b,secHeaRet[1]) 94 | annotation (Line(points={{140,-70},{240,-70},{240,32},{300,32}},color={0,127,255})); 95 | connect(disFloHea.port_a,secHeaSup[1]) 96 | annotation (Line(points={{120,-70},{-242,-70},{-242,32},{-300,32}},color={0,127,255})); 97 | connect(disFloCoo.port_b,secCooRet[1]) 98 | annotation (Line(points={{140,-110},{252,-110},{252,-30},{300,-30}},color={0,127,255})); 99 | connect(disFloCoo.port_a,secCooSup[1]) 100 | annotation (Line(points={{120,-110},{-280,-110},{-280,-30},{-300,-30}},color={0,127,255})); 101 | connect(disFloHea.ports_a1,terUni.port_bHeaWat) 102 | annotation (Line(points={{-120,-80.6667},{-104,-80.6667},{-104,-58.3333},{-180,-58.3333}},color={0,127,255})); 103 | connect(disFloHea.ports_b1,terUni.port_aHeaWat) 104 | annotation (Line(points={{-140,-80.6667},{-216,-80.6667},{-216,-58.3333},{-200,-58.3333}},color={0,127,255})); 105 | connect(disFloCoo.ports_a1,terUni.port_bChiWat) 106 | annotation (Line(points={{-120,-144},{-94,-144},{-94,-56},{-180,-56},{-180,-56.6667}},color={0,127,255})); 107 | connect(disFloCoo.ports_b1,terUni.port_aChiWat) 108 | annotation (Line(points={{-140,-144},{-226,-144},{-226,-56.6667},{-200,-56.6667}},color={0,127,255})); 109 | connect(weaBus,meeting.weaBus) 110 | annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}},color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6,3},{6,3}},horizontalAlignment=TextAlignment.Left)); 111 | connect(terUni[0+1].heaPorCon,meeting.port_a) 112 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191,0,0})); 113 | connect(terUni[0+1].heaPorRad,meeting.port_a) 114 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0})); 115 | connect(weaBus,floor.weaBus) 116 | annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}},color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6,3},{6,3}},horizontalAlignment=TextAlignment.Left)); 117 | connect(terUni[1+1].heaPorCon,floor.port_a) 118 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191,0,0})); 119 | connect(terUni[1+1].heaPorRad,floor.port_a) 120 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0})); 121 | connect(weaBus,storage.weaBus) 122 | annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}},color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6,3},{6,3}},horizontalAlignment=TextAlignment.Left)); 123 | connect(terUni[2+1].heaPorCon,storage.port_a) 124 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191,0,0})); 125 | connect(terUni[2+1].heaPorRad,storage.port_a) 126 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0})); 127 | connect(weaBus,office.weaBus) 128 | annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}},color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6,3},{6,3}},horizontalAlignment=TextAlignment.Left)); 129 | connect(terUni[3+1].heaPorCon,office.port_a) 130 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191,0,0})); 131 | connect(terUni[3+1].heaPorRad,office.port_a) 132 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0})); 133 | connect(weaBus,restroom.weaBus) 134 | annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}},color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6,3},{6,3}},horizontalAlignment=TextAlignment.Left)); 135 | connect(terUni[4+1].heaPorCon,restroom.port_a) 136 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191,0,0})); 137 | connect(terUni[4+1].heaPorRad,restroom.port_a) 138 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0})); 139 | connect(weaBus,ict.weaBus) 140 | annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}},color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6,3},{6,3}},horizontalAlignment=TextAlignment.Left)); 141 | connect(terUni[5+1].heaPorCon,ict.port_a) 142 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191,0,0})); 143 | connect(terUni[5+1].heaPorRad,ict.port_a) 144 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0})); 145 | connect(terUni.mReqHeaWat_flow,disFloHea.mReq_flow) 146 | annotation (Line(points={{-179.167,-53.3333},{-179.167,-54},{-170,-54},{-170,-94},{-141,-94}},color={0,0,127})); 147 | connect(terUni.mReqChiWat_flow,disFloCoo.mReq_flow) 148 | annotation (Line(points={{-179.167,-55},{-179.167,-56},{-172,-56},{-172,-154},{-141,-154}},color={0,0,127})); 149 | connect(mulSum.y,PPum) 150 | annotation (Line(points={{282,80},{320,80}},color={0,0,127})); 151 | connect(disFloHea.PPum,mulSum.u[1]) 152 | annotation (Line(points={{-119,-98},{240,-98},{240,81},{258,81}},color={0,0,127})); 153 | connect(disFloCoo.PPum,mulSum.u[2]) 154 | annotation (Line(points={{-119,-158},{240,-158},{240,79},{258,79}},color={0,0,127})); 155 | connect(disFloHea.QActTot_flow,QHea_flow) 156 | annotation (Line(points={{-119,-96},{223.5,-96},{223.5,280},{320,280}},color={0,0,127})); 157 | connect(disFloCoo.QActTot_flow,QCoo_flow) 158 | annotation (Line(points={{-119,-156},{230,-156},{230,240},{320,240}},color={0,0,127})); 159 | connect(maxTSet.y,terUni.TSetCoo) 160 | annotation (Line(points={{-268,200},{-240,200},{-240,-46.6667},{-200.833,-46.6667}},color={0,0,127})); 161 | connect(minTSet.y,terUni.TSetHea) 162 | annotation (Line(points={{-268,240},{-220,240},{-220,-45},{-200.833,-45}},color={0,0,127})); 163 | annotation ( 164 | Documentation( 165 | info=" 166 | 167 |

168 | Building wrapper for running n-zone thermal zone models generated by TEASER. 169 | 170 | The heating and cooling loads are computed with a four-pipe 171 | fan coil unit model derived from 172 | 173 | Buildings.Applications.DHC.Loads.BaseClasses.PartialTerminalUnit 174 | and connected to the room model by means of heat ports. 175 |

176 | ", 177 | revisions=" 178 |
    179 |
  • 180 | May 29, 2020, by Nicholas Long:
    181 | Template model for use in GeoJSON to Modelica Translator. 182 |
  • 183 |
  • 184 | February 21, 2020, by Antoine Gautier:
    185 | First implementation. 186 |
  • 187 |
188 | "), 189 | Icon( 190 | graphics={ 191 | Rectangle( 192 | lineColor={200,200,200}, 193 | fillColor={248,248,248}, 194 | fillPattern=FillPattern.HorizontalCylinder, 195 | extent={{-100,-100},{100,100}}, 196 | radius=25.0), 197 | Polygon( 198 | points={{0,76},{-80,-64},{80,-64},{0,76}}, 199 | fillColor={0,0,0}, 200 | fillPattern=FillPattern.Solid, 201 | pattern=LinePattern.None, 202 | lineColor={0,0,0}), 203 | Polygon( 204 | points={{0,68},{-72,-60},{72,-60},{0,68}}, 205 | lineColor={0,0,0}, 206 | fillColor={255,255,170}, 207 | fillPattern=FillPattern.Solid), 208 | Ellipse( 209 | extent={{-6,-36},{4,-46}}, 210 | pattern=LinePattern.None, 211 | fillColor={0,0,0}, 212 | fillPattern=FillPattern.Solid), 213 | Rectangle( 214 | extent={{-4,34},{2,-28}}, 215 | fillColor={0,0,0}, 216 | fillPattern=FillPattern.Solid, 217 | pattern=LinePattern.None)})); 218 | end building; 219 | /* trailing comment */ 220 | -------------------------------------------------------------------------------- /examples/gmt-building-empty-lines-out.mo: -------------------------------------------------------------------------------- 1 | // Model copied from GeoJSON to Modelica Translator project (https://github.com/urbanopt/geojson-modelica-translator) 2 | within a_project.B5a6b99ec37f4de7f94020090; 3 | model building 4 | "n-zone RC building model based on URBANopt's use of TEASER export, with distribution pumps" 5 | extends PartialBuilding( 6 | redeclare package Medium=MediumW, 7 | have_fan=false, 8 | have_eleHea=false, 9 | have_eleCoo=false); 10 | 11 | package MediumW=Buildings.Media.Water 12 | "Source side medium"; 13 | 14 | package MediumA=Buildings.Media.Air 15 | "Load side medium"; 16 | 17 | parameter Integer nZon=6 18 | "Number of thermal zones"; 19 | 20 | parameter Integer facSca=3 21 | "Scaling factor to be applied to on each extensive quantity"; 22 | 23 | parameter Modelica.SIunits.TemperatureDifference delTBuiCoo=5 24 | "Nominal building supply and return chilled water temperature difference"; 25 | 26 | Buildings.Controls.OBC.CDL.Continuous.Sources.Constant minTSet[nZon]( 27 | k=fill( 28 | 293.15, 29 | nZon), 30 | y( 31 | each final unit="K", 32 | each displayUnit="degC")) 33 | "Minimum temperature set point" 34 | annotation (Placement(transformation(extent={{-290,230},{-270,250}}))); 35 | 36 | Buildings.Controls.OBC.CDL.Continuous.Sources.Constant maxTSet[nZon]( 37 | k=fill( 38 | 297.15, 39 | nZon), 40 | y( 41 | each final unit="K", 42 | each displayUnit="degC")) 43 | "Maximum temperature set point" 44 | annotation (Placement(transformation(extent={{-290,190},{-270,210}}))); 45 | 46 | Meeting meeting 47 | annotation (Placement(transformation(extent={{-160,-20},{-140,0}}))); 48 | 49 | Floor floor 50 | annotation (Placement(transformation(extent={{-120,-20},{-100,0}}))); 51 | 52 | Storage storage 53 | annotation (Placement(transformation(extent={{-80,-20},{-60,0}}))); 54 | 55 | Office office 56 | annotation (Placement(transformation(extent={{-40,-20},{-20,0}}))); 57 | 58 | Restroom restroom 59 | annotation (Placement(transformation(extent={{0,-20},{20,0}}))); 60 | 61 | ICT ict 62 | annotation (Placement(transformation(extent={{40,-20},{60,0}}))); 63 | 64 | Buildings.Controls.OBC.CDL.Continuous.MultiSum mulSum( 65 | nin=2) if have_pum 66 | annotation (Placement(transformation(extent={{260,70},{280,90}}))); 67 | 68 | Buildings.Applications.DHC.Loads.Examples.BaseClasses.FanCoil4PipeHeatPorts terUni[nZon]( 69 | redeclare each package Medium1=MediumW, 70 | redeclare each package Medium2=MediumA, 71 | each facSca=facSca, 72 | QHea_flow_nominal={10000,10000,10000,10000,10000,10000}, 73 | QCoo_flow_nominal={-10000,-10000,-10000,-10000,-10000,-50000}, 74 | each T_aLoaHea_nominal=293.15, 75 | each T_aLoaCoo_nominal=297.15, 76 | each T_bHeaWat_nominal=35+273.15, 77 | each T_bChiWat_nominal=12+273.15, 78 | each T_aHeaWat_nominal=40+273.15, 79 | each T_aChiWat_nominal=7+273.15, 80 | each mLoaHea_flow_nominal=5, 81 | each mLoaCoo_flow_nominal=5) 82 | "Terminal unit" 83 | annotation (Placement(transformation(extent={{-200,-60},{-180,-40}}))); 84 | 85 | Buildings.Applications.DHC.Loads.BaseClasses.FlowDistribution disFloHea( 86 | redeclare package Medium=MediumW, 87 | m_flow_nominal=sum( 88 | terUni.mHeaWat_flow_nominal .* terUni.facSca), 89 | dp_nominal( 90 | displayUnit="Pa")=100000, 91 | have_pum=have_pum, 92 | nPorts_a1=nZon, 93 | nPorts_b1=nZon) 94 | "Heating water distribution system" 95 | annotation (Placement(transformation(extent={{-140,-100},{-120,-80}}))); 96 | 97 | Buildings.Applications.DHC.Loads.BaseClasses.FlowDistribution disFloCoo( 98 | redeclare package Medium=MediumW, 99 | m_flow_nominal=sum( 100 | terUni.mChiWat_flow_nominal .* terUni.facSca), 101 | typDis=Buildings.Applications.DHC.Loads.Types.DistributionType.ChilledWater, 102 | dp_nominal( 103 | displayUnit="Pa")=100000, 104 | have_pum=have_pum, 105 | nPorts_a1=nZon, 106 | nPorts_b1=nZon) 107 | "Chilled water distribution system" 108 | annotation (Placement(transformation(extent={{-140,-160},{-120,-140}}))); 109 | 110 | equation 111 | connect(disFloHea.port_b,secHeaRet[1]) 112 | annotation (Line(points={{140,-70},{240,-70},{240,32},{300,32}},color={0,127,255})); 113 | 114 | connect(disFloHea.port_a,secHeaSup[1]) 115 | annotation (Line(points={{120,-70},{-242,-70},{-242,32},{-300,32}},color={0,127,255})); 116 | 117 | connect(disFloCoo.port_b,secCooRet[1]) 118 | annotation (Line(points={{140,-110},{252,-110},{252,-30},{300,-30}},color={0,127,255})); 119 | 120 | connect(disFloCoo.port_a,secCooSup[1]) 121 | annotation (Line(points={{120,-110},{-280,-110},{-280,-30},{-300,-30}},color={0,127,255})); 122 | 123 | connect(disFloHea.ports_a1,terUni.port_bHeaWat) 124 | annotation (Line(points={{-120,-80.6667},{-104,-80.6667},{-104,-58.3333},{-180,-58.3333}},color={0,127,255})); 125 | 126 | connect(disFloHea.ports_b1,terUni.port_aHeaWat) 127 | annotation (Line(points={{-140,-80.6667},{-216,-80.6667},{-216,-58.3333},{-200,-58.3333}},color={0,127,255})); 128 | 129 | connect(disFloCoo.ports_a1,terUni.port_bChiWat) 130 | annotation (Line(points={{-120,-144},{-94,-144},{-94,-56},{-180,-56},{-180,-56.6667}},color={0,127,255})); 131 | 132 | connect(disFloCoo.ports_b1,terUni.port_aChiWat) 133 | annotation (Line(points={{-140,-144},{-226,-144},{-226,-56.6667},{-200,-56.6667}},color={0,127,255})); 134 | 135 | connect(weaBus,meeting.weaBus) 136 | annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}},color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6,3},{6,3}},horizontalAlignment=TextAlignment.Left)); 137 | 138 | connect(terUni[0+1].heaPorCon,meeting.port_a) 139 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191,0,0})); 140 | 141 | connect(terUni[0+1].heaPorRad,meeting.port_a) 142 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0})); 143 | 144 | connect(weaBus,floor.weaBus) 145 | annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}},color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6,3},{6,3}},horizontalAlignment=TextAlignment.Left)); 146 | 147 | connect(terUni[1+1].heaPorCon,floor.port_a) 148 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191,0,0})); 149 | 150 | connect(terUni[1+1].heaPorRad,floor.port_a) 151 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0})); 152 | 153 | connect(weaBus,storage.weaBus) 154 | annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}},color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6,3},{6,3}},horizontalAlignment=TextAlignment.Left)); 155 | 156 | connect(terUni[2+1].heaPorCon,storage.port_a) 157 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191,0,0})); 158 | 159 | connect(terUni[2+1].heaPorRad,storage.port_a) 160 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0})); 161 | 162 | connect(weaBus,office.weaBus) 163 | annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}},color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6,3},{6,3}},horizontalAlignment=TextAlignment.Left)); 164 | 165 | connect(terUni[3+1].heaPorCon,office.port_a) 166 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191,0,0})); 167 | 168 | connect(terUni[3+1].heaPorRad,office.port_a) 169 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0})); 170 | 171 | connect(weaBus,restroom.weaBus) 172 | annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}},color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6,3},{6,3}},horizontalAlignment=TextAlignment.Left)); 173 | 174 | connect(terUni[4+1].heaPorCon,restroom.port_a) 175 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191,0,0})); 176 | 177 | connect(terUni[4+1].heaPorRad,restroom.port_a) 178 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0})); 179 | 180 | connect(weaBus,ict.weaBus) 181 | annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}},color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6,3},{6,3}},horizontalAlignment=TextAlignment.Left)); 182 | 183 | connect(terUni[5+1].heaPorCon,ict.port_a) 184 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191,0,0})); 185 | 186 | connect(terUni[5+1].heaPorRad,ict.port_a) 187 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0})); 188 | 189 | connect(terUni.mReqHeaWat_flow,disFloHea.mReq_flow) 190 | annotation (Line(points={{-179.167,-53.3333},{-179.167,-54},{-170,-54},{-170,-94},{-141,-94}},color={0,0,127})); 191 | 192 | connect(terUni.mReqChiWat_flow,disFloCoo.mReq_flow) 193 | annotation (Line(points={{-179.167,-55},{-179.167,-56},{-172,-56},{-172,-154},{-141,-154}},color={0,0,127})); 194 | 195 | connect(mulSum.y,PPum) 196 | annotation (Line(points={{282,80},{320,80}},color={0,0,127})); 197 | 198 | connect(disFloHea.PPum,mulSum.u[1]) 199 | annotation (Line(points={{-119,-98},{240,-98},{240,81},{258,81}},color={0,0,127})); 200 | 201 | connect(disFloCoo.PPum,mulSum.u[2]) 202 | annotation (Line(points={{-119,-158},{240,-158},{240,79},{258,79}},color={0,0,127})); 203 | 204 | connect(disFloHea.QActTot_flow,QHea_flow) 205 | annotation (Line(points={{-119,-96},{223.5,-96},{223.5,280},{320,280}},color={0,0,127})); 206 | 207 | connect(disFloCoo.QActTot_flow,QCoo_flow) 208 | annotation (Line(points={{-119,-156},{230,-156},{230,240},{320,240}},color={0,0,127})); 209 | 210 | connect(maxTSet.y,terUni.TSetCoo) 211 | annotation (Line(points={{-268,200},{-240,200},{-240,-46.6667},{-200.833,-46.6667}},color={0,0,127})); 212 | 213 | connect(minTSet.y,terUni.TSetHea) 214 | annotation (Line(points={{-268,240},{-220,240},{-220,-45},{-200.833,-45}},color={0,0,127})); 215 | 216 | annotation ( 217 | Documentation( 218 | info=" 219 | 220 |

221 | Building wrapper for running n-zone thermal zone models generated by TEASER. 222 | 223 | The heating and cooling loads are computed with a four-pipe 224 | fan coil unit model derived from 225 | 226 | Buildings.Applications.DHC.Loads.BaseClasses.PartialTerminalUnit 227 | and connected to the room model by means of heat ports. 228 |

229 | ", 230 | revisions=" 231 |
    232 |
  • 233 | May 29, 2020, by Nicholas Long:
    234 | Template model for use in GeoJSON to Modelica Translator. 235 |
  • 236 |
  • 237 | February 21, 2020, by Antoine Gautier:
    238 | First implementation. 239 |
  • 240 |
241 | "), 242 | Icon( 243 | graphics={ 244 | Rectangle( 245 | lineColor={200,200,200}, 246 | fillColor={248,248,248}, 247 | fillPattern=FillPattern.HorizontalCylinder, 248 | extent={{-100,-100},{100,100}}, 249 | radius=25.0), 250 | Polygon( 251 | points={{0,76},{-80,-64},{80,-64},{0,76}}, 252 | fillColor={0,0,0}, 253 | fillPattern=FillPattern.Solid, 254 | pattern=LinePattern.None, 255 | lineColor={0,0,0}), 256 | Polygon( 257 | points={{0,68},{-72,-60},{72,-60},{0,68}}, 258 | lineColor={0,0,0}, 259 | fillColor={255,255,170}, 260 | fillPattern=FillPattern.Solid), 261 | Ellipse( 262 | extent={{-6,-36},{4,-46}}, 263 | pattern=LinePattern.None, 264 | fillColor={0,0,0}, 265 | fillPattern=FillPattern.Solid), 266 | Rectangle( 267 | extent={{-4,34},{2,-28}}, 268 | fillColor={0,0,0}, 269 | fillPattern=FillPattern.Solid, 270 | pattern=LinePattern.None)})); 271 | 272 | end building; 273 | 274 | /* trailing comment */ 275 | -------------------------------------------------------------------------------- /examples/gmt-building-80-out.mo: -------------------------------------------------------------------------------- 1 | // Model copied from GeoJSON to Modelica Translator project (https://github.com/urbanopt/geojson-modelica-translator) 2 | within a_project.B5a6b99ec37f4de7f94020090; 3 | model building 4 | "n-zone RC building model based on URBANopt's use of TEASER export, with distribution pumps" 5 | extends PartialBuilding( 6 | redeclare package Medium=MediumW, 7 | have_fan=false, 8 | have_eleHea=false, 9 | have_eleCoo=false); 10 | package MediumW=Buildings.Media.Water 11 | "Source side medium"; 12 | package MediumA=Buildings.Media.Air 13 | "Load side medium"; 14 | parameter Integer nZon=6 15 | "Number of thermal zones"; 16 | parameter Integer facSca=3 17 | "Scaling factor to be applied to on each extensive quantity"; 18 | parameter Modelica.SIunits.TemperatureDifference delTBuiCoo=5 19 | "Nominal building supply and return chilled water temperature difference"; 20 | Buildings.Controls.OBC.CDL.Continuous.Sources.Constant minTSet[nZon]( 21 | k=fill( 22 | 293.15, 23 | nZon), 24 | y( 25 | each final unit="K", 26 | each displayUnit="degC")) 27 | "Minimum temperature set point" 28 | annotation (Placement(transformation(extent={{-290,230},{-270,250}}))); 29 | Buildings.Controls.OBC.CDL.Continuous.Sources.Constant maxTSet[nZon]( 30 | k=fill( 31 | 297.15, 32 | nZon), 33 | y( 34 | each final unit="K", 35 | each displayUnit="degC")) 36 | "Maximum temperature set point" 37 | annotation (Placement(transformation(extent={{-290,190},{-270,210}}))); 38 | Meeting meeting 39 | annotation (Placement(transformation(extent={{-160,-20},{-140,0}}))); 40 | Floor floor 41 | annotation (Placement(transformation(extent={{-120,-20},{-100,0}}))); 42 | Storage storage 43 | annotation (Placement(transformation(extent={{-80,-20},{-60,0}}))); 44 | Office office 45 | annotation (Placement(transformation(extent={{-40,-20},{-20,0}}))); 46 | Restroom restroom 47 | annotation (Placement(transformation(extent={{0,-20},{20,0}}))); 48 | ICT ict 49 | annotation (Placement(transformation(extent={{40,-20},{60,0}}))); 50 | Buildings.Controls.OBC.CDL.Continuous.MultiSum mulSum( 51 | nin=2) if have_pum 52 | annotation (Placement(transformation(extent={{260,70},{280,90}}))); 53 | Buildings.Applications.DHC.Loads.Examples.BaseClasses.FanCoil4PipeHeatPorts terUni[nZon]( 54 | redeclare each package Medium1=MediumW, 55 | redeclare each package Medium2=MediumA, 56 | each facSca=facSca, 57 | QHea_flow_nominal={10000,10000,10000,10000,10000,10000}, 58 | QCoo_flow_nominal={-10000,-10000,-10000,-10000,-10000,-50000}, 59 | each T_aLoaHea_nominal=293.15, 60 | each T_aLoaCoo_nominal=297.15, 61 | each T_bHeaWat_nominal=35+273.15, 62 | each T_bChiWat_nominal=12+273.15, 63 | each T_aHeaWat_nominal=40+273.15, 64 | each T_aChiWat_nominal=7+273.15, 65 | each mLoaHea_flow_nominal=5, 66 | each mLoaCoo_flow_nominal=5) 67 | "Terminal unit" 68 | annotation (Placement(transformation(extent={{-200,-60},{-180,-40}}))); 69 | Buildings.Applications.DHC.Loads.BaseClasses.FlowDistribution disFloHea( 70 | redeclare package Medium=MediumW, 71 | m_flow_nominal=sum( 72 | terUni.mHeaWat_flow_nominal .* terUni.facSca), 73 | dp_nominal( 74 | displayUnit="Pa")=100000, 75 | have_pum=have_pum, 76 | nPorts_a1=nZon, 77 | nPorts_b1=nZon) 78 | "Heating water distribution system" 79 | annotation (Placement(transformation(extent={{-140,-100},{-120,-80}}))); 80 | Buildings.Applications.DHC.Loads.BaseClasses.FlowDistribution disFloCoo( 81 | redeclare package Medium=MediumW, 82 | m_flow_nominal=sum( 83 | terUni.mChiWat_flow_nominal .* terUni.facSca), 84 | typDis=Buildings.Applications.DHC.Loads.Types.DistributionType.ChilledWater, 85 | dp_nominal( 86 | displayUnit="Pa")=100000, 87 | have_pum=have_pum, 88 | nPorts_a1=nZon, 89 | nPorts_b1=nZon) 90 | "Chilled water distribution system" 91 | annotation (Placement(transformation(extent={{-140,-160},{-120,-140}}))); 92 | equation 93 | connect(disFloHea.port_b,secHeaRet[1]) 94 | annotation (Line(points={{140,-70},{240,-70},{240,32},{300,32}},color={0,127, 95 | 255})); 96 | connect(disFloHea.port_a,secHeaSup[1]) 97 | annotation (Line(points={{120,-70},{-242,-70},{-242,32},{-300,32}},color={0, 98 | 127,255})); 99 | connect(disFloCoo.port_b,secCooRet[1]) 100 | annotation (Line(points={{140,-110},{252,-110},{252,-30},{300,-30}},color={0, 101 | 127,255})); 102 | connect(disFloCoo.port_a,secCooSup[1]) 103 | annotation (Line(points={{120,-110},{-280,-110},{-280,-30},{-300,-30}},color= 104 | {0,127,255})); 105 | connect(disFloHea.ports_a1,terUni.port_bHeaWat) 106 | annotation (Line(points={{-120,-80.6667},{-104,-80.6667},{-104,-58.3333},{-180, 107 | -58.3333}},color={0,127,255})); 108 | connect(disFloHea.ports_b1,terUni.port_aHeaWat) 109 | annotation (Line(points={{-140,-80.6667},{-216,-80.6667},{-216,-58.3333},{-200, 110 | -58.3333}},color={0,127,255})); 111 | connect(disFloCoo.ports_a1,terUni.port_bChiWat) 112 | annotation (Line(points={{-120,-144},{-94,-144},{-94,-56},{-180,-56},{-180,-56.6667}}, 113 | color={0,127,255})); 114 | connect(disFloCoo.ports_b1,terUni.port_aChiWat) 115 | annotation (Line(points={{-140,-144},{-226,-144},{-226,-56.6667},{-200,-56.6667}}, 116 | color={0,127,255})); 117 | connect(weaBus,meeting.weaBus) 118 | annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}}, 119 | color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6, 120 | 3},{6,3}},horizontalAlignment=TextAlignment.Left)); 121 | connect(terUni[0+1].heaPorCon,meeting.port_a) 122 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191, 123 | 0,0})); 124 | connect(terUni[0+1].heaPorRad,meeting.port_a) 125 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0})); 126 | connect(weaBus,floor.weaBus) 127 | annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}}, 128 | color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6, 129 | 3},{6,3}},horizontalAlignment=TextAlignment.Left)); 130 | connect(terUni[1+1].heaPorCon,floor.port_a) 131 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191, 132 | 0,0})); 133 | connect(terUni[1+1].heaPorRad,floor.port_a) 134 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0})); 135 | connect(weaBus,storage.weaBus) 136 | annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}}, 137 | color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6, 138 | 3},{6,3}},horizontalAlignment=TextAlignment.Left)); 139 | connect(terUni[2+1].heaPorCon,storage.port_a) 140 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191, 141 | 0,0})); 142 | connect(terUni[2+1].heaPorRad,storage.port_a) 143 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0})); 144 | connect(weaBus,office.weaBus) 145 | annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}}, 146 | color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6, 147 | 3},{6,3}},horizontalAlignment=TextAlignment.Left)); 148 | connect(terUni[3+1].heaPorCon,office.port_a) 149 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191, 150 | 0,0})); 151 | connect(terUni[3+1].heaPorRad,office.port_a) 152 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0})); 153 | connect(weaBus,restroom.weaBus) 154 | annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}}, 155 | color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6, 156 | 3},{6,3}},horizontalAlignment=TextAlignment.Left)); 157 | connect(terUni[4+1].heaPorCon,restroom.port_a) 158 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191, 159 | 0,0})); 160 | connect(terUni[4+1].heaPorRad,restroom.port_a) 161 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0})); 162 | connect(weaBus,ict.weaBus) 163 | annotation (Line(points={{1,300},{0,300},{0,20},{-66,20},{-66,-10.2},{-96,-10.2}}, 164 | color={255,204,51},thickness=0.5),Text(string="%first",index=-1,extent={{6, 165 | 3},{6,3}},horizontalAlignment=TextAlignment.Left)); 166 | connect(terUni[5+1].heaPorCon,ict.port_a) 167 | annotation (Line(points={{-193.333,-50},{-192,-50},{-192,0},{-90,0}},color={191, 168 | 0,0})); 169 | connect(terUni[5+1].heaPorRad,ict.port_a) 170 | annotation (Line(points={{-186.667,-50},{-90,-50},{-90,0}},color={191,0,0})); 171 | connect(terUni.mReqHeaWat_flow,disFloHea.mReq_flow) 172 | annotation (Line(points={{-179.167,-53.3333},{-179.167,-54},{-170,-54},{-170, 173 | -94},{-141,-94}},color={0,0,127})); 174 | connect(terUni.mReqChiWat_flow,disFloCoo.mReq_flow) 175 | annotation (Line(points={{-179.167,-55},{-179.167,-56},{-172,-56},{-172,-154}, 176 | {-141,-154}},color={0,0,127})); 177 | connect(mulSum.y,PPum) 178 | annotation (Line(points={{282,80},{320,80}},color={0,0,127})); 179 | connect(disFloHea.PPum,mulSum.u[1]) 180 | annotation (Line(points={{-119,-98},{240,-98},{240,81},{258,81}},color={0,0, 181 | 127})); 182 | connect(disFloCoo.PPum,mulSum.u[2]) 183 | annotation (Line(points={{-119,-158},{240,-158},{240,79},{258,79}},color={0, 184 | 0,127})); 185 | connect(disFloHea.QActTot_flow,QHea_flow) 186 | annotation (Line(points={{-119,-96},{223.5,-96},{223.5,280},{320,280}},color= 187 | {0,0,127})); 188 | connect(disFloCoo.QActTot_flow,QCoo_flow) 189 | annotation (Line(points={{-119,-156},{230,-156},{230,240},{320,240}},color={0, 190 | 0,127})); 191 | connect(maxTSet.y,terUni.TSetCoo) 192 | annotation (Line(points={{-268,200},{-240,200},{-240,-46.6667},{-200.833,-46.6667}}, 193 | color={0,0,127})); 194 | connect(minTSet.y,terUni.TSetHea) 195 | annotation (Line(points={{-268,240},{-220,240},{-220,-45},{-200.833,-45}}, 196 | color={0,0,127})); 197 | annotation ( 198 | Documentation( 199 | info=" 200 | 201 |

202 | Building wrapper for running n-zone thermal zone models generated by TEASER. 203 | 204 | The heating and cooling loads are computed with a four-pipe 205 | fan coil unit model derived from 206 | 207 | Buildings.Applications.DHC.Loads.BaseClasses.PartialTerminalUnit 208 | and connected to the room model by means of heat ports. 209 |

210 | ", 211 | revisions=" 212 |
    213 |
  • 214 | May 29, 2020, by Nicholas Long:
    215 | Template model for use in GeoJSON to Modelica Translator. 216 |
  • 217 |
  • 218 | February 21, 2020, by Antoine Gautier:
    219 | First implementation. 220 |
  • 221 |
222 | "), 223 | Icon( 224 | graphics={ 225 | Rectangle( 226 | lineColor={200,200,200}, 227 | fillColor={248,248,248}, 228 | fillPattern=FillPattern.HorizontalCylinder, 229 | extent={{-100,-100},{100,100}}, 230 | radius=25.0), 231 | Polygon( 232 | points={{0,76},{-80,-64},{80,-64},{0,76}}, 233 | fillColor={0,0,0}, 234 | fillPattern=FillPattern.Solid, 235 | pattern=LinePattern.None, 236 | lineColor={0,0,0}), 237 | Polygon( 238 | points={{0,68},{-72,-60},{72,-60},{0,68}}, 239 | lineColor={0,0,0}, 240 | fillColor={255,255,170}, 241 | fillPattern=FillPattern.Solid), 242 | Ellipse( 243 | extent={{-6,-36},{4,-46}}, 244 | pattern=LinePattern.None, 245 | fillColor={0,0,0}, 246 | fillPattern=FillPattern.Solid), 247 | Rectangle( 248 | extent={{-4,34},{2,-28}}, 249 | fillColor={0,0,0}, 250 | fillPattern=FillPattern.Solid, 251 | pattern=LinePattern.None)})); 252 | end building; 253 | /* trailing comment */ 254 | -------------------------------------------------------------------------------- /thirdparty/Modelica.g4: -------------------------------------------------------------------------------- 1 | /* 2 | [The "BSD licence"] 3 | Copyright (c) 2012 Tom Everett 4 | All rights reserved. 5 | Redistribution and use in source and binary forms, with or without 6 | modification, are permitted provided that the following conditions 7 | are met: 8 | 1. Redistributions of source code must retain the above copyright 9 | notice, this list of conditions and the following disclaimer. 10 | 2. Redistributions in binary form must reproduce the above copyright 11 | notice, this list of conditions and the following disclaimer in the 12 | documentation and/or other materials provided with the distribution. 13 | 3. The name of the author may not be used to endorse or promote products 14 | derived from this software without specific prior written permission. 15 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 16 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 17 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 18 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 19 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 20 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 21 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 22 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 24 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 | */ 26 | 27 | grammar Modelica; 28 | 29 | stored_definition 30 | : ('within' (name)? ';')* (('final')? class_definition last_semicolon )* 31 | ; 32 | 33 | class_definition 34 | : ('encapsulated')? class_prefixes class_specifier 35 | ; 36 | 37 | last_semicolon 38 | : ';' 39 | ; 40 | 41 | class_specifier 42 | : long_class_specifier 43 | | short_class_specifier 44 | | der_class_specifier 45 | ; 46 | 47 | class_prefixes 48 | : ('partial')? ('class' | 'model' | ('operator')? 'record' | 'block' | ('expandable')? 'connector' | 'type' | 'package' | (('pure' | 'impure'))? ('operator')? 'function' | 'operator') 49 | ; 50 | 51 | long_class_specifier 52 | : IDENT (string_comment)? composition 'end' IDENT 53 | | 'extends' IDENT (class_modification)? (string_comment)? composition 'end' IDENT 54 | ; 55 | 56 | short_class_specifier 57 | : IDENT '=' base_prefix name (array_subscripts)? (class_modification)? (string_comment)? (annotation)? 58 | | IDENT '=' 'enumeration' '(' ((enum_list)? | ':') ')' (string_comment)? (annotation)? 59 | ; 60 | 61 | der_class_specifier 62 | : IDENT '=' 'der' '(' name ',' IDENT (',' IDENT)* ')' (string_comment)? (annotation)? 63 | ; 64 | 65 | base_prefix 66 | : type_prefix 67 | ; 68 | 69 | enum_list 70 | : enumeration_literal (',' enumeration_literal)* 71 | ; 72 | 73 | enumeration_literal 74 | : IDENT (string_comment)? (annotation)? 75 | ; 76 | 77 | composition 78 | : element_list ('public' element_list | 'protected' element_list | equation_section | algorithm_section)* ('external' (language_specification)? (external_function_call)? (annotation)? ';')? (model_annotation ';')? 79 | ; 80 | 81 | model_annotation 82 | : annotation 83 | ; 84 | 85 | language_specification 86 | : STRING 87 | ; 88 | 89 | // changed from original file 90 | external_function_call 91 | : (component_reference '=')? IDENT '(' (external_function_call_args)? ')' 92 | ; 93 | 94 | external_function_call_args 95 | : external_function_call_argument (',' external_function_call_argument)* 96 | ; 97 | 98 | external_function_call_argument 99 | : expression 100 | ; 101 | 102 | element_list 103 | : (element ';')* 104 | ; 105 | 106 | element 107 | : import_clause 108 | | extends_clause 109 | | ('redeclare')? ('final')? ('inner')? ('outer')? ((class_definition | component_clause) | 'replaceable' (class_definition | component_clause) (constraining_clause (string_comment)? (annotation)?)?) 110 | ; 111 | 112 | import_clause 113 | : 'import' (IDENT '=' name | name '.*' | name '.{' import_list '}' | name ) (string_comment)? (annotation)? 114 | ; 115 | 116 | import_list 117 | : IDENT (',' IDENT)* 118 | ; 119 | 120 | extends_clause 121 | : 'extends' name (class_modification)? (annotation)? 122 | ; 123 | 124 | constraining_clause 125 | : 'constrainedby' name (class_modification)? 126 | ; 127 | 128 | component_clause 129 | : type_prefix type_specifier (array_subscripts)? component_list 130 | ; 131 | 132 | type_prefix 133 | : ('flow' | 'stream')? ('discrete' | 'parameter' | 'constant')? ('input' | 'output')? 134 | ; 135 | 136 | type_specifier 137 | : name 138 | ; 139 | 140 | component_list 141 | : component_declaration (',' component_declaration)* 142 | ; 143 | 144 | component_declaration 145 | : declaration (condition_attribute)? (string_comment)? (annotation)? 146 | ; 147 | 148 | condition_attribute 149 | : 'if' expression 150 | ; 151 | 152 | declaration 153 | : IDENT (array_subscripts)? (modification)? 154 | ; 155 | 156 | modification 157 | : class_modification ('=' expression)? 158 | | '=' expression 159 | | ':=' expression 160 | ; 161 | 162 | class_modification 163 | : '(' (argument_list)? ')' 164 | ; 165 | 166 | argument_list 167 | : argument (',' argument)* 168 | ; 169 | 170 | argument 171 | : element_modification_or_replaceable 172 | | element_redeclaration 173 | ; 174 | 175 | element_modification_or_replaceable 176 | : ('each')? ('final')? (element_modification | element_replaceable) 177 | ; 178 | 179 | element_modification 180 | : name (modification)? (string_comment)? 181 | ; 182 | 183 | element_redeclaration 184 | : 'redeclare' ('each')? ('final')? ((short_class_definition | component_clause1) | element_replaceable) 185 | ; 186 | 187 | element_replaceable 188 | : 'replaceable' (short_class_definition | component_clause1) (constraining_clause)? 189 | ; 190 | 191 | component_clause1 192 | : type_prefix type_specifier component_declaration1 193 | ; 194 | 195 | component_declaration1 196 | : declaration (string_comment)? (annotation)? 197 | ; 198 | 199 | short_class_definition 200 | : class_prefixes short_class_specifier 201 | ; 202 | 203 | equation_section 204 | : ('initial')? 'equation' (equations)? 205 | ; 206 | 207 | equations 208 | : (equation ';')+ 209 | ; 210 | 211 | algorithm_section 212 | : ('initial')? 'algorithm' (algorithm_statements)? 213 | ; 214 | 215 | algorithm_statements 216 | : (statement ';')+ 217 | ; 218 | 219 | equation 220 | : (simple_expression '=' expression | if_equation | for_equation | connect_clause | when_equation | name function_call_args) (string_comment)? (annotation)? 221 | ; 222 | 223 | statement 224 | : (component_reference (':=' expression | function_call_args) | '(' output_expression_list ')' ':=' component_reference function_call_args | 'break' | 'return' | if_statement | for_statement | while_statement | when_statement) (string_comment)? (annotation)? 225 | ; 226 | 227 | if_equation 228 | : 'if' expression 'then' (control_structure_body)? ('elseif' expression 'then' (control_structure_body)?)* ('else' (control_structure_body)?)? 'end' 'if' 229 | ; 230 | 231 | if_statement 232 | : 'if' expression 'then' (control_structure_body)? ('elseif' expression 'then' (control_structure_body)?)* ('else' (control_structure_body)?)? 'end' 'if' 233 | ; 234 | 235 | control_structure_body 236 | : (statement ';')+ 237 | | (equation ';')+ 238 | ; 239 | 240 | for_equation 241 | : 'for' for_indices 'loop' (control_structure_body)? 'end' 'for' 242 | ; 243 | 244 | for_statement 245 | : 'for' for_indices 'loop' (control_structure_body)? 'end' 'for' 246 | ; 247 | 248 | for_indices 249 | : for_index (',' for_index)* 250 | ; 251 | 252 | for_index 253 | : IDENT ('in' expression)? 254 | ; 255 | 256 | while_statement 257 | : 'while' expression 'loop' (control_structure_body)? 'end' 'while' 258 | ; 259 | 260 | when_equation 261 | : 'when' expression 'then' (control_structure_body)? ('elsewhen' expression 'then' (control_structure_body)?)* 'end' 'when' 262 | ; 263 | 264 | when_statement 265 | : 'when' expression 'then' (control_structure_body)? ('elsewhen' expression 'then' (control_structure_body)?)* 'end' 'when' 266 | ; 267 | 268 | connect_clause 269 | : 'connect' '(' component_reference ',' component_reference ')' 270 | ; 271 | 272 | expression 273 | : simple_expression 274 | // changed from original file 275 | | if_expression 276 | ; 277 | 278 | simple_expression 279 | : logical_expression (':' logical_expression (':' logical_expression)?)? 280 | ; 281 | 282 | // added to original file 283 | if_expression 284 | : if_expression_condition (elseif_expression_condition)* else_expression_condition 285 | ; 286 | 287 | // added to original file 288 | if_expression_body 289 | : expression 290 | ; 291 | 292 | // added to original file 293 | if_expression_condition 294 | : 'if' expression 'then' if_expression_body 295 | ; 296 | 297 | // added to original file 298 | elseif_expression_condition 299 | : 'elseif' expression 'then' if_expression_body 300 | ; 301 | 302 | // added to original file 303 | else_expression_condition 304 | : 'else' if_expression_body 305 | ; 306 | 307 | logical_expression 308 | : logical_term ('or' logical_term)* 309 | ; 310 | 311 | logical_term 312 | : logical_factor ('and' logical_factor)* 313 | ; 314 | 315 | logical_factor 316 | : ('not')? relation 317 | ; 318 | 319 | relation 320 | : arithmetic_expression (rel_op arithmetic_expression)? 321 | ; 322 | 323 | rel_op 324 | : '<' 325 | | '<=' 326 | | '>' 327 | | '>=' 328 | | '==' 329 | | '<>' 330 | ; 331 | 332 | arithmetic_expression 333 | : (add_op)? term (add_op term)* 334 | ; 335 | 336 | add_op 337 | : '+' 338 | | '-' 339 | | '.+' 340 | | '.-' 341 | ; 342 | 343 | term 344 | : factor (mul_op factor)* 345 | ; 346 | 347 | mul_op 348 | : '*' 349 | | '/' 350 | | '.*' 351 | | './' 352 | ; 353 | 354 | factor 355 | : primary (('^' | '.^') primary)? 356 | ; 357 | 358 | primary 359 | : UNSIGNED_NUMBER 360 | | STRING 361 | | 'false' 362 | | 'true' 363 | | (name | 'der' | 'initial') function_call_args 364 | | component_reference 365 | | '(' output_expression_list ')' 366 | | '[' expression_list (';' expression_list)* ']' 367 | // changed from original file 368 | | vector 369 | | 'end' 370 | ; 371 | 372 | // added to original file 373 | vector 374 | : '{' (array_arguments | array_iterator_constructor) '}' 375 | ; 376 | 377 | // added to original file 378 | array_arguments 379 | : expression (',' expression)* 380 | ; 381 | 382 | // added to original file 383 | array_iterator_constructor 384 | : expression 'for' for_indices 385 | ; 386 | 387 | name 388 | : ('.')? IDENT ('.' IDENT)* 389 | ; 390 | 391 | component_reference 392 | : ('.')? IDENT (array_subscripts)? ('.' IDENT (array_subscripts)?)* 393 | ; 394 | 395 | function_call_args 396 | : '(' (function_arguments)? ')' 397 | ; 398 | 399 | function_arguments 400 | : function_argument (',' function_arguments | 'for' for_indices)? 401 | | named_arguments 402 | ; 403 | 404 | named_arguments 405 | : named_argument (',' named_arguments)? 406 | ; 407 | 408 | named_argument 409 | : IDENT '=' function_argument 410 | ; 411 | 412 | function_argument 413 | : 'function' name '(' (named_arguments)? ')' 414 | | expression 415 | ; 416 | 417 | output_expression_list 418 | : (expression)? (',' (expression)?)* 419 | ; 420 | 421 | expression_list 422 | : expression (',' expression)* 423 | ; 424 | 425 | array_subscripts 426 | : '[' subscript (',' subscript)* ']' 427 | ; 428 | 429 | subscript 430 | : ':' 431 | | expression 432 | ; 433 | 434 | comment 435 | : string_comment (annotation)? 436 | ; 437 | 438 | string_comment 439 | : STRING ('+' STRING)* 440 | ; 441 | 442 | annotation 443 | : 'annotation' class_modification 444 | ; 445 | 446 | 447 | IDENT 448 | : NONDIGIT (DIGIT | NONDIGIT)* | Q_IDENT 449 | ; 450 | 451 | 452 | fragment Q_IDENT 453 | : '\'' (Q_CHAR | S_ESCAPE) (Q_CHAR | S_ESCAPE)* '\'' 454 | ; 455 | 456 | 457 | fragment S_CHAR 458 | : ~ ["\\] 459 | ; 460 | 461 | 462 | fragment NONDIGIT 463 | : '_' | 'a' .. 'z' | 'A' .. 'Z' 464 | ; 465 | 466 | 467 | STRING 468 | : '"' ( S_CHAR | S_ESCAPE )* '"' 469 | ; 470 | 471 | 472 | fragment Q_CHAR 473 | : NONDIGIT | DIGIT | '!' | '#' | '$' | '%' | '&' | '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | ':' | ';' | '<' | '>' | '=' | '?' | '@' | '[' | ']' | '^' | '{' | '}' | '|' | '~' 474 | ; 475 | 476 | 477 | fragment S_ESCAPE 478 | : '\\' ('’' | '\'' | '"' | '?' | '\\' | 'a' | 'b' | 'f' | 'n' | 'r' | 't' | 'v') 479 | ; 480 | 481 | 482 | fragment DIGIT 483 | : '0' .. '9' 484 | ; 485 | 486 | 487 | fragment UNSIGNED_INTEGER 488 | : DIGIT (DIGIT)* 489 | ; 490 | 491 | 492 | UNSIGNED_NUMBER 493 | : UNSIGNED_INTEGER ('.' (UNSIGNED_INTEGER)?)? (('e' | 'E') ('+' | '-')? UNSIGNED_INTEGER)? 494 | ; 495 | 496 | 497 | WS 498 | : [ \r\n\t] + -> channel (HIDDEN) 499 | ; 500 | 501 | COMMENT 502 | : '/*' .*? '*/' -> channel (HIDDEN) 503 | ; 504 | 505 | LINE_COMMENT 506 | : '//' ~[\r\n]* -> channel (HIDDEN) 507 | ; 508 | -------------------------------------------------------------------------------- /examples/gmt-coolingtower.mo: -------------------------------------------------------------------------------- 1 | // Model copied from MBL project (https://github.com/lbl-srg/modelica-buildings) 2 | within Buildings.Fluid.HeatExchangers.CoolingTowers; 3 | model Merkel "Cooling tower model based on Merkel's theory" 4 | extends Buildings.Fluid.HeatExchangers.CoolingTowers.BaseClasses.CoolingTower; 5 | 6 | import cha = 7 | Buildings.Fluid.HeatExchangers.CoolingTowers.BaseClasses.Characteristics; 8 | 9 | final parameter Modelica.SIunits.MassFlowRate mAir_flow_nominal= 10 | m_flow_nominal/ratWatAir_nominal 11 | "Nominal mass flow rate of air" 12 | annotation (Dialog(group="Fan")); 13 | 14 | parameter Real ratWatAir_nominal(min=0, unit="1") = 1.2 15 | "Water-to-air mass flow rate ratio at design condition" 16 | annotation (Dialog(group="Nominal condition")); 17 | 18 | parameter Modelica.SIunits.Temperature TAirInWB_nominal 19 | "Nominal outdoor (air inlet) wetbulb temperature" 20 | annotation (Dialog(group="Heat transfer")); 21 | parameter Modelica.SIunits.Temperature TWatIn_nominal 22 | "Nominal water inlet temperature" 23 | annotation (Dialog(group="Heat transfer")); 24 | parameter Modelica.SIunits.Temperature TWatOut_nominal 25 | "Nominal water outlet temperature" 26 | annotation (Dialog(group="Heat transfer")); 27 | 28 | parameter Real fraFreCon(min=0, max=1, final unit="1") = 0.125 29 | "Fraction of tower capacity in free convection regime" 30 | annotation (Dialog(group="Heat transfer")); 31 | 32 | replaceable parameter Buildings.Fluid.HeatExchangers.CoolingTowers.Data.UAMerkel UACor 33 | constrainedby Buildings.Fluid.HeatExchangers.CoolingTowers.Data.UAMerkel 34 | "Coefficients for UA correction" 35 | annotation ( 36 | Dialog(group="Heat transfer"), 37 | choicesAllMatching=true, 38 | Placement(transformation(extent={{18,70},{38,90}}))); 39 | 40 | parameter Real fraPFan_nominal(unit="W/(kg/s)") = 275/0.15 41 | "Fan power divided by water mass flow rate at design condition" 42 | annotation (Dialog(group="Fan")); 43 | parameter Modelica.SIunits.Power PFan_nominal = fraPFan_nominal*m_flow_nominal 44 | "Fan power" 45 | annotation (Dialog(group="Fan")); 46 | 47 | parameter Real yMin(min=0.01, max=1, final unit="1") = 0.3 48 | "Minimum control signal until fan is switched off (used for smoothing 49 | between forced and free convection regime)" 50 | annotation (Dialog(group="Fan")); 51 | 52 | replaceable parameter cha.fan fanRelPow( 53 | r_V = {0, 0.1, 0.3, 0.6, 1}, 54 | r_P = {0, 0.1^3, 0.3^3, 0.6^3, 1}) 55 | constrainedby cha.fan 56 | "Fan relative power consumption as a function of control signal, fanRelPow=P(y)/P(y=1)" 57 | annotation ( 58 | choicesAllMatching=true, 59 | Placement(transformation(extent={{58,70},{78,90}})), 60 | Dialog(group="Fan")); 61 | 62 | final parameter Modelica.SIunits.HeatFlowRate Q_flow_nominal(max=0)=per.Q_flow_nominal 63 | "Nominal heat transfer, (negative)"; 64 | final parameter Modelica.SIunits.ThermalConductance UA_nominal=per.UA_nominal 65 | "Thermal conductance at nominal flow, used to compute heat capacity"; 66 | final parameter Real eps_nominal=per.eps_nominal 67 | "Nominal heat transfer effectiveness"; 68 | final parameter Real NTU_nominal(min=0)=per.NTU_nominal 69 | "Nominal number of transfer units"; 70 | 71 | Modelica.Blocks.Interfaces.RealInput TAir( 72 | final min=0, 73 | final unit="K", 74 | displayUnit="degC") 75 | "Entering air wet bulb temperature" 76 | annotation (Placement(transformation(extent={{-140,20},{-100,60}}))); 77 | 78 | Modelica.Blocks.Interfaces.RealInput y(unit="1") "Fan control signal" 79 | annotation (Placement(transformation(extent={{-140,60},{-100,100}}))); 80 | 81 | Modelica.Blocks.Interfaces.RealOutput PFan( 82 | final quantity="Power", 83 | final unit="W")= 84 | Buildings.Utilities.Math.Functions.spliceFunction( 85 | pos=cha.normalizedPower(per=fanRelPow, r_V=y, d=fanRelPowDer) * PFan_nominal, 86 | neg=0, 87 | x=y-yMin+yMin/20, 88 | deltax=yMin/20) 89 | "Electric power consumed by fan" 90 | annotation (Placement(transformation(extent={{100,70},{120,90}}), 91 | iconTransformation(extent={{100,70},{120,90}}))); 92 | 93 | protected 94 | final parameter Real fanRelPowDer[size(fanRelPow.r_V,1)]= 95 | Buildings.Utilities.Math.Functions.splineDerivatives( 96 | x=fanRelPow.r_V, 97 | y=fanRelPow.r_P, 98 | ensureMonotonicity=Buildings.Utilities.Math.Functions.isMonotonic( 99 | x=fanRelPow.r_P, 100 | strict=false)) 101 | "Coefficients for fan relative power consumption as a function 102 | of control signal"; 103 | 104 | Modelica.Blocks.Sources.RealExpression TWatIn( 105 | final y=Medium.temperature( 106 | Medium.setState_phX( 107 | p=port_a.p, 108 | h=inStream(port_a.h_outflow), 109 | X=inStream(port_a.Xi_outflow)))) 110 | "Water inlet temperature" 111 | annotation (Placement(transformation(extent={{-70,36},{-50,54}}))); 112 | Modelica.Blocks.Sources.RealExpression mWat_flow(final y=port_a.m_flow) 113 | "Water mass flow rate" 114 | annotation (Placement(transformation(extent={{-70,20},{-50,38}}))); 115 | 116 | Buildings.Fluid.HeatExchangers.CoolingTowers.BaseClasses.Merkel per( 117 | redeclare final package Medium = Medium, 118 | final m_flow_nominal=m_flow_nominal, 119 | final ratWatAir_nominal=ratWatAir_nominal, 120 | final TAirInWB_nominal=TAirInWB_nominal, 121 | final TWatIn_nominal=TWatIn_nominal, 122 | final TWatOut_nominal=TWatOut_nominal, 123 | final fraFreCon=fraFreCon, 124 | final UACor = UACor, 125 | final yMin=yMin) "Model for thermal performance" 126 | annotation (Placement(transformation(extent={{-20,40},{0,60}}))); 127 | 128 | initial equation 129 | // Check validity of relative fan power consumption at y=yMin and y=1 130 | assert(cha.normalizedPower(per=fanRelPow, r_V=yMin, d=fanRelPowDer) > -1E-4, 131 | "The fan relative power consumption must be non-negative for y=0." 132 | + "\n Obtained fanRelPow(0) = " 133 | + String(cha.normalizedPower(per=fanRelPow, r_V=yMin, d=fanRelPowDer)) 134 | + "\n You need to choose different values for the parameter fanRelPow."); 135 | assert(abs(1-cha.normalizedPower(per=fanRelPow, r_V=1, d=fanRelPowDer))<1E-4, 136 | "The fan relative power consumption must be one for y=1." 137 | + "\n Obtained fanRelPow(1) = " 138 | + String(cha.normalizedPower(per=fanRelPow, r_V=1, d=fanRelPowDer)) 139 | + "\n You need to choose different values for the parameter fanRelPow." 140 | + "\n To increase the fan power, change fraPFan_nominal or PFan_nominal."); 141 | 142 | equation 143 | connect(per.y, y) annotation (Line(points={{-22,58},{-40,58},{-40,80},{-120, 144 | 80}}, 145 | color={0,0,127})); 146 | connect(per.TAir, TAir) annotation (Line(points={{-22,54},{-80,54},{-80,40},{ 147 | -120,40}}, 148 | color={0,0,127})); 149 | connect(per.Q_flow, preHea.Q_flow) annotation (Line(points={{1,50},{12,50},{ 150 | 12,12},{-80,12},{-80,-60},{-40,-60}},color={0,0,127})); 151 | connect(per.m_flow, mWat_flow.y) annotation (Line(points={{-22,42},{-34,42},{ 152 | -34,29},{-49,29}}, 153 | color={0,0,127})); 154 | connect(TWatIn.y, per.TWatIn) annotation (Line(points={{-49,45},{-40,45},{-40, 155 | 46},{-22,46}}, color={0,0,127})); 156 | annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ 157 | Text( 158 | extent={{-98,100},{-86,84}}, 159 | lineColor={0,0,127}, 160 | textString="y"), 161 | Text( 162 | extent={{-104,70},{-70,32}}, 163 | lineColor={0,0,127}, 164 | textString="TWB"), 165 | Rectangle( 166 | extent={{-100,81},{-70,78}}, 167 | lineColor={0,0,255}, 168 | pattern=LinePattern.None, 169 | fillColor={0,0,127}, 170 | fillPattern=FillPattern.Solid), 171 | Text( 172 | extent={{-54,6},{58,-114}}, 173 | lineColor={255,255,255}, 174 | fillColor={0,127,0}, 175 | fillPattern=FillPattern.Solid, 176 | textString="Merkel"), 177 | Ellipse( 178 | extent={{-54,62},{0,50}}, 179 | lineColor={255,255,255}, 180 | fillColor={255,255,255}, 181 | fillPattern=FillPattern.Solid), 182 | Ellipse( 183 | extent={{0,62},{54,50}}, 184 | lineColor={255,255,255}, 185 | fillColor={255,255,255}, 186 | fillPattern=FillPattern.Solid), 187 | Rectangle( 188 | extent={{78,82},{100,78}}, 189 | lineColor={0,0,255}, 190 | pattern=LinePattern.None, 191 | fillColor={0,0,127}, 192 | fillPattern=FillPattern.Solid), 193 | Rectangle( 194 | extent={{70,56},{82,52}}, 195 | lineColor={0,0,255}, 196 | pattern=LinePattern.None, 197 | fillColor={0,0,127}, 198 | fillPattern=FillPattern.Solid), 199 | Rectangle( 200 | extent={{78,54},{82,80}}, 201 | lineColor={0,0,255}, 202 | pattern=LinePattern.None, 203 | fillColor={0,0,127}, 204 | fillPattern=FillPattern.Solid), 205 | Text( 206 | extent={{64,114},{98,76}}, 207 | lineColor={0,0,127}, 208 | textString="PFan"), 209 | Rectangle( 210 | extent={{78,-60},{82,-4}}, 211 | lineColor={0,0,255}, 212 | pattern=LinePattern.None, 213 | fillColor={0,0,127}, 214 | fillPattern=FillPattern.Solid), 215 | Text( 216 | extent={{70,-58},{104,-96}}, 217 | lineColor={0,0,127}, 218 | textString="TLvg"), 219 | Rectangle( 220 | extent={{78,-58},{102,-62}}, 221 | lineColor={0,0,255}, 222 | pattern=LinePattern.None, 223 | fillColor={0,0,127}, 224 | fillPattern=FillPattern.Solid)}), 225 | Diagram(coordinateSystem(preserveAspectRatio=false)), 226 | Documentation( 227 | info=" 228 |

229 | Model for a steady-state or dynamic cooling tower with a variable speed fan 230 | using Merkel's calculation method. 231 |

232 |

Thermal performance

233 |

234 | To compute the thermal performance, this model takes as parameters the nominal water 235 | mass flow rate, the water-to-air mass flow ratio at nominal condition, 236 | the nominal inlet air wetbulb temperature, 237 | and the nominal water inlet and outlet temperatures. Cooling tower performance is 238 | modeled using the effectiveness-NTU relationships for various heat exchanger flow regimes. 239 |

240 |

241 | The total heat transfer between the air and water entering the tower is computed based 242 | on Merkel's theory. The fundamental basis for Merkel's theory is that the steady-state 243 | total heat transfer is proportional to the difference between the enthalpy of air and 244 | the enthalpy of air saturated at the wetted-surface temperature. This is represented 245 | by 246 |

247 |

248 | dQ̇total = UdA/cp (hs - ha), 249 |

250 |

251 | where 252 | hs is the enthalpy of saturated air at the wetted-surface temperature, 253 | ha is the enthalpy of air in the free stream, 254 | cp is the specific heat of moist air, 255 | U is the cooling tower overall heat transfer coefficient, and 256 | A is the heat transfer surface area. 257 |

258 |

259 | The model also treats the moist air as an equivalent gas with a mean specific heat 260 | cpe defined as 261 |

262 |

263 | cpe = Δh / ΔTwb, 264 |

265 |

266 | where 267 | Δh and ΔTwb are the enthalpy difference and 268 | wetbulb temperature difference, respectively, between the entering and leaving air. 269 |

270 |

271 | For off-design conditions, Merkel's theory is modified to include Sheier's 272 | adjustment factors that change the current UA value. The three adjustment factors, based 273 | on the current wetbulb temperature, air flow rates, and water flow rates, are used to calculate the 274 | UA value as 275 |

276 |

277 | UAe = UA0 · fUA,wetbulb · fUA,airflow · fUA,waterflow, 278 |

279 |

280 | where 281 | UAe and UA0 are the equivalent and design 282 | overall heat transfer coefficent-area products, respectively. 283 | The factors fUA,wetbulb, fUA,airflow, and fUA,waterflow 284 | adjust the current UA value for the current wetbulb temperature, air flow rate, and water 285 | flow rate, respectively. These adjustment factors are third-order polynomial functions defined as 286 |

287 |

288 | fUA,x = 289 | cx,0  290 | + cx,1 x 291 | + cx,2 x2 292 | + cx,3 x3, 293 |

294 |

295 | where x = {(T0,wetbulb - Twetbulb),   296 | ṁair ⁄ ṁ0,air,   297 | ṁwat ⁄ ṁ0,wat} 298 | 299 | for the respective adjustment factor, and the 300 | coefficients cx,0, cx,1, cx,2, and cx,3 301 | are the user-defined 302 | values for the respective adjustment factor functions obtained from 303 | 304 | Buildings.Fluid.HeatExchangers.CoolingTowers.Data.UAMerkel. 305 | By changing the parameter UACor, the 306 | user can update the values in this record based on the performance characteristics of 307 | their specific cooling tower. 308 |

309 |

Comparison with the cooling tower model of EnergyPlus

310 |

311 | This model is similar to the model CoolingTower:VariableSpeed:Merkel 312 | that is implemented in the EnergyPlus building energy simulation program version 8.9.0. 313 | The main differences are: 314 |

315 |
    316 |
  1. 317 | Not implemented are the basin heater power consumption and the make-up water usage. 318 |
  2. 319 |
  3. 320 | The model has no built-in control to switch individual cells of the tower on or off. 321 | To switch cells on or off, use multiple instances of this model, and use your own control 322 | law to compute the input signal y. 323 |
  4. 324 |
325 |

Assumptions

326 |

327 | The following assumptions are made with Merkel's theory and this implementation: 328 |

329 |
    330 |
  1. 331 | The moist air enthalpy is a function of wetbulb temperature only. 332 |
  2. 333 |
  3. 334 | The wetted surface temperature is equal to the water temperature. 335 |
  4. 336 |
  5. 337 | Cycle losses are not taken into account. 338 |
  6. 339 |
340 |

References

341 |

342 | EnergyPlus 8.9.0 Engineering Reference, March 23, 2018.

343 | ", 344 | revisions=" 345 |
    346 |
  • 347 | January 16, 2020, by Michael Wetter:
    348 | Revised model to put the thermal performance in a separate block. 349 |
  • 350 |
  • 351 | January 10, 2020, by Michael Wetter:
    352 | Revised model, changed parameters to make model easier to use with design data. 353 |
  • 354 |
  • 355 | October 22, 2019, by Yangyang Fu:
    356 | First implementation. 357 |
  • 358 |
359 | ")); 360 | end Merkel; -------------------------------------------------------------------------------- /examples/gmt-coolingtower-out.mo: -------------------------------------------------------------------------------- 1 | // Model copied from MBL project (https://github.com/lbl-srg/modelica-buildings) 2 | within Buildings.Fluid.HeatExchangers.CoolingTowers; 3 | model Merkel 4 | "Cooling tower model based on Merkel's theory" 5 | extends Buildings.Fluid.HeatExchangers.CoolingTowers.BaseClasses.CoolingTower; 6 | import cha=Buildings.Fluid.HeatExchangers.CoolingTowers.BaseClasses.Characteristics; 7 | final parameter Modelica.SIunits.MassFlowRate mAir_flow_nominal=m_flow_nominal/ratWatAir_nominal 8 | "Nominal mass flow rate of air" 9 | annotation (Dialog(group="Fan")); 10 | parameter Real ratWatAir_nominal( 11 | min=0, 12 | unit="1")=1.2 13 | "Water-to-air mass flow rate ratio at design condition" 14 | annotation (Dialog(group="Nominal condition")); 15 | parameter Modelica.SIunits.Temperature TAirInWB_nominal 16 | "Nominal outdoor (air inlet) wetbulb temperature" 17 | annotation (Dialog(group="Heat transfer")); 18 | parameter Modelica.SIunits.Temperature TWatIn_nominal 19 | "Nominal water inlet temperature" 20 | annotation (Dialog(group="Heat transfer")); 21 | parameter Modelica.SIunits.Temperature TWatOut_nominal 22 | "Nominal water outlet temperature" 23 | annotation (Dialog(group="Heat transfer")); 24 | parameter Real fraFreCon( 25 | min=0, 26 | max=1, 27 | final unit="1")=0.125 28 | "Fraction of tower capacity in free convection regime" 29 | annotation (Dialog(group="Heat transfer")); 30 | replaceable parameter Buildings.Fluid.HeatExchangers.CoolingTowers.Data.UAMerkel UACor 31 | constrainedby Buildings.Fluid.HeatExchangers.CoolingTowers.Data.UAMerkel 32 | "Coefficients for UA correction" 33 | annotation (Dialog(group="Heat transfer"),choicesAllMatching=true,Placement(transformation(extent={{18,70},{38,90}}))); 34 | parameter Real fraPFan_nominal( 35 | unit="W/(kg/s)")=275/0.15 36 | "Fan power divided by water mass flow rate at design condition" 37 | annotation (Dialog(group="Fan")); 38 | parameter Modelica.SIunits.Power PFan_nominal=fraPFan_nominal*m_flow_nominal 39 | "Fan power" 40 | annotation (Dialog(group="Fan")); 41 | parameter Real yMin( 42 | min=0.01, 43 | max=1, 44 | final unit="1")=0.3 45 | "Minimum control signal until fan is switched off (used for smoothing 46 | between forced and free convection regime)" 47 | annotation (Dialog(group="Fan")); 48 | replaceable parameter cha.fan fanRelPow( 49 | r_V={0,0.1,0.3,0.6,1}, 50 | r_P={0,0.1^3,0.3^3,0.6^3,1}) 51 | constrainedby cha.fan 52 | "Fan relative power consumption as a function of control signal, fanRelPow=P(y)/P(y=1)" 53 | annotation (choicesAllMatching=true,Placement(transformation(extent={{58,70},{78,90}})),Dialog(group="Fan")); 54 | final parameter Modelica.SIunits.HeatFlowRate Q_flow_nominal( 55 | max=0)=per.Q_flow_nominal 56 | "Nominal heat transfer, (negative)"; 57 | final parameter Modelica.SIunits.ThermalConductance UA_nominal=per.UA_nominal 58 | "Thermal conductance at nominal flow, used to compute heat capacity"; 59 | final parameter Real eps_nominal=per.eps_nominal 60 | "Nominal heat transfer effectiveness"; 61 | final parameter Real NTU_nominal( 62 | min=0)=per.NTU_nominal 63 | "Nominal number of transfer units"; 64 | Modelica.Blocks.Interfaces.RealInput TAir( 65 | final min=0, 66 | final unit="K", 67 | displayUnit="degC") 68 | "Entering air wet bulb temperature" 69 | annotation (Placement(transformation(extent={{-140,20},{-100,60}}))); 70 | Modelica.Blocks.Interfaces.RealInput y( 71 | unit="1") 72 | "Fan control signal" 73 | annotation (Placement(transformation(extent={{-140,60},{-100,100}}))); 74 | Modelica.Blocks.Interfaces.RealOutput PFan( 75 | final quantity="Power", 76 | final unit="W")=Buildings.Utilities.Math.Functions.spliceFunction( 77 | pos=cha.normalizedPower( 78 | per=fanRelPow, 79 | r_V=y, 80 | d=fanRelPowDer)*PFan_nominal, 81 | neg=0, 82 | x=y-yMin+yMin/20, 83 | deltax=yMin/20) 84 | "Electric power consumed by fan" 85 | annotation (Placement(transformation(extent={{100,70},{120,90}}),iconTransformation(extent={{100,70},{120,90}}))); 86 | protected 87 | final parameter Real fanRelPowDer[size( 88 | fanRelPow.r_V, 89 | 1)]=Buildings.Utilities.Math.Functions.splineDerivatives( 90 | x=fanRelPow.r_V, 91 | y=fanRelPow.r_P, 92 | ensureMonotonicity=Buildings.Utilities.Math.Functions.isMonotonic( 93 | x=fanRelPow.r_P, 94 | strict=false)) 95 | "Coefficients for fan relative power consumption as a function 96 | of control signal"; 97 | Modelica.Blocks.Sources.RealExpression TWatIn( 98 | final y=Medium.temperature( 99 | Medium.setState_phX( 100 | p=port_a.p, 101 | h=inStream(port_a.h_outflow), 102 | X=inStream(port_a.Xi_outflow)))) 103 | "Water inlet temperature" 104 | annotation (Placement(transformation(extent={{-70,36},{-50,54}}))); 105 | Modelica.Blocks.Sources.RealExpression mWat_flow( 106 | final y=port_a.m_flow) 107 | "Water mass flow rate" 108 | annotation (Placement(transformation(extent={{-70,20},{-50,38}}))); 109 | Buildings.Fluid.HeatExchangers.CoolingTowers.BaseClasses.Merkel per( 110 | redeclare final package Medium=Medium, 111 | final m_flow_nominal=m_flow_nominal, 112 | final ratWatAir_nominal=ratWatAir_nominal, 113 | final TAirInWB_nominal=TAirInWB_nominal, 114 | final TWatIn_nominal=TWatIn_nominal, 115 | final TWatOut_nominal=TWatOut_nominal, 116 | final fraFreCon=fraFreCon, 117 | final UACor=UACor, 118 | final yMin=yMin) 119 | "Model for thermal performance" 120 | annotation (Placement(transformation(extent={{-20,40},{0,60}}))); 121 | initial equation 122 | // Check validity of relative fan power consumption at y=yMin and y=1 123 | assert( 124 | cha.normalizedPower( 125 | per=fanRelPow, 126 | r_V=yMin, 127 | d=fanRelPowDer) >-1E-4, 128 | "The fan relative power consumption must be non-negative for y=0."+"\n Obtained fanRelPow(0) = "+String( 129 | cha.normalizedPower( 130 | per=fanRelPow, 131 | r_V=yMin, 132 | d=fanRelPowDer))+"\n You need to choose different values for the parameter fanRelPow."); 133 | assert( 134 | abs( 135 | 1-cha.normalizedPower( 136 | per=fanRelPow, 137 | r_V=1, 138 | d=fanRelPowDer)) < 1E-4, 139 | "The fan relative power consumption must be one for y=1."+"\n Obtained fanRelPow(1) = "+String( 140 | cha.normalizedPower( 141 | per=fanRelPow, 142 | r_V=1, 143 | d=fanRelPowDer))+"\n You need to choose different values for the parameter fanRelPow."+"\n To increase the fan power, change fraPFan_nominal or PFan_nominal."); 144 | equation 145 | connect(per.y,y) 146 | annotation (Line(points={{-22,58},{-40,58},{-40,80},{-120,80}},color={0,0,127})); 147 | connect(per.TAir,TAir) 148 | annotation (Line(points={{-22,54},{-80,54},{-80,40},{-120,40}},color={0,0,127})); 149 | connect(per.Q_flow,preHea.Q_flow) 150 | annotation (Line(points={{1,50},{12,50},{12,12},{-80,12},{-80,-60},{-40,-60}},color={0,0,127})); 151 | connect(per.m_flow,mWat_flow.y) 152 | annotation (Line(points={{-22,42},{-34,42},{-34,29},{-49,29}},color={0,0,127})); 153 | connect(TWatIn.y,per.TWatIn) 154 | annotation (Line(points={{-49,45},{-40,45},{-40,46},{-22,46}},color={0,0,127})); 155 | annotation ( 156 | Icon( 157 | coordinateSystem( 158 | preserveAspectRatio=false), 159 | graphics={ 160 | Text( 161 | extent={{-98,100},{-86,84}}, 162 | lineColor={0,0,127}, 163 | textString="y"), 164 | Text( 165 | extent={{-104,70},{-70,32}}, 166 | lineColor={0,0,127}, 167 | textString="TWB"), 168 | Rectangle( 169 | extent={{-100,81},{-70,78}}, 170 | lineColor={0,0,255}, 171 | pattern=LinePattern.None, 172 | fillColor={0,0,127}, 173 | fillPattern=FillPattern.Solid), 174 | Text( 175 | extent={{-54,6},{58,-114}}, 176 | lineColor={255,255,255}, 177 | fillColor={0,127,0}, 178 | fillPattern=FillPattern.Solid, 179 | textString="Merkel"), 180 | Ellipse( 181 | extent={{-54,62},{0,50}}, 182 | lineColor={255,255,255}, 183 | fillColor={255,255,255}, 184 | fillPattern=FillPattern.Solid), 185 | Ellipse( 186 | extent={{0,62},{54,50}}, 187 | lineColor={255,255,255}, 188 | fillColor={255,255,255}, 189 | fillPattern=FillPattern.Solid), 190 | Rectangle( 191 | extent={{78,82},{100,78}}, 192 | lineColor={0,0,255}, 193 | pattern=LinePattern.None, 194 | fillColor={0,0,127}, 195 | fillPattern=FillPattern.Solid), 196 | Rectangle( 197 | extent={{70,56},{82,52}}, 198 | lineColor={0,0,255}, 199 | pattern=LinePattern.None, 200 | fillColor={0,0,127}, 201 | fillPattern=FillPattern.Solid), 202 | Rectangle( 203 | extent={{78,54},{82,80}}, 204 | lineColor={0,0,255}, 205 | pattern=LinePattern.None, 206 | fillColor={0,0,127}, 207 | fillPattern=FillPattern.Solid), 208 | Text( 209 | extent={{64,114},{98,76}}, 210 | lineColor={0,0,127}, 211 | textString="PFan"), 212 | Rectangle( 213 | extent={{78,-60},{82,-4}}, 214 | lineColor={0,0,255}, 215 | pattern=LinePattern.None, 216 | fillColor={0,0,127}, 217 | fillPattern=FillPattern.Solid), 218 | Text( 219 | extent={{70,-58},{104,-96}}, 220 | lineColor={0,0,127}, 221 | textString="TLvg"), 222 | Rectangle( 223 | extent={{78,-58},{102,-62}}, 224 | lineColor={0,0,255}, 225 | pattern=LinePattern.None, 226 | fillColor={0,0,127}, 227 | fillPattern=FillPattern.Solid)}), 228 | Diagram( 229 | coordinateSystem( 230 | preserveAspectRatio=false)), 231 | Documentation( 232 | info=" 233 |

234 | Model for a steady-state or dynamic cooling tower with a variable speed fan 235 | using Merkel's calculation method. 236 |

237 |

Thermal performance

238 |

239 | To compute the thermal performance, this model takes as parameters the nominal water 240 | mass flow rate, the water-to-air mass flow ratio at nominal condition, 241 | the nominal inlet air wetbulb temperature, 242 | and the nominal water inlet and outlet temperatures. Cooling tower performance is 243 | modeled using the effectiveness-NTU relationships for various heat exchanger flow regimes. 244 |

245 |

246 | The total heat transfer between the air and water entering the tower is computed based 247 | on Merkel's theory. The fundamental basis for Merkel's theory is that the steady-state 248 | total heat transfer is proportional to the difference between the enthalpy of air and 249 | the enthalpy of air saturated at the wetted-surface temperature. This is represented 250 | by 251 |

252 |

253 | dQ̇total = UdA/cp (hs - ha), 254 |

255 |

256 | where 257 | hs is the enthalpy of saturated air at the wetted-surface temperature, 258 | ha is the enthalpy of air in the free stream, 259 | cp is the specific heat of moist air, 260 | U is the cooling tower overall heat transfer coefficient, and 261 | A is the heat transfer surface area. 262 |

263 |

264 | The model also treats the moist air as an equivalent gas with a mean specific heat 265 | cpe defined as 266 |

267 |

268 | cpe = Δh / ΔTwb, 269 |

270 |

271 | where 272 | Δh and ΔTwb are the enthalpy difference and 273 | wetbulb temperature difference, respectively, between the entering and leaving air. 274 |

275 |

276 | For off-design conditions, Merkel's theory is modified to include Sheier's 277 | adjustment factors that change the current UA value. The three adjustment factors, based 278 | on the current wetbulb temperature, air flow rates, and water flow rates, are used to calculate the 279 | UA value as 280 |

281 |

282 | UAe = UA0 · fUA,wetbulb · fUA,airflow · fUA,waterflow, 283 |

284 |

285 | where 286 | UAe and UA0 are the equivalent and design 287 | overall heat transfer coefficent-area products, respectively. 288 | The factors fUA,wetbulb, fUA,airflow, and fUA,waterflow 289 | adjust the current UA value for the current wetbulb temperature, air flow rate, and water 290 | flow rate, respectively. These adjustment factors are third-order polynomial functions defined as 291 |

292 |

293 | fUA,x = 294 | cx,0  295 | + cx,1 x 296 | + cx,2 x2 297 | + cx,3 x3, 298 |

299 |

300 | where x = {(T0,wetbulb - Twetbulb),   301 | ṁair ⁄ ṁ0,air,   302 | ṁwat ⁄ ṁ0,wat} 303 | 304 | for the respective adjustment factor, and the 305 | coefficients cx,0, cx,1, cx,2, and cx,3 306 | are the user-defined 307 | values for the respective adjustment factor functions obtained from 308 | 309 | Buildings.Fluid.HeatExchangers.CoolingTowers.Data.UAMerkel. 310 | By changing the parameter UACor, the 311 | user can update the values in this record based on the performance characteristics of 312 | their specific cooling tower. 313 |

314 |

Comparison with the cooling tower model of EnergyPlus

315 |

316 | This model is similar to the model CoolingTower:VariableSpeed:Merkel 317 | that is implemented in the EnergyPlus building energy simulation program version 8.9.0. 318 | The main differences are: 319 |

320 |
    321 |
  1. 322 | Not implemented are the basin heater power consumption and the make-up water usage. 323 |
  2. 324 |
  3. 325 | The model has no built-in control to switch individual cells of the tower on or off. 326 | To switch cells on or off, use multiple instances of this model, and use your own control 327 | law to compute the input signal y. 328 |
  4. 329 |
330 |

Assumptions

331 |

332 | The following assumptions are made with Merkel's theory and this implementation: 333 |

334 |
    335 |
  1. 336 | The moist air enthalpy is a function of wetbulb temperature only. 337 |
  2. 338 |
  3. 339 | The wetted surface temperature is equal to the water temperature. 340 |
  4. 341 |
  5. 342 | Cycle losses are not taken into account. 343 |
  6. 344 |
345 |

References

346 |

347 | EnergyPlus 8.9.0 Engineering Reference, March 23, 2018.

348 | ", 349 | revisions=" 350 |
    351 |
  • 352 | January 16, 2020, by Michael Wetter:
    353 | Revised model to put the thermal performance in a separate block. 354 |
  • 355 |
  • 356 | January 10, 2020, by Michael Wetter:
    357 | Revised model, changed parameters to make model easier to use with design data. 358 |
  • 359 |
  • 360 | October 22, 2019, by Yangyang Fu:
    361 | First implementation. 362 |
  • 363 |
364 | ")); 365 | end Merkel; 366 | -------------------------------------------------------------------------------- /modelicafmt.go: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2020, Alliance for Sustainable Energy, LLC. 2 | // All rights reserved. 3 | 4 | package main 5 | 6 | import ( 7 | "bufio" 8 | "io" 9 | "io/ioutil" 10 | "strings" 11 | 12 | "github.com/antlr/antlr4/runtime/Go/antlr" 13 | "github.com/urbanopt/modelica-fmt/thirdparty/parser" 14 | ) 15 | 16 | type Config struct { 17 | maxLineLength int 18 | emptyLines bool 19 | } 20 | 21 | const ( 22 | // indent 23 | spaceIndent = " " 24 | ) 25 | 26 | // insertIndentBefore returns true if the rule should be on a new line and indented 27 | func (l *modelicaListener) insertIndentBefore(rule antlr.ParserRuleContext) bool { 28 | switch rule.(type) { 29 | case 30 | parser.IElementContext, 31 | parser.IEquationsContext, 32 | parser.IAlgorithm_statementsContext, 33 | parser.IControl_structure_bodyContext, 34 | parser.IAnnotationContext, 35 | parser.IExpression_listContext, 36 | parser.IConstraining_clauseContext, 37 | parser.IIf_expressionContext, 38 | parser.IIf_expression_bodyContext, 39 | parser.IExternal_function_call_argumentContext: 40 | return true 41 | case parser.IString_commentContext: 42 | return 0 == l.inAnnotation 43 | case 44 | parser.IArgumentContext, 45 | parser.INamed_argumentContext: 46 | return 0 == l.inAnnotation || 0 < l.inModelAnnotation 47 | case parser.IExpressionContext: 48 | if len(l.modelAnnotationVectorStack) == 0 { 49 | return false 50 | } 51 | 52 | // handle expression which is an element of a vector (array_arguments) and within model annotation 53 | arrayArgumentsNode, ok := rule.GetParent().(*parser.Array_argumentsContext) 54 | if !ok { 55 | return false 56 | } 57 | 58 | // check if the vector is the same as the one on top of our stack 59 | thisVectorInterval := arrayArgumentsNode.GetParent().(*parser.VectorContext).GetSourceInterval() 60 | stackVectorInterval := l.modelAnnotationVectorStack[len(l.modelAnnotationVectorStack)-1].GetSourceInterval() 61 | if thisVectorInterval.Start == stackVectorInterval.Start && thisVectorInterval.Stop == stackVectorInterval.Stop { 62 | return true 63 | } 64 | return false 65 | case parser.IFunction_argumentContext: 66 | return 0 == l.inNamedArgument && 0 == l.inVector && (0 == l.inAnnotation || 0 < l.inModelAnnotation) 67 | default: 68 | return false 69 | } 70 | } 71 | 72 | // insertSpaceBeforeToken returns true if a space should be inserted before the current token 73 | func insertSpaceBeforeToken(currentTokenText, previousTokenText string) bool { 74 | switch currentTokenText { 75 | case "(": 76 | // add a space between 'annotation' and opening parens 77 | if previousTokenText == "annotation" { 78 | return true 79 | } 80 | fallthrough 81 | default: 82 | return !tokenInGroup(previousTokenText, noSpaceAfterTokens) && 83 | !tokenInGroup(currentTokenText, noSpaceBeforeTokens) 84 | } 85 | } 86 | 87 | // insertNewlineBefore returns true if the rule should be on a new line 88 | func insertNewlineBefore(rule antlr.ParserRuleContext) bool { 89 | switch rule.(type) { 90 | case 91 | parser.ICompositionContext, 92 | parser.IEquationsContext, 93 | parser.IIf_expression_conditionContext, 94 | parser.IElseif_expression_conditionContext, 95 | parser.IElse_expression_conditionContext: 96 | return true 97 | default: 98 | return false 99 | } 100 | } 101 | 102 | var ( 103 | // tokens which should *generally* not have a space after them 104 | // this can be overridden in the insertSpace function 105 | noSpaceAfterTokens = []string{ 106 | "(", 107 | "=", 108 | ".", 109 | "[", 110 | "{", 111 | "-", "+", "^", "*", "/", 112 | ";", 113 | ",", 114 | ":", // array range constructor 115 | } 116 | 117 | // tokens which should *generally* not have a space before them 118 | // this can be overridden in the insertSpace function 119 | noSpaceBeforeTokens = []string{ 120 | "(", ")", 121 | "[", "]", 122 | "}", 123 | ";", 124 | "=", 125 | ",", 126 | ".", 127 | "-", "+", "^", "*", "/", 128 | ":", // array range constructor 129 | } 130 | 131 | allowBreakAfterTokens = []string{ 132 | "=", 133 | ",", 134 | "(", 135 | } 136 | ) 137 | 138 | // tokenInGroup returns true if a token is in a given list 139 | func tokenInGroup(token string, group []string) bool { 140 | for _, other := range group { 141 | if token == other { 142 | return true 143 | } 144 | } 145 | return false 146 | } 147 | 148 | type indent int 149 | 150 | const ( 151 | renderIndent indent = iota 152 | ignoreIndent 153 | ) 154 | 155 | // modelicaListener is used to format the parse tree 156 | type modelicaListener struct { 157 | *parser.BaseModelicaListener // parser 158 | writer *bufio.Writer // writing destination 159 | indentationStack []indent // a stack used for tracking rendered and ignored indentations 160 | onNewLine bool // true when write position succeeds a newline character 161 | withinOnCurrentLine bool // true when `within` statement is found on the current line 162 | insideBracket bool // true when inside brackets (i.e. `[]`) 163 | lineIndentIncreased bool // true when the indentation level has already been increased for a line 164 | previousTokenText string // text of previous token 165 | previousTokenIdx int // index of previous token 166 | commentTokens []antlr.Token // stores comments to insert while writing 167 | maxLineLength int // configuration for num charaters per line 168 | currentLineLength int // length of the line up to the writing position 169 | 170 | // modelAnnotationVectorStack is a stack which stores `vector` contexts, 171 | // which is used for conditionally indenting vector children 172 | // Specifically, a vector inside of a model annotation will have indented elements 173 | // if that vector has one or more elements which are function calls, class modifications or similar 174 | // (ie not if all elements are numbers, more vectors, etc) 175 | // 176 | // The last element of the slice is the first `vector` context ancestor whose contents 177 | // must be indented on new lines 178 | // For example, we would like model annotations to look like this: 179 | // annotation ( 180 | // Abc( 181 | // paramA={ 182 | // SomeIdentifier( 183 | // 1, 184 | // 2), 185 | // 123})) 186 | // 187 | // However, due to existing rules, we would end up with something like this 188 | // annotation ( 189 | // Abc( 190 | // paramA={SomeIdentifier( 191 | // 1, 192 | // 2), 123})) 193 | // 194 | // Thus by pushing/popping vectors we can check if an expression in a vector 195 | // should be indented or not by checking if the top of the stack is its ancestor 196 | modelAnnotationVectorStack []antlr.RuleContext 197 | 198 | // NOTE: consider refactoring this simple approach for context awareness with 199 | // a set. 200 | // It should probably be map[string]int for rule name and current count (rules can be recursive, ie inside the same rule multiple times) 201 | inAnnotation int // counts number of current or ancestor contexts that are annotation rule 202 | inModelAnnotation int // counts number of current or ancestor contexts that are model annotation rule 203 | inNamedArgument int // counts number of current or ancestor contexts that are named argument 204 | inVector int // counts number of current or ancestor contexts that are vector 205 | inLastSemicolon bool // true if the listener is handling the last_semicolon rule 206 | 207 | // Other config 208 | config Config 209 | } 210 | 211 | func newListener(out io.Writer, commentTokens []antlr.Token, config Config) *modelicaListener { 212 | return &modelicaListener{ 213 | BaseModelicaListener: &parser.BaseModelicaListener{}, 214 | writer: bufio.NewWriter(out), 215 | onNewLine: true, 216 | withinOnCurrentLine: false, 217 | insideBracket: false, 218 | lineIndentIncreased: false, 219 | inLastSemicolon: false, 220 | inAnnotation: 0, 221 | inModelAnnotation: 0, 222 | inVector: 0, 223 | inNamedArgument: 0, 224 | previousTokenText: "", 225 | previousTokenIdx: -1, 226 | commentTokens: commentTokens, 227 | currentLineLength: 0, 228 | config: config, 229 | } 230 | } 231 | 232 | func (l *modelicaListener) close() { 233 | err := l.writer.Flush() 234 | if err != nil { 235 | panic(err) 236 | } 237 | } 238 | 239 | // indentation returns the writer's current number of *rendered* indentations 240 | func (l *modelicaListener) indentation() int { 241 | nRenderIndents := 0 242 | for _, indentType := range l.indentationStack { 243 | if indentType == renderIndent { 244 | nRenderIndents++ 245 | } 246 | } 247 | 248 | return nRenderIndents 249 | } 250 | 251 | // maybeIndent should be called when the writer's indentation is to be increased 252 | func (l *modelicaListener) maybeIndent() { 253 | // Only increase indentation if it hasn't been changed already, otherwise ignore it 254 | // NOTE: This means that there can be at most 1 increase in indentation per line 255 | // This is a bit of a hack to avoid having an overindented line, occurring when 256 | // multiple rules want to be indented and we want it to be indented only once 257 | 258 | if !l.lineIndentIncreased { 259 | l.indentationStack = append(l.indentationStack, renderIndent) 260 | 261 | // WARNING: this is coupled with writeNewline, which should reset 262 | // lineIndentIncreased to false 263 | l.lineIndentIncreased = true 264 | } else { 265 | l.indentationStack = append(l.indentationStack, ignoreIndent) 266 | } 267 | } 268 | 269 | // maybeDedent should be called when the writer's indentation is to be decreased 270 | func (l *modelicaListener) maybeDedent() { 271 | l.indentationStack = l.indentationStack[:len(l.indentationStack)-1] 272 | } 273 | 274 | // writeString writes a string to the listener's output 275 | // It should serve as the main entrypoint to writing to the output 276 | func (l *modelicaListener) writeString(str string) { 277 | originalSpacePrefix := l.getSpaceBefore(str, true) 278 | charsOnFirstLine := len(originalSpacePrefix) 279 | firstNewlineIndex := strings.Index(str, "\n") 280 | if firstNewlineIndex < 0 { 281 | charsOnFirstLine += len(str) 282 | } else { 283 | charsOnFirstLine += firstNewlineIndex 284 | } 285 | 286 | // break the line if writing this string would make it too long and the previous token is breakable 287 | var actualSpacePrefix string 288 | if l.config.maxLineLength > 0 && 289 | l.currentLineLength+charsOnFirstLine > l.config.maxLineLength && 290 | tokenInGroup(l.previousTokenText, allowBreakAfterTokens) { 291 | 292 | l.writeNewline() 293 | l.maybeIndent() 294 | actualSpacePrefix = l.getSpaceBefore(str, false) 295 | l.writer.WriteString(actualSpacePrefix + str) 296 | l.maybeDedent() 297 | } else { 298 | actualSpacePrefix = l.getSpaceBefore(str, false) 299 | l.writer.WriteString(actualSpacePrefix + str) 300 | } 301 | 302 | lastNewlineIndex := strings.LastIndex(str, "\n") 303 | var charsOnLastLine int 304 | if lastNewlineIndex < 0 { 305 | charsOnLastLine = len(actualSpacePrefix) + len(str) 306 | } else { 307 | // since there was a newline, no need to add the space prefix to the count 308 | charsOnLastLine = len(str) - (lastNewlineIndex + 1) 309 | } 310 | l.currentLineLength += charsOnLastLine 311 | } 312 | 313 | func (l *modelicaListener) writeNewline() { 314 | // explicitly not using l.writeString here b/c it's not necessary and I think we could end up in infinite recursion (though really unlikely) 315 | l.writer.WriteString("\n") 316 | l.onNewLine = true 317 | l.currentLineLength = 0 318 | 319 | // WARNING: this is coupled with maybeIndent, which uses this state 320 | l.lineIndentIncreased = false 321 | } 322 | 323 | func (l *modelicaListener) writeComment(comment antlr.Token) { 324 | l.writeString(comment.GetText()) 325 | if comment.GetTokenType() == parser.ModelicaLexerLINE_COMMENT { 326 | l.writeNewline() 327 | } 328 | } 329 | 330 | // getSpaceBefore returns whitespace that should prefix the string. Note that this can modify the listener state 331 | // If dryRun is true, the function will NOT modify the listener state (useful for predicting what the space will be) 332 | func (l *modelicaListener) getSpaceBefore(str string, dryRun bool) string { 333 | if l.onNewLine { 334 | if !dryRun { 335 | l.onNewLine = false 336 | } 337 | 338 | // insert indentation 339 | if l.indentation() > 0 { 340 | indentation := l.indentation() 341 | return strings.Repeat(spaceIndent, indentation) 342 | } 343 | } else if insertSpaceBeforeToken(str, l.previousTokenText) { 344 | // insert a space 345 | return " " 346 | } 347 | return "" 348 | } 349 | 350 | // insertBlankLine returns true if an empty line should be inserted 351 | // Used when visiting a terminal semicolon (ie ';') 352 | func (l *modelicaListener) insertBlankLine() bool { 353 | if !l.config.emptyLines { 354 | return false 355 | } 356 | 357 | // if at the end of the file (ie the last semicolon) only insert an extra 358 | // line if there are comments remaining which will be appended at the end of 359 | // the file 360 | if l.inLastSemicolon { 361 | return len(l.commentTokens) > 0 362 | } 363 | 364 | // only insert a blank line if there's no `within` on current line, 365 | // and we're outside of brackets 366 | return !l.withinOnCurrentLine && !l.insideBracket 367 | } 368 | 369 | func (l *modelicaListener) VisitTerminal(node antlr.TerminalNode) { 370 | // if there's a comment that should go before this node, insert it first 371 | tokenIdx := node.GetSymbol().GetTokenIndex() 372 | for len(l.commentTokens) > 0 && tokenIdx > l.commentTokens[0].GetTokenIndex() && l.commentTokens[0].GetTokenIndex() > l.previousTokenIdx { 373 | commentToken := l.commentTokens[0] 374 | l.commentTokens = l.commentTokens[1:] 375 | l.writeComment(commentToken) 376 | } 377 | 378 | l.writeString(node.GetText()) 379 | 380 | if l.previousTokenText == "within" { 381 | l.withinOnCurrentLine = true 382 | } 383 | 384 | if l.previousTokenText == "[" { 385 | l.insideBracket = true 386 | } else if l.previousTokenText == "]" { 387 | l.insideBracket = false 388 | } 389 | 390 | if node.GetText() == ";" { 391 | l.writeNewline() 392 | 393 | if l.insertBlankLine() { 394 | l.writeNewline() 395 | } else { 396 | l.withinOnCurrentLine = false 397 | } 398 | } 399 | 400 | l.previousTokenText = node.GetText() 401 | l.previousTokenIdx = node.GetSymbol().GetTokenIndex() 402 | } 403 | 404 | func (l *modelicaListener) EnterEveryRule(node antlr.ParserRuleContext) { 405 | if insertNewlineBefore(node) && !l.onNewLine { 406 | l.writeNewline() 407 | } 408 | 409 | if l.insertIndentBefore(node) { 410 | if !l.onNewLine { 411 | l.writeNewline() 412 | } 413 | l.maybeIndent() 414 | } 415 | } 416 | 417 | func (l *modelicaListener) ExitEveryRule(node antlr.ParserRuleContext) { 418 | if l.insertIndentBefore(node) { 419 | l.maybeDedent() 420 | } 421 | } 422 | 423 | func (l *modelicaListener) EnterAnnotation(node *parser.AnnotationContext) { 424 | l.inAnnotation++ 425 | } 426 | 427 | func (l *modelicaListener) ExitAnnotation(node *parser.AnnotationContext) { 428 | l.inAnnotation-- 429 | } 430 | 431 | func (l *modelicaListener) EnterModel_annotation(node *parser.Model_annotationContext) { 432 | l.inModelAnnotation++ 433 | } 434 | 435 | func (l *modelicaListener) ExitModel_annotation(node *parser.Model_annotationContext) { 436 | l.inModelAnnotation-- 437 | } 438 | 439 | func (l *modelicaListener) EnterVector(node *parser.VectorContext) { 440 | l.inVector++ 441 | if l.inModelAnnotation > 0 { 442 | // if this array uses an iterator for construction it gets no special treatment 443 | if _, ok := node.GetChild(0).(parser.Array_iterator_constructorContext); ok { 444 | return 445 | } 446 | 447 | // check if there is an element of this vector which would require indentation 448 | for _, child := range node.Array_arguments().GetChildren() { 449 | expressionNode, ok := child.(*parser.ExpressionContext) 450 | if !ok { 451 | continue 452 | } 453 | startToken := expressionNode.GetStart() 454 | if startToken.GetTokenType() == parser.ModelicaLexerIDENT { 455 | l.modelAnnotationVectorStack = append(l.modelAnnotationVectorStack, node) 456 | break 457 | } 458 | } 459 | } 460 | } 461 | 462 | func (l *modelicaListener) ExitVector(node *parser.VectorContext) { 463 | l.inVector-- 464 | if len(l.modelAnnotationVectorStack) > 0 { 465 | annotationVectorInterval := l.modelAnnotationVectorStack[len(l.modelAnnotationVectorStack)-1].GetSourceInterval() 466 | thisVectorInterval := node.GetSourceInterval() 467 | if annotationVectorInterval.Start == thisVectorInterval.Start && annotationVectorInterval.Stop == thisVectorInterval.Stop { 468 | l.modelAnnotationVectorStack = l.modelAnnotationVectorStack[:len(l.modelAnnotationVectorStack)-1] 469 | } 470 | } 471 | } 472 | 473 | func (l *modelicaListener) EnterNamed_argument(node *parser.Named_argumentContext) { 474 | l.inNamedArgument++ 475 | } 476 | 477 | func (l *modelicaListener) ExitNamed_argument(node *parser.Named_argumentContext) { 478 | l.inNamedArgument-- 479 | } 480 | 481 | func (l *modelicaListener) EnterLast_semicolon(node *parser.Last_semicolonContext) { 482 | l.inLastSemicolon = true 483 | } 484 | 485 | func (l *modelicaListener) ExitLast_semicolon(node *parser.Last_semicolonContext) { 486 | l.inLastSemicolon = false 487 | } 488 | 489 | // commentCollector is a wrapper around the default lexer which collects comment 490 | // tokens for later use 491 | type commentCollector struct { 492 | antlr.TokenSource 493 | commentTokens []antlr.Token 494 | } 495 | 496 | func newCommentCollector(source antlr.TokenSource) commentCollector { 497 | return commentCollector{ 498 | source, 499 | []antlr.Token{}, 500 | } 501 | } 502 | 503 | // NextToken returns the next token from the source 504 | func (c *commentCollector) NextToken() antlr.Token { 505 | token := c.TokenSource.NextToken() 506 | 507 | tokenType := token.GetTokenType() 508 | if tokenType == parser.ModelicaLexerCOMMENT || tokenType == parser.ModelicaLexerLINE_COMMENT { 509 | c.commentTokens = append(c.commentTokens, token) 510 | } 511 | 512 | return token 513 | } 514 | 515 | // processFile formats a file 516 | func processFile(filename string, out io.Writer, config Config) error { 517 | content, err := ioutil.ReadFile(filename) 518 | if err != nil { 519 | panic(err) 520 | } 521 | 522 | text := string(content) 523 | inputStream := antlr.NewInputStream(text) 524 | lexer := parser.NewModelicaLexer(inputStream) 525 | 526 | // wrap the default lexer to collect comments and set it as the stream's source 527 | stream := antlr.NewCommonTokenStream(lexer, antlr.TokenDefaultChannel) 528 | tokenSource := newCommentCollector(lexer) 529 | stream.SetTokenSource(&tokenSource) 530 | 531 | p := parser.NewModelicaParser(stream) 532 | sd := p.Stored_definition() 533 | 534 | listener := newListener(out, tokenSource.commentTokens, config) 535 | defer listener.close() 536 | 537 | antlr.ParseTreeWalkerDefault.Walk(listener, sd) 538 | // add any remaining comments and handle newline at end of file 539 | for _, comment := range listener.commentTokens { 540 | listener.writeComment(comment) 541 | } 542 | if !listener.onNewLine { 543 | listener.writeNewline() 544 | } 545 | 546 | return nil 547 | } 548 | -------------------------------------------------------------------------------- /thirdparty/parser/modelica_listener.go: -------------------------------------------------------------------------------- 1 | // Code generated from /var/antlrResult/Modelica.g4 by ANTLR 4.8. DO NOT EDIT. 2 | 3 | package parser // Modelica 4 | 5 | import "github.com/antlr/antlr4/runtime/Go/antlr" 6 | 7 | // ModelicaListener is a complete listener for a parse tree produced by ModelicaParser. 8 | type ModelicaListener interface { 9 | antlr.ParseTreeListener 10 | 11 | // EnterStored_definition is called when entering the stored_definition production. 12 | EnterStored_definition(c *Stored_definitionContext) 13 | 14 | // EnterClass_definition is called when entering the class_definition production. 15 | EnterClass_definition(c *Class_definitionContext) 16 | 17 | // EnterLast_semicolon is called when entering the last_semicolon production. 18 | EnterLast_semicolon(c *Last_semicolonContext) 19 | 20 | // EnterClass_specifier is called when entering the class_specifier production. 21 | EnterClass_specifier(c *Class_specifierContext) 22 | 23 | // EnterClass_prefixes is called when entering the class_prefixes production. 24 | EnterClass_prefixes(c *Class_prefixesContext) 25 | 26 | // EnterLong_class_specifier is called when entering the long_class_specifier production. 27 | EnterLong_class_specifier(c *Long_class_specifierContext) 28 | 29 | // EnterShort_class_specifier is called when entering the short_class_specifier production. 30 | EnterShort_class_specifier(c *Short_class_specifierContext) 31 | 32 | // EnterDer_class_specifier is called when entering the der_class_specifier production. 33 | EnterDer_class_specifier(c *Der_class_specifierContext) 34 | 35 | // EnterBase_prefix is called when entering the base_prefix production. 36 | EnterBase_prefix(c *Base_prefixContext) 37 | 38 | // EnterEnum_list is called when entering the enum_list production. 39 | EnterEnum_list(c *Enum_listContext) 40 | 41 | // EnterEnumeration_literal is called when entering the enumeration_literal production. 42 | EnterEnumeration_literal(c *Enumeration_literalContext) 43 | 44 | // EnterComposition is called when entering the composition production. 45 | EnterComposition(c *CompositionContext) 46 | 47 | // EnterModel_annotation is called when entering the model_annotation production. 48 | EnterModel_annotation(c *Model_annotationContext) 49 | 50 | // EnterLanguage_specification is called when entering the language_specification production. 51 | EnterLanguage_specification(c *Language_specificationContext) 52 | 53 | // EnterExternal_function_call is called when entering the external_function_call production. 54 | EnterExternal_function_call(c *External_function_callContext) 55 | 56 | // EnterExternal_function_call_args is called when entering the external_function_call_args production. 57 | EnterExternal_function_call_args(c *External_function_call_argsContext) 58 | 59 | // EnterExternal_function_call_argument is called when entering the external_function_call_argument production. 60 | EnterExternal_function_call_argument(c *External_function_call_argumentContext) 61 | 62 | // EnterElement_list is called when entering the element_list production. 63 | EnterElement_list(c *Element_listContext) 64 | 65 | // EnterElement is called when entering the element production. 66 | EnterElement(c *ElementContext) 67 | 68 | // EnterImport_clause is called when entering the import_clause production. 69 | EnterImport_clause(c *Import_clauseContext) 70 | 71 | // EnterImport_list is called when entering the import_list production. 72 | EnterImport_list(c *Import_listContext) 73 | 74 | // EnterExtends_clause is called when entering the extends_clause production. 75 | EnterExtends_clause(c *Extends_clauseContext) 76 | 77 | // EnterConstraining_clause is called when entering the constraining_clause production. 78 | EnterConstraining_clause(c *Constraining_clauseContext) 79 | 80 | // EnterComponent_clause is called when entering the component_clause production. 81 | EnterComponent_clause(c *Component_clauseContext) 82 | 83 | // EnterType_prefix is called when entering the type_prefix production. 84 | EnterType_prefix(c *Type_prefixContext) 85 | 86 | // EnterType_specifier is called when entering the type_specifier production. 87 | EnterType_specifier(c *Type_specifierContext) 88 | 89 | // EnterComponent_list is called when entering the component_list production. 90 | EnterComponent_list(c *Component_listContext) 91 | 92 | // EnterComponent_declaration is called when entering the component_declaration production. 93 | EnterComponent_declaration(c *Component_declarationContext) 94 | 95 | // EnterCondition_attribute is called when entering the condition_attribute production. 96 | EnterCondition_attribute(c *Condition_attributeContext) 97 | 98 | // EnterDeclaration is called when entering the declaration production. 99 | EnterDeclaration(c *DeclarationContext) 100 | 101 | // EnterModification is called when entering the modification production. 102 | EnterModification(c *ModificationContext) 103 | 104 | // EnterClass_modification is called when entering the class_modification production. 105 | EnterClass_modification(c *Class_modificationContext) 106 | 107 | // EnterArgument_list is called when entering the argument_list production. 108 | EnterArgument_list(c *Argument_listContext) 109 | 110 | // EnterArgument is called when entering the argument production. 111 | EnterArgument(c *ArgumentContext) 112 | 113 | // EnterElement_modification_or_replaceable is called when entering the element_modification_or_replaceable production. 114 | EnterElement_modification_or_replaceable(c *Element_modification_or_replaceableContext) 115 | 116 | // EnterElement_modification is called when entering the element_modification production. 117 | EnterElement_modification(c *Element_modificationContext) 118 | 119 | // EnterElement_redeclaration is called when entering the element_redeclaration production. 120 | EnterElement_redeclaration(c *Element_redeclarationContext) 121 | 122 | // EnterElement_replaceable is called when entering the element_replaceable production. 123 | EnterElement_replaceable(c *Element_replaceableContext) 124 | 125 | // EnterComponent_clause1 is called when entering the component_clause1 production. 126 | EnterComponent_clause1(c *Component_clause1Context) 127 | 128 | // EnterComponent_declaration1 is called when entering the component_declaration1 production. 129 | EnterComponent_declaration1(c *Component_declaration1Context) 130 | 131 | // EnterShort_class_definition is called when entering the short_class_definition production. 132 | EnterShort_class_definition(c *Short_class_definitionContext) 133 | 134 | // EnterEquation_section is called when entering the equation_section production. 135 | EnterEquation_section(c *Equation_sectionContext) 136 | 137 | // EnterEquations is called when entering the equations production. 138 | EnterEquations(c *EquationsContext) 139 | 140 | // EnterAlgorithm_section is called when entering the algorithm_section production. 141 | EnterAlgorithm_section(c *Algorithm_sectionContext) 142 | 143 | // EnterAlgorithm_statements is called when entering the algorithm_statements production. 144 | EnterAlgorithm_statements(c *Algorithm_statementsContext) 145 | 146 | // EnterEquation is called when entering the equation production. 147 | EnterEquation(c *EquationContext) 148 | 149 | // EnterStatement is called when entering the statement production. 150 | EnterStatement(c *StatementContext) 151 | 152 | // EnterIf_equation is called when entering the if_equation production. 153 | EnterIf_equation(c *If_equationContext) 154 | 155 | // EnterIf_statement is called when entering the if_statement production. 156 | EnterIf_statement(c *If_statementContext) 157 | 158 | // EnterControl_structure_body is called when entering the control_structure_body production. 159 | EnterControl_structure_body(c *Control_structure_bodyContext) 160 | 161 | // EnterFor_equation is called when entering the for_equation production. 162 | EnterFor_equation(c *For_equationContext) 163 | 164 | // EnterFor_statement is called when entering the for_statement production. 165 | EnterFor_statement(c *For_statementContext) 166 | 167 | // EnterFor_indices is called when entering the for_indices production. 168 | EnterFor_indices(c *For_indicesContext) 169 | 170 | // EnterFor_index is called when entering the for_index production. 171 | EnterFor_index(c *For_indexContext) 172 | 173 | // EnterWhile_statement is called when entering the while_statement production. 174 | EnterWhile_statement(c *While_statementContext) 175 | 176 | // EnterWhen_equation is called when entering the when_equation production. 177 | EnterWhen_equation(c *When_equationContext) 178 | 179 | // EnterWhen_statement is called when entering the when_statement production. 180 | EnterWhen_statement(c *When_statementContext) 181 | 182 | // EnterConnect_clause is called when entering the connect_clause production. 183 | EnterConnect_clause(c *Connect_clauseContext) 184 | 185 | // EnterExpression is called when entering the expression production. 186 | EnterExpression(c *ExpressionContext) 187 | 188 | // EnterSimple_expression is called when entering the simple_expression production. 189 | EnterSimple_expression(c *Simple_expressionContext) 190 | 191 | // EnterIf_expression is called when entering the if_expression production. 192 | EnterIf_expression(c *If_expressionContext) 193 | 194 | // EnterIf_expression_body is called when entering the if_expression_body production. 195 | EnterIf_expression_body(c *If_expression_bodyContext) 196 | 197 | // EnterIf_expression_condition is called when entering the if_expression_condition production. 198 | EnterIf_expression_condition(c *If_expression_conditionContext) 199 | 200 | // EnterElseif_expression_condition is called when entering the elseif_expression_condition production. 201 | EnterElseif_expression_condition(c *Elseif_expression_conditionContext) 202 | 203 | // EnterElse_expression_condition is called when entering the else_expression_condition production. 204 | EnterElse_expression_condition(c *Else_expression_conditionContext) 205 | 206 | // EnterLogical_expression is called when entering the logical_expression production. 207 | EnterLogical_expression(c *Logical_expressionContext) 208 | 209 | // EnterLogical_term is called when entering the logical_term production. 210 | EnterLogical_term(c *Logical_termContext) 211 | 212 | // EnterLogical_factor is called when entering the logical_factor production. 213 | EnterLogical_factor(c *Logical_factorContext) 214 | 215 | // EnterRelation is called when entering the relation production. 216 | EnterRelation(c *RelationContext) 217 | 218 | // EnterRel_op is called when entering the rel_op production. 219 | EnterRel_op(c *Rel_opContext) 220 | 221 | // EnterArithmetic_expression is called when entering the arithmetic_expression production. 222 | EnterArithmetic_expression(c *Arithmetic_expressionContext) 223 | 224 | // EnterAdd_op is called when entering the add_op production. 225 | EnterAdd_op(c *Add_opContext) 226 | 227 | // EnterTerm is called when entering the term production. 228 | EnterTerm(c *TermContext) 229 | 230 | // EnterMul_op is called when entering the mul_op production. 231 | EnterMul_op(c *Mul_opContext) 232 | 233 | // EnterFactor is called when entering the factor production. 234 | EnterFactor(c *FactorContext) 235 | 236 | // EnterPrimary is called when entering the primary production. 237 | EnterPrimary(c *PrimaryContext) 238 | 239 | // EnterVector is called when entering the vector production. 240 | EnterVector(c *VectorContext) 241 | 242 | // EnterArray_arguments is called when entering the array_arguments production. 243 | EnterArray_arguments(c *Array_argumentsContext) 244 | 245 | // EnterArray_iterator_constructor is called when entering the array_iterator_constructor production. 246 | EnterArray_iterator_constructor(c *Array_iterator_constructorContext) 247 | 248 | // EnterName is called when entering the name production. 249 | EnterName(c *NameContext) 250 | 251 | // EnterComponent_reference is called when entering the component_reference production. 252 | EnterComponent_reference(c *Component_referenceContext) 253 | 254 | // EnterFunction_call_args is called when entering the function_call_args production. 255 | EnterFunction_call_args(c *Function_call_argsContext) 256 | 257 | // EnterFunction_arguments is called when entering the function_arguments production. 258 | EnterFunction_arguments(c *Function_argumentsContext) 259 | 260 | // EnterNamed_arguments is called when entering the named_arguments production. 261 | EnterNamed_arguments(c *Named_argumentsContext) 262 | 263 | // EnterNamed_argument is called when entering the named_argument production. 264 | EnterNamed_argument(c *Named_argumentContext) 265 | 266 | // EnterFunction_argument is called when entering the function_argument production. 267 | EnterFunction_argument(c *Function_argumentContext) 268 | 269 | // EnterOutput_expression_list is called when entering the output_expression_list production. 270 | EnterOutput_expression_list(c *Output_expression_listContext) 271 | 272 | // EnterExpression_list is called when entering the expression_list production. 273 | EnterExpression_list(c *Expression_listContext) 274 | 275 | // EnterArray_subscripts is called when entering the array_subscripts production. 276 | EnterArray_subscripts(c *Array_subscriptsContext) 277 | 278 | // EnterSubscript is called when entering the subscript production. 279 | EnterSubscript(c *SubscriptContext) 280 | 281 | // EnterComment is called when entering the comment production. 282 | EnterComment(c *CommentContext) 283 | 284 | // EnterString_comment is called when entering the string_comment production. 285 | EnterString_comment(c *String_commentContext) 286 | 287 | // EnterAnnotation is called when entering the annotation production. 288 | EnterAnnotation(c *AnnotationContext) 289 | 290 | // ExitStored_definition is called when exiting the stored_definition production. 291 | ExitStored_definition(c *Stored_definitionContext) 292 | 293 | // ExitClass_definition is called when exiting the class_definition production. 294 | ExitClass_definition(c *Class_definitionContext) 295 | 296 | // ExitLast_semicolon is called when exiting the last_semicolon production. 297 | ExitLast_semicolon(c *Last_semicolonContext) 298 | 299 | // ExitClass_specifier is called when exiting the class_specifier production. 300 | ExitClass_specifier(c *Class_specifierContext) 301 | 302 | // ExitClass_prefixes is called when exiting the class_prefixes production. 303 | ExitClass_prefixes(c *Class_prefixesContext) 304 | 305 | // ExitLong_class_specifier is called when exiting the long_class_specifier production. 306 | ExitLong_class_specifier(c *Long_class_specifierContext) 307 | 308 | // ExitShort_class_specifier is called when exiting the short_class_specifier production. 309 | ExitShort_class_specifier(c *Short_class_specifierContext) 310 | 311 | // ExitDer_class_specifier is called when exiting the der_class_specifier production. 312 | ExitDer_class_specifier(c *Der_class_specifierContext) 313 | 314 | // ExitBase_prefix is called when exiting the base_prefix production. 315 | ExitBase_prefix(c *Base_prefixContext) 316 | 317 | // ExitEnum_list is called when exiting the enum_list production. 318 | ExitEnum_list(c *Enum_listContext) 319 | 320 | // ExitEnumeration_literal is called when exiting the enumeration_literal production. 321 | ExitEnumeration_literal(c *Enumeration_literalContext) 322 | 323 | // ExitComposition is called when exiting the composition production. 324 | ExitComposition(c *CompositionContext) 325 | 326 | // ExitModel_annotation is called when exiting the model_annotation production. 327 | ExitModel_annotation(c *Model_annotationContext) 328 | 329 | // ExitLanguage_specification is called when exiting the language_specification production. 330 | ExitLanguage_specification(c *Language_specificationContext) 331 | 332 | // ExitExternal_function_call is called when exiting the external_function_call production. 333 | ExitExternal_function_call(c *External_function_callContext) 334 | 335 | // ExitExternal_function_call_args is called when exiting the external_function_call_args production. 336 | ExitExternal_function_call_args(c *External_function_call_argsContext) 337 | 338 | // ExitExternal_function_call_argument is called when exiting the external_function_call_argument production. 339 | ExitExternal_function_call_argument(c *External_function_call_argumentContext) 340 | 341 | // ExitElement_list is called when exiting the element_list production. 342 | ExitElement_list(c *Element_listContext) 343 | 344 | // ExitElement is called when exiting the element production. 345 | ExitElement(c *ElementContext) 346 | 347 | // ExitImport_clause is called when exiting the import_clause production. 348 | ExitImport_clause(c *Import_clauseContext) 349 | 350 | // ExitImport_list is called when exiting the import_list production. 351 | ExitImport_list(c *Import_listContext) 352 | 353 | // ExitExtends_clause is called when exiting the extends_clause production. 354 | ExitExtends_clause(c *Extends_clauseContext) 355 | 356 | // ExitConstraining_clause is called when exiting the constraining_clause production. 357 | ExitConstraining_clause(c *Constraining_clauseContext) 358 | 359 | // ExitComponent_clause is called when exiting the component_clause production. 360 | ExitComponent_clause(c *Component_clauseContext) 361 | 362 | // ExitType_prefix is called when exiting the type_prefix production. 363 | ExitType_prefix(c *Type_prefixContext) 364 | 365 | // ExitType_specifier is called when exiting the type_specifier production. 366 | ExitType_specifier(c *Type_specifierContext) 367 | 368 | // ExitComponent_list is called when exiting the component_list production. 369 | ExitComponent_list(c *Component_listContext) 370 | 371 | // ExitComponent_declaration is called when exiting the component_declaration production. 372 | ExitComponent_declaration(c *Component_declarationContext) 373 | 374 | // ExitCondition_attribute is called when exiting the condition_attribute production. 375 | ExitCondition_attribute(c *Condition_attributeContext) 376 | 377 | // ExitDeclaration is called when exiting the declaration production. 378 | ExitDeclaration(c *DeclarationContext) 379 | 380 | // ExitModification is called when exiting the modification production. 381 | ExitModification(c *ModificationContext) 382 | 383 | // ExitClass_modification is called when exiting the class_modification production. 384 | ExitClass_modification(c *Class_modificationContext) 385 | 386 | // ExitArgument_list is called when exiting the argument_list production. 387 | ExitArgument_list(c *Argument_listContext) 388 | 389 | // ExitArgument is called when exiting the argument production. 390 | ExitArgument(c *ArgumentContext) 391 | 392 | // ExitElement_modification_or_replaceable is called when exiting the element_modification_or_replaceable production. 393 | ExitElement_modification_or_replaceable(c *Element_modification_or_replaceableContext) 394 | 395 | // ExitElement_modification is called when exiting the element_modification production. 396 | ExitElement_modification(c *Element_modificationContext) 397 | 398 | // ExitElement_redeclaration is called when exiting the element_redeclaration production. 399 | ExitElement_redeclaration(c *Element_redeclarationContext) 400 | 401 | // ExitElement_replaceable is called when exiting the element_replaceable production. 402 | ExitElement_replaceable(c *Element_replaceableContext) 403 | 404 | // ExitComponent_clause1 is called when exiting the component_clause1 production. 405 | ExitComponent_clause1(c *Component_clause1Context) 406 | 407 | // ExitComponent_declaration1 is called when exiting the component_declaration1 production. 408 | ExitComponent_declaration1(c *Component_declaration1Context) 409 | 410 | // ExitShort_class_definition is called when exiting the short_class_definition production. 411 | ExitShort_class_definition(c *Short_class_definitionContext) 412 | 413 | // ExitEquation_section is called when exiting the equation_section production. 414 | ExitEquation_section(c *Equation_sectionContext) 415 | 416 | // ExitEquations is called when exiting the equations production. 417 | ExitEquations(c *EquationsContext) 418 | 419 | // ExitAlgorithm_section is called when exiting the algorithm_section production. 420 | ExitAlgorithm_section(c *Algorithm_sectionContext) 421 | 422 | // ExitAlgorithm_statements is called when exiting the algorithm_statements production. 423 | ExitAlgorithm_statements(c *Algorithm_statementsContext) 424 | 425 | // ExitEquation is called when exiting the equation production. 426 | ExitEquation(c *EquationContext) 427 | 428 | // ExitStatement is called when exiting the statement production. 429 | ExitStatement(c *StatementContext) 430 | 431 | // ExitIf_equation is called when exiting the if_equation production. 432 | ExitIf_equation(c *If_equationContext) 433 | 434 | // ExitIf_statement is called when exiting the if_statement production. 435 | ExitIf_statement(c *If_statementContext) 436 | 437 | // ExitControl_structure_body is called when exiting the control_structure_body production. 438 | ExitControl_structure_body(c *Control_structure_bodyContext) 439 | 440 | // ExitFor_equation is called when exiting the for_equation production. 441 | ExitFor_equation(c *For_equationContext) 442 | 443 | // ExitFor_statement is called when exiting the for_statement production. 444 | ExitFor_statement(c *For_statementContext) 445 | 446 | // ExitFor_indices is called when exiting the for_indices production. 447 | ExitFor_indices(c *For_indicesContext) 448 | 449 | // ExitFor_index is called when exiting the for_index production. 450 | ExitFor_index(c *For_indexContext) 451 | 452 | // ExitWhile_statement is called when exiting the while_statement production. 453 | ExitWhile_statement(c *While_statementContext) 454 | 455 | // ExitWhen_equation is called when exiting the when_equation production. 456 | ExitWhen_equation(c *When_equationContext) 457 | 458 | // ExitWhen_statement is called when exiting the when_statement production. 459 | ExitWhen_statement(c *When_statementContext) 460 | 461 | // ExitConnect_clause is called when exiting the connect_clause production. 462 | ExitConnect_clause(c *Connect_clauseContext) 463 | 464 | // ExitExpression is called when exiting the expression production. 465 | ExitExpression(c *ExpressionContext) 466 | 467 | // ExitSimple_expression is called when exiting the simple_expression production. 468 | ExitSimple_expression(c *Simple_expressionContext) 469 | 470 | // ExitIf_expression is called when exiting the if_expression production. 471 | ExitIf_expression(c *If_expressionContext) 472 | 473 | // ExitIf_expression_body is called when exiting the if_expression_body production. 474 | ExitIf_expression_body(c *If_expression_bodyContext) 475 | 476 | // ExitIf_expression_condition is called when exiting the if_expression_condition production. 477 | ExitIf_expression_condition(c *If_expression_conditionContext) 478 | 479 | // ExitElseif_expression_condition is called when exiting the elseif_expression_condition production. 480 | ExitElseif_expression_condition(c *Elseif_expression_conditionContext) 481 | 482 | // ExitElse_expression_condition is called when exiting the else_expression_condition production. 483 | ExitElse_expression_condition(c *Else_expression_conditionContext) 484 | 485 | // ExitLogical_expression is called when exiting the logical_expression production. 486 | ExitLogical_expression(c *Logical_expressionContext) 487 | 488 | // ExitLogical_term is called when exiting the logical_term production. 489 | ExitLogical_term(c *Logical_termContext) 490 | 491 | // ExitLogical_factor is called when exiting the logical_factor production. 492 | ExitLogical_factor(c *Logical_factorContext) 493 | 494 | // ExitRelation is called when exiting the relation production. 495 | ExitRelation(c *RelationContext) 496 | 497 | // ExitRel_op is called when exiting the rel_op production. 498 | ExitRel_op(c *Rel_opContext) 499 | 500 | // ExitArithmetic_expression is called when exiting the arithmetic_expression production. 501 | ExitArithmetic_expression(c *Arithmetic_expressionContext) 502 | 503 | // ExitAdd_op is called when exiting the add_op production. 504 | ExitAdd_op(c *Add_opContext) 505 | 506 | // ExitTerm is called when exiting the term production. 507 | ExitTerm(c *TermContext) 508 | 509 | // ExitMul_op is called when exiting the mul_op production. 510 | ExitMul_op(c *Mul_opContext) 511 | 512 | // ExitFactor is called when exiting the factor production. 513 | ExitFactor(c *FactorContext) 514 | 515 | // ExitPrimary is called when exiting the primary production. 516 | ExitPrimary(c *PrimaryContext) 517 | 518 | // ExitVector is called when exiting the vector production. 519 | ExitVector(c *VectorContext) 520 | 521 | // ExitArray_arguments is called when exiting the array_arguments production. 522 | ExitArray_arguments(c *Array_argumentsContext) 523 | 524 | // ExitArray_iterator_constructor is called when exiting the array_iterator_constructor production. 525 | ExitArray_iterator_constructor(c *Array_iterator_constructorContext) 526 | 527 | // ExitName is called when exiting the name production. 528 | ExitName(c *NameContext) 529 | 530 | // ExitComponent_reference is called when exiting the component_reference production. 531 | ExitComponent_reference(c *Component_referenceContext) 532 | 533 | // ExitFunction_call_args is called when exiting the function_call_args production. 534 | ExitFunction_call_args(c *Function_call_argsContext) 535 | 536 | // ExitFunction_arguments is called when exiting the function_arguments production. 537 | ExitFunction_arguments(c *Function_argumentsContext) 538 | 539 | // ExitNamed_arguments is called when exiting the named_arguments production. 540 | ExitNamed_arguments(c *Named_argumentsContext) 541 | 542 | // ExitNamed_argument is called when exiting the named_argument production. 543 | ExitNamed_argument(c *Named_argumentContext) 544 | 545 | // ExitFunction_argument is called when exiting the function_argument production. 546 | ExitFunction_argument(c *Function_argumentContext) 547 | 548 | // ExitOutput_expression_list is called when exiting the output_expression_list production. 549 | ExitOutput_expression_list(c *Output_expression_listContext) 550 | 551 | // ExitExpression_list is called when exiting the expression_list production. 552 | ExitExpression_list(c *Expression_listContext) 553 | 554 | // ExitArray_subscripts is called when exiting the array_subscripts production. 555 | ExitArray_subscripts(c *Array_subscriptsContext) 556 | 557 | // ExitSubscript is called when exiting the subscript production. 558 | ExitSubscript(c *SubscriptContext) 559 | 560 | // ExitComment is called when exiting the comment production. 561 | ExitComment(c *CommentContext) 562 | 563 | // ExitString_comment is called when exiting the string_comment production. 564 | ExitString_comment(c *String_commentContext) 565 | 566 | // ExitAnnotation is called when exiting the annotation production. 567 | ExitAnnotation(c *AnnotationContext) 568 | } 569 | -------------------------------------------------------------------------------- /thirdparty/parser/ModelicaLexer.interp: -------------------------------------------------------------------------------- 1 | token literal names: 2 | null 3 | 'within' 4 | ';' 5 | 'final' 6 | 'encapsulated' 7 | 'partial' 8 | 'class' 9 | 'model' 10 | 'operator' 11 | 'record' 12 | 'block' 13 | 'expandable' 14 | 'connector' 15 | 'type' 16 | 'package' 17 | 'pure' 18 | 'impure' 19 | 'function' 20 | 'end' 21 | 'extends' 22 | '=' 23 | 'enumeration' 24 | '(' 25 | ':' 26 | ')' 27 | 'der' 28 | ',' 29 | 'public' 30 | 'protected' 31 | 'external' 32 | 'redeclare' 33 | 'inner' 34 | 'outer' 35 | 'replaceable' 36 | 'import' 37 | '.*' 38 | '.{' 39 | '}' 40 | 'constrainedby' 41 | 'flow' 42 | 'stream' 43 | 'discrete' 44 | 'parameter' 45 | 'constant' 46 | 'input' 47 | 'output' 48 | 'if' 49 | ':=' 50 | 'each' 51 | 'initial' 52 | 'equation' 53 | 'algorithm' 54 | 'break' 55 | 'return' 56 | 'then' 57 | 'elseif' 58 | 'else' 59 | 'for' 60 | 'loop' 61 | 'in' 62 | 'while' 63 | 'when' 64 | 'elsewhen' 65 | 'connect' 66 | 'or' 67 | 'and' 68 | 'not' 69 | '<' 70 | '<=' 71 | '>' 72 | '>=' 73 | '==' 74 | '<>' 75 | '+' 76 | '-' 77 | '.+' 78 | '.-' 79 | '*' 80 | '/' 81 | './' 82 | '^' 83 | '.^' 84 | 'false' 85 | 'true' 86 | '[' 87 | ']' 88 | '{' 89 | '.' 90 | 'annotation' 91 | null 92 | null 93 | null 94 | null 95 | null 96 | null 97 | 98 | token symbolic names: 99 | null 100 | null 101 | null 102 | null 103 | null 104 | null 105 | null 106 | null 107 | null 108 | null 109 | null 110 | null 111 | null 112 | null 113 | null 114 | null 115 | null 116 | null 117 | null 118 | null 119 | null 120 | null 121 | null 122 | null 123 | null 124 | null 125 | null 126 | null 127 | null 128 | null 129 | null 130 | null 131 | null 132 | null 133 | null 134 | null 135 | null 136 | null 137 | null 138 | null 139 | null 140 | null 141 | null 142 | null 143 | null 144 | null 145 | null 146 | null 147 | null 148 | null 149 | null 150 | null 151 | null 152 | null 153 | null 154 | null 155 | null 156 | null 157 | null 158 | null 159 | null 160 | null 161 | null 162 | null 163 | null 164 | null 165 | null 166 | null 167 | null 168 | null 169 | null 170 | null 171 | null 172 | null 173 | null 174 | null 175 | null 176 | null 177 | null 178 | null 179 | null 180 | null 181 | null 182 | null 183 | null 184 | null 185 | null 186 | null 187 | null 188 | IDENT 189 | STRING 190 | UNSIGNED_NUMBER 191 | WS 192 | COMMENT 193 | LINE_COMMENT 194 | 195 | rule names: 196 | T__0 197 | T__1 198 | T__2 199 | T__3 200 | T__4 201 | T__5 202 | T__6 203 | T__7 204 | T__8 205 | T__9 206 | T__10 207 | T__11 208 | T__12 209 | T__13 210 | T__14 211 | T__15 212 | T__16 213 | T__17 214 | T__18 215 | T__19 216 | T__20 217 | T__21 218 | T__22 219 | T__23 220 | T__24 221 | T__25 222 | T__26 223 | T__27 224 | T__28 225 | T__29 226 | T__30 227 | T__31 228 | T__32 229 | T__33 230 | T__34 231 | T__35 232 | T__36 233 | T__37 234 | T__38 235 | T__39 236 | T__40 237 | T__41 238 | T__42 239 | T__43 240 | T__44 241 | T__45 242 | T__46 243 | T__47 244 | T__48 245 | T__49 246 | T__50 247 | T__51 248 | T__52 249 | T__53 250 | T__54 251 | T__55 252 | T__56 253 | T__57 254 | T__58 255 | T__59 256 | T__60 257 | T__61 258 | T__62 259 | T__63 260 | T__64 261 | T__65 262 | T__66 263 | T__67 264 | T__68 265 | T__69 266 | T__70 267 | T__71 268 | T__72 269 | T__73 270 | T__74 271 | T__75 272 | T__76 273 | T__77 274 | T__78 275 | T__79 276 | T__80 277 | T__81 278 | T__82 279 | T__83 280 | T__84 281 | T__85 282 | T__86 283 | T__87 284 | IDENT 285 | Q_IDENT 286 | S_CHAR 287 | NONDIGIT 288 | STRING 289 | Q_CHAR 290 | S_ESCAPE 291 | DIGIT 292 | UNSIGNED_INTEGER 293 | UNSIGNED_NUMBER 294 | WS 295 | COMMENT 296 | LINE_COMMENT 297 | 298 | channel names: 299 | DEFAULT_TOKEN_CHANNEL 300 | HIDDEN 301 | 302 | mode names: 303 | DEFAULT_MODE 304 | 305 | atn: 306 | [3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 96, 799, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, 9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9, 49, 4, 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54, 4, 55, 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4, 60, 9, 60, 4, 61, 9, 61, 4, 62, 9, 62, 4, 63, 9, 63, 4, 64, 9, 64, 4, 65, 9, 65, 4, 66, 9, 66, 4, 67, 9, 67, 4, 68, 9, 68, 4, 69, 9, 69, 4, 70, 9, 70, 4, 71, 9, 71, 4, 72, 9, 72, 4, 73, 9, 73, 4, 74, 9, 74, 4, 75, 9, 75, 4, 76, 9, 76, 4, 77, 9, 77, 4, 78, 9, 78, 4, 79, 9, 79, 4, 80, 9, 80, 4, 81, 9, 81, 4, 82, 9, 82, 4, 83, 9, 83, 4, 84, 9, 84, 4, 85, 9, 85, 4, 86, 9, 86, 4, 87, 9, 87, 4, 88, 9, 88, 4, 89, 9, 89, 4, 90, 9, 90, 4, 91, 9, 91, 4, 92, 9, 92, 4, 93, 9, 93, 4, 94, 9, 94, 4, 95, 9, 95, 4, 96, 9, 96, 4, 97, 9, 97, 4, 98, 9, 98, 4, 99, 9, 99, 4, 100, 9, 100, 4, 101, 9, 101, 4, 102, 9, 102, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 2, 3, 3, 3, 3, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 4, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 15, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 19, 3, 19, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 3, 21, 3, 21, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 24, 3, 24, 3, 25, 3, 25, 3, 26, 3, 26, 3, 26, 3, 26, 3, 27, 3, 27, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 36, 3, 36, 3, 36, 3, 37, 3, 37, 3, 37, 3, 38, 3, 38, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 45, 3, 45, 3, 45, 3, 45, 3, 45, 3, 45, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 3, 47, 3, 47, 3, 47, 3, 48, 3, 48, 3, 48, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 58, 3, 58, 3, 58, 3, 58, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 60, 3, 60, 3, 60, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 64, 3, 64, 3, 64, 3, 64, 3, 64, 3, 64, 3, 64, 3, 64, 3, 65, 3, 65, 3, 65, 3, 66, 3, 66, 3, 66, 3, 66, 3, 67, 3, 67, 3, 67, 3, 67, 3, 68, 3, 68, 3, 69, 3, 69, 3, 69, 3, 70, 3, 70, 3, 71, 3, 71, 3, 71, 3, 72, 3, 72, 3, 72, 3, 73, 3, 73, 3, 73, 3, 74, 3, 74, 3, 75, 3, 75, 3, 76, 3, 76, 3, 76, 3, 77, 3, 77, 3, 77, 3, 78, 3, 78, 3, 79, 3, 79, 3, 80, 3, 80, 3, 80, 3, 81, 3, 81, 3, 82, 3, 82, 3, 82, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 84, 3, 84, 3, 84, 3, 84, 3, 84, 3, 85, 3, 85, 3, 86, 3, 86, 3, 87, 3, 87, 3, 88, 3, 88, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 90, 3, 90, 3, 90, 7, 90, 701, 10, 90, 12, 90, 14, 90, 704, 11, 90, 3, 90, 5, 90, 707, 10, 90, 3, 91, 3, 91, 3, 91, 5, 91, 712, 10, 91, 3, 91, 3, 91, 7, 91, 716, 10, 91, 12, 91, 14, 91, 719, 11, 91, 3, 91, 3, 91, 3, 92, 3, 92, 3, 93, 3, 93, 3, 94, 3, 94, 3, 94, 7, 94, 730, 10, 94, 12, 94, 14, 94, 733, 11, 94, 3, 94, 3, 94, 3, 95, 3, 95, 3, 95, 5, 95, 740, 10, 95, 3, 96, 3, 96, 3, 96, 3, 97, 3, 97, 3, 98, 3, 98, 7, 98, 749, 10, 98, 12, 98, 14, 98, 752, 11, 98, 3, 99, 3, 99, 3, 99, 5, 99, 757, 10, 99, 5, 99, 759, 10, 99, 3, 99, 3, 99, 5, 99, 763, 10, 99, 3, 99, 5, 99, 766, 10, 99, 3, 100, 6, 100, 769, 10, 100, 13, 100, 14, 100, 770, 3, 100, 3, 100, 3, 101, 3, 101, 3, 101, 3, 101, 7, 101, 779, 10, 101, 12, 101, 14, 101, 782, 11, 101, 3, 101, 3, 101, 3, 101, 3, 101, 3, 101, 3, 102, 3, 102, 3, 102, 3, 102, 7, 102, 793, 10, 102, 12, 102, 14, 102, 796, 11, 102, 3, 102, 3, 102, 3, 780, 2, 103, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 20, 39, 21, 41, 22, 43, 23, 45, 24, 47, 25, 49, 26, 51, 27, 53, 28, 55, 29, 57, 30, 59, 31, 61, 32, 63, 33, 65, 34, 67, 35, 69, 36, 71, 37, 73, 38, 75, 39, 77, 40, 79, 41, 81, 42, 83, 43, 85, 44, 87, 45, 89, 46, 91, 47, 93, 48, 95, 49, 97, 50, 99, 51, 101, 52, 103, 53, 105, 54, 107, 55, 109, 56, 111, 57, 113, 58, 115, 59, 117, 60, 119, 61, 121, 62, 123, 63, 125, 64, 127, 65, 129, 66, 131, 67, 133, 68, 135, 69, 137, 70, 139, 71, 141, 72, 143, 73, 145, 74, 147, 75, 149, 76, 151, 77, 153, 78, 155, 79, 157, 80, 159, 81, 161, 82, 163, 83, 165, 84, 167, 85, 169, 86, 171, 87, 173, 88, 175, 89, 177, 90, 179, 91, 181, 2, 183, 2, 185, 2, 187, 92, 189, 2, 191, 2, 193, 2, 195, 2, 197, 93, 199, 94, 201, 95, 203, 96, 3, 2, 10, 4, 2, 36, 36, 94, 94, 5, 2, 67, 92, 97, 97, 99, 124, 9, 2, 35, 35, 37, 40, 42, 49, 60, 66, 93, 93, 95, 96, 125, 128, 13, 2, 36, 36, 41, 41, 65, 65, 94, 94, 99, 100, 104, 104, 112, 112, 116, 116, 118, 118, 120, 120, 8219, 8219, 4, 2, 71, 71, 103, 103, 4, 2, 45, 45, 47, 47, 5, 2, 11, 12, 15, 15, 34, 34, 4, 2, 12, 12, 15, 15, 2, 809, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, 31, 3, 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 37, 3, 2, 2, 2, 2, 39, 3, 2, 2, 2, 2, 41, 3, 2, 2, 2, 2, 43, 3, 2, 2, 2, 2, 45, 3, 2, 2, 2, 2, 47, 3, 2, 2, 2, 2, 49, 3, 2, 2, 2, 2, 51, 3, 2, 2, 2, 2, 53, 3, 2, 2, 2, 2, 55, 3, 2, 2, 2, 2, 57, 3, 2, 2, 2, 2, 59, 3, 2, 2, 2, 2, 61, 3, 2, 2, 2, 2, 63, 3, 2, 2, 2, 2, 65, 3, 2, 2, 2, 2, 67, 3, 2, 2, 2, 2, 69, 3, 2, 2, 2, 2, 71, 3, 2, 2, 2, 2, 73, 3, 2, 2, 2, 2, 75, 3, 2, 2, 2, 2, 77, 3, 2, 2, 2, 2, 79, 3, 2, 2, 2, 2, 81, 3, 2, 2, 2, 2, 83, 3, 2, 2, 2, 2, 85, 3, 2, 2, 2, 2, 87, 3, 2, 2, 2, 2, 89, 3, 2, 2, 2, 2, 91, 3, 2, 2, 2, 2, 93, 3, 2, 2, 2, 2, 95, 3, 2, 2, 2, 2, 97, 3, 2, 2, 2, 2, 99, 3, 2, 2, 2, 2, 101, 3, 2, 2, 2, 2, 103, 3, 2, 2, 2, 2, 105, 3, 2, 2, 2, 2, 107, 3, 2, 2, 2, 2, 109, 3, 2, 2, 2, 2, 111, 3, 2, 2, 2, 2, 113, 3, 2, 2, 2, 2, 115, 3, 2, 2, 2, 2, 117, 3, 2, 2, 2, 2, 119, 3, 2, 2, 2, 2, 121, 3, 2, 2, 2, 2, 123, 3, 2, 2, 2, 2, 125, 3, 2, 2, 2, 2, 127, 3, 2, 2, 2, 2, 129, 3, 2, 2, 2, 2, 131, 3, 2, 2, 2, 2, 133, 3, 2, 2, 2, 2, 135, 3, 2, 2, 2, 2, 137, 3, 2, 2, 2, 2, 139, 3, 2, 2, 2, 2, 141, 3, 2, 2, 2, 2, 143, 3, 2, 2, 2, 2, 145, 3, 2, 2, 2, 2, 147, 3, 2, 2, 2, 2, 149, 3, 2, 2, 2, 2, 151, 3, 2, 2, 2, 2, 153, 3, 2, 2, 2, 2, 155, 3, 2, 2, 2, 2, 157, 3, 2, 2, 2, 2, 159, 3, 2, 2, 2, 2, 161, 3, 2, 2, 2, 2, 163, 3, 2, 2, 2, 2, 165, 3, 2, 2, 2, 2, 167, 3, 2, 2, 2, 2, 169, 3, 2, 2, 2, 2, 171, 3, 2, 2, 2, 2, 173, 3, 2, 2, 2, 2, 175, 3, 2, 2, 2, 2, 177, 3, 2, 2, 2, 2, 179, 3, 2, 2, 2, 2, 187, 3, 2, 2, 2, 2, 197, 3, 2, 2, 2, 2, 199, 3, 2, 2, 2, 2, 201, 3, 2, 2, 2, 2, 203, 3, 2, 2, 2, 3, 205, 3, 2, 2, 2, 5, 212, 3, 2, 2, 2, 7, 214, 3, 2, 2, 2, 9, 220, 3, 2, 2, 2, 11, 233, 3, 2, 2, 2, 13, 241, 3, 2, 2, 2, 15, 247, 3, 2, 2, 2, 17, 253, 3, 2, 2, 2, 19, 262, 3, 2, 2, 2, 21, 269, 3, 2, 2, 2, 23, 275, 3, 2, 2, 2, 25, 286, 3, 2, 2, 2, 27, 296, 3, 2, 2, 2, 29, 301, 3, 2, 2, 2, 31, 309, 3, 2, 2, 2, 33, 314, 3, 2, 2, 2, 35, 321, 3, 2, 2, 2, 37, 330, 3, 2, 2, 2, 39, 334, 3, 2, 2, 2, 41, 342, 3, 2, 2, 2, 43, 344, 3, 2, 2, 2, 45, 356, 3, 2, 2, 2, 47, 358, 3, 2, 2, 2, 49, 360, 3, 2, 2, 2, 51, 362, 3, 2, 2, 2, 53, 366, 3, 2, 2, 2, 55, 368, 3, 2, 2, 2, 57, 375, 3, 2, 2, 2, 59, 385, 3, 2, 2, 2, 61, 394, 3, 2, 2, 2, 63, 404, 3, 2, 2, 2, 65, 410, 3, 2, 2, 2, 67, 416, 3, 2, 2, 2, 69, 428, 3, 2, 2, 2, 71, 435, 3, 2, 2, 2, 73, 438, 3, 2, 2, 2, 75, 441, 3, 2, 2, 2, 77, 443, 3, 2, 2, 2, 79, 457, 3, 2, 2, 2, 81, 462, 3, 2, 2, 2, 83, 469, 3, 2, 2, 2, 85, 478, 3, 2, 2, 2, 87, 488, 3, 2, 2, 2, 89, 497, 3, 2, 2, 2, 91, 503, 3, 2, 2, 2, 93, 510, 3, 2, 2, 2, 95, 513, 3, 2, 2, 2, 97, 516, 3, 2, 2, 2, 99, 521, 3, 2, 2, 2, 101, 529, 3, 2, 2, 2, 103, 538, 3, 2, 2, 2, 105, 548, 3, 2, 2, 2, 107, 554, 3, 2, 2, 2, 109, 561, 3, 2, 2, 2, 111, 566, 3, 2, 2, 2, 113, 573, 3, 2, 2, 2, 115, 578, 3, 2, 2, 2, 117, 582, 3, 2, 2, 2, 119, 587, 3, 2, 2, 2, 121, 590, 3, 2, 2, 2, 123, 596, 3, 2, 2, 2, 125, 601, 3, 2, 2, 2, 127, 610, 3, 2, 2, 2, 129, 618, 3, 2, 2, 2, 131, 621, 3, 2, 2, 2, 133, 625, 3, 2, 2, 2, 135, 629, 3, 2, 2, 2, 137, 631, 3, 2, 2, 2, 139, 634, 3, 2, 2, 2, 141, 636, 3, 2, 2, 2, 143, 639, 3, 2, 2, 2, 145, 642, 3, 2, 2, 2, 147, 645, 3, 2, 2, 2, 149, 647, 3, 2, 2, 2, 151, 649, 3, 2, 2, 2, 153, 652, 3, 2, 2, 2, 155, 655, 3, 2, 2, 2, 157, 657, 3, 2, 2, 2, 159, 659, 3, 2, 2, 2, 161, 662, 3, 2, 2, 2, 163, 664, 3, 2, 2, 2, 165, 667, 3, 2, 2, 2, 167, 673, 3, 2, 2, 2, 169, 678, 3, 2, 2, 2, 171, 680, 3, 2, 2, 2, 173, 682, 3, 2, 2, 2, 175, 684, 3, 2, 2, 2, 177, 686, 3, 2, 2, 2, 179, 706, 3, 2, 2, 2, 181, 708, 3, 2, 2, 2, 183, 722, 3, 2, 2, 2, 185, 724, 3, 2, 2, 2, 187, 726, 3, 2, 2, 2, 189, 739, 3, 2, 2, 2, 191, 741, 3, 2, 2, 2, 193, 744, 3, 2, 2, 2, 195, 746, 3, 2, 2, 2, 197, 753, 3, 2, 2, 2, 199, 768, 3, 2, 2, 2, 201, 774, 3, 2, 2, 2, 203, 788, 3, 2, 2, 2, 205, 206, 7, 121, 2, 2, 206, 207, 7, 107, 2, 2, 207, 208, 7, 118, 2, 2, 208, 209, 7, 106, 2, 2, 209, 210, 7, 107, 2, 2, 210, 211, 7, 112, 2, 2, 211, 4, 3, 2, 2, 2, 212, 213, 7, 61, 2, 2, 213, 6, 3, 2, 2, 2, 214, 215, 7, 104, 2, 2, 215, 216, 7, 107, 2, 2, 216, 217, 7, 112, 2, 2, 217, 218, 7, 99, 2, 2, 218, 219, 7, 110, 2, 2, 219, 8, 3, 2, 2, 2, 220, 221, 7, 103, 2, 2, 221, 222, 7, 112, 2, 2, 222, 223, 7, 101, 2, 2, 223, 224, 7, 99, 2, 2, 224, 225, 7, 114, 2, 2, 225, 226, 7, 117, 2, 2, 226, 227, 7, 119, 2, 2, 227, 228, 7, 110, 2, 2, 228, 229, 7, 99, 2, 2, 229, 230, 7, 118, 2, 2, 230, 231, 7, 103, 2, 2, 231, 232, 7, 102, 2, 2, 232, 10, 3, 2, 2, 2, 233, 234, 7, 114, 2, 2, 234, 235, 7, 99, 2, 2, 235, 236, 7, 116, 2, 2, 236, 237, 7, 118, 2, 2, 237, 238, 7, 107, 2, 2, 238, 239, 7, 99, 2, 2, 239, 240, 7, 110, 2, 2, 240, 12, 3, 2, 2, 2, 241, 242, 7, 101, 2, 2, 242, 243, 7, 110, 2, 2, 243, 244, 7, 99, 2, 2, 244, 245, 7, 117, 2, 2, 245, 246, 7, 117, 2, 2, 246, 14, 3, 2, 2, 2, 247, 248, 7, 111, 2, 2, 248, 249, 7, 113, 2, 2, 249, 250, 7, 102, 2, 2, 250, 251, 7, 103, 2, 2, 251, 252, 7, 110, 2, 2, 252, 16, 3, 2, 2, 2, 253, 254, 7, 113, 2, 2, 254, 255, 7, 114, 2, 2, 255, 256, 7, 103, 2, 2, 256, 257, 7, 116, 2, 2, 257, 258, 7, 99, 2, 2, 258, 259, 7, 118, 2, 2, 259, 260, 7, 113, 2, 2, 260, 261, 7, 116, 2, 2, 261, 18, 3, 2, 2, 2, 262, 263, 7, 116, 2, 2, 263, 264, 7, 103, 2, 2, 264, 265, 7, 101, 2, 2, 265, 266, 7, 113, 2, 2, 266, 267, 7, 116, 2, 2, 267, 268, 7, 102, 2, 2, 268, 20, 3, 2, 2, 2, 269, 270, 7, 100, 2, 2, 270, 271, 7, 110, 2, 2, 271, 272, 7, 113, 2, 2, 272, 273, 7, 101, 2, 2, 273, 274, 7, 109, 2, 2, 274, 22, 3, 2, 2, 2, 275, 276, 7, 103, 2, 2, 276, 277, 7, 122, 2, 2, 277, 278, 7, 114, 2, 2, 278, 279, 7, 99, 2, 2, 279, 280, 7, 112, 2, 2, 280, 281, 7, 102, 2, 2, 281, 282, 7, 99, 2, 2, 282, 283, 7, 100, 2, 2, 283, 284, 7, 110, 2, 2, 284, 285, 7, 103, 2, 2, 285, 24, 3, 2, 2, 2, 286, 287, 7, 101, 2, 2, 287, 288, 7, 113, 2, 2, 288, 289, 7, 112, 2, 2, 289, 290, 7, 112, 2, 2, 290, 291, 7, 103, 2, 2, 291, 292, 7, 101, 2, 2, 292, 293, 7, 118, 2, 2, 293, 294, 7, 113, 2, 2, 294, 295, 7, 116, 2, 2, 295, 26, 3, 2, 2, 2, 296, 297, 7, 118, 2, 2, 297, 298, 7, 123, 2, 2, 298, 299, 7, 114, 2, 2, 299, 300, 7, 103, 2, 2, 300, 28, 3, 2, 2, 2, 301, 302, 7, 114, 2, 2, 302, 303, 7, 99, 2, 2, 303, 304, 7, 101, 2, 2, 304, 305, 7, 109, 2, 2, 305, 306, 7, 99, 2, 2, 306, 307, 7, 105, 2, 2, 307, 308, 7, 103, 2, 2, 308, 30, 3, 2, 2, 2, 309, 310, 7, 114, 2, 2, 310, 311, 7, 119, 2, 2, 311, 312, 7, 116, 2, 2, 312, 313, 7, 103, 2, 2, 313, 32, 3, 2, 2, 2, 314, 315, 7, 107, 2, 2, 315, 316, 7, 111, 2, 2, 316, 317, 7, 114, 2, 2, 317, 318, 7, 119, 2, 2, 318, 319, 7, 116, 2, 2, 319, 320, 7, 103, 2, 2, 320, 34, 3, 2, 2, 2, 321, 322, 7, 104, 2, 2, 322, 323, 7, 119, 2, 2, 323, 324, 7, 112, 2, 2, 324, 325, 7, 101, 2, 2, 325, 326, 7, 118, 2, 2, 326, 327, 7, 107, 2, 2, 327, 328, 7, 113, 2, 2, 328, 329, 7, 112, 2, 2, 329, 36, 3, 2, 2, 2, 330, 331, 7, 103, 2, 2, 331, 332, 7, 112, 2, 2, 332, 333, 7, 102, 2, 2, 333, 38, 3, 2, 2, 2, 334, 335, 7, 103, 2, 2, 335, 336, 7, 122, 2, 2, 336, 337, 7, 118, 2, 2, 337, 338, 7, 103, 2, 2, 338, 339, 7, 112, 2, 2, 339, 340, 7, 102, 2, 2, 340, 341, 7, 117, 2, 2, 341, 40, 3, 2, 2, 2, 342, 343, 7, 63, 2, 2, 343, 42, 3, 2, 2, 2, 344, 345, 7, 103, 2, 2, 345, 346, 7, 112, 2, 2, 346, 347, 7, 119, 2, 2, 347, 348, 7, 111, 2, 2, 348, 349, 7, 103, 2, 2, 349, 350, 7, 116, 2, 2, 350, 351, 7, 99, 2, 2, 351, 352, 7, 118, 2, 2, 352, 353, 7, 107, 2, 2, 353, 354, 7, 113, 2, 2, 354, 355, 7, 112, 2, 2, 355, 44, 3, 2, 2, 2, 356, 357, 7, 42, 2, 2, 357, 46, 3, 2, 2, 2, 358, 359, 7, 60, 2, 2, 359, 48, 3, 2, 2, 2, 360, 361, 7, 43, 2, 2, 361, 50, 3, 2, 2, 2, 362, 363, 7, 102, 2, 2, 363, 364, 7, 103, 2, 2, 364, 365, 7, 116, 2, 2, 365, 52, 3, 2, 2, 2, 366, 367, 7, 46, 2, 2, 367, 54, 3, 2, 2, 2, 368, 369, 7, 114, 2, 2, 369, 370, 7, 119, 2, 2, 370, 371, 7, 100, 2, 2, 371, 372, 7, 110, 2, 2, 372, 373, 7, 107, 2, 2, 373, 374, 7, 101, 2, 2, 374, 56, 3, 2, 2, 2, 375, 376, 7, 114, 2, 2, 376, 377, 7, 116, 2, 2, 377, 378, 7, 113, 2, 2, 378, 379, 7, 118, 2, 2, 379, 380, 7, 103, 2, 2, 380, 381, 7, 101, 2, 2, 381, 382, 7, 118, 2, 2, 382, 383, 7, 103, 2, 2, 383, 384, 7, 102, 2, 2, 384, 58, 3, 2, 2, 2, 385, 386, 7, 103, 2, 2, 386, 387, 7, 122, 2, 2, 387, 388, 7, 118, 2, 2, 388, 389, 7, 103, 2, 2, 389, 390, 7, 116, 2, 2, 390, 391, 7, 112, 2, 2, 391, 392, 7, 99, 2, 2, 392, 393, 7, 110, 2, 2, 393, 60, 3, 2, 2, 2, 394, 395, 7, 116, 2, 2, 395, 396, 7, 103, 2, 2, 396, 397, 7, 102, 2, 2, 397, 398, 7, 103, 2, 2, 398, 399, 7, 101, 2, 2, 399, 400, 7, 110, 2, 2, 400, 401, 7, 99, 2, 2, 401, 402, 7, 116, 2, 2, 402, 403, 7, 103, 2, 2, 403, 62, 3, 2, 2, 2, 404, 405, 7, 107, 2, 2, 405, 406, 7, 112, 2, 2, 406, 407, 7, 112, 2, 2, 407, 408, 7, 103, 2, 2, 408, 409, 7, 116, 2, 2, 409, 64, 3, 2, 2, 2, 410, 411, 7, 113, 2, 2, 411, 412, 7, 119, 2, 2, 412, 413, 7, 118, 2, 2, 413, 414, 7, 103, 2, 2, 414, 415, 7, 116, 2, 2, 415, 66, 3, 2, 2, 2, 416, 417, 7, 116, 2, 2, 417, 418, 7, 103, 2, 2, 418, 419, 7, 114, 2, 2, 419, 420, 7, 110, 2, 2, 420, 421, 7, 99, 2, 2, 421, 422, 7, 101, 2, 2, 422, 423, 7, 103, 2, 2, 423, 424, 7, 99, 2, 2, 424, 425, 7, 100, 2, 2, 425, 426, 7, 110, 2, 2, 426, 427, 7, 103, 2, 2, 427, 68, 3, 2, 2, 2, 428, 429, 7, 107, 2, 2, 429, 430, 7, 111, 2, 2, 430, 431, 7, 114, 2, 2, 431, 432, 7, 113, 2, 2, 432, 433, 7, 116, 2, 2, 433, 434, 7, 118, 2, 2, 434, 70, 3, 2, 2, 2, 435, 436, 7, 48, 2, 2, 436, 437, 7, 44, 2, 2, 437, 72, 3, 2, 2, 2, 438, 439, 7, 48, 2, 2, 439, 440, 7, 125, 2, 2, 440, 74, 3, 2, 2, 2, 441, 442, 7, 127, 2, 2, 442, 76, 3, 2, 2, 2, 443, 444, 7, 101, 2, 2, 444, 445, 7, 113, 2, 2, 445, 446, 7, 112, 2, 2, 446, 447, 7, 117, 2, 2, 447, 448, 7, 118, 2, 2, 448, 449, 7, 116, 2, 2, 449, 450, 7, 99, 2, 2, 450, 451, 7, 107, 2, 2, 451, 452, 7, 112, 2, 2, 452, 453, 7, 103, 2, 2, 453, 454, 7, 102, 2, 2, 454, 455, 7, 100, 2, 2, 455, 456, 7, 123, 2, 2, 456, 78, 3, 2, 2, 2, 457, 458, 7, 104, 2, 2, 458, 459, 7, 110, 2, 2, 459, 460, 7, 113, 2, 2, 460, 461, 7, 121, 2, 2, 461, 80, 3, 2, 2, 2, 462, 463, 7, 117, 2, 2, 463, 464, 7, 118, 2, 2, 464, 465, 7, 116, 2, 2, 465, 466, 7, 103, 2, 2, 466, 467, 7, 99, 2, 2, 467, 468, 7, 111, 2, 2, 468, 82, 3, 2, 2, 2, 469, 470, 7, 102, 2, 2, 470, 471, 7, 107, 2, 2, 471, 472, 7, 117, 2, 2, 472, 473, 7, 101, 2, 2, 473, 474, 7, 116, 2, 2, 474, 475, 7, 103, 2, 2, 475, 476, 7, 118, 2, 2, 476, 477, 7, 103, 2, 2, 477, 84, 3, 2, 2, 2, 478, 479, 7, 114, 2, 2, 479, 480, 7, 99, 2, 2, 480, 481, 7, 116, 2, 2, 481, 482, 7, 99, 2, 2, 482, 483, 7, 111, 2, 2, 483, 484, 7, 103, 2, 2, 484, 485, 7, 118, 2, 2, 485, 486, 7, 103, 2, 2, 486, 487, 7, 116, 2, 2, 487, 86, 3, 2, 2, 2, 488, 489, 7, 101, 2, 2, 489, 490, 7, 113, 2, 2, 490, 491, 7, 112, 2, 2, 491, 492, 7, 117, 2, 2, 492, 493, 7, 118, 2, 2, 493, 494, 7, 99, 2, 2, 494, 495, 7, 112, 2, 2, 495, 496, 7, 118, 2, 2, 496, 88, 3, 2, 2, 2, 497, 498, 7, 107, 2, 2, 498, 499, 7, 112, 2, 2, 499, 500, 7, 114, 2, 2, 500, 501, 7, 119, 2, 2, 501, 502, 7, 118, 2, 2, 502, 90, 3, 2, 2, 2, 503, 504, 7, 113, 2, 2, 504, 505, 7, 119, 2, 2, 505, 506, 7, 118, 2, 2, 506, 507, 7, 114, 2, 2, 507, 508, 7, 119, 2, 2, 508, 509, 7, 118, 2, 2, 509, 92, 3, 2, 2, 2, 510, 511, 7, 107, 2, 2, 511, 512, 7, 104, 2, 2, 512, 94, 3, 2, 2, 2, 513, 514, 7, 60, 2, 2, 514, 515, 7, 63, 2, 2, 515, 96, 3, 2, 2, 2, 516, 517, 7, 103, 2, 2, 517, 518, 7, 99, 2, 2, 518, 519, 7, 101, 2, 2, 519, 520, 7, 106, 2, 2, 520, 98, 3, 2, 2, 2, 521, 522, 7, 107, 2, 2, 522, 523, 7, 112, 2, 2, 523, 524, 7, 107, 2, 2, 524, 525, 7, 118, 2, 2, 525, 526, 7, 107, 2, 2, 526, 527, 7, 99, 2, 2, 527, 528, 7, 110, 2, 2, 528, 100, 3, 2, 2, 2, 529, 530, 7, 103, 2, 2, 530, 531, 7, 115, 2, 2, 531, 532, 7, 119, 2, 2, 532, 533, 7, 99, 2, 2, 533, 534, 7, 118, 2, 2, 534, 535, 7, 107, 2, 2, 535, 536, 7, 113, 2, 2, 536, 537, 7, 112, 2, 2, 537, 102, 3, 2, 2, 2, 538, 539, 7, 99, 2, 2, 539, 540, 7, 110, 2, 2, 540, 541, 7, 105, 2, 2, 541, 542, 7, 113, 2, 2, 542, 543, 7, 116, 2, 2, 543, 544, 7, 107, 2, 2, 544, 545, 7, 118, 2, 2, 545, 546, 7, 106, 2, 2, 546, 547, 7, 111, 2, 2, 547, 104, 3, 2, 2, 2, 548, 549, 7, 100, 2, 2, 549, 550, 7, 116, 2, 2, 550, 551, 7, 103, 2, 2, 551, 552, 7, 99, 2, 2, 552, 553, 7, 109, 2, 2, 553, 106, 3, 2, 2, 2, 554, 555, 7, 116, 2, 2, 555, 556, 7, 103, 2, 2, 556, 557, 7, 118, 2, 2, 557, 558, 7, 119, 2, 2, 558, 559, 7, 116, 2, 2, 559, 560, 7, 112, 2, 2, 560, 108, 3, 2, 2, 2, 561, 562, 7, 118, 2, 2, 562, 563, 7, 106, 2, 2, 563, 564, 7, 103, 2, 2, 564, 565, 7, 112, 2, 2, 565, 110, 3, 2, 2, 2, 566, 567, 7, 103, 2, 2, 567, 568, 7, 110, 2, 2, 568, 569, 7, 117, 2, 2, 569, 570, 7, 103, 2, 2, 570, 571, 7, 107, 2, 2, 571, 572, 7, 104, 2, 2, 572, 112, 3, 2, 2, 2, 573, 574, 7, 103, 2, 2, 574, 575, 7, 110, 2, 2, 575, 576, 7, 117, 2, 2, 576, 577, 7, 103, 2, 2, 577, 114, 3, 2, 2, 2, 578, 579, 7, 104, 2, 2, 579, 580, 7, 113, 2, 2, 580, 581, 7, 116, 2, 2, 581, 116, 3, 2, 2, 2, 582, 583, 7, 110, 2, 2, 583, 584, 7, 113, 2, 2, 584, 585, 7, 113, 2, 2, 585, 586, 7, 114, 2, 2, 586, 118, 3, 2, 2, 2, 587, 588, 7, 107, 2, 2, 588, 589, 7, 112, 2, 2, 589, 120, 3, 2, 2, 2, 590, 591, 7, 121, 2, 2, 591, 592, 7, 106, 2, 2, 592, 593, 7, 107, 2, 2, 593, 594, 7, 110, 2, 2, 594, 595, 7, 103, 2, 2, 595, 122, 3, 2, 2, 2, 596, 597, 7, 121, 2, 2, 597, 598, 7, 106, 2, 2, 598, 599, 7, 103, 2, 2, 599, 600, 7, 112, 2, 2, 600, 124, 3, 2, 2, 2, 601, 602, 7, 103, 2, 2, 602, 603, 7, 110, 2, 2, 603, 604, 7, 117, 2, 2, 604, 605, 7, 103, 2, 2, 605, 606, 7, 121, 2, 2, 606, 607, 7, 106, 2, 2, 607, 608, 7, 103, 2, 2, 608, 609, 7, 112, 2, 2, 609, 126, 3, 2, 2, 2, 610, 611, 7, 101, 2, 2, 611, 612, 7, 113, 2, 2, 612, 613, 7, 112, 2, 2, 613, 614, 7, 112, 2, 2, 614, 615, 7, 103, 2, 2, 615, 616, 7, 101, 2, 2, 616, 617, 7, 118, 2, 2, 617, 128, 3, 2, 2, 2, 618, 619, 7, 113, 2, 2, 619, 620, 7, 116, 2, 2, 620, 130, 3, 2, 2, 2, 621, 622, 7, 99, 2, 2, 622, 623, 7, 112, 2, 2, 623, 624, 7, 102, 2, 2, 624, 132, 3, 2, 2, 2, 625, 626, 7, 112, 2, 2, 626, 627, 7, 113, 2, 2, 627, 628, 7, 118, 2, 2, 628, 134, 3, 2, 2, 2, 629, 630, 7, 62, 2, 2, 630, 136, 3, 2, 2, 2, 631, 632, 7, 62, 2, 2, 632, 633, 7, 63, 2, 2, 633, 138, 3, 2, 2, 2, 634, 635, 7, 64, 2, 2, 635, 140, 3, 2, 2, 2, 636, 637, 7, 64, 2, 2, 637, 638, 7, 63, 2, 2, 638, 142, 3, 2, 2, 2, 639, 640, 7, 63, 2, 2, 640, 641, 7, 63, 2, 2, 641, 144, 3, 2, 2, 2, 642, 643, 7, 62, 2, 2, 643, 644, 7, 64, 2, 2, 644, 146, 3, 2, 2, 2, 645, 646, 7, 45, 2, 2, 646, 148, 3, 2, 2, 2, 647, 648, 7, 47, 2, 2, 648, 150, 3, 2, 2, 2, 649, 650, 7, 48, 2, 2, 650, 651, 7, 45, 2, 2, 651, 152, 3, 2, 2, 2, 652, 653, 7, 48, 2, 2, 653, 654, 7, 47, 2, 2, 654, 154, 3, 2, 2, 2, 655, 656, 7, 44, 2, 2, 656, 156, 3, 2, 2, 2, 657, 658, 7, 49, 2, 2, 658, 158, 3, 2, 2, 2, 659, 660, 7, 48, 2, 2, 660, 661, 7, 49, 2, 2, 661, 160, 3, 2, 2, 2, 662, 663, 7, 96, 2, 2, 663, 162, 3, 2, 2, 2, 664, 665, 7, 48, 2, 2, 665, 666, 7, 96, 2, 2, 666, 164, 3, 2, 2, 2, 667, 668, 7, 104, 2, 2, 668, 669, 7, 99, 2, 2, 669, 670, 7, 110, 2, 2, 670, 671, 7, 117, 2, 2, 671, 672, 7, 103, 2, 2, 672, 166, 3, 2, 2, 2, 673, 674, 7, 118, 2, 2, 674, 675, 7, 116, 2, 2, 675, 676, 7, 119, 2, 2, 676, 677, 7, 103, 2, 2, 677, 168, 3, 2, 2, 2, 678, 679, 7, 93, 2, 2, 679, 170, 3, 2, 2, 2, 680, 681, 7, 95, 2, 2, 681, 172, 3, 2, 2, 2, 682, 683, 7, 125, 2, 2, 683, 174, 3, 2, 2, 2, 684, 685, 7, 48, 2, 2, 685, 176, 3, 2, 2, 2, 686, 687, 7, 99, 2, 2, 687, 688, 7, 112, 2, 2, 688, 689, 7, 112, 2, 2, 689, 690, 7, 113, 2, 2, 690, 691, 7, 118, 2, 2, 691, 692, 7, 99, 2, 2, 692, 693, 7, 118, 2, 2, 693, 694, 7, 107, 2, 2, 694, 695, 7, 113, 2, 2, 695, 696, 7, 112, 2, 2, 696, 178, 3, 2, 2, 2, 697, 702, 5, 185, 93, 2, 698, 701, 5, 193, 97, 2, 699, 701, 5, 185, 93, 2, 700, 698, 3, 2, 2, 2, 700, 699, 3, 2, 2, 2, 701, 704, 3, 2, 2, 2, 702, 700, 3, 2, 2, 2, 702, 703, 3, 2, 2, 2, 703, 707, 3, 2, 2, 2, 704, 702, 3, 2, 2, 2, 705, 707, 5, 181, 91, 2, 706, 697, 3, 2, 2, 2, 706, 705, 3, 2, 2, 2, 707, 180, 3, 2, 2, 2, 708, 711, 7, 41, 2, 2, 709, 712, 5, 189, 95, 2, 710, 712, 5, 191, 96, 2, 711, 709, 3, 2, 2, 2, 711, 710, 3, 2, 2, 2, 712, 717, 3, 2, 2, 2, 713, 716, 5, 189, 95, 2, 714, 716, 5, 191, 96, 2, 715, 713, 3, 2, 2, 2, 715, 714, 3, 2, 2, 2, 716, 719, 3, 2, 2, 2, 717, 715, 3, 2, 2, 2, 717, 718, 3, 2, 2, 2, 718, 720, 3, 2, 2, 2, 719, 717, 3, 2, 2, 2, 720, 721, 7, 41, 2, 2, 721, 182, 3, 2, 2, 2, 722, 723, 10, 2, 2, 2, 723, 184, 3, 2, 2, 2, 724, 725, 9, 3, 2, 2, 725, 186, 3, 2, 2, 2, 726, 731, 7, 36, 2, 2, 727, 730, 5, 183, 92, 2, 728, 730, 5, 191, 96, 2, 729, 727, 3, 2, 2, 2, 729, 728, 3, 2, 2, 2, 730, 733, 3, 2, 2, 2, 731, 729, 3, 2, 2, 2, 731, 732, 3, 2, 2, 2, 732, 734, 3, 2, 2, 2, 733, 731, 3, 2, 2, 2, 734, 735, 7, 36, 2, 2, 735, 188, 3, 2, 2, 2, 736, 740, 5, 185, 93, 2, 737, 740, 5, 193, 97, 2, 738, 740, 9, 4, 2, 2, 739, 736, 3, 2, 2, 2, 739, 737, 3, 2, 2, 2, 739, 738, 3, 2, 2, 2, 740, 190, 3, 2, 2, 2, 741, 742, 7, 94, 2, 2, 742, 743, 9, 5, 2, 2, 743, 192, 3, 2, 2, 2, 744, 745, 4, 50, 59, 2, 745, 194, 3, 2, 2, 2, 746, 750, 5, 193, 97, 2, 747, 749, 5, 193, 97, 2, 748, 747, 3, 2, 2, 2, 749, 752, 3, 2, 2, 2, 750, 748, 3, 2, 2, 2, 750, 751, 3, 2, 2, 2, 751, 196, 3, 2, 2, 2, 752, 750, 3, 2, 2, 2, 753, 758, 5, 195, 98, 2, 754, 756, 7, 48, 2, 2, 755, 757, 5, 195, 98, 2, 756, 755, 3, 2, 2, 2, 756, 757, 3, 2, 2, 2, 757, 759, 3, 2, 2, 2, 758, 754, 3, 2, 2, 2, 758, 759, 3, 2, 2, 2, 759, 765, 3, 2, 2, 2, 760, 762, 9, 6, 2, 2, 761, 763, 9, 7, 2, 2, 762, 761, 3, 2, 2, 2, 762, 763, 3, 2, 2, 2, 763, 764, 3, 2, 2, 2, 764, 766, 5, 195, 98, 2, 765, 760, 3, 2, 2, 2, 765, 766, 3, 2, 2, 2, 766, 198, 3, 2, 2, 2, 767, 769, 9, 8, 2, 2, 768, 767, 3, 2, 2, 2, 769, 770, 3, 2, 2, 2, 770, 768, 3, 2, 2, 2, 770, 771, 3, 2, 2, 2, 771, 772, 3, 2, 2, 2, 772, 773, 8, 100, 2, 2, 773, 200, 3, 2, 2, 2, 774, 775, 7, 49, 2, 2, 775, 776, 7, 44, 2, 2, 776, 780, 3, 2, 2, 2, 777, 779, 11, 2, 2, 2, 778, 777, 3, 2, 2, 2, 779, 782, 3, 2, 2, 2, 780, 781, 3, 2, 2, 2, 780, 778, 3, 2, 2, 2, 781, 783, 3, 2, 2, 2, 782, 780, 3, 2, 2, 2, 783, 784, 7, 44, 2, 2, 784, 785, 7, 49, 2, 2, 785, 786, 3, 2, 2, 2, 786, 787, 8, 101, 2, 2, 787, 202, 3, 2, 2, 2, 788, 789, 7, 49, 2, 2, 789, 790, 7, 49, 2, 2, 790, 794, 3, 2, 2, 2, 791, 793, 10, 9, 2, 2, 792, 791, 3, 2, 2, 2, 793, 796, 3, 2, 2, 2, 794, 792, 3, 2, 2, 2, 794, 795, 3, 2, 2, 2, 795, 797, 3, 2, 2, 2, 796, 794, 3, 2, 2, 2, 797, 798, 8, 102, 2, 2, 798, 204, 3, 2, 2, 2, 20, 2, 700, 702, 706, 711, 715, 717, 729, 731, 739, 750, 756, 758, 762, 765, 770, 780, 794, 3, 2, 3, 2] -------------------------------------------------------------------------------- /thirdparty/parser/modelica_base_listener.go: -------------------------------------------------------------------------------- 1 | // Code generated from /var/antlrResult/Modelica.g4 by ANTLR 4.8. DO NOT EDIT. 2 | 3 | package parser // Modelica 4 | 5 | import "github.com/antlr/antlr4/runtime/Go/antlr" 6 | 7 | // BaseModelicaListener is a complete listener for a parse tree produced by ModelicaParser. 8 | type BaseModelicaListener struct{} 9 | 10 | var _ ModelicaListener = &BaseModelicaListener{} 11 | 12 | // VisitTerminal is called when a terminal node is visited. 13 | func (s *BaseModelicaListener) VisitTerminal(node antlr.TerminalNode) {} 14 | 15 | // VisitErrorNode is called when an error node is visited. 16 | func (s *BaseModelicaListener) VisitErrorNode(node antlr.ErrorNode) {} 17 | 18 | // EnterEveryRule is called when any rule is entered. 19 | func (s *BaseModelicaListener) EnterEveryRule(ctx antlr.ParserRuleContext) {} 20 | 21 | // ExitEveryRule is called when any rule is exited. 22 | func (s *BaseModelicaListener) ExitEveryRule(ctx antlr.ParserRuleContext) {} 23 | 24 | // EnterStored_definition is called when production stored_definition is entered. 25 | func (s *BaseModelicaListener) EnterStored_definition(ctx *Stored_definitionContext) {} 26 | 27 | // ExitStored_definition is called when production stored_definition is exited. 28 | func (s *BaseModelicaListener) ExitStored_definition(ctx *Stored_definitionContext) {} 29 | 30 | // EnterClass_definition is called when production class_definition is entered. 31 | func (s *BaseModelicaListener) EnterClass_definition(ctx *Class_definitionContext) {} 32 | 33 | // ExitClass_definition is called when production class_definition is exited. 34 | func (s *BaseModelicaListener) ExitClass_definition(ctx *Class_definitionContext) {} 35 | 36 | // EnterLast_semicolon is called when production last_semicolon is entered. 37 | func (s *BaseModelicaListener) EnterLast_semicolon(ctx *Last_semicolonContext) {} 38 | 39 | // ExitLast_semicolon is called when production last_semicolon is exited. 40 | func (s *BaseModelicaListener) ExitLast_semicolon(ctx *Last_semicolonContext) {} 41 | 42 | // EnterClass_specifier is called when production class_specifier is entered. 43 | func (s *BaseModelicaListener) EnterClass_specifier(ctx *Class_specifierContext) {} 44 | 45 | // ExitClass_specifier is called when production class_specifier is exited. 46 | func (s *BaseModelicaListener) ExitClass_specifier(ctx *Class_specifierContext) {} 47 | 48 | // EnterClass_prefixes is called when production class_prefixes is entered. 49 | func (s *BaseModelicaListener) EnterClass_prefixes(ctx *Class_prefixesContext) {} 50 | 51 | // ExitClass_prefixes is called when production class_prefixes is exited. 52 | func (s *BaseModelicaListener) ExitClass_prefixes(ctx *Class_prefixesContext) {} 53 | 54 | // EnterLong_class_specifier is called when production long_class_specifier is entered. 55 | func (s *BaseModelicaListener) EnterLong_class_specifier(ctx *Long_class_specifierContext) {} 56 | 57 | // ExitLong_class_specifier is called when production long_class_specifier is exited. 58 | func (s *BaseModelicaListener) ExitLong_class_specifier(ctx *Long_class_specifierContext) {} 59 | 60 | // EnterShort_class_specifier is called when production short_class_specifier is entered. 61 | func (s *BaseModelicaListener) EnterShort_class_specifier(ctx *Short_class_specifierContext) {} 62 | 63 | // ExitShort_class_specifier is called when production short_class_specifier is exited. 64 | func (s *BaseModelicaListener) ExitShort_class_specifier(ctx *Short_class_specifierContext) {} 65 | 66 | // EnterDer_class_specifier is called when production der_class_specifier is entered. 67 | func (s *BaseModelicaListener) EnterDer_class_specifier(ctx *Der_class_specifierContext) {} 68 | 69 | // ExitDer_class_specifier is called when production der_class_specifier is exited. 70 | func (s *BaseModelicaListener) ExitDer_class_specifier(ctx *Der_class_specifierContext) {} 71 | 72 | // EnterBase_prefix is called when production base_prefix is entered. 73 | func (s *BaseModelicaListener) EnterBase_prefix(ctx *Base_prefixContext) {} 74 | 75 | // ExitBase_prefix is called when production base_prefix is exited. 76 | func (s *BaseModelicaListener) ExitBase_prefix(ctx *Base_prefixContext) {} 77 | 78 | // EnterEnum_list is called when production enum_list is entered. 79 | func (s *BaseModelicaListener) EnterEnum_list(ctx *Enum_listContext) {} 80 | 81 | // ExitEnum_list is called when production enum_list is exited. 82 | func (s *BaseModelicaListener) ExitEnum_list(ctx *Enum_listContext) {} 83 | 84 | // EnterEnumeration_literal is called when production enumeration_literal is entered. 85 | func (s *BaseModelicaListener) EnterEnumeration_literal(ctx *Enumeration_literalContext) {} 86 | 87 | // ExitEnumeration_literal is called when production enumeration_literal is exited. 88 | func (s *BaseModelicaListener) ExitEnumeration_literal(ctx *Enumeration_literalContext) {} 89 | 90 | // EnterComposition is called when production composition is entered. 91 | func (s *BaseModelicaListener) EnterComposition(ctx *CompositionContext) {} 92 | 93 | // ExitComposition is called when production composition is exited. 94 | func (s *BaseModelicaListener) ExitComposition(ctx *CompositionContext) {} 95 | 96 | // EnterModel_annotation is called when production model_annotation is entered. 97 | func (s *BaseModelicaListener) EnterModel_annotation(ctx *Model_annotationContext) {} 98 | 99 | // ExitModel_annotation is called when production model_annotation is exited. 100 | func (s *BaseModelicaListener) ExitModel_annotation(ctx *Model_annotationContext) {} 101 | 102 | // EnterLanguage_specification is called when production language_specification is entered. 103 | func (s *BaseModelicaListener) EnterLanguage_specification(ctx *Language_specificationContext) {} 104 | 105 | // ExitLanguage_specification is called when production language_specification is exited. 106 | func (s *BaseModelicaListener) ExitLanguage_specification(ctx *Language_specificationContext) {} 107 | 108 | // EnterExternal_function_call is called when production external_function_call is entered. 109 | func (s *BaseModelicaListener) EnterExternal_function_call(ctx *External_function_callContext) {} 110 | 111 | // ExitExternal_function_call is called when production external_function_call is exited. 112 | func (s *BaseModelicaListener) ExitExternal_function_call(ctx *External_function_callContext) {} 113 | 114 | // EnterExternal_function_call_args is called when production external_function_call_args is entered. 115 | func (s *BaseModelicaListener) EnterExternal_function_call_args(ctx *External_function_call_argsContext) {} 116 | 117 | // ExitExternal_function_call_args is called when production external_function_call_args is exited. 118 | func (s *BaseModelicaListener) ExitExternal_function_call_args(ctx *External_function_call_argsContext) {} 119 | 120 | // EnterExternal_function_call_argument is called when production external_function_call_argument is entered. 121 | func (s *BaseModelicaListener) EnterExternal_function_call_argument(ctx *External_function_call_argumentContext) {} 122 | 123 | // ExitExternal_function_call_argument is called when production external_function_call_argument is exited. 124 | func (s *BaseModelicaListener) ExitExternal_function_call_argument(ctx *External_function_call_argumentContext) {} 125 | 126 | // EnterElement_list is called when production element_list is entered. 127 | func (s *BaseModelicaListener) EnterElement_list(ctx *Element_listContext) {} 128 | 129 | // ExitElement_list is called when production element_list is exited. 130 | func (s *BaseModelicaListener) ExitElement_list(ctx *Element_listContext) {} 131 | 132 | // EnterElement is called when production element is entered. 133 | func (s *BaseModelicaListener) EnterElement(ctx *ElementContext) {} 134 | 135 | // ExitElement is called when production element is exited. 136 | func (s *BaseModelicaListener) ExitElement(ctx *ElementContext) {} 137 | 138 | // EnterImport_clause is called when production import_clause is entered. 139 | func (s *BaseModelicaListener) EnterImport_clause(ctx *Import_clauseContext) {} 140 | 141 | // ExitImport_clause is called when production import_clause is exited. 142 | func (s *BaseModelicaListener) ExitImport_clause(ctx *Import_clauseContext) {} 143 | 144 | // EnterImport_list is called when production import_list is entered. 145 | func (s *BaseModelicaListener) EnterImport_list(ctx *Import_listContext) {} 146 | 147 | // ExitImport_list is called when production import_list is exited. 148 | func (s *BaseModelicaListener) ExitImport_list(ctx *Import_listContext) {} 149 | 150 | // EnterExtends_clause is called when production extends_clause is entered. 151 | func (s *BaseModelicaListener) EnterExtends_clause(ctx *Extends_clauseContext) {} 152 | 153 | // ExitExtends_clause is called when production extends_clause is exited. 154 | func (s *BaseModelicaListener) ExitExtends_clause(ctx *Extends_clauseContext) {} 155 | 156 | // EnterConstraining_clause is called when production constraining_clause is entered. 157 | func (s *BaseModelicaListener) EnterConstraining_clause(ctx *Constraining_clauseContext) {} 158 | 159 | // ExitConstraining_clause is called when production constraining_clause is exited. 160 | func (s *BaseModelicaListener) ExitConstraining_clause(ctx *Constraining_clauseContext) {} 161 | 162 | // EnterComponent_clause is called when production component_clause is entered. 163 | func (s *BaseModelicaListener) EnterComponent_clause(ctx *Component_clauseContext) {} 164 | 165 | // ExitComponent_clause is called when production component_clause is exited. 166 | func (s *BaseModelicaListener) ExitComponent_clause(ctx *Component_clauseContext) {} 167 | 168 | // EnterType_prefix is called when production type_prefix is entered. 169 | func (s *BaseModelicaListener) EnterType_prefix(ctx *Type_prefixContext) {} 170 | 171 | // ExitType_prefix is called when production type_prefix is exited. 172 | func (s *BaseModelicaListener) ExitType_prefix(ctx *Type_prefixContext) {} 173 | 174 | // EnterType_specifier is called when production type_specifier is entered. 175 | func (s *BaseModelicaListener) EnterType_specifier(ctx *Type_specifierContext) {} 176 | 177 | // ExitType_specifier is called when production type_specifier is exited. 178 | func (s *BaseModelicaListener) ExitType_specifier(ctx *Type_specifierContext) {} 179 | 180 | // EnterComponent_list is called when production component_list is entered. 181 | func (s *BaseModelicaListener) EnterComponent_list(ctx *Component_listContext) {} 182 | 183 | // ExitComponent_list is called when production component_list is exited. 184 | func (s *BaseModelicaListener) ExitComponent_list(ctx *Component_listContext) {} 185 | 186 | // EnterComponent_declaration is called when production component_declaration is entered. 187 | func (s *BaseModelicaListener) EnterComponent_declaration(ctx *Component_declarationContext) {} 188 | 189 | // ExitComponent_declaration is called when production component_declaration is exited. 190 | func (s *BaseModelicaListener) ExitComponent_declaration(ctx *Component_declarationContext) {} 191 | 192 | // EnterCondition_attribute is called when production condition_attribute is entered. 193 | func (s *BaseModelicaListener) EnterCondition_attribute(ctx *Condition_attributeContext) {} 194 | 195 | // ExitCondition_attribute is called when production condition_attribute is exited. 196 | func (s *BaseModelicaListener) ExitCondition_attribute(ctx *Condition_attributeContext) {} 197 | 198 | // EnterDeclaration is called when production declaration is entered. 199 | func (s *BaseModelicaListener) EnterDeclaration(ctx *DeclarationContext) {} 200 | 201 | // ExitDeclaration is called when production declaration is exited. 202 | func (s *BaseModelicaListener) ExitDeclaration(ctx *DeclarationContext) {} 203 | 204 | // EnterModification is called when production modification is entered. 205 | func (s *BaseModelicaListener) EnterModification(ctx *ModificationContext) {} 206 | 207 | // ExitModification is called when production modification is exited. 208 | func (s *BaseModelicaListener) ExitModification(ctx *ModificationContext) {} 209 | 210 | // EnterClass_modification is called when production class_modification is entered. 211 | func (s *BaseModelicaListener) EnterClass_modification(ctx *Class_modificationContext) {} 212 | 213 | // ExitClass_modification is called when production class_modification is exited. 214 | func (s *BaseModelicaListener) ExitClass_modification(ctx *Class_modificationContext) {} 215 | 216 | // EnterArgument_list is called when production argument_list is entered. 217 | func (s *BaseModelicaListener) EnterArgument_list(ctx *Argument_listContext) {} 218 | 219 | // ExitArgument_list is called when production argument_list is exited. 220 | func (s *BaseModelicaListener) ExitArgument_list(ctx *Argument_listContext) {} 221 | 222 | // EnterArgument is called when production argument is entered. 223 | func (s *BaseModelicaListener) EnterArgument(ctx *ArgumentContext) {} 224 | 225 | // ExitArgument is called when production argument is exited. 226 | func (s *BaseModelicaListener) ExitArgument(ctx *ArgumentContext) {} 227 | 228 | // EnterElement_modification_or_replaceable is called when production element_modification_or_replaceable is entered. 229 | func (s *BaseModelicaListener) EnterElement_modification_or_replaceable(ctx *Element_modification_or_replaceableContext) {} 230 | 231 | // ExitElement_modification_or_replaceable is called when production element_modification_or_replaceable is exited. 232 | func (s *BaseModelicaListener) ExitElement_modification_or_replaceable(ctx *Element_modification_or_replaceableContext) {} 233 | 234 | // EnterElement_modification is called when production element_modification is entered. 235 | func (s *BaseModelicaListener) EnterElement_modification(ctx *Element_modificationContext) {} 236 | 237 | // ExitElement_modification is called when production element_modification is exited. 238 | func (s *BaseModelicaListener) ExitElement_modification(ctx *Element_modificationContext) {} 239 | 240 | // EnterElement_redeclaration is called when production element_redeclaration is entered. 241 | func (s *BaseModelicaListener) EnterElement_redeclaration(ctx *Element_redeclarationContext) {} 242 | 243 | // ExitElement_redeclaration is called when production element_redeclaration is exited. 244 | func (s *BaseModelicaListener) ExitElement_redeclaration(ctx *Element_redeclarationContext) {} 245 | 246 | // EnterElement_replaceable is called when production element_replaceable is entered. 247 | func (s *BaseModelicaListener) EnterElement_replaceable(ctx *Element_replaceableContext) {} 248 | 249 | // ExitElement_replaceable is called when production element_replaceable is exited. 250 | func (s *BaseModelicaListener) ExitElement_replaceable(ctx *Element_replaceableContext) {} 251 | 252 | // EnterComponent_clause1 is called when production component_clause1 is entered. 253 | func (s *BaseModelicaListener) EnterComponent_clause1(ctx *Component_clause1Context) {} 254 | 255 | // ExitComponent_clause1 is called when production component_clause1 is exited. 256 | func (s *BaseModelicaListener) ExitComponent_clause1(ctx *Component_clause1Context) {} 257 | 258 | // EnterComponent_declaration1 is called when production component_declaration1 is entered. 259 | func (s *BaseModelicaListener) EnterComponent_declaration1(ctx *Component_declaration1Context) {} 260 | 261 | // ExitComponent_declaration1 is called when production component_declaration1 is exited. 262 | func (s *BaseModelicaListener) ExitComponent_declaration1(ctx *Component_declaration1Context) {} 263 | 264 | // EnterShort_class_definition is called when production short_class_definition is entered. 265 | func (s *BaseModelicaListener) EnterShort_class_definition(ctx *Short_class_definitionContext) {} 266 | 267 | // ExitShort_class_definition is called when production short_class_definition is exited. 268 | func (s *BaseModelicaListener) ExitShort_class_definition(ctx *Short_class_definitionContext) {} 269 | 270 | // EnterEquation_section is called when production equation_section is entered. 271 | func (s *BaseModelicaListener) EnterEquation_section(ctx *Equation_sectionContext) {} 272 | 273 | // ExitEquation_section is called when production equation_section is exited. 274 | func (s *BaseModelicaListener) ExitEquation_section(ctx *Equation_sectionContext) {} 275 | 276 | // EnterEquations is called when production equations is entered. 277 | func (s *BaseModelicaListener) EnterEquations(ctx *EquationsContext) {} 278 | 279 | // ExitEquations is called when production equations is exited. 280 | func (s *BaseModelicaListener) ExitEquations(ctx *EquationsContext) {} 281 | 282 | // EnterAlgorithm_section is called when production algorithm_section is entered. 283 | func (s *BaseModelicaListener) EnterAlgorithm_section(ctx *Algorithm_sectionContext) {} 284 | 285 | // ExitAlgorithm_section is called when production algorithm_section is exited. 286 | func (s *BaseModelicaListener) ExitAlgorithm_section(ctx *Algorithm_sectionContext) {} 287 | 288 | // EnterAlgorithm_statements is called when production algorithm_statements is entered. 289 | func (s *BaseModelicaListener) EnterAlgorithm_statements(ctx *Algorithm_statementsContext) {} 290 | 291 | // ExitAlgorithm_statements is called when production algorithm_statements is exited. 292 | func (s *BaseModelicaListener) ExitAlgorithm_statements(ctx *Algorithm_statementsContext) {} 293 | 294 | // EnterEquation is called when production equation is entered. 295 | func (s *BaseModelicaListener) EnterEquation(ctx *EquationContext) {} 296 | 297 | // ExitEquation is called when production equation is exited. 298 | func (s *BaseModelicaListener) ExitEquation(ctx *EquationContext) {} 299 | 300 | // EnterStatement is called when production statement is entered. 301 | func (s *BaseModelicaListener) EnterStatement(ctx *StatementContext) {} 302 | 303 | // ExitStatement is called when production statement is exited. 304 | func (s *BaseModelicaListener) ExitStatement(ctx *StatementContext) {} 305 | 306 | // EnterIf_equation is called when production if_equation is entered. 307 | func (s *BaseModelicaListener) EnterIf_equation(ctx *If_equationContext) {} 308 | 309 | // ExitIf_equation is called when production if_equation is exited. 310 | func (s *BaseModelicaListener) ExitIf_equation(ctx *If_equationContext) {} 311 | 312 | // EnterIf_statement is called when production if_statement is entered. 313 | func (s *BaseModelicaListener) EnterIf_statement(ctx *If_statementContext) {} 314 | 315 | // ExitIf_statement is called when production if_statement is exited. 316 | func (s *BaseModelicaListener) ExitIf_statement(ctx *If_statementContext) {} 317 | 318 | // EnterControl_structure_body is called when production control_structure_body is entered. 319 | func (s *BaseModelicaListener) EnterControl_structure_body(ctx *Control_structure_bodyContext) {} 320 | 321 | // ExitControl_structure_body is called when production control_structure_body is exited. 322 | func (s *BaseModelicaListener) ExitControl_structure_body(ctx *Control_structure_bodyContext) {} 323 | 324 | // EnterFor_equation is called when production for_equation is entered. 325 | func (s *BaseModelicaListener) EnterFor_equation(ctx *For_equationContext) {} 326 | 327 | // ExitFor_equation is called when production for_equation is exited. 328 | func (s *BaseModelicaListener) ExitFor_equation(ctx *For_equationContext) {} 329 | 330 | // EnterFor_statement is called when production for_statement is entered. 331 | func (s *BaseModelicaListener) EnterFor_statement(ctx *For_statementContext) {} 332 | 333 | // ExitFor_statement is called when production for_statement is exited. 334 | func (s *BaseModelicaListener) ExitFor_statement(ctx *For_statementContext) {} 335 | 336 | // EnterFor_indices is called when production for_indices is entered. 337 | func (s *BaseModelicaListener) EnterFor_indices(ctx *For_indicesContext) {} 338 | 339 | // ExitFor_indices is called when production for_indices is exited. 340 | func (s *BaseModelicaListener) ExitFor_indices(ctx *For_indicesContext) {} 341 | 342 | // EnterFor_index is called when production for_index is entered. 343 | func (s *BaseModelicaListener) EnterFor_index(ctx *For_indexContext) {} 344 | 345 | // ExitFor_index is called when production for_index is exited. 346 | func (s *BaseModelicaListener) ExitFor_index(ctx *For_indexContext) {} 347 | 348 | // EnterWhile_statement is called when production while_statement is entered. 349 | func (s *BaseModelicaListener) EnterWhile_statement(ctx *While_statementContext) {} 350 | 351 | // ExitWhile_statement is called when production while_statement is exited. 352 | func (s *BaseModelicaListener) ExitWhile_statement(ctx *While_statementContext) {} 353 | 354 | // EnterWhen_equation is called when production when_equation is entered. 355 | func (s *BaseModelicaListener) EnterWhen_equation(ctx *When_equationContext) {} 356 | 357 | // ExitWhen_equation is called when production when_equation is exited. 358 | func (s *BaseModelicaListener) ExitWhen_equation(ctx *When_equationContext) {} 359 | 360 | // EnterWhen_statement is called when production when_statement is entered. 361 | func (s *BaseModelicaListener) EnterWhen_statement(ctx *When_statementContext) {} 362 | 363 | // ExitWhen_statement is called when production when_statement is exited. 364 | func (s *BaseModelicaListener) ExitWhen_statement(ctx *When_statementContext) {} 365 | 366 | // EnterConnect_clause is called when production connect_clause is entered. 367 | func (s *BaseModelicaListener) EnterConnect_clause(ctx *Connect_clauseContext) {} 368 | 369 | // ExitConnect_clause is called when production connect_clause is exited. 370 | func (s *BaseModelicaListener) ExitConnect_clause(ctx *Connect_clauseContext) {} 371 | 372 | // EnterExpression is called when production expression is entered. 373 | func (s *BaseModelicaListener) EnterExpression(ctx *ExpressionContext) {} 374 | 375 | // ExitExpression is called when production expression is exited. 376 | func (s *BaseModelicaListener) ExitExpression(ctx *ExpressionContext) {} 377 | 378 | // EnterSimple_expression is called when production simple_expression is entered. 379 | func (s *BaseModelicaListener) EnterSimple_expression(ctx *Simple_expressionContext) {} 380 | 381 | // ExitSimple_expression is called when production simple_expression is exited. 382 | func (s *BaseModelicaListener) ExitSimple_expression(ctx *Simple_expressionContext) {} 383 | 384 | // EnterIf_expression is called when production if_expression is entered. 385 | func (s *BaseModelicaListener) EnterIf_expression(ctx *If_expressionContext) {} 386 | 387 | // ExitIf_expression is called when production if_expression is exited. 388 | func (s *BaseModelicaListener) ExitIf_expression(ctx *If_expressionContext) {} 389 | 390 | // EnterIf_expression_body is called when production if_expression_body is entered. 391 | func (s *BaseModelicaListener) EnterIf_expression_body(ctx *If_expression_bodyContext) {} 392 | 393 | // ExitIf_expression_body is called when production if_expression_body is exited. 394 | func (s *BaseModelicaListener) ExitIf_expression_body(ctx *If_expression_bodyContext) {} 395 | 396 | // EnterIf_expression_condition is called when production if_expression_condition is entered. 397 | func (s *BaseModelicaListener) EnterIf_expression_condition(ctx *If_expression_conditionContext) {} 398 | 399 | // ExitIf_expression_condition is called when production if_expression_condition is exited. 400 | func (s *BaseModelicaListener) ExitIf_expression_condition(ctx *If_expression_conditionContext) {} 401 | 402 | // EnterElseif_expression_condition is called when production elseif_expression_condition is entered. 403 | func (s *BaseModelicaListener) EnterElseif_expression_condition(ctx *Elseif_expression_conditionContext) {} 404 | 405 | // ExitElseif_expression_condition is called when production elseif_expression_condition is exited. 406 | func (s *BaseModelicaListener) ExitElseif_expression_condition(ctx *Elseif_expression_conditionContext) {} 407 | 408 | // EnterElse_expression_condition is called when production else_expression_condition is entered. 409 | func (s *BaseModelicaListener) EnterElse_expression_condition(ctx *Else_expression_conditionContext) {} 410 | 411 | // ExitElse_expression_condition is called when production else_expression_condition is exited. 412 | func (s *BaseModelicaListener) ExitElse_expression_condition(ctx *Else_expression_conditionContext) {} 413 | 414 | // EnterLogical_expression is called when production logical_expression is entered. 415 | func (s *BaseModelicaListener) EnterLogical_expression(ctx *Logical_expressionContext) {} 416 | 417 | // ExitLogical_expression is called when production logical_expression is exited. 418 | func (s *BaseModelicaListener) ExitLogical_expression(ctx *Logical_expressionContext) {} 419 | 420 | // EnterLogical_term is called when production logical_term is entered. 421 | func (s *BaseModelicaListener) EnterLogical_term(ctx *Logical_termContext) {} 422 | 423 | // ExitLogical_term is called when production logical_term is exited. 424 | func (s *BaseModelicaListener) ExitLogical_term(ctx *Logical_termContext) {} 425 | 426 | // EnterLogical_factor is called when production logical_factor is entered. 427 | func (s *BaseModelicaListener) EnterLogical_factor(ctx *Logical_factorContext) {} 428 | 429 | // ExitLogical_factor is called when production logical_factor is exited. 430 | func (s *BaseModelicaListener) ExitLogical_factor(ctx *Logical_factorContext) {} 431 | 432 | // EnterRelation is called when production relation is entered. 433 | func (s *BaseModelicaListener) EnterRelation(ctx *RelationContext) {} 434 | 435 | // ExitRelation is called when production relation is exited. 436 | func (s *BaseModelicaListener) ExitRelation(ctx *RelationContext) {} 437 | 438 | // EnterRel_op is called when production rel_op is entered. 439 | func (s *BaseModelicaListener) EnterRel_op(ctx *Rel_opContext) {} 440 | 441 | // ExitRel_op is called when production rel_op is exited. 442 | func (s *BaseModelicaListener) ExitRel_op(ctx *Rel_opContext) {} 443 | 444 | // EnterArithmetic_expression is called when production arithmetic_expression is entered. 445 | func (s *BaseModelicaListener) EnterArithmetic_expression(ctx *Arithmetic_expressionContext) {} 446 | 447 | // ExitArithmetic_expression is called when production arithmetic_expression is exited. 448 | func (s *BaseModelicaListener) ExitArithmetic_expression(ctx *Arithmetic_expressionContext) {} 449 | 450 | // EnterAdd_op is called when production add_op is entered. 451 | func (s *BaseModelicaListener) EnterAdd_op(ctx *Add_opContext) {} 452 | 453 | // ExitAdd_op is called when production add_op is exited. 454 | func (s *BaseModelicaListener) ExitAdd_op(ctx *Add_opContext) {} 455 | 456 | // EnterTerm is called when production term is entered. 457 | func (s *BaseModelicaListener) EnterTerm(ctx *TermContext) {} 458 | 459 | // ExitTerm is called when production term is exited. 460 | func (s *BaseModelicaListener) ExitTerm(ctx *TermContext) {} 461 | 462 | // EnterMul_op is called when production mul_op is entered. 463 | func (s *BaseModelicaListener) EnterMul_op(ctx *Mul_opContext) {} 464 | 465 | // ExitMul_op is called when production mul_op is exited. 466 | func (s *BaseModelicaListener) ExitMul_op(ctx *Mul_opContext) {} 467 | 468 | // EnterFactor is called when production factor is entered. 469 | func (s *BaseModelicaListener) EnterFactor(ctx *FactorContext) {} 470 | 471 | // ExitFactor is called when production factor is exited. 472 | func (s *BaseModelicaListener) ExitFactor(ctx *FactorContext) {} 473 | 474 | // EnterPrimary is called when production primary is entered. 475 | func (s *BaseModelicaListener) EnterPrimary(ctx *PrimaryContext) {} 476 | 477 | // ExitPrimary is called when production primary is exited. 478 | func (s *BaseModelicaListener) ExitPrimary(ctx *PrimaryContext) {} 479 | 480 | // EnterVector is called when production vector is entered. 481 | func (s *BaseModelicaListener) EnterVector(ctx *VectorContext) {} 482 | 483 | // ExitVector is called when production vector is exited. 484 | func (s *BaseModelicaListener) ExitVector(ctx *VectorContext) {} 485 | 486 | // EnterArray_arguments is called when production array_arguments is entered. 487 | func (s *BaseModelicaListener) EnterArray_arguments(ctx *Array_argumentsContext) {} 488 | 489 | // ExitArray_arguments is called when production array_arguments is exited. 490 | func (s *BaseModelicaListener) ExitArray_arguments(ctx *Array_argumentsContext) {} 491 | 492 | // EnterArray_iterator_constructor is called when production array_iterator_constructor is entered. 493 | func (s *BaseModelicaListener) EnterArray_iterator_constructor(ctx *Array_iterator_constructorContext) {} 494 | 495 | // ExitArray_iterator_constructor is called when production array_iterator_constructor is exited. 496 | func (s *BaseModelicaListener) ExitArray_iterator_constructor(ctx *Array_iterator_constructorContext) {} 497 | 498 | // EnterName is called when production name is entered. 499 | func (s *BaseModelicaListener) EnterName(ctx *NameContext) {} 500 | 501 | // ExitName is called when production name is exited. 502 | func (s *BaseModelicaListener) ExitName(ctx *NameContext) {} 503 | 504 | // EnterComponent_reference is called when production component_reference is entered. 505 | func (s *BaseModelicaListener) EnterComponent_reference(ctx *Component_referenceContext) {} 506 | 507 | // ExitComponent_reference is called when production component_reference is exited. 508 | func (s *BaseModelicaListener) ExitComponent_reference(ctx *Component_referenceContext) {} 509 | 510 | // EnterFunction_call_args is called when production function_call_args is entered. 511 | func (s *BaseModelicaListener) EnterFunction_call_args(ctx *Function_call_argsContext) {} 512 | 513 | // ExitFunction_call_args is called when production function_call_args is exited. 514 | func (s *BaseModelicaListener) ExitFunction_call_args(ctx *Function_call_argsContext) {} 515 | 516 | // EnterFunction_arguments is called when production function_arguments is entered. 517 | func (s *BaseModelicaListener) EnterFunction_arguments(ctx *Function_argumentsContext) {} 518 | 519 | // ExitFunction_arguments is called when production function_arguments is exited. 520 | func (s *BaseModelicaListener) ExitFunction_arguments(ctx *Function_argumentsContext) {} 521 | 522 | // EnterNamed_arguments is called when production named_arguments is entered. 523 | func (s *BaseModelicaListener) EnterNamed_arguments(ctx *Named_argumentsContext) {} 524 | 525 | // ExitNamed_arguments is called when production named_arguments is exited. 526 | func (s *BaseModelicaListener) ExitNamed_arguments(ctx *Named_argumentsContext) {} 527 | 528 | // EnterNamed_argument is called when production named_argument is entered. 529 | func (s *BaseModelicaListener) EnterNamed_argument(ctx *Named_argumentContext) {} 530 | 531 | // ExitNamed_argument is called when production named_argument is exited. 532 | func (s *BaseModelicaListener) ExitNamed_argument(ctx *Named_argumentContext) {} 533 | 534 | // EnterFunction_argument is called when production function_argument is entered. 535 | func (s *BaseModelicaListener) EnterFunction_argument(ctx *Function_argumentContext) {} 536 | 537 | // ExitFunction_argument is called when production function_argument is exited. 538 | func (s *BaseModelicaListener) ExitFunction_argument(ctx *Function_argumentContext) {} 539 | 540 | // EnterOutput_expression_list is called when production output_expression_list is entered. 541 | func (s *BaseModelicaListener) EnterOutput_expression_list(ctx *Output_expression_listContext) {} 542 | 543 | // ExitOutput_expression_list is called when production output_expression_list is exited. 544 | func (s *BaseModelicaListener) ExitOutput_expression_list(ctx *Output_expression_listContext) {} 545 | 546 | // EnterExpression_list is called when production expression_list is entered. 547 | func (s *BaseModelicaListener) EnterExpression_list(ctx *Expression_listContext) {} 548 | 549 | // ExitExpression_list is called when production expression_list is exited. 550 | func (s *BaseModelicaListener) ExitExpression_list(ctx *Expression_listContext) {} 551 | 552 | // EnterArray_subscripts is called when production array_subscripts is entered. 553 | func (s *BaseModelicaListener) EnterArray_subscripts(ctx *Array_subscriptsContext) {} 554 | 555 | // ExitArray_subscripts is called when production array_subscripts is exited. 556 | func (s *BaseModelicaListener) ExitArray_subscripts(ctx *Array_subscriptsContext) {} 557 | 558 | // EnterSubscript is called when production subscript is entered. 559 | func (s *BaseModelicaListener) EnterSubscript(ctx *SubscriptContext) {} 560 | 561 | // ExitSubscript is called when production subscript is exited. 562 | func (s *BaseModelicaListener) ExitSubscript(ctx *SubscriptContext) {} 563 | 564 | // EnterComment is called when production comment is entered. 565 | func (s *BaseModelicaListener) EnterComment(ctx *CommentContext) {} 566 | 567 | // ExitComment is called when production comment is exited. 568 | func (s *BaseModelicaListener) ExitComment(ctx *CommentContext) {} 569 | 570 | // EnterString_comment is called when production string_comment is entered. 571 | func (s *BaseModelicaListener) EnterString_comment(ctx *String_commentContext) {} 572 | 573 | // ExitString_comment is called when production string_comment is exited. 574 | func (s *BaseModelicaListener) ExitString_comment(ctx *String_commentContext) {} 575 | 576 | // EnterAnnotation is called when production annotation is entered. 577 | func (s *BaseModelicaListener) EnterAnnotation(ctx *AnnotationContext) {} 578 | 579 | // ExitAnnotation is called when production annotation is exited. 580 | func (s *BaseModelicaListener) ExitAnnotation(ctx *AnnotationContext) {} 581 | --------------------------------------------------------------------------------