- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Custom packages: Failed to insert...
Custom packages: Failed to insert class ... within ...
Custom packages: Failed to insert class ... within ...
Hi.
I like to structure my Modelica classes hierarchically and in separate files.
So I created a new folder "C:\WSNmodel\" which contains:
package.mo:
Code:
within ;
package WSNmodel
"Wireless Sensor Node root package";
extends Modelica.Icons.Package;
end WSNmodel;
and
SolarCellTest.mo:
Code:
within WSNmodel;
model SolarCellTest
...
equation
...
end SolarCellTest;
(This is the very first step and additional subfolders with their package.mo will follow in the future)
When I open SolarCellTest.mo it says:
Code:
[:0:0-0:0] Error: Failed to insert class SolarCellTest within WSNmodel;
the available classes were:
Modelica.SIunits.ComplexPower
Modelica.SIunits.ComplexAdmittance
Modelica.SIunits.ComplexImpedance
Modelica.SIunits.ComplexReluctance
Modelica.SIunits.ComplexMagneticFlux
Modelica.SIunits.ComplexMagneticFluxDensity
Modelica.SIunits.ComplexMagnetomotiveForce
Modelica.SIunits.ComplexMagneticPotentialDifference
Modelica.SIunits.ComplexMagneticPotential
Modelica.SIunits.ComplexMagneticFieldStrength
Modelica.SIunits.ComplexElectricFlux
Modelica.SIunits.ComplexElectricFluxDensity
... [all MSL classes]
I already added the path "C:\WSNmodel\" to MODELICAPATH
and in OMEdit in Tools->Options->Libs->Custom.
When I try it with Wolfram SystemModeler it says:
Code:
No top level Modelica classes found in the file SolarCellTest.mo
Another issue is, when I open package.mo it says:
Code:
No viable alternative near token: ;
What is going on here???
Thanks!
Re: Custom packages: Failed to insert class ... within ...
Remove the ; after the class comment.
- sjoelund.se
- 1700 Posts
Re: Custom packages: Failed to insert class ... within ...
Hi sjoelund.se!
Thanks for your quick response!
What do you mean with "class comment"?
I tried to remove the ";" on different positions - other error occure like:
Error: No viable alternative near token: WSNmodel
or
Error: Parser error: Unexpected token near: (<EOF>)
In all examples I have studied, the ";" is written as I did it.
So it seems, that there is another issue.
Best Regards
Jan
Re: Custom packages: Failed to insert class ... within ...
Code:
within ;
package WSNmodel
"Wireless Sensor Node root package" /* No semicolon is allowed here! */
extends Modelica.Icons.Package;
end WSNmodel;
- sjoelund.se
- 1700 Posts
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Custom packages: Failed to insert...