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
  • Index
  • » Users
  • » aeismail
  • » Profile

Posts

Posts

Aug-30-11 19:51:45
Error: Class SI.Pressure not found in scope A while instantiating p.
Category: Programming

NOTE: ANSWER FOUND. The problem was that I failed to load the Modelica library in the shell. Any reason why this needs to be manually done, instead of done automatically on startup?

Hello, all:

I'm trying to use OpenModelica on OS X (Snow Leopard), and just downloaded the 1.7.0 release from the website. I've tried using a simple example in the Notebook:

Code:

package Examples

 
  model SimplePendulum
  import Modelica.Math.*;
  import SI = Modelica.SIunits;
   
  // type Angle = Real (
  //    final quantity="Angle",
  //    final unit="rad",
  //    displayUnit="deg");
  // type AngularVelocity = Real (
  //    final quantity="AngularVelocity",
  //    final unit="rad/s",
  //    displayUnit="rev/min");
    parameter Real L = 2;
    constant Real g = 9.81;
    SI.Angle phi(start=2, fixed=true);
    SI.AngularVelocity omega;
  equation
    der(phi) = omega;
    der(omega) = -(g/L) * sin(phi);
  end SimplePendulum;
 
end Examples;

Now, if I delete the import SI line and remove the comments from the type definitions and the "SI." in front of the "Angle" and "AngularVelocity" definitions, everything works as expected. However, if I leave the import SIunits statement in place, the simulation crashes, and gives me the following message:

Code:

[[/Users/aei/Documents/workspace/Modelica/SimplePendulum.mo:17:5-17:38:writable] Error: Class SI.Angle not found in scope Examples.SimplePendulum while instantiating phi.

Error: Error occured while flattening model Examples.SimplePendulum
[/Users/aei/Documents/workspace/Modelica/SimplePendulum.mo:17:5-17:38:writable] Error: Class SI.Angle not found in scope Examples.SimplePendulum while instantiating phi.
Error: Error occured while flattening model Examples.SimplePendulum

I've tried looking through the previous messages, and can't seem to find anything related to problems with importing SIunits. (Note that the import Modelica.Math command appears to work correctly.)

Any ideas what could be going wrong here?

Thanks,

--AEI

  • Index
  • » Users
  • » aeismail
  • » Profile
You are here: