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

Too many equations, overdetermined system

Too many equations, overdetermined system

Hi All,

I am tyring to write a Modelica code and I have this error "Too many equations, overdetermined system.The model has 126 equation(s) and 26 variable(s)". My code is;

model basisFunction
  parameter Integer sn=5 "The number of the points in each axis";
  parameter Integer i=1;
  parameter Integer j=1;
  parameter Real c[2,1]=[0.1; 0.2];
  parameter Real theta_r[sn]=linspace(-0.02,0.02,sn) "Generates sn values for position";
  parameter Real theta_p[sn]=linspace(-0.1,0.1,sn)   "Generates sn values for velocity";
  parameter Real s[1,2]=[(theta_r[2]-theta_r[1])/1.7, (theta_p[2]-theta_p[1])/1.7]    "Determine the size of the basis function";
  parameter Real bFunc[sn*sn]=fill(1,sn*sn);
  input Real x[2,1]=[0.01; 0.09];
  output Real bPen[sn*sn]=fill(1,sn*sn);
  // Calculate the basis function response
    equation
    for i in 1:size(theta_r,1) loop
      for j in 1:size(theta_p,1) loop
        c=[theta_r[i]; theta_p[j]]  "Centre of each basis";
        bFunc[(i-1)*size(theta_r,1)+j]=scalar(exp(-((1.0./(s)).^2)*((x-c).^2)));
      end for;
    end for;
    bPen=bFunc/sum(bFunc);
    end basisFunction;

if you are able to help me, I will be very pleased. Also if you know how I can plot "bPen" here, please let me know...

Best

Re: Too many equations, overdetermined system

Hi,

You need to learn some Modelica!
Read the tutorial form here:
https://www.openmodelica.org/index.php/ … umentation

Then at least read the Modelica specification:
https://www.modelica.org/documents/Mode … ision1.pdf

As far as I can tell your "model" is not a model, is a function and the equation is an algorithm.

Cheers,
Adrian Pop/

Re: Too many equations, overdetermined system

Thanks Adrian, I looked at those documents before and this is my first algorithm in Modelica. I initially wrote it as a function with algorithm but I am trying to generate a "Modelica Custom Component" for a MapleSim application; hence I am just trying to adapt it into MapleSim.

Thanks for your suggestions...

There are 0 guests and 0 other users also viewing this topic
You are here: