# rolling_car_2d.mbd #----------------------------------------------------------------------------- # [Data Block] begin: data; problem: initial value; end: data; #----------------------------------------------------------------------------- # [ Block] begin: initial value; initial time: 0.; final time: 2.; time step: 1.e-4; max iterations: 10; tolerance: 1.e-7; end: initial value; #----------------------------------------------------------------------------- # [Control Data Block] begin: control data; skip initial joint assembly; output frequency: 50; structural nodes: 8; rigid bodies: 3; joints: 11; forces: 2; gravity; end: control data; #----------------------------------------------------------------------------- # Design Variables set: real L = 0.1; # [m] Wheel Base set: real M = 0.1; # [kg] Mass set: real D = 0.05; # [m] Chassis Height set: real K = 100.; # [N/m] Spring Rate set: real C = 1; # [Ns/m] Shock Absorber set: real Kc = 5000.; # [N/m] Contact Stiffness set: real Ec = 1.2; # [-] Contact Stiffness Exponent set: real Cc = 0.1; # [Ns/m] Contact Damping set: real Dc = 0.0001;# [m] Contact Damping Activation Depth set: real Delta_Road = 0.0001; #[m] #----------------------------------------------------------------------------- # Intermediate Variables set: real I = M*L^2./12.; # Moment of Inertia of Chassis #----------------------------------------------------------------------------- # Reference Labels set: integer Ref_RearWheel = 1; # Node Labels set: integer NoSta_Ground = 1; set: integer NoDyn_Chassis = 2; set: integer NoDyn_FrontWheel = 3; set: integer NoDyn_RearWheel = 4; set: integer NoDyn_Road1 = 5; set: integer NoDyn_Road2 = 6; set: integer NoDum_FrontWheel = 7; set: integer NoDum_RearWheel = 8; # Body Labels set: integer Body_Chassis = 1; set: integer Body_FrontWheel = 2; set: integer Body_RearWheel = 3; # Joint Labels set: integer JoClamp_Ground = 1; set: integer JoInp_Ground_Chassis = 2; set: integer JoRevrot_Ground_Chassis = 3; set: integer JoInlin_Chassis_FrontWheel = 4; set: integer JoPrism_Chassis_FrontWheel = 5; set: integer JoDfmd_Chassis_FrontWheel = 6; set: integer JoInlin_Chassis_RearWheel = 7; set: integer JoPrism_Chassis_RearWheel = 8; set: integer JoDfmd_Chassis_RearWheel = 9; set: integer JoTotp_Road1 = 10; set: integer JoTotp_Road2 = 11; # Force Labels set: integer FoStrin_Normal_FrontWheel_Road1 = 1; set: integer FoStrin_Normal_RearWheel_Road2 = 2; #----------------------------------------------------------------------------- # Scalar Functions include: "sf_cubstep.sub"; include: "sf_Fun_Road.sub"; #----------------------------------------------------------------------------- # Intermediate Variables set: real Road1_Height_Ini = model::sf::Fun_Road(L); set: real Road2_Height_Ini = model::sf::Fun_Road(0.); set: real Road1_Angle_Ini = atan((model::sf::Fun_Road(L+Delta_Road)-model::sf::Fun_Road(L))/Delta_Road); set: real Road2_Angle_Ini = atan((model::sf::Fun_Road(Delta_Road)-model::sf::Fun_Road(0.))/Delta_Road); #----------------------------------------------------------------------------- # References reference: Ref_RearWheel, 0., 0., Road2_Height_Ini, # absolute position eye, # absolute orientation null, # absolute velocity null; # absolute angular velocity #----------------------------------------------------------------------------- # [Nodes Block] begin: nodes; #----------------------------------------------------------------------------- # Nodes structural: NoSta_Ground, static, null, # absolute position eye, # absolute orientation null, # absolute velocity null; # absolute angular velocity structural: NoDyn_Chassis, dynamic, reference, Ref_RearWheel, L/2., 0., D, # absolute position reference, Ref_RearWheel, euler, pi/2., 0., 0., # absolute orientation reference, Ref_RearWheel, null, # absolute velocity reference, Ref_RearWheel, null; # absolute angular velocity structural: NoDyn_FrontWheel, dynamic, reference, Ref_RearWheel, L, 0., 0., # absolute position reference, Ref_RearWheel, eye, # absolute orientation reference, Ref_RearWheel, null, # absolute velocity reference, Ref_RearWheel, null; # absolute angular velocity structural: NoDyn_RearWheel, dynamic, reference, Ref_RearWheel, null, # absolute position reference, Ref_RearWheel, eye, # absolute orientation reference, Ref_RearWheel, null, # absolute velocity reference, Ref_RearWheel, null; # absolute angular velocity structural: NoDyn_Road1, dynamic, L, 0., Road1_Height_Ini, # absolute position euler, 0., -Road1_Angle_Ini, 0., # absolute orientation null, # absolute velocity null; # absolute angular velocity structural: NoDyn_Road2, dynamic, 0., 0., Road2_Height_Ini, # absolute position euler, 0., -Road2_Angle_Ini, 0., # absolute orientation null, # absolute velocity null; # absolute angular velocity structural: NoDum_FrontWheel, dummy, NoDyn_FrontWheel, relative frame, NoDyn_Road1; structural: NoDum_RearWheel, dummy, NoDyn_RearWheel, relative frame, NoDyn_Road2; end: nodes; #----------------------------------------------------------------------------- # Plugin Variables set: [node, DX1, NoDyn_FrontWheel, structural, string="X[1]"]; set: [node, DX2, NoDyn_RearWheel, structural, string="X[1]"]; set: [node, DZ1_Dum, NoDum_FrontWheel, structural, string="X[3]"]; set: [node, DZ2_Dum, NoDum_RearWheel, structural, string="X[3]"]; set: [node, VZ1_Dum, NoDum_FrontWheel, structural, string="XP[3]"]; set: [node, VZ2_Dum, NoDum_RearWheel, structural, string="XP[3]"]; #----------------------------------------------------------------------------- # [Elements Block] begin: elements; #----------------------------------------------------------------------------- # Bodies body: Body_Chassis, NoDyn_Chassis, M, # mass null, # relative center of mass diag, 1., 1., I; # inertia matrix body: Body_FrontWheel, NoDyn_FrontWheel, 1.e-6, # mass null, # relative center of mass diag, 1.e-9, 1.e-9, 1.e-9; # inertia matrix body: Body_RearWheel, NoDyn_RearWheel, 1.e-6, # mass null, # relative center of mass diag, 1.e-9, 1.e-9, 1.e-9; # inertia matrix #----------------------------------------------------------------------------- # Joints joint: JoClamp_Ground, clamp, NoSta_Ground, position, node, orientation, node; joint: JoInp_Ground_Chassis, in plane, NoSta_Ground, null, # relative plane position 0., 1., 0., # relative normal direction NoDyn_Chassis; joint: JoRevrot_Ground_Chassis, revolute rotation, NoSta_Ground, hinge, euler, pi/2., 0, 0., # relative orientation matrix NoDyn_Chassis; joint: JoInlin_Chassis_FrontWheel, in line, NoDyn_Chassis, reference, Ref_RearWheel, L, 0., D, # relative line position reference, Ref_RearWheel, eye, # relative line orientation NoDyn_FrontWheel; joint: JoPrism_Chassis_FrontWheel, prismatic, NoDyn_Chassis, hinge, reference, global, eye, # relative orientation matrix NoDyn_FrontWheel; joint: JoDfmd_Chassis_FrontWheel, deformable displacement joint, NoDyn_Chassis, reference, Ref_RearWheel, L, 0., D, # relative offset hinge, reference, Ref_RearWheel, eye, # relative orientation matrix NoDyn_FrontWheel, null, # relative offset linear viscoelastic isotropic, K, # stiffness C, # viscosity coefficient prestrain, single, 0., 0., -1, const, D; joint: JoInlin_Chassis_RearWheel, in line, NoDyn_Chassis, reference, Ref_RearWheel, 0., 0., D, # relative line position reference, Ref_RearWheel, eye, # relative line orientation NoDyn_RearWheel; joint: JoPrism_Chassis_RearWheel, prismatic, NoDyn_Chassis, hinge, reference, global, eye, # relative orientation matrix NoDyn_RearWheel; joint: JoDfmd_Chassis_RearWheel, deformable displacement joint, NoDyn_Chassis, reference, Ref_RearWheel, 0., 0., D, # relative offset hinge, reference, Ref_RearWheel, eye, # relative orientation matrix NoDyn_RearWheel, null, # relative offset linear viscoelastic isotropic, K, # stiffness C, # viscosity coefficient prestrain, single, 0., 0., -1, const, D; joint: JoTotp_Road1, total pin joint, NoDyn_Road1, position, null, # relative offset position, null, # absolute position position constraint, active, active, active, component, string, "DX1", null, string, "model::sf::Fun_Road(DX1)", orientation constraint, active, active, active, single, 0., 1., 0, string, "-atan((model::sf::Fun_Road(DX1+Delta_Road)\ -model::sf::Fun_Road(DX1))/Delta_Road)"; joint: JoTotp_Road2, total pin joint, NoDyn_Road2, position, null, # relative offset position, null, # absolute position position constraint, active, active, active, component, string, "DX2", const, 0., string, "model::sf::Fun_Road(DX2)", orientation constraint, active, active, active, single, 0., 1., 0, string, "-atan((model::sf::Fun_Road(DX2+Delta_Road)\ -model::sf::Fun_Road(DX2))/Delta_Road)"; #----------------------------------------------------------------------------- # Forces force: FoStrin_Normal_FrontWheel_Road1, follower internal, NoDyn_Road1, position, null, # relative arm NoDyn_FrontWheel, position, null, # relative arm single, 0., 0., -1., string, "max(0,Kc*sign(0-DZ1_Dum)*abs(0-DZ1_Dum)^Ec\ -Cc*VZ1_Dum*model::sf::cubstep((0-DZ1_Dum)/Dc))"; # force value force: FoStrin_Normal_RearWheel_Road2, follower internal, NoDyn_Road2, position, null, # relative arm NoDyn_RearWheel, position, null, # relative arm single, 0., 0., -1., string, "max(0,Kc*sign(0-DZ2_Dum)*abs(0-DZ2_Dum)^Ec\ -Cc*VZ2_Dum*model::sf::cubstep((0-DZ2_Dum)/Dc))"; # force value #----------------------------------------------------------------------------- # Gravity gravity: 0., 0., -1., const, 9.81; end: elements;