Error Compiling

7 posts / 0 new
Last post
jbonilla
Offline
Joined: 2010-12-15
Error Compiling

I've installed today JModelica, especially because I want to optimize one of my models, anyway I was trying to compile one model, but the compiling process failed I don't know exactly why, but here it is the error output. It seems that there is a illegal character, but in that line there is no such character.

Thanks in advance.

In [9]: compile_jmu(model_name,mo_file)
---------------------------------------------------------------------------
CompilerError Traceback (most recent call last)

C:\Documents and Settings\All Users\Documentos\JModelica.org\diss\ in ()

C:\JModelica.org-1.4\Python\jmodelica\jmi.pyc in compile_jmu(class_name, file_na
me, compiler, target, compiler_options, compile_to)
5995
5996 #compile model

-> 5997 comp.compile_model(class_name, file_name, target=target)
5998
5999 # pack JMU file

C:\JModelica.org-1.4\Python\jmodelica\compiler.pyc in compile_model(self, model_
class_name, model_file_name, target)
451
452 except jpype.JavaException, ex:
--> 453 self._handle_exception(ex)
454
455 def parse_model(self,model_file_name):

C:\JModelica.org-1.4\Python\jmodelica\compiler.pyc in _handle_exception(self, ex
)
719 errors.append(p)
720
--> 721 raise CompilerError(errors,compliance_errors,warnings)
722
723 if ex.javaClass() is \

CompilerError:
1 error(s), 0 compliance error(s) and 0 warning(s) found:

Error: in file 'DISS_Last.mo':
Lexical error at line 3777, column 26:
Illegal character """

jbonilla
Offline
Joined: 2010-12-15
I solved it, It's seemed

I solved it, It's seemed that there is some problem with the next code, with the first ", omitting the code is enough to solve the problem:

Documentation(info="

Package PartialComponents is part of the ThermoFluid Base Library.
There will be documentation, some time!
<\p>
DISCLAIMER

The Modelica package in its original or in a modified form is provided
\"as is\" and the copyright holder assumes no responsibility for its contents
what so ever. Any express or implied warranties, including, but not
limited to, the implied warranties of merchantability and fitness for a
particular purpose are disclaimed. In no event shall the
copyright holders, or any party who modify and/or redistribute the package,
be liable for any direct, indirect, incidental, special, exemplary, or
consequential damages, arising in any way out of the use of this software,
even if advised of the possibility of such damage.

Copyright (C) 2000-2001, Modelica Association and Department of Automatic Control, Lund.

"),

jbonilla
Offline
Joined: 2010-12-15
Now, I have a more serious

Now, I have a more serious problem compiling:

In [25]: compile_jmu(model_name,mo_file)
---------------------------------------------------------------------------
JError Traceback (most recent call last)

C:\Documents and Settings\All Users\Documentos\JModelica.org\diss\ in ()

C:\JModelica.org-1.4\Python\jmodelica\jmi.pyc in compile_jmu(class_name, file_na
me, compiler, target, compiler_options, compile_to)
5995
5996 #compile model

-> 5997 comp.compile_model(class_name, file_name, target=target)
5998
5999 # pack JMU file

C:\JModelica.org-1.4\Python\jmodelica\compiler.pyc in compile_model(self, model_
class_name, model_file_name, target)
451
452 except jpype.JavaException, ex:
--> 453 self._handle_exception(ex)
454
455 def parse_model(self,model_file_name):

C:\JModelica.org-1.4\Python\jmodelica\compiler.pyc in _handle_exception(self, ex
)
772 raise JError(ex.stacktrace().encode('utf-8'))
773
--> 774 raise JError(ex.stacktrace().encode('utf-8'))
775
776 class OptimicaCompiler(ModelicaCompiler):

JError: java.lang.ArrayIndexOutOfBoundsException: 22
at org.jmodelica.modelica.compiler.ASTNode.getChildNoTransform(ASTNode.j
ava:1322)
at org.jmodelica.modelica.compiler.ASTNode.getChild(ASTNode.java:1267)
at org.jmodelica.modelica.compiler.ASTNode.getChild(ASTNode.java:1261)
at org.jmodelica.modelica.compiler.Array.getFExp(Array.java:483)
at org.jmodelica.modelica.compiler.Array.get(Array.java:207)
at org.jmodelica.modelica.compiler.FExp.cevalArray_compute(FExp.java:128
1)
at org.jmodelica.modelica.compiler.FExp.cevalArray(FExp.java:1266)
at org.jmodelica.modelica.compiler.FExp.ceval_compute(FExp.java:1245)
at org.jmodelica.modelica.compiler.FExp.ceval(FExp.java:1233)
at org.jmodelica.modelica.compiler.InstAssignable.ceval_compute(InstAssignable.java:1359)
at org.jmodelica.modelica.compiler.InstAssignable.ceval(InstAssignable.java:1343)
at org.jmodelica.modelica.compiler.InstComponentAccess.ceval_compute(InstComponentAccess.java:309)
at org.jmodelica.modelica.compiler.InstComponentAccess.ceval(InstComponentAccess.java:284)
at org.jmodelica.modelica.compiler.FInstAccessExp.cevalCalc_compute(FInstAccessExp.java:528)
at org.jmodelica.modelica.compiler.FInstAccessExp.cevalCalc(FInstAccessExp.java:520)
at org.jmodelica.modelica.compiler.FExp.ceval_compute(FExp.java:1246)
at org.jmodelica.modelica.compiler.FExp.ceval(FExp.java:1233)
at org.jmodelica.modelica.compiler.InstAssignable.ceval_compute(InstAssignable.java:1359)
at org.jmodelica.modelica.compiler.InstAssignable.ceval(InstAssignable.java:1343)
at org.jmodelica.modelica.compiler.InstComponentAccess.ceval_compute(InstComponentAccess.java:309)
at org.jmodelica.modelica.compiler.InstComponentAccess.ceval(InstComponentAccess.java:284)
at org.jmodelica.modelica.compiler.InstDot.ceval_compute(InstDot.java:365)
at org.jmodelica.modelica.compiler.InstDot.ceval(InstDot.java:357)
at org.jmodelica.modelica.compiler.FInstAccessExp.cevalCalc_compute(FInstAccessExp.java:528)
at org.jmodelica.modelica.compiler.FInstAccessExp.cevalCalc(FInstAccessExp.java:520)
at org.jmodelica.modelica.compiler.FExp.ceval_compute(FExp.java:1216)
at org.jmodelica.modelica.compiler.FExp.ceval(FExp.java:1203)
at org.jmodelica.modelica.compiler.FExp.checkConstantExpression(FExp.java:186)
at org.jmodelica.modelica.compiler.InstPrimitive.collectErrors(InstPrimitive.java:100)
at org.jmodelica.modelica.compiler.InstNode.collectErrors(InstNode.java:190)
at org.jmodelica.modelica.compiler.InstComponentDecl.collectErrors(InstComponentDecl.java:213)
at org.jmodelica.modelica.compiler.InstNode.collectErrors(InstNode.java:190)
at org.jmodelica.modelica.compiler.InstComponentDecl.collectErrors(InstComponentDecl.java:213)
at org.jmodelica.modelica.compiler.InstNode.collectErrors(InstNode.java:190)
at org.jmodelica.modelica.compiler.InstComponentDecl.collectErrors(InstComponentDecl.java:213)
at org.jmodelica.modelica.compiler.InstNode.collectErrors(InstNode.java:190)
at org.jmodelica.modelica.compiler.InstComponentDecl.collectErrors(InstComponentDecl.java:213)
at org.jmodelica.modelica.compiler.InstNode.collectErrors(InstNode.java:190)
at org.jmodelica.modelica.compiler.InstExtends.collectErrors(InstExtends.java:83)
at org.jmodelica.modelica.compiler.InstNode.collectErrors(InstNode.java:193)
at org.jmodelica.modelica.compiler.InstBaseClassDecl.collectErrors(InstBaseClassDecl.java:45)
at org.jmodelica.modelica.compiler.InstFullClassDecl.collectErrors(InstFullClassDecl.java:78)
at org.jmodelica.modelica.compiler.ASTNode.errorCheck(ASTNode.java:220)
at org.jmodelica.modelica.compiler.InstProgramRoot.checkErrorsInInstClass(InstProgramRoot.java:91)
at org.jmodelica.modelica.compiler.ModelicaCompiler.instantiateModel(ModelicaCompiler.java:628)
at org.jmodelica.modelica.compiler.ModelicaCompiler.compileModel(ModelicaCompiler.java:476)

hubertus
Offline
Joined: 2009-04-24
Old Modelica Version

Dear jbonilla,

The code you are trying to use, the old ThermoFluid Library, was written by me about 10 years ago and is using Modelica version 1.6. JModelica.org is implementing Modelica 3.1, and between Modelica 2.2 and Modelica 3.0, there have been major changes in the language. I think that this old code needs a major overhaul before it can be used. Furthermore, the model where not really written with dynamic optimization in mind (though they might work, if sufficiently simple models are used).

I recommend to extract the models that you really want to use, make sure they are fully updated to Modelica 3.1 (maybe using Dymola, if you have access to it, because Dymola has a compiler that supports older Modelica versions), and then try again.

Best regards,

Hubertus

jbonilla
Offline
Joined: 2010-12-15
Dear Tummescheit, Thank you

Dear Tummescheit,

Thank you for your soon reply.

We use some models from your ThermoFluid library as base models, to develop solar thermal power plant models, because they work great. Presently, I am still stuck in the Modelica version 2.2.1 using Dymola 6.0b. The Library version 1.6 is automatically converted to version 2.2.1 by the Dymola tool and it works fine.

Luckily, my institution is in the process of acquiring new Dymola licenses so I hope that shorty I will be able to try to update the needed models to the new Modelica version 3.1.

The aim of the use of JModelica was mainly for using Optimica, because I was wondering if it could be possible to perform parameter optimizations on some of our models.

Thank you very much again and I will follow your advice as soon as we have the new Dymola licenses.

Best Regards,
Javier.

jmattsson
Offline
Joined: 2009-10-18
Hi Could you post or send

Hi
 
Could you post or send us your model? (Or perhaps another model that gives the same error?)
Even though it is likely that it isn't valid Modelica 3 code, you should get an error message, not an exception.
 
I think the first problem could be a character encoding issue - all Modelica files should be encoded in UTF-8.
 
Jesper

jbonilla
Offline
Joined: 2010-12-15
Hello Jesper, The code that

Hello Jesper,

The code that throws the exception is the first ", as mentioned in a previous post. And you are right, the file encoding is not UTF-8, it is ISO 8859-15 (also called Latin-9). If you still need the model code let me know.

Thanks,
Javier Bonilla.

Login or register to post comments