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

command line error using omc

command line error using omc

Can anyone help me to fix this to run using command line
To give you an idea,
- I have a package named Package
- With in it there is a an experiment called System
- my model uses four data files (a two column, and n number of rows). The files are AWCD.txt, DWCD.txt, popmillion.txt, and air.txt

I created mos file (mosfile.mos) as follows:

Code:


loadModel(Modelica);
loadFile("F:/0000_Apps/MODELICA/Test/Package.mo"); getErrorString();
loadFile("F:/0000_Apps/MODELICA/Test/Data/AWCD.txt"); getErrorString();
loadFile("F:/0000_Apps/MODELICA/Test/Data/DWCD.txt"); getErrorString();
loadFile("F:/0000_Apps/MODELICA/Test/Data/popmillion.txt"); getErrorString();
loadFile("F:/0000_Apps/MODELICA/Test/Data/air.txt"); getErrorString();
simulate(System, startTime = 0, stopTime = 1, numberOfIntervals = 500, tolerance = 0.0001, method = "dassl", outputFormat = "csv"); getErrorString();

And my batch file is :

Code:


c:/OpenModelica1.9.3Nightly/bin/omc.exe mosfile.mos
pause

After launching the cmd file using batch file, I got this errors:

Code:


F:\0000_Apps\MODELICA\Test>c:/OpenModelica1.9.3Nightly/bin/omc.exe mosfile.mos
"F:/0000_Apps/MODELICA/Test"
true
true
"[F:/0000_Apps/MODELICA/Test/Package.mo:356:73-356:77:writable] Warning: Lexer treating \ as \\, since \_ is not a valid Modelica escape sequence.
[F:/0000_Apps/MODELICA/Test/Package.mo:356:73-356:88:writable] Warning: Lexer treating \ as \\, since \M is not a valid Modelica escape sequence.
[F:/0000_Apps/MODELICA/Test/Package.mo:356:73-356:97:writable] Warning: Lexer treating \ as \\, since \W is not a valid Modelica escape sequence.
[F:/0000_Apps/MODELICA/Test/Package.mo:356:73-356:106:writable] Warning: Lexer treating \ as \\, since \D is not a valid Modelica escape sequence.
[F:/0000_Apps/MODELICA/Test/Package.mo:356:73-356:111:writable] Warning: Lexer treating \ as \\, since \w is not a valid Modelica escape sequence.
[F:/0000_Apps/MODELICA/Test/Package.mo:532:73-532:77:writable] Warning: Lexer treating \ as \\, since \_ is not a valid Modelica escape sequence.
[F:/0000_Apps/MODELICA/Test/Package.mo:532:73-532:88:writable] Warning: Lexer treating \ as \\, since \M is not a valid Modelica escape sequence.
[F:/0000_Apps/MODELICA/Test/Package.mo:532:73-532:97:writable] Warning: Lexer treating \ as \\, since \W is not a valid Modelica escape sequence.
[F:/0000_Apps/MODELICA/Test/Package.mo:532:73-532:106:writable] Warning: Lexer treating \ as \\, since \D is not a valid Modelica escape sequence.
[F:/0000_Apps/MODELICA/Test/Package.mo:532:73-532:111:writable] Warning: Lexer treating \ as \\, since \p is not a valid Modelica escape sequence.
[F:/0000_Apps/MODELICA/Test/Package.mo:630:73-630:77:writable] Warning: Lexer treating \ as \\, since \_ is not a valid Modelica escape sequence.
[F:/0000_Apps/MODELICA/Test/Package.mo:630:73-630:88:writable] Warning: Lexer treating \ as \\, since \M is not a valid Modelica escape sequence.
[F:/0000_Apps/MODELICA/Test/Package.mo:630:73-630:97:writable] Warning: Lexer treating \ as \\, since \W is not a valid Modelica escape sequence.
[F:/0000_Apps/MODELICA/Test/Package.mo:630:73-630:106:writable] Warning: Lexer treating \ as \\, since \D is not a valid Modelica escape sequence.
[F:/0000_Apps/MODELICA/Test/Package.mo:630:73-630:111:writable] Warning: Lexer treating \ as \\, since \D is not a valid Modelica escape sequence.
[F:/0000_Apps/MODELICA/Test/Package.mo:653:73-653:77:writable] Warning: Lexer treating \ as \\, since \_ is not a valid Modelica escape sequence.
[F:/0000_Apps/MODELICA/Test/Package.mo:653:73-653:88:writable] Warning: Lexer treating \ as \\, since \M is not a valid Modelica escape sequence.
[F:/0000_Apps/MODELICA/Test/Package.mo:653:73-653:97:writable] Warning: Lexer treating \ as \\, since \W is not a valid Modelica escape sequence.
[F:/0000_Apps/MODELICA/Test/Package.mo:653:73-653:106:writable] Warning: Lexer treating \ as \\, since \D is not a valid Modelica escape sequence.
[F:/0000_Apps/MODELICA/Test/Package.mo:653:73-653:111:writable] Warning: Lexer treating \ as \\, since \A is not a valid Modelica escape sequence.
"
false
"[F:/0000_Apps/MODELICA/Test/Data/AWCD.txt:1:0-1:0:writable] Error: Lexer failed to recognize '#1
double '
"
false
"[F:/0000_Apps/MODELICA/Test/Data/DWCD.txt:1:0-1:0:writable] Error: Lexer failed to recognize '#1
double '
"
false
"[F:/0000_Apps/MODELICA/Test/Data/popmillion.txt:1:0-1:0:writable] Error: Lexer failed to recognize '#1
double '
"
false
"[F:/0000_Apps/MODELICA/Test/Data/air.txt:1:0-1:0:writable] Error: Lexer failed to recognize '#1
double '
"
record SimulationResult
    resultFile = "",
    simulationOptions = "startTime = 0.0, stopTime = 1.0, numberOfIntervals = 500, tolerance = 0.0001, method = 'dassl', fileNamePrefix = 'System', options = '', outputFormat = 'csv', variableFilter = '.*', cflags = '', simflags = ''",
    messages = "Simulation Failed. Model: System does not exist! Please load it first before simulation.",
    timeFrontend = 0.0,
    timeBackend = 0.0,
    timeSimCode = 0.0,
    timeTemplates = 0.0,
    timeCompile = 0.0,
    timeSimulation = 0.0,
    timeTotal = 0.0
end SimulationResult;
""

F:\0000_Apps\MODELICA\Test>pause
Appuyez sur une touche pour continuer...

Could you please guide me how to fix this problem?

The batch file approach and the mos file format without using external files (on a simple test model) works without any issue.  However, with this model, it doesn't work. Maybe there is another way to call the data files? Or any error that I didn't pay attention?

Many thanks in advance

Re: command line error using omc

To me it looks as if there is an issue with the path name using "/" on windows?

Re: command line error using omc

The problem is that you're trying to load .txt models using loadFile. Command loadFile should only be used for .mo files.
Also, the System class doesn't seem to be in the Modelica file you loaded.

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