- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Overconstrained model.

## Overconstrained model.

### Overconstrained model.

Hi,

Can somebody of the community help me with an issue I have with a simple motor model.

When I instantiate the model with OMEdit, it forces torque equation to zero. This issue rise only when I use connectors.

Many thanks.

David

Rotor.tau = 0.0;//?

Stator.tau = 0.0;//?

The resulting failure is that I end with too much equations. Below is the full model and the instantiated model.

Model as written:

**Edited by:**Supaswing - Dec-04-13 18:35:26

### Re: Overconstrained model.

I did others model and I have always the same issue using connector type Flange, flattening of the model add an equation xxx.tau=0.0 even if I try to impose another equation.

I am stuck on this problem and I would really appreciate some help

### Re: Overconstrained model.

Well, you have Friction1.tau = 0; Friction2.tau = 0; in the model, so I don't see what the problem is.

- sjoelund.se
- 1700 Posts

### Re: Overconstrained model.

I'm unfortunately not a modeler and can't tell you exactly how to fix your model, but I can try to explain how connectors work in Modelica. In Modelica you have the concept of outside and inside connectors. Outside connectors are connectors declared in the same scope as the connection (or in connectors in that scope), while inside connectors are declared in a non-connector component. For example:

#### Code:

connector Flange

flow Real tau;

Real theta;

end Flange;

model M1

Flange f1;

end M1;

model M2

M1 m1;

Flange f2;

equation

connect(m1.f1, f2); // m1.f1 is an inside connector because f1 is declared inside non-connector component m1,

// f2 is an outside connector because it's declared in the same scope as this connect equation.

end M2;

Zero-equations are automatically generated for flow-variables in connector components which have not been connected as inside. In my example above you would get an equation "f2.tau = 0.0", because f2.tau has not been connected as inside, only outside. This is done to make sure that models are balanced, and if your model becomes unbalanced because of these extra equations it means that your model most likely has some issues. You probably need to remove the zero-equations you've added yourself for those flow-variables, and connect your motor to some other components to make it work correctly.

- perost
- 114 Posts

### Re: Overconstrained model.

I could make it work. Thank you

It was a bad understanding of connectors. You can't have connection inside a model. The working model below:

#### Code:

model Motor_simple

Rotor1 Rot;

Stator1 Stat;

Friction1 F1;

Friction1 F2;

Speed w;

Angle theta;

initial equation

der(w) = 0;

//steadystate

equation

Rot.c.theta - Stat.c.theta = theta;

w = der(theta);

connect(Rot.c,F1.c);

connect(Stat.c,F2.c);

end Motor_simple;

- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » Overconstrained model.