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
  • Index
  • » Users
  • » bruno
  • » Profile

Posts

Posts

Hi,
I am trying to linearize a model and export the matrices into a .mat file with an OpenModelica script but I have several issues.

-Some of the the Modelica.Utilities.Files functions do now work OM scripts. The output is just a while line.  For example:
Modelica.Utilities.Strings.length("test") works correctly but Modelica.Utilities.Files.exist("C:") gives no result.
Is is a matter of system APIs?

-The Modelica_LinearSystems2 liearize function does not work (I know the OM API has a linearize() function but it does not allow me to change parameters) an example is shown here:

loadModel(Modelica);
loadModel(Modelica_LinearSystems2);
loadFile("PackagewithModels.mo");
Modelica_LinearSystems2.ModelAnalysis.Linearize(ModelToBeLinearized)

>>Modelica_LinearSystems2.ModelAnalysis.Linearize[<interactive>:1:1-1:0:writable] Error: Variable Modelica_LinearSystems2.ModelAnalysis.Linearize not found in scope <global scope>.

Finally, if I use the OpenModelica.Scripting.linearize() function it produces a .mo linear model, I have found no way to extract the matrices and write them into a .mat file within an OM script. I only could use the getParameterValue() to extract the matrices as strings and write them into a .m ASCII file, then open it in matlab.

Do you have any suggestion?
Many Thanks
Bruno

  • Index
  • » Users
  • » bruno
  • » Profile
You are here: