- Index
- » Programming
- » Modelica Language
- » Further problems with simple models
Further problems with simple models
Further problems with simple models
Hi,
I'm having further problems getting a simple model to run correctly. I'm trying to duplicate a simple model shown in the Modelica User's guide: http://modelica.github.io/Modelica/help … orldForce. I've set all of the parameters just as the example shows. Upon trying to simulate I get 3 error messages: 1) "Type mismatch in binding k={-800,400,0}, expected subtype of Real(start=10), got type Integer [3]" 2) "Error occurred while flattening model wecpart" 3) same as 1) above. I've attached the model.
I thought we had to stipulate that the force has 3 components as indicated by the 3 component vector for k. Is this not correct? Not sure why I'm getting this error message when it's exactly the example given.
Any help would be most appreciated. Thankyou.
Re: Further problems with simple models
The error is correct, const.k is a scalar, so of course you can't give it a vector as value. You need to make const a vector to make it work:
Modelica.Blocks.Sources.Constant const[3](k = {-800,400,0});
You also need to change the first connect equation to connect the whole arrays:
connect(const.y,force.force[1]);
- perost
- 114 Posts
- Index
- » Programming
- » Modelica Language
- » Further problems with simple models