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
  • » julian.wyszynski
  • » Profile

Posts

Posts

Hello,
I'm still trying to make our library work in OpenModelica.
After putting a lot of effort in this and reporting errors I had most of it working in an earlier version. But in the newest nightly build I got 3 errors, for which I also created tickets.
https://trac.openmodelica.org/OpenModelica/ticket/2034
https://trac.openmodelica.org/OpenModelica/ticket/1913
https://trac.openmodelica.org/OpenModelica/ticket/2044

Is somebody working to fix these? Can you give a brief estimation on when this could be fixed so I know when I can continue my tests with OpenModelica.

Best regards
Julian

I just created a ticket https://trac.openmodelica.org/OpenModelica/ticket/2035 with an error that shows up in the latest nightly-build.

I also create this topic in the forum since I am not sure if this is an error of the program or if you deliberatly changed this, since it was working in an earlier nightly-build (r13615). I think it is easier to discuss this in the forum.

This structure gives one of the big advantages of our library and is essential. Like this you can easily exchange a whole lot of information by just redeclaring package "modelPackage" when declaring component "model2" in "model1".

It would be great if this feature would work in the newest version of the program, eventually the new release. Otherwise our library couldn't be used with OpenModelica at all.

Thanks. It is awesome how quickly you always respond.
I hope it didn't sound like I wanted to complain, just wanted to make sure you know that this error is still there.

Thank you also for fixing the other error I only reported a few hours ago so fast.

Best regards,
Julian

Hey,
I wrote this Ticket about a month ago.

https://trac.openmodelica.org/OpenModelica/ticket/1824

When trying to make our Library work in OpenModelica I changed a few things to avoid this error. I forgot I changed this and thought the "bug" was fixed, so I didn't follow it anymore. But now I found that it is still only running with the "workaround".

Is someone still working on this?

Thank you for the info.

The strange bug you mentioned in your earlier post is that the one which comes when simulating "SmallPlant"?


Error: Interner Fehler generateHelpVarsForWhenStatements failed
Error: Interner Fehler ./Compiler/BackEnd/SimCode.mo: function createSimCode failed [Transformation from optimised DAE to simulation code structure failed]

adrpo wrote:

Also, it seems the library is rather weird as you need to run a Dymola mos script to set the initial values of the plant models.
For example this script WasteWater\ASM1\small_asm1.mos should be used for the model: WasteWater.ASM1.Examples.SmallPlant
However Modelica has evolved since this library was made, so you don't need such a script anymore, you can just set the
start values of those components to the values given in the .mos file. I haven't done that yet.

I have a Script for the initial values which is working.


tempString := getSourceFile(WasteWater);
tempString := dirname(tempString);
cd(tempString);

buildModel(WasteWater.ASM1.Examples.BenchPlant);

system("WasteWater.ASM1.Examples.SmallPlant.exe -overrideFile ASM1BenchPlant.txt");

What is the other way to do it? Writing them into the Variabledeklaration like this

Real a(start=1);

makes it hard to read the code and to see which initial values are used.

I tried to write them into an "initial equation" section but this doesn't seem to work in OpenModelica.
I wrote it like this:

model testModel
...
...
initial equation
  variable1 = 1;
  variable2 = 2;
equation
...
...
end testModel;


Another question:
If I try and simulate ASM1.Examples.BenchPlant I get this warning:
[C:/OpenModelica1.9.0/lib/omlibrary/Modelica 3.1/Blocks/Nonlinear.mo:19:12-23:97:writable] Warning: If-equations are only partially supported.

Will this limiter be available in the future?

Hey,
the Version of the WasteWater Library like found on the Modelica website is based on the Modelica Standard Library 2.2
It is not compatible with the current version of Modelica and is not working in your Dymola version and probably will have the same problems in OpenModelica.

You need to modify some components like the declaration of CombiTableTime. It is now found in "Modelica.Blocks.Sources.CombiTimeTable".
It should be possible to make everything run, just use equivalent components which are available in the current version of Modelica.

OpenModelica has some additional issues with this library that Dymola ignores.
If you try and open the Library with OMShell you are told what courses the problem and can fix them.

Commands you need to execute are:

loadModel(Modelica)
loadFile("YOURPATH/package.mo")

I hope this helps you.

Hey,
tried it today and it works perfectly.

Thank you very much!

Hi Adrian,
thank you for your reply.

As you already said writing it directly in the command line won't work for the values must be as precice as the examples I wrote. So that would do for about 50-70 Components.

But if you could extend the command with "-overrideFile=f.txt" it would be perfect.
That would be just what I have been looking for.

When would that be available?

Best regard,
Julian

Hi,
thank you for your answer. It is actually working this way.

But there is a little problem. In the model I tested there are 170 Variables that need to be changed. The  setInitXmlStartValue command to change them takes about 3 minutes.
3 minutes wouldn't be a problem, but we got other models that need more than a thousand Variables to be changed. So this would take too long.

This is the script I wrote:

InitialComponents := {"nitri2.Si","nitri2.Ss", .....};

InitialValues := {"5.178780049396e+01","2.156778436699e+00", .....};

buildModel(WasteWater.ASM1.Examples.ComplexPlant);

setInitXmlStartValue("WasteWater.ASM1.Examples.ComplexPlant_init.xml", InitialComponents, InitialValues, "WasteWater.ASM1.Examples.ComplexPlant_init.xml");

system("WasteWater.ASM1.Examples.ComplexPlant.exe");

I think setInitXmlStartValue rewrites the init.xml for every single variable.
Is there a way to make this faster with the function like it is or could you modify the setInitXmlStartValue function so that it writes all variables in the init.xml in one step?

Best regards,
Julian

Hi sjoelund,

Thanks for the tip, the function "setInitXmlStartValue" works, I can write the desired value(s) into the <modelName>_init.XML file.

However, how do I make it so that the next time I enter the "simulate" command, the values from this file will be used? Can I add a parameter to the "simulate(...)" command that forces the use of some other XML file than the automatically generated file?

I read the OpenModelica User Guide, and could not find any info on how to do that.

Here is how I try to do it:
1) simulate(WasteWater.ASMx.Examples.TestDeniNitriModel) so that the XML file is there in the first place
2) setInitXmlStartValue("WasteWater.ASMx.Examples.TestDeniNitriModel_init.xml", "Sink2.SP", "7", "WasteWater.ASMx.Examples.TestDeniNitriModel_init.xml") to write the alternative value for Sink2.SP into the XML file
3) simulate(WasteWater.ASMx.Examples.TestDeniNitriModel) again to start the simulation

But instead of using the value I wrote into the XML file in step 2, it re-generates the XML file so the value is overwritten. Simulationsresult from step 3 is the same as from step 1.

Best regards,
Julian

Hi,

I have a Model which needs a big amount of initial values and parameters changed before simulating.
In Dymola it is done by executing a script which contains all initial values changing them after translating.

You could write all values within the modelcode but the good thing about the script is that you can easily change the values and it keeps the modelcode short and easy to read.

Is something similar like the script possible in OpenModelica?
Or is there a different way to solve this.

Thank you
Julian

  • Index
  • » Users
  • » julian.wyszynski
  • » Profile
You are here: