Opened 11 years ago

Closed 20 months ago

#2501 closed defect (fixed)

Cannot solve linear system

Reported by: massimo ceraolo Owned by: Willi Braun
Priority: high Milestone: Future
Component: Backend Version: trunk
Keywords: Cc: Lennart Ochel

Description (last modified by Martin Sjölund)

The model I enclose creates a C code that OMEdit (r18411) shows to be incorrect in some points (red messages).
Then the generated code does not produce a valid result.

Steps to reproduce the problem:
1) load "pmwpulser.mo"
2) load and run "InvTrifNotWorking.mo"
3) (in OMEdit) look at the red text in the compilation tab in the simulation output window.

I reproduce hereafter the contents of my compilation window.
I added blank rows to put in evidence the text that appears red in OMEdit.
MC

"C:\OpenModelica1.9.1Nightly\\MinGW\bin\mingw32-make.exe" -f invTrifNotWorking.makefile
gcc   -falign-functions -msse2 -mfpmath=sse    -I"C:/OpenModelica1.9.1Nightly//include/omc" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o invTrifNotWorking.o invTrifNotWorking.c
************************************************************
invTrifNotWorking.c:1893: warning: initialization from incompatible pointer type
************************************************************
gcc   -falign-functions -msse2 -mfpmath=sse    -I"C:/OpenModelica1.9.1Nightly//include/omc" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o invTrifNotWorking_functions.o invTrifNotWorking_functions.c
gcc   -falign-functions -msse2 -mfpmath=sse    -I"C:/OpenModelica1.9.1Nightly//include/omc" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o invTrifNotWorking_records.o invTrifNotWorking_records.c
gcc   -falign-functions -msse2 -mfpmath=sse    -I"C:/OpenModelica1.9.1Nightly//include/omc" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o invTrifNotWorking_01exo.o invTrifNotWorking_01exo.c
gcc   -falign-functions -msse2 -mfpmath=sse    -I"C:/OpenModelica1.9.1Nightly//include/omc" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o invTrifNotWorking_02nls.o invTrifNotWorking_02nls.c
gcc   -falign-functions -msse2 -mfpmath=sse    -I"C:/OpenModelica1.9.1Nightly//include/omc" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o invTrifNotWorking_03lsy.o invTrifNotWorking_03lsy.c
gcc   -falign-functions -msse2 -mfpmath=sse    -I"C:/OpenModelica1.9.1Nightly//include/omc" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o invTrifNotWorking_04set.o invTrifNotWorking_04set.c
gcc   -falign-functions -msse2 -mfpmath=sse    -I"C:/OpenModelica1.9.1Nightly//include/omc" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o invTrifNotWorking_05evt.o invTrifNotWorking_05evt.c
************************************************************
invTrifNotWorking_05evt.c: In function 'invTrifNotWorking_zeroCrossingDescription':
invTrifNotWorking_05evt.c:91: warning: assignment discards qualifiers from pointer target type
************************************************************
gcc   -falign-functions -msse2 -mfpmath=sse    -I"C:/OpenModelica1.9.1Nightly//include/omc" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o invTrifNotWorking_06inz.o invTrifNotWorking_06inz.c
gcc   -falign-functions -msse2 -mfpmath=sse    -I"C:/OpenModelica1.9.1Nightly//include/omc" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o invTrifNotWorking_07dly.o invTrifNotWorking_07dly.c
gcc   -falign-functions -msse2 -mfpmath=sse    -I"C:/OpenModelica1.9.1Nightly//include/omc" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o invTrifNotWorking_08bnd.o invTrifNotWorking_08bnd.c
gcc   -falign-functions -msse2 -mfpmath=sse    -I"C:/OpenModelica1.9.1Nightly//include/omc" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o invTrifNotWorking_09alg.o invTrifNotWorking_09alg.c
gcc   -falign-functions -msse2 -mfpmath=sse    -I"C:/OpenModelica1.9.1Nightly//include/omc" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o invTrifNotWorking_10asr.o invTrifNotWorking_10asr.c
gcc   -falign-functions -msse2 -mfpmath=sse    -I"C:/OpenModelica1.9.1Nightly//include/omc" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o invTrifNotWorking_11mix.o invTrifNotWorking_11mix.c
gcc   -falign-functions -msse2 -mfpmath=sse    -I"C:/OpenModelica1.9.1Nightly//include/omc" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o invTrifNotWorking_12jac.o invTrifNotWorking_12jac.c
gcc   -falign-functions -msse2 -mfpmath=sse    -I"C:/OpenModelica1.9.1Nightly//include/omc" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o invTrifNotWorking_13opt.o invTrifNotWorking_13opt.c
gcc   -falign-functions -msse2 -mfpmath=sse    -I"C:/OpenModelica1.9.1Nightly//include/omc" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME  -c -o invTrifNotWorking_14lnz.o invTrifNotWorking_14lnz.c
gcc -I. -o invTrifNotWorking.exe invTrifNotWorking.o invTrifNotWorking_functions.o invTrifNotWorking_records.o invTrifNotWorking_01exo.o invTrifNotWorking_02nls.o invTrifNotWorking_03lsy.o invTrifNotWorking_04set.o invTrifNotWorking_05evt.o invTrifNotWorking_06inz.o invTrifNotWorking_07dly.o invTrifNotWorking_08bnd.o invTrifNotWorking_09alg.o invTrifNotWorking_10asr.o invTrifNotWorking_11mix.o invTrifNotWorking_12jac.o invTrifNotWorking_13opt.o invTrifNotWorking_14lnz.o -I"C:/OpenModelica1.9.1Nightly//include/omc" -I.  -DOPENMODELICA_XML_FROM_FILE_AT_RUNTIME      -falign-functions -msse2 -mfpmath=sse    -L"C:/OpenModelica1.9.1Nightly//lib/omc" -L"C:/OpenModelica1.9.1Nightly//lib" -Wl,--stack,0x2000000,-rpath,"C:/OpenModelica1.9.1Nightly//lib/omc" -Wl,-rpath,"C:/OpenModelica1.9.1Nightly//lib"  -lregex -lexpat -lgc -lpthread -fopenmp -loleaut32  -lSimulationRuntimeC -lgc -lexpat -lregex -static-libgcc -luuid -loleaut32 -lole32 -lws2_32 -lsundials_kinsol -lsundials_nvecserial -lipopt -lcoinmumps -lcoinmetis -lpthread -lm -lgfortranbegin -lgfortran -lmingw32 -lgcc_eh -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -llapack-mingw -ltmglib-mingw -lblas-mingw -lf2c -linteractive -lwsock32 -llis -lstdc++
/tmp/OpenModelica/OMEdit/invTrifNotWorking -port=52829 -w -lv=LOG_STATS
stdout            | warning | Failed to solve linear system of equations (no. 146) at time 0.000000, system is singular for U[20, 20].
LOG_LS            | warning | linear system fails: Linear function (index 146, size 24) at t=0
|                 | |       | | [1] upSW.idealOpeningSwitch[1].v
|                 | |       | | [2] upSW.idealOpeningSwitch[1].s
|                 | |       | | [3] upSW.i[1]
|                 | |       | | [4] upSW.idealOpeningSwitch[2].v
|                 | |       | | [5] upSW.idealOpeningSwitch[2].s
|                 | |       | | [6] upSW.i[2]
|                 | |       | | [7] Rf.plug_p.pin[2].v
|                 | |       | | [8] Rf.plug_p.pin[1].v
|                 | |       | | [9] star.pin_n.v
|                 | |       | | [10] downSW.idealOpeningSwitch[3].v
|                 | |       | | [11] downSW.idealOpeningSwitch[3].s
|                 | |       | | [12] downSW.i[3]
|                 | |       | | [13] V1.i
|                 | |       | | [14] upSW.i[3]
|                 | |       | | [15] upSW.idealOpeningSwitch[3].s
|                 | |       | | [16] upSW.idealOpeningSwitch[3].v
|                 | |       | | [17] Rf.plug_p.pin[3].v
|                 | |       | | [18] downSW.idealOpeningSwitch[1].v
|                 | |       | | [19] star1.pin_n.v
|                 | |       | | [20] downSW.idealOpeningSwitch[2].v
|                 | |       | | [21] downSW.idealOpeningSwitch[2].s
|                 | |       | | [22] downSW.i[2]
|                 | |       | | [23] downSW.i[1]
|                 | |       | | [24] downSW.idealOpeningSwitch[1].s
stdout            | warning | Failed to solve linear system of equations (no. 230) at time 0.000000, system is singular for U[21, 21].
stdout            | warning | Error in initialization. Storing results and exiting.
|                 | |       | Use -lv=LOG_INIT -w for more information.
Simulation process exited with code 255

Attachments (2)

PwmPulser.mo (4.4 KB ) - added by massimo ceraolo 11 years ago.
invTrifNotWorking.mo (4.8 KB ) - added by massimo ceraolo 11 years ago.

Download all attachments as: .zip

Change History (16)

by massimo ceraolo, 11 years ago

Attachment: PwmPulser.mo added

by massimo ceraolo, 11 years ago

Attachment: invTrifNotWorking.mo added

comment:1 by Martin Sjölund, 11 years ago

Description: modified (diff)

comment:2 by Martin Sjölund, 11 years ago

Description: modified (diff)
Owner: changed from probably noone to Willi Braun
Status: newassigned
Summary: OM creates incorrect C code? (r18411)Cannot solve linear system

There should be no warnings in r18427. But it also won't help with your problem since it is related to a singular linear system being generated.

comment:3 by massimo ceraolo, 11 years ago

Ah, ok. I hoped it was a much simpler issue.
Just in case it may help, I can tell that the model should be ok: it runs good in Dymola.

comment:4 by Lennart Ochel, 11 years ago

Cc: Lennart Ochel added

comment:5 by Martin Sjölund, 10 years ago

Milestone: 1.9.11.9.2

This ticket was not closed for 1.9.1, which has now been released. It was batch modified for milestone 1.9.2 (but maybe an empty milestone was more appropriate; feel free to change it).

comment:6 by Martin Sjölund, 10 years ago

Milestone: 1.9.21.9.3

Milestone changed to 1.9.3 since 1.9.2 was released.

comment:7 by Martin Sjölund, 9 years ago

Milestone: 1.9.31.9.4

Moved to new milestone 1.9.4

comment:8 by Martin Sjölund, 9 years ago

Milestone: 1.9.41.9.5

Milestone pushed to 1.9.5

comment:9 by Martin Sjölund, 9 years ago

Milestone: 1.9.51.10.0

Milestone renamed

comment:10 by Martin Sjölund, 8 years ago

Milestone: 1.10.01.11.0

Ticket retargeted after milestone closed

comment:11 by Martin Sjölund, 8 years ago

Milestone: 1.11.01.12.0

Milestone moved to 1.12.0 due to 1.11.0 already being released.

comment:12 by Francesco Casella, 7 years ago

Milestone: 1.12.0Future

The milestone of this ticket has been reassigned to "Future".

If you think the issue is still valid and relevant for you, please select milestone 1.13.0 for back-end, code generation and run-time issues, or 2.0.0 for front-end issues.

If you are aware that the problem is no longer present, please select the milestone corresponding to the version of OMC you used to check that, and set the status to "worksforme".

In both cases, a short informative comment would be welcome.

comment:13 by massimo ceraolo, 20 months ago

This ticket is very old, and does not apply anymore to more recent versions of OM.
Please close it as fixed.

comment:14 by Adrian Pop, 20 months ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.