Hello, I need some help with drawing xcos program to give me graphs of system reacting when specific starting force is aplied.
I am trying to do this problem for 2 days and I am getting algebraic loop error.
I need your help!
Thanks
Hello,
This only doable with a Modelica block because the system is not an ode but a dae (differential algebraic equation). Here is the zcos file of Xcos diagram below (\phi is red and x_V is blue in the screenshot): cart.zcos (3.6 KB)
The most interesting part is the Modelica script (which is in the last dialog of the block).
class cart
//parameters
Real x_V ;
Real v_V ;
Real phi ;
Real omega ;
parameter Real m_V;
parameter Real m_N;
parameter Real l ;
parameter Real g ;
//input variables
Real F;
//output variables
Real xval,phival;
equation
xval = x_V;
phival = phi;
(m_V+m_N)*der(v_V)-m_N*l*der(omega)*cos(phi)+m_N*l*omega^2*sin(phi)=F;
l*der(omega)-der(v_V)*cos(phi)=g*sin(phi);
der(phi)=omega;
der(x_V)=v_V;
end cart;
Status of variables (parameters ,states, inputs or outputs) is set in the first dialogs of the block
![Screenshot 2024-01-25 at 15.10.35](https://canada1.discourse-cdn.com/free1/uploads/utc/original/1X/1867e407a00c12deb724737458eee71e251fe5d0.png)
When not in a local file the script is entered in the last dialog:
S.