Opened 11 years ago
Closed 10 years ago
#2614 closed defect (fixed)
import mat-files for initialization
Reported by: | Lennart Ochel | Owned by: | Lennart Ochel |
---|---|---|---|
Priority: | high | Milestone: | 1.9.1 |
Component: | Run-time | Version: | trunk |
Keywords: | Cc: |
Description
Currently, it is not possible to import mat-files for initialization purpose generated by OpenModelica:
loadString(" model test Real x(start=2, fixed=true); equation der(x) = 0; end test; "); geterrorString(); simulate(test); getErrorString(); simulate(test, simflags="-iif=test_res.mat"); getErrorString();
Output:
Simulation execution failed for model: test assert | debug | unable to read input-file <test_res.mat> [Too few rows in data_2 matrix]
Change History (5)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I added the following error message in r19557:
Simulation execution failed for model: test LOG_INIT | error | It is not possible to import the current result file <test_res.mat> for the initialization. stdout | warning | Error in initialization. Storing results and exiting. | | | | Use -lv=LOG_INIT -w for more information.
comment:3 by , 10 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Sorry to reopen a closed report.
The fix in r19557 only checks for modelFilePrefix+"_res.mat" but does not check for when the result file is redirected with the -r flag. If you are redirecting the result file then there (probably) isn't a reason you cannot read from a result file with the same name as the model.
Also, the error message is confusing. It would be nice if it also described how to fix the problem. How about "Cannot import a result file for initialization that is also the current output file. Consider redirecting the output result file <-r new_res.mat> or renaming the result file that is used for initialization import."
comment:4 by , 10 years ago
Status: | reopened → accepted |
---|
comment:5 by , 10 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
Thank you for this helpful comment. I improved this in r22413.
Actually, it is not a bug, but a restriction. We cannot read and write to the same file. I will add a warning for that.