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

max size of result file? (.mat, OM 1.8.0)

max size of result file? (.mat, OM 1.8.0)

Hallo,

i'm now working on my master thesis with OM. I am building a testbed for a gasoline engine to simulate the torsional vibration behaviour of the drive shaft system.

To get correct excitation in the engine cylinder i have to use a sample time of 10kHz, because I have to use cylinder pressure data from a 3D Interpolation. So the result file is very big for long test runs (>1GB).

Now to my problem. My model finishes only until a certain .mat file size at approx. 800mb successfully. When i increase the simulation time it fails and when i decrease the simulation time it works.

Is there an upper limit for the .mat result file? I tried different test runs but never got past these 800mb

I tried to find a way to exclude protected variables (like in Dymola) but didn't find anything.

I am now on OM 1.8.0 stable released.

Re: max size of result file? (.mat, OM 1.8.0)

See this line when you run the simulate() command?

Code:

    simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 50, tolerance = 0.000001, method = 'dassl', fileNamePrefix = 'Alias', storeInTemp = false, noClean = false, options = '', outputFormat = 'mat', variableFilter = '.*', measureTime = false, cflags = ''",

If you call

Code:

simulate(Model, variableFilter="x|y")

You only store time, x and y in the result-file. The syntax is a regular expression, which needs to match the whole name of the variable. You can google around for the exact syntax, we use "man 3 regex" REG_EXTENDED syntax.

Re: max size of result file? (.mat, OM 1.8.0)

Thanks for the quick reply! I will try it with this filtering!

Re: max size of result file? (.mat, OM 1.8.0)

I tried using the variableFiler option in the simulate command with the whole name of the variable but the simulation won't run.

I have to say that I am a newby to programming. How is the syntax to get a correct statement?

I used :

simulate(tModelicaLib.TestBeds.I4T_Testbed_V2,startTime=0, stopTime=5, numberOfIntervals=50000, variableFilter="CV15Shaft.Damper.flange_b.phi");

but i get this error:

Assertion failed: it != indx_parammap.end(), file simulation_result_mat.cpp, line 397

Re: max size of result file? (.mat, OM 1.8.0)

I think i got the meaning of regex. I tried different methods to describe the string for a variable but I couldn't get the desired variable stored to the .mat file.

could you give me an example what it should look like to get the variable " dynometerController.DynoSetTorque " .

I tried this:

simulate(tModelicaLib.TestBeds.I4T_Testbed_V2,startTime=0, stopTime=2, numberOfIntervals=20000, variableFilter="\QdynometerController.DynoSetTorque\E")
record SimulationResult
    resultFile = "C:/Work/Diplomarbeit/DA_MK/Src/Modelica_Tests/Test_I4Testbed_V2/tModelicaLib.TestBeds.I4T_Testbed_V2_res.mat",
    simulationOptions = "startTime = 0.0, stopTime = 2.0, numberOfIntervals = 20000, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'tModelicaLib.TestBeds.I4T_Testbed_V2', storeInTemp = false, noClean = false, options = '', outputFormat = 'mat', variableFilter = '\\\\QdynometerController.DynoSetTorque\\\\E', measureTime = false, cflags = ''",

It's not clear for me why the answer to my simulate command for variableFilter with "\Q ... \E" leads to "\\\\Q ... \\\\E"

Re: max size of result file? (.mat, OM 1.8.0)

Hi,

You could try to filter just some of them, i.e. "*dynometerController*", or "*DynoSetTorque*".
This would make the mat file smaller anyway.

Cheers,
Adrian Pop/

Re: max size of result file? (.mat, OM 1.8.0)

Hi everyone.

I tried a lot with the option variableFilter..

i took a very simple example model to try different settings.

The model and the script are as followed:

model:

model testVarFilter
  Modelica.Blocks.Sources.Sine sine(amplitude=5,freqHz=10,offset=5,startTime=0);
  Modelica.Mechanics.Rotational.Sources.Torque torque1;
  Modelica.Mechanics.Rotational.Components.Inertia inertia1(J=0.001);
  Modelica.Mechanics.Rotational.Components.SpringDamper springDamper(c=5000, d=0.5);
  Modelica.Mechanics.Rotational.Components.Inertia inertia2(J=1);
equation
  connect(sine.y, torque1.tau);
  connect(torque1.flange, inertia1.flange_a);
  connect(inertia1.flange_b, springDamper.flange_a);
  connect(springDamper.flange_b, inertia2.flange_a);
end testVarFilter;

mos Script:

loadModel(Modelica);
loadFile("testVarFilter.mo");
instantiateModel(testVarFilter);
simulate(testVarFilter,startTime=0, stopTime=1, numberOfIntervals=100, variableFilter="VARIABLE");

I tired to set
VARIABLE = inertia2\\.w and got it into the mat File on second row in data2 below the time variable,
VARIABLE = inertia1\\.w and there was only time in the mat file.

Same result without the \\ because "." can be any sign.

So i think it's not about the syntax. Has anyone an idea why that command behaves like this?

Also i tried to set more than one Variable with the pipe sign.
VARIABLE = inertia2\\.phi|inertia2\\.w  worked as it should.

I just don't understand why some of the Variables aren't stored with the same syntax. (like: springDamper\\.flange\\_b\\.tau, inertia1\\.w , sine\\.y, ...)

Re: max size of result file? (.mat, OM 1.8.0)

Maybe because of variable alias elimination. But I tried all of these on the latest version in Linux, and all of your examples do produce the correct results for me. Might be a Windows-specific issue or an issue with 1.8.0.

Re: max size of result file? (.mat, OM 1.8.0)

I updated today to the latest nightly build and got the same issues.

I think you are right about the aliases. I now take the standard option ".*" in advance and look inside the name variable in the .mat file to know which of the variables i can use.

I think i will build a new outputVar Block which i can place inside the model and parse the result with an regex expression.

But there is one question left.

Is there a max. file size for the .mat file?

I only found a restriction for .mat 7.3 which means there is a 2GB limit.

How is this in open modelica?

Re: max size of result file? (.mat, OM 1.8.0)

I think our files become corrupt after trying to write more than 4,294,967,295 rows. The maximum file size is dependent on the number of variables in your equation, with the maximum being 4,294,967,295, giving 147573952589676412928 bytes when storing doubles.

But I don't know if there is an implementation bug that causes problems for smaller files since I did not program the mat-writer myself.

Re: max size of result file? (.mat, OM 1.8.0)

Code:

loadString("model M

  Real r = time;
end M;");

simulate(M,startTime=0, stopTime=1, numberOfIntervals=268435456);

// Produces 4GB M_res.mat - 2GB for time, 2GB for r

Code:

currentSimulationResult:="M_res.mat";

val(r,0.05); // Takes a long time as it reads the whole file to memory... Silly me

But it works.

Re: max size of result file? (.mat, OM 1.8.0)

hallo sir i am working on queter car model i would like to know how to give the road excitation

ersachindethe@gmail.com
useravatar
Offline
1 Posts
There are 0 guests and 0 other users also viewing this topic
You are here: