Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 11 additions & 23 deletions Modelica/Mechanics/MultiBody/Joints/Constraints/Prismatic.mo
Original file line number Diff line number Diff line change
Expand Up @@ -55,34 +55,22 @@ equation
zeros(3)=Modelica.Mechanics.MultiBody.Frames.Orientation.equalityConstraint(frame_a.R, frame_b.R);

// Constraint equations concerning translations
if x_locked and y_locked and z_locked then
r_rel_a=zeros(3);
elseif x_locked and y_locked and not z_locked then
if x_locked then
r_rel_a[1]=0;
r_rel_a[2]=0;
frame_a.f[3]=0;
elseif x_locked and not y_locked and z_locked then
r_rel_a[1]=0;
r_rel_a[3]=0;
frame_a.f[2]=0;
elseif x_locked and not y_locked and not z_locked then
r_rel_a[1]=0;
frame_a.f[2]=0;
frame_a.f[3]=0;
elseif not x_locked and y_locked and z_locked then
r_rel_a[2]=0;
r_rel_a[3]=0;
else
frame_a.f[1]=0;
elseif not x_locked and y_locked and not z_locked then
end if;

if y_locked then
r_rel_a[2]=0;
frame_a.f[1]=0;
frame_a.f[3]=0;
elseif not x_locked and not y_locked and z_locked then
r_rel_a[3]=0;
frame_a.f[1]=0;
else
frame_a.f[2]=0;
end if;

if z_locked then
r_rel_a[3]=0;
else
frame_a.f=zeros(3);
frame_a.f[3]=0;
end if;

zeros(3) = frame_a.t + Frames.resolve1(R_rel, frame_b.t) + cross(r_rel_a,
Expand Down
34 changes: 11 additions & 23 deletions Modelica/Mechanics/MultiBody/Joints/Constraints/Revolute.mo
Original file line number Diff line number Diff line change
Expand Up @@ -70,34 +70,22 @@ equation
r_rel_a = Frames.resolve2(frame_a.R, frame_b.r_0 - frame_a.r_0);

// Constraint equations concerning translations
if x_locked and y_locked and z_locked then
r_rel_a=zeros(3);
elseif x_locked and y_locked and not z_locked then
if x_locked then
r_rel_a[1]=0;
r_rel_a[2]=0;
frame_a.f[3]=0;
elseif x_locked and not y_locked and z_locked then
r_rel_a[1]=0;
r_rel_a[3]=0;
frame_a.f[2]=0;
elseif x_locked and not y_locked and not z_locked then
r_rel_a[1]=0;
frame_a.f[2]=0;
frame_a.f[3]=0;
elseif not x_locked and y_locked and z_locked then
r_rel_a[2]=0;
r_rel_a[3]=0;
else
frame_a.f[1]=0;
elseif not x_locked and y_locked and not z_locked then
end if;

if y_locked then
r_rel_a[2]=0;
frame_a.f[1]=0;
frame_a.f[3]=0;
elseif not x_locked and not y_locked and z_locked then
r_rel_a[3]=0;
frame_a.f[1]=0;
else
frame_a.f[2]=0;
end if;

if z_locked then
r_rel_a[3]=0;
else
frame_a.f=zeros(3);
frame_a.f[3]=0;
end if;

// Constraint equations concerning rotations
Expand Down
34 changes: 11 additions & 23 deletions Modelica/Mechanics/MultiBody/Joints/Constraints/Spherical.mo
Original file line number Diff line number Diff line change
Expand Up @@ -52,34 +52,22 @@ equation
r_rel_a = MBS.Frames.resolve2(frame_a.R, frame_b.r_0 - frame_a.r_0);

// Constraint equations concerning translation
if x_locked and y_locked and z_locked then
r_rel_a=zeros(3);
elseif x_locked and y_locked and not z_locked then
if x_locked then
r_rel_a[1]=0;
r_rel_a[2]=0;
frame_a.f[3]=0;
elseif x_locked and not y_locked and z_locked then
r_rel_a[1]=0;
r_rel_a[3]=0;
frame_a.f[2]=0;
elseif x_locked and not y_locked and not z_locked then
r_rel_a[1]=0;
frame_a.f[2]=0;
frame_a.f[3]=0;
elseif not x_locked and y_locked and z_locked then
r_rel_a[2]=0;
r_rel_a[3]=0;
else
frame_a.f[1]=0;
elseif not x_locked and y_locked and not z_locked then
end if;

if y_locked then
r_rel_a[2]=0;
frame_a.f[1]=0;
frame_a.f[3]=0;
elseif not x_locked and not y_locked and z_locked then
r_rel_a[3]=0;
frame_a.f[1]=0;
else
frame_a.f[2]=0;
end if;

if z_locked then
r_rel_a[3]=0;
else
frame_a.f=zeros(3);
frame_a.f[3]=0;
end if;

//frame_a.t = zeros(3);
Expand Down
35 changes: 12 additions & 23 deletions Modelica/Mechanics/MultiBody/Joints/Constraints/Universal.mo
Original file line number Diff line number Diff line change
Expand Up @@ -46,35 +46,24 @@ equation
r_rel_a = MBS.Frames.resolve2(frame_a.R, frame_b.r_0 - frame_a.r_0);

// Constraint equations concerning translations
if x_locked and y_locked and z_locked then
r_rel_a=zeros(3);
elseif x_locked and y_locked and not z_locked then
if x_locked then
r_rel_a[1]=0;
r_rel_a[2]=0;
frame_a.f[3]=0;
elseif x_locked and not y_locked and z_locked then
r_rel_a[1]=0;
r_rel_a[3]=0;
frame_a.f[2]=0;
elseif x_locked and not y_locked and not z_locked then
r_rel_a[1]=0;
frame_a.f[2]=0;
frame_a.f[3]=0;
elseif not x_locked and y_locked and z_locked then
r_rel_a[2]=0;
r_rel_a[3]=0;
else
frame_a.f[1]=0;
elseif not x_locked and y_locked and not z_locked then
end if;

if y_locked then
r_rel_a[2]=0;
frame_a.f[1]=0;
frame_a.f[3]=0;
elseif not x_locked and not y_locked and z_locked then
r_rel_a[3]=0;
frame_a.f[1]=0;
else
frame_a.f[2]=0;
end if;

if z_locked then
r_rel_a[3]=0;
else
frame_a.f=zeros(3);
frame_a.f[3]=0;
end if;

// Constraint equations concerning rotations
frame_a.t*n_a=0;
frame_b.t*n_b=0;
Expand Down