Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)

Forgot password? | Forgot username? | Register

Change References

Change References


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;

  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!

Edited by: psch90 - Mar-28-14 11:46:07

Re: Change References

No ideas about this issue?

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.

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.

Adrian Pop/

There are 0 guests and 0 other users also viewing this topic
You are here: