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
  • » AlphaOmega
  • » Profile

Posts

Posts

Jul-28-16 14:17:50
How to read OMC's failtrace outputs?

Hello to all,

I'm having a "flattening" problem with no hints from the Modelica compiler when I try to simulate my model.  It's actually a model I got out of a presentation, and I was just trying it out.  I found a couple of problems and fixed them (related to the math), but I still get this "flattening" error.  I've tried all sorts of simplifications, one by one, to see if anything would get me around this problem, but no luck, and Modelica just seems to be sitting there like the Cheshire cat.  Here's the model:

block StateSpace
        parameter Real A[:, :];
    parameter Real B[size(A,1), :];
    parameter Real C[:, size(A,2)];
    parameter Real D[size(C,1), size(B,2)] = zeros(size(C,1), size(B,2));
    input    Real u[size(B,2)];
    output   Real y[size(C,1)];
   
    protected
        Real x[size(A,2)];
    equation
        assert( size(A,1) == size (A,2), "Matrix A must be square.");
        der(x) = A*x + B*u;
        y      = C*x + D*u;
end StateSpace;

block TestSS
    StateSpace S(A=[1,2; 3,4], B=[0;1], C=[1,1]);
equation
    S.u = sin(time);
end TestSS;

Here's the result of simulate(StateSpace, stopTime=5):

>> simulate(StateSpace, stopTime=5)
record SimulationResult
    resultFile = "",
    simulationOptions = "startTime = 0.0, stopTime = 5.0, numberOfIntervals = 500, tolerance = 1e-006, method = 'dassl', fileNamePrefix = 'StateSpace', options = '', outputFormat = 'mat', variableFilter = '.*', cflags = '', simflags = ''",
    messages = "Failed to build model: StateSpace",
    timeFrontend = 0.0,
    timeBackend = 0.0,
    timeSimCode = 0.0,
    timeTemplates = 0.0,
    timeCompile = 0.0,
    timeSimulation = 0.0,
    timeTotal = 0.0
end SimulationResult;
Error: Error occurred while flattening model StateSpace

I'm using OMShell 1.1 conected to OpenModelica v1.9.6.

Any help would be appreciated. 

Thanks, AlphaOmega

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