Opened 12 years ago
Last modified 11 years ago
#2455 closed defect
"mixed system involving complex equation" — at Version 1
| Reported by: | Owned by: | ||
|---|---|---|---|
| Priority: | blocker | Milestone: | 1.9.1 |
| Component: | Backend | Version: | trunk |
| Keywords: | Cc: |
Description (last modified by )
Hello,
I am using OMEdit and I wrote a component which should simulate a 1-D mass with friction on a moveable ground.
The friction is included by the mean of stribeck-friction.
Depending on the frictionstate (slip, stick) the friction force and the accerlation of both masses are calculated in the equation part as follows:
if frictionMode == Stick then
Ffric = flange_a.f - (flange_a.f + flange_b.f) / (mA + mB) * mA;
aA = (flange_a.f + flange_b.f + g * (mA + mB)) / (mA + mB);
aB = (flange_a.f + flange_b.f + g * (mA + mB)) / (mA + mB);
elseif frictionMode == StartSlip then
Ffric = Fc * sign(deltav) + vis * deltav + sticktionForce * exp(-stribeckFactor * abs(deltav)) * sign(deltav);
aA = (flange_a.f - Ffric + g * mA) / mA;
aB = (flange_b.f + Ffric + g * mB) / mB;
When I simulate the model I get the message that my model contains a mixed system involving algorithms or other complex-equations.
I think it's a rather easy component and not very complex algorithm included.
I'm rather sure that this lines make im stop simulate because I tested the model without them and it worked.
I hope you can help me to solve my problem.
Thank you for your help.
Complete model:
model TwoMassFriction
import SI = Modelica.SIunits;
extends Modelica.Mechanics.Translational.Interfaces.PartialTwoFlanges;
// FUNCTION FOR STRIBECKFACTOR
function stribeckFunction
// INPUTS
input Real sticktionForce;
input Real vis;
input Real vh;
// OUTPUTS
output Real stribeckFactor;
algorithm
if not sticktionForce == 0 then
if not vis == 0 then
stribeckFactor:=-log(vis * vh / sticktionForce) / vh;
for i in 0:10 loop
stribeckFactor:=stribeckFactor - (-stribeckFactor * sticktionForce * exp(-stribeckFactor * vh) + vis) / (sticktionForce * exp(-stribeckFactor * vh) * (stribeckFactor * vh - 1));
end for;
else
stribeckFactor:=-log(0.000001 / sticktionForce) / vh;
end if;
else
end if;
end stribeckFunction;
parameter SI.Mass mA = 1 "mass body A";
parameter SI.Mass mB = 1 "mass body 1";
parameter SI.Force Fh = 10 "static friction";
parameter SI.Force Fc = 5 "sliding friction";
parameter Real vis(unit = "N.s/m") = 0 "viscous friction value";
parameter SI.Velocity vh = 0.000001 "static velocity limit";
parameter SI.Acceleration g = -9.81 "gravity";
parameter Boolean initialize_sA = false;
parameter Boolean initialize_sB = false;
parameter Boolean initialize_vA = false;
parameter Boolean initialize_vB = false;
parameter SI.Position sA_init = 0;
parameter SI.Position sB_init = 0;
parameter SI.Velocity vA_init = 0;
parameter SI.Velocity vB_init = 0;
SI.Position sA;
SI.Position sB;
SI.Velocity vA;
SI.Velocity vB;
SI.Acceleration aA;
SI.Acceleration aB;
SI.Force Ffric "total friction";
SI.Force deltaf "difference of forces";
SI.Velocity deltav "difference of velocities";
Integer frictionMode(start = Stick);
protected
parameter Real stribeckFactor = stribeckFunction(sticktionForce, vis, vh);
parameter SI.Force sticktionForce = Fh - Fc;
constant SI.Velocity velLimit = 0.000005;
constant Integer None = 0;
constant Integer Stick = 1;
constant Integer StartSlip = 2;
constant Integer Slip = 3;
initial equation
if initialize_sA then
sA = sA_init;
end if;
if initialize_vA then
vA = vA_init;
end if;
if initialize_sB then
sB = sB_init;
end if;
if initialize_vB then
vB = vB_init;
end if;
if Fh == 0 and Fc == 0 then
frictionMode = None;
end if;
algorithm
when frictionMode == StartSlip and abs(deltav) > velLimit then
frictionMode:=Slip; elsewhen frictionMode == Stick and abs(Ffric) > Fh then
frictionMode:=StartSlip;
elsewhen frictionMode == Slip and abs(deltav) < velLimit / 5 then
frictionMode:=Stick;
end when;
equation
assert(mA > 0, "Negative mass is not allowed!");
assert(mB > 0, "Negative mass is not allowed!");
assert(Fh > Fc, "The Static friction should be larger than the Running friction!");
sA = flange_a.s;
sB = flange_b.s;
vA = der(flange_a.s);
vB = der(flange_b.s);
aA = der(vA);
aB = der(vB);
deltav = vA - vB;
deltaf = flange_a.f - flange_b.f;
if frictionMode == None then
Ffric = 0;
aA = (flange_a.f - deltav * vis + mA * g) / mA;
aB = (flange_b.f - deltav * vis + mB * g) / mB;
elseif frictionMode == Stick then
Ffric = flange_a.f - (flange_a.f + flange_b.f) / (mA + mB) * mA;
aA = (flange_a.f + flange_b.f + g * (mA + mB)) / (mA + mB);
aB = (flange_a.f + flange_b.f + g * (mA + mB)) / (mA + mB);
elseif frictionMode == StartSlip then
Ffric = Fc * sign(deltav) + vis * deltav + sticktionForce * exp(-stribeckFactor * abs(deltav)) * sign(deltav);
aA = (flange_a.f - Ffric + g * mA) / mA;
aB = (flange_b.f + Ffric + g * mB) / mB;
elseif frictionMode == Slip then
Ffric = Fc * sign(deltav) + vis * deltav + sticktionForce * exp(-stribeckFactor * abs(deltav)) * sign(deltav);
aA = (flange_a.f - Ffric + g * mA) / mA;
aB = (flange_b.f + Ffric + g * mB) / mB;
else
Ffric = 0;
aA = 0;
aB = 0;
end if;
Change History (1)
comment:1 by , 12 years ago
| Component: | OMEdit → Backend |
|---|---|
| Description: | modified (diff) |
| Owner: | removed |
| Priority: | high → blocker |
| Status: | new → assigned |

There is no support for mixed systems at all - yet. See #2432.