- Index
- » Programming
- » Modelica Language
- » Change References
Change References
Change References
Hello,
is it possible to change a reference-name in a model, for example with a string? Following Code-example (not working) should explain my question:
model test
parameter String a="excitation"; //this parameter should be exchangeable
Real y;
algorithm
y:=a.y; // should be: excitation.y
end test;
Is there a way to make this possible? When not, do you have a workaround for my problem?
Thanks a lot!
Re: Change References
Sorry, no. Modelica does not have any constructs for renaming components. Perhaps you could explain what it is you're trying to do? There might be another solution.
- perost
- 114 Posts
Re: Change References
I have a central block in my model (a engine). There I can read for example a external ASCII-file (table). In other blocks of the engine I need to transfer some variables from this central block and also read the external table (references of the central block). This works fine so far.
But now it is possible that I have two engines with the same structure in my model. Therefore I need two of these central blocks. The whole process should be automized in the end. So it is not possible to change the references manually.
Any idea for another solution is welcome.
Thank you!
Re: Change References
You could probably use redeclares or inner outer.
Read more about those in the Modelica specification.
Cheers,
Adrian Pop/
- adrpo
- 885 Posts
- Index
- » Programming
- » Modelica Language
- » Change References