modelicadymola

How to define a model within another model


I am trying to define a model Toto within another model Example1. I know this is not Best Practices, but Toto is purely meant for this specific model Example1 and I don't want to see it in my package browser.

Basically, I would like to end up with something like:

model Example1
    Toto toto;
    [...]
    model Toto
        [...]
    end Toto;
end Example1;

Is it somehow possible?


Solution

  • Yes, almost exactly like you did it. Just fix the syntax errors and move the model into a protected section:

    model Example1
        Toto toto;
        // ....
    protected
        model Toto
          // ...
        end Toto;
    end Example1;