onder

50 Reputation

8 Badges

13 years, 318 days

MaplePrimes Activity


These are replies submitted by onder

Thanks Joe. Where do I need to save this modelica file to get this flattener error message? Suppose it should be somewhere in MapleSim, hence I tried to import modelica option in file menu of MapleSim, but it did not work.

I tried to test this model in Modelica and I have this error; "Too many equations, overdetermined system". Also a developer from modelica forum informed me that there is a bug in the modelica which causes problem with matrix/scalar division and he has been trying to fix this problem.Do you think this will affect our model generated by Modelica Custom Component?

Thanks for your help...

This is the modelica file for this error message;

model basisFunction
  parameter Real phi = 0.01;
  parameter Real omega = 0.1;
  parameter Integer sn = 5 "The number of samples in each axist";
  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];
  Real c[2,1] = fill(1, 2, 1) "Centre of each basis";
  Real bFunc[sn * sn] = fill(1, sn * sn) "The basis function";
  Real bPen[sn * sn] = fill(0, sn * sn) "The normalized output for the basis function";
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]];
      bFunc[(i - 1) * size(theta_r, 1) + j] = scalar(exp(-(1.0 ./ s) .^ 2 * ([phi;omega] - c) .^ 2));
     end for;
  end for;
  bPen = bFunc / sum(bFunc);
end basisFunction;

Thanks Joe. Where do I need to save this modelica file to get this flattener error message? Suppose it should be somewhere in MapleSim, hence I tried to import modelica option in file menu of MapleSim, but it did not work.

I tried to test this model in Modelica and I have this error; "Too many equations, overdetermined system". Also a developer from modelica forum informed me that there is a bug in the modelica which causes problem with matrix/scalar division and he has been trying to fix this problem.Do you think this will affect our model generated by Modelica Custom Component?

Thanks for your help...

This is the modelica file for this error message;

model basisFunction
  parameter Real phi = 0.01;
  parameter Real omega = 0.1;
  parameter Integer sn = 5 "The number of samples in each axist";
  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];
  Real c[2,1] = fill(1, 2, 1) "Centre of each basis";
  Real bFunc[sn * sn] = fill(1, sn * sn) "The basis function";
  Real bPen[sn * sn] = fill(0, sn * sn) "The normalized output for the basis function";
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]];
      bFunc[(i - 1) * size(theta_r, 1) + j] = scalar(exp(-(1.0 ./ s) .^ 2 * ([phi;omega] - c) .^ 2));
     end for;
  end for;
  bPen = bFunc / sum(bFunc);
end basisFunction;

Thanks Joe, but I am afraid the same error continues. I do not know what this error implies "Attempted to retrieve property of unknown component Component name". Please could you have a look at the code below for me? Thanks...

model basisFunction
    extends Maplesoft.Icons.CustomComponent;
    parameter Real phi, omega "Position and velocity";
    parameter Real bPen[sn*sn] "The normalized output for the basis function";
    parameter Integer sn=5 "The number of samples in each axist";
    parameter Real c[2,1] "Centre of each basis";
    parameter Real bFunc[sn*sn] "The basis function";
    parameter Real theta_r=linspace(-0.02,0.02,sn) "Generates sn values for position";
    parameter Real theta_p=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];
    Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_a annotation (Placement(transformation(
        extent = {
            {-110, 32},
            {-90, 52}},
        rotation = 0)));
    Modelica.Blocks.Interfaces.RealOutput bPen[sn*sn] annotation (Placement(transformation(
        extent = {
            {90, -13},
            {110, 7}},
        rotation = 0)));
equation
    phi =flange_a.phi;
    omega=der(phi);
    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]];
          bFunc[(i-1)*size(theta_r,1)+j]=scalar(exp(-((1.0./s).^2)*([phi; omega]-c).^2));
       end for;
    end for;
    bPen=bFunc/sum(bFunc);
    annotation (uses(Modelica(version = "3.1")));
end basisFunction;

Thanks Joe, but I am afraid the same error continues. I do not know what this error implies "Attempted to retrieve property of unknown component Component name". Please could you have a look at the code below for me? Thanks...

model basisFunction
    extends Maplesoft.Icons.CustomComponent;
    parameter Real phi, omega "Position and velocity";
    parameter Real bPen[sn*sn] "The normalized output for the basis function";
    parameter Integer sn=5 "The number of samples in each axist";
    parameter Real c[2,1] "Centre of each basis";
    parameter Real bFunc[sn*sn] "The basis function";
    parameter Real theta_r=linspace(-0.02,0.02,sn) "Generates sn values for position";
    parameter Real theta_p=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];
    Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_a annotation (Placement(transformation(
        extent = {
            {-110, 32},
            {-90, 52}},
        rotation = 0)));
    Modelica.Blocks.Interfaces.RealOutput bPen[sn*sn] annotation (Placement(transformation(
        extent = {
            {90, -13},
            {110, 7}},
        rotation = 0)));
equation
    phi =flange_a.phi;
    omega=der(phi);
    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]];
          bFunc[(i-1)*size(theta_r,1)+j]=scalar(exp(-((1.0./s).^2)*([phi; omega]-c).^2));
       end for;
    end for;
    bPen=bFunc/sum(bFunc);
    annotation (uses(Modelica(version = "3.1")));
end basisFunction;

Hi Joe,

Thank you so much for your help. I really appreciated it. Now I am able to reinitialize both the position and velocity of the pendulum based on the position value.

My learning/control algorithm is discrete and the model (which is pendulum for this case) must be linear and discrete. I use the "Custom Discrete State Space" and "Linearization" components. Does these mean that the model is linear and discrete now and the position/velocity sensor measurements that I obtained are discrete as well. They seem to me not...

Please let me know your suggestions...

Thanks

Hi Joe,

Thank you so much for your help. I really appreciated it. Now I am able to reinitialize both the position and velocity of the pendulum based on the position value.

My learning/control algorithm is discrete and the model (which is pendulum for this case) must be linear and discrete. I use the "Custom Discrete State Space" and "Linearization" components. Does these mean that the model is linear and discrete now and the position/velocity sensor measurements that I obtained are discrete as well. They seem to me not...

Please let me know your suggestions...

Thanks

1 2 3 Page 3 of 3