/*
 * radial_cam_follower.java
 */

import com.comsol.model.*;
import com.comsol.model.util.*;

/** Model exported on May 13 2026, 10:53 by COMSOL 6.4.0.419. */
public class radial_cam_follower {

  public static Model run() {
    Model model = ModelUtil.create("Model");

//    From the File menu, choose New.
//    In the New window, click Model Wizard.
//    In the Model Wizard window, click 3D.
//    In the Select Physics tree, select Structural Mechanics > Multibody Dynamics (mbd).
//    Click Add.
//    Click Study.
//    In the Select Study tree, select General Studies > Time Dependent.
//    Click Done.

    model.component().create("comp1", true);

    model.component("comp1").geom().create("geom1", 3);
    model.component("comp1").geom("geom1").geomRep("comsol");

    model.component("comp1").mesh().create("mesh1");
    model.component("comp1").mesh("mesh1").contribute("geom/detail", true);

    model.component("comp1").physics().create("mbd", "MultibodyDynamics", "geom1");

    model.study().create("std1");
    model.study("std1").create("time", "Transient");

//    In the Model Builder window, under Global Definitions, click Parameters 1.
//    In the Settings window for Parameters, locate the Parameters section.
//    Click Load from File.
//    Browse to the model's Application Library folder and double-click the file radial_cam_follower_parameters.txt.
//    To import content from file, use:
//    model.param().loadFile("FILENAME");
    model.param().set("rf", "(0.025/3)[m]", "Follower radius");
    model.param().set("k", "5[kN/m]", "Spring stiffness");
    model.param().set("N", "1200", "Cam shaft RPM");
    model.param().set("omega", "(2*pi*N/60)[rad/s]", "Cam shaft angular speed");
    model.param().set("T", "2*pi/omega", "Time period");

//    In the Model Builder window, expand the Component 1 (comp1) > Geometry 1 node.
//    Right-click Geometry 1 and choose Import.

    model.component("comp1").geom("geom1").create("imp1", "Import");

//    In the Settings window for Import, locate the Source section.
//    Click Browse.
//    Browse to the model's Application Library folder and double-click the file radial_cam_follower.mphbin.

    model.component("comp1").geom("geom1").feature("imp1").set("filename", "radial_cam_follower.mphbin");

//    Click Import.

    model.component("comp1").geom("geom1").feature("imp1").importData();

//    In the Model Builder window, under Component 1 (comp1) > Geometry 1, click Form Union (fin).
//    In the Settings window for Form Union/Assembly, locate the Form Union/Assembly section.
//    From the Action list, select Form an assembly.

    model.component("comp1").geom("geom1").feature("fin").set("action", "assembly");

//    Clear the Create pairs checkbox.

    model.component("comp1").geom("geom1").feature("fin").set("createpairs", false);

//    In the Geometry toolbar, click Build All.

    model.component("comp1").geom("geom1").run("fin");

//    In the Home toolbar, click Functions and choose Global > Step.

    model.func().create("step1", "Step");

//    In the Settings window for Step, locate the Parameters section.
//    In the Location text field, type T/40.

    model.func("step1").set("location", "T/40");

//    Click to expand the Smoothing section.
//    In the Size of transition zone text field, type T/20.

    model.func("step1").set("smooth", "T/20");

//    In the Definitions toolbar, click Explicit.

    model.component("comp1").selection().create("sel1", "Explicit");

//    In the Settings window for Explicit, locate the Input Entities section.
//    From the Geometric entity level list, select Boundary.

    model.component("comp1").selection("sel1").geom(2);

//    Select Boundary 89.

    model.component("comp1").selection("sel1").set(89);

//    Select the Group by continuous tangent checkbox.

    model.component("comp1").selection("sel1").set("groupcontang", true);

//    In the Label text field, type Cam Surface.

    model.component("comp1").selection("sel1").label("Cam Surface");

//    In the Definitions toolbar, click Adjacent.

    model.component("comp1").selection().create("adj1", "Adjacent");

//    In the Settings window for Adjacent, locate the Input Entities section.
//    From the Geometric entity level list, select Boundary.

    model.component("comp1").selection("adj1").set("entitydim", 2);

//    Under Input selections, click Add.
//    In the Add dialog, select Cam Surface in the Input selections list.
//    Click OK.

    model.component("comp1").selection("adj1").set("input", new String[]{"sel1"});

//    In the Settings window for Adjacent, locate the Output Entities section.
//    From the Geometric entity level list, select Adjacent edges.

    model.component("comp1").selection("adj1").set("outputdim", 1);

//    In the Label text field, type Cam Surface: Adjacent Edges.

    model.component("comp1").selection("adj1").label("Cam Surface: Adjacent Edges");

//    In the Materials toolbar, click Add Material to open the Add Material window.
//    In the tree, select Built-in > Structural steel.
//    Click Add to Component in the window toolbar.

    model.component("comp1").material().create("mat1", "Common");
    model.component("comp1").material("mat1").propertyGroup()
         .create("Enu", "Enu", "Young's modulus and Poisson's ratio");
    model.component("comp1").material("mat1").propertyGroup("Enu").func().create("int1", "Interpolation");
    model.component("comp1").material("mat1").propertyGroup("Enu").func().create("int2", "Interpolation");
    model.component("comp1").material("mat1").propertyGroup().create("Murnaghan", "Murnaghan", "Murnaghan");
    model.component("comp1").material("mat1").propertyGroup()
         .create("ElastoplasticModel", "ElastoplasticModel", "Elastoplastic material model");
    model.component("comp1").material("mat1").propertyGroup("ElastoplasticModel").func()
         .create("int1", "Interpolation");
    model.component("comp1").material("mat1").propertyGroup().create("Ludwik", "Ludwik", "Ludwik");
    model.component("comp1").material("mat1").propertyGroup("Ludwik").func().create("int1", "Interpolation");
    model.component("comp1").material("mat1").propertyGroup().create("JohnsonCook", "JohnsonCook", "Johnson-Cook");
    model.component("comp1").material("mat1").propertyGroup().create("Swift", "Swift", "Swift");
    model.component("comp1").material("mat1").propertyGroup().create("Voce", "Voce", "Voce");
    model.component("comp1").material("mat1").propertyGroup("Voce").func().create("int1", "Interpolation");
    model.component("comp1").material("mat1").propertyGroup()
         .create("HockettSherby", "HockettSherby", "Hockett-Sherby");
    model.component("comp1").material("mat1").propertyGroup("HockettSherby").func().create("int1", "Interpolation");
    model.component("comp1").material("mat1").propertyGroup()
         .create("ArmstrongFrederick", "ArmstrongFrederick", "Armstrong-Frederick");
    model.component("comp1").material("mat1").propertyGroup("ArmstrongFrederick").func()
         .create("int1", "Interpolation");
    model.component("comp1").material("mat1").propertyGroup().create("Norton", "Norton", "Norton");
    model.component("comp1").material("mat1").propertyGroup()
         .create("Garofalo", "Garofalo", "Garofalo (hyperbolic sine)");
    model.component("comp1").material("mat1").propertyGroup()
         .create("ChabocheViscoplasticity", "ChabocheViscoplasticity", "Chaboche viscoplasticity");
    model.component("comp1").material("mat1").label("Structural steel");
    model.component("comp1").material("mat1").set("family", "custom");
    model.component("comp1").material("mat1")
         .set("customspecular", new double[]{0.7843137254901961, 0.7843137254901961, 0.7843137254901961});
    model.component("comp1").material("mat1").set("diffuse", "custom");
    model.component("comp1").material("mat1")
         .set("customdiffuse", new double[]{0.6666666666666666, 0.6666666666666666, 0.6666666666666666});
    model.component("comp1").material("mat1").set("ambient", "custom");
    model.component("comp1").material("mat1")
         .set("customambient", new double[]{0.6666666666666666, 0.6666666666666666, 0.6666666666666666});
    model.component("comp1").material("mat1").set("noise", true);
    model.component("comp1").material("mat1").set("fresnel", 0.9);
    model.component("comp1").material("mat1").set("roughness", 0.3);
    model.component("comp1").material("mat1").set("diffusewrap", 0);
    model.component("comp1").material("mat1").set("reflectance", 0);
    model.component("comp1").material("mat1").propertyGroup("def").set("lossfactor", "0.02");
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("relpermeability", new String[]{"1", "0", "0", "0", "1", "0", "0", "0", "1"});
    model.component("comp1").material("mat1").propertyGroup("def").set("heatcapacity", "475[J/(kg*K)]");
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("thermalconductivity", new String[]{"44.5[W/(m*K)]", "0", "0", "0", "44.5[W/(m*K)]", "0", "0", "0", "44.5[W/(m*K)]"});
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("electricconductivity", new String[]{"4.032e6[S/m]", "0", "0", "0", "4.032e6[S/m]", "0", "0", "0", "4.032e6[S/m]"});
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("relpermittivity", new String[]{"1", "0", "0", "0", "1", "0", "0", "0", "1"});
    model.component("comp1").material("mat1").propertyGroup("def")
         .set("thermalexpansioncoefficient", new String[]{"12.3e-6[1/K]", "0", "0", "0", "12.3e-6[1/K]", "0", "0", "0", "12.3e-6[1/K]"});
    model.component("comp1").material("mat1").propertyGroup("def").set("density", "7850[kg/m^3]");
    model.component("comp1").material("mat1").propertyGroup("Enu").func("int1").set("funcname", "E");
    model.component("comp1").material("mat1").propertyGroup("Enu").func("int1")
         .set("table", new String[][]{{"293.15", "200e9"}, {"793.15", "166.6e9"}});
    model.component("comp1").material("mat1").propertyGroup("Enu").func("int1").set("extrap", "linear");
    model.component("comp1").material("mat1").propertyGroup("Enu").func("int1").set("fununit", new String[]{"Pa"});
    model.component("comp1").material("mat1").propertyGroup("Enu").func("int1").set("argunit", new String[]{"K"});
    model.component("comp1").material("mat1").propertyGroup("Enu").func("int2").set("funcname", "nu");
    model.component("comp1").material("mat1").propertyGroup("Enu").func("int2")
         .set("table", new String[][]{{"293.15", "0.30"}, {"793.15", "0.315"}});
    model.component("comp1").material("mat1").propertyGroup("Enu").func("int2").set("extrap", "linear");
    model.component("comp1").material("mat1").propertyGroup("Enu").func("int2").set("fununit", new String[]{"1"});
    model.component("comp1").material("mat1").propertyGroup("Enu").func("int2").set("argunit", new String[]{"K"});
    model.component("comp1").material("mat1").propertyGroup("Enu").set("E", "E(T)");
    model.component("comp1").material("mat1").propertyGroup("Enu").set("nu", "nu(T)");
    model.component("comp1").material("mat1").propertyGroup("Enu").addInput("temperature");
    model.component("comp1").material("mat1").propertyGroup("Murnaghan").set("l", "-3.0e11[Pa]");
    model.component("comp1").material("mat1").propertyGroup("Murnaghan").set("m", "-6.2e11[Pa]");
    model.component("comp1").material("mat1").propertyGroup("Murnaghan").set("n", "-7.2e11[Pa]");
    model.component("comp1").material("mat1").propertyGroup("ElastoplasticModel").func("int1").set("funcname", "a");
    model.component("comp1").material("mat1").propertyGroup("ElastoplasticModel").func("int1")
         .set("table", new String[][]{{"600", "1"}, {"1100", "0.1"}, {"1643", "0"}});
    model.component("comp1").material("mat1").propertyGroup("ElastoplasticModel").func("int1")
         .set("fununit", new String[]{"1"});
    model.component("comp1").material("mat1").propertyGroup("ElastoplasticModel").func("int1")
         .set("argunit", new String[]{"K"});
    model.component("comp1").material("mat1").propertyGroup("ElastoplasticModel").set("sigmags", "350[MPa]*a(T)");
    model.component("comp1").material("mat1").propertyGroup("ElastoplasticModel").set("Et", "1.045[GPa]*a(T)");
    model.component("comp1").material("mat1").propertyGroup("ElastoplasticModel").set("Ek", "1.045[GPa]*a(T)");
    model.component("comp1").material("mat1").propertyGroup("ElastoplasticModel")
         .set("sigmagh", "1.050[GPa]*epe*a(T)");
    model.component("comp1").material("mat1").propertyGroup("ElastoplasticModel")
         .set("Hillcoefficients", new String[]{"0[m^2*s^4/kg^2]", "0[m^2*s^4/kg^2]", "0[m^2*s^4/kg^2]", "0[m^2*s^4/kg^2]", "0[m^2*s^4/kg^2]", "0[m^2*s^4/kg^2]"});
    model.component("comp1").material("mat1").propertyGroup("ElastoplasticModel")
         .set("ys", new String[]{"0[N/m^2]", "0[N/m^2]", "0[N/m^2]", "0[N/m^2]", "0[N/m^2]", "0[N/m^2]"});
    model.component("comp1").material("mat1").propertyGroup("ElastoplasticModel").addInput("temperature");
    model.component("comp1").material("mat1").propertyGroup("ElastoplasticModel").addInput("effectiveplasticstrain");
    model.component("comp1").material("mat1").propertyGroup("Ludwik").func("int1").set("funcname", "a");
    model.component("comp1").material("mat1").propertyGroup("Ludwik").func("int1")
         .set("table", new String[][]{{"600", "1"}, {"1100", "0.1"}, {"1643", "0"}});
    model.component("comp1").material("mat1").propertyGroup("Ludwik").func("int1").set("fununit", new String[]{"1"});
    model.component("comp1").material("mat1").propertyGroup("Ludwik").func("int1").set("argunit", new String[]{"K"});
    model.component("comp1").material("mat1").propertyGroup("Ludwik").set("k_lud", "560[MPa]*a(T)");
    model.component("comp1").material("mat1").propertyGroup("Ludwik").set("n_lud", "0.61");
    model.component("comp1").material("mat1").propertyGroup("Ludwik").addInput("temperature");
    model.component("comp1").material("mat1").propertyGroup("JohnsonCook").label("Johnson-Cook");
    model.component("comp1").material("mat1").propertyGroup("JohnsonCook").set("k_jcook", "560[MPa]");
    model.component("comp1").material("mat1").propertyGroup("JohnsonCook").set("n_jcook", "0.61");
    model.component("comp1").material("mat1").propertyGroup("JohnsonCook").set("C_jcook", "0.12");
    model.component("comp1").material("mat1").propertyGroup("JohnsonCook").set("epet0_jcook", "1[1/s]");
    model.component("comp1").material("mat1").propertyGroup("JohnsonCook").set("m_jcook", "0.6");
    model.component("comp1").material("mat1").propertyGroup("Swift").set("e0_swi", "0.021");
    model.component("comp1").material("mat1").propertyGroup("Swift").set("n_swi", "0.2");
    model.component("comp1").material("mat1").propertyGroup("Voce").func("int1").set("funcname", "a");
    model.component("comp1").material("mat1").propertyGroup("Voce").func("int1")
         .set("table", new String[][]{{"600", "1"}, {"1100", "0.1"}, {"1643", "0"}});
    model.component("comp1").material("mat1").propertyGroup("Voce").func("int1").set("fununit", new String[]{"1"});
    model.component("comp1").material("mat1").propertyGroup("Voce").func("int1").set("argunit", new String[]{"K"});
    model.component("comp1").material("mat1").propertyGroup("Voce").set("sigma_voc", "249[MPa]*a(T)");
    model.component("comp1").material("mat1").propertyGroup("Voce").set("beta_voc", "9.3");
    model.component("comp1").material("mat1").propertyGroup("Voce").addInput("temperature");
    model.component("comp1").material("mat1").propertyGroup("HockettSherby").label("Hockett-Sherby");
    model.component("comp1").material("mat1").propertyGroup("HockettSherby").func("int1").set("funcname", "a");
    model.component("comp1").material("mat1").propertyGroup("HockettSherby").func("int1")
         .set("table", new String[][]{{"600", "1"}, {"1100", "0.1"}, {"1643", "0"}});
    model.component("comp1").material("mat1").propertyGroup("HockettSherby").func("int1")
         .set("fununit", new String[]{"1"});
    model.component("comp1").material("mat1").propertyGroup("HockettSherby").func("int1")
         .set("argunit", new String[]{"K"});
    model.component("comp1").material("mat1").propertyGroup("HockettSherby").set("sigma_hoc", "684[MPa]*a(T)");
    model.component("comp1").material("mat1").propertyGroup("HockettSherby").set("m_hoc", "3.9");
    model.component("comp1").material("mat1").propertyGroup("HockettSherby").set("n_hoc", "0.85");
    model.component("comp1").material("mat1").propertyGroup("HockettSherby").addInput("temperature");
    model.component("comp1").material("mat1").propertyGroup("ArmstrongFrederick").label("Armstrong-Frederick");
    model.component("comp1").material("mat1").propertyGroup("ArmstrongFrederick").func("int1").set("funcname", "a");
    model.component("comp1").material("mat1").propertyGroup("ArmstrongFrederick").func("int1")
         .set("table", new String[][]{{"600", "1"}, {"1100", "0.1"}, {"1643", "0"}});
    model.component("comp1").material("mat1").propertyGroup("ArmstrongFrederick").func("int1")
         .set("fununit", new String[]{"1"});
    model.component("comp1").material("mat1").propertyGroup("ArmstrongFrederick").func("int1")
         .set("argunit", new String[]{"K"});
    model.component("comp1").material("mat1").propertyGroup("ArmstrongFrederick").set("Ck", "2.070[GPa]*a(T)");
    model.component("comp1").material("mat1").propertyGroup("ArmstrongFrederick").set("gammak", "8.0");
    model.component("comp1").material("mat1").propertyGroup("ArmstrongFrederick").addInput("temperature");
    model.component("comp1").material("mat1").propertyGroup("Norton").set("A_nor", "1.2e-15[1/s]");
    model.component("comp1").material("mat1").propertyGroup("Norton").set("sigRef_nor", "1[MPa]");
    model.component("comp1").material("mat1").propertyGroup("Norton").set("n_nor", "4.5");
    model.component("comp1").material("mat1").propertyGroup("Garofalo").set("A_gar", "1e-6[1/s]");
    model.component("comp1").material("mat1").propertyGroup("Garofalo").set("sigRef_gar", "100[MPa]");
    model.component("comp1").material("mat1").propertyGroup("Garofalo").set("n_gar", "4.6");
    model.component("comp1").material("mat1").propertyGroup("ChabocheViscoplasticity").set("A_cha", "1[1/s]");
    model.component("comp1").material("mat1").propertyGroup("ChabocheViscoplasticity").set("sigRef_cha", "490[MPa]");
    model.component("comp1").material("mat1").propertyGroup("ChabocheViscoplasticity").set("n_cha", "9");

//    In the Materials toolbar, click Add Material to close the Add Material window.
//    In the Settings window for Multibody Dynamics, click to expand the Discretization section.
//    From the Displacement field list, select Quadratic Lagrange.

    model.component("comp1").physics("mbd").prop("ShapeProperty").set("order_displacement", 2);

//    Start by defining different components of the mechanism as rigid bodies.
//    In the Physics toolbar, click Domains and choose Rigid Material.

    model.component("comp1").physics("mbd").create("rd1", "RigidDomain", 3);

//    In the Settings window for Rigid Material, type Rigid Material: Cam in the Label text field.

    model.component("comp1").physics("mbd").feature("rd1").label("Rigid Material: Cam");

//    Select Domain 5.

    model.component("comp1").physics("mbd").feature("rd1").selection().set(5);
    model.component("comp1").physics("mbd").create("rd2", "RigidDomain", 3);
    model.component("comp1").physics("mbd").feature("rd2").label("Rigid Material: Follower");
    model.component("comp1").physics("mbd").feature("rd2").selection().set(7);
    model.component("comp1").physics("mbd").create("rd3", "RigidDomain", 3);
    model.component("comp1").physics("mbd").feature("rd3").label("Rigid Material: Rocker Arm");
    model.component("comp1").physics("mbd").feature("rd3").selection().set(3);
    model.component("comp1").physics("mbd").create("rd4", "RigidDomain", 3);
    model.component("comp1").physics("mbd").feature("rd4").label("Rigid Material: Valve");
    model.component("comp1").physics("mbd").feature("rd4").selection().set(1);
    model.component("comp1").physics("mbd").create("rd5", "RigidDomain", 3);
    model.component("comp1").physics("mbd").feature("rd5").label("Rigid Material: Follower Guide");
    model.component("comp1").physics("mbd").feature("rd5").selection().set(6);
    model.component("comp1").physics("mbd").create("rd6", "RigidDomain", 3);
    model.component("comp1").physics("mbd").feature("rd6").label("Rigid Material: Pin");
    model.component("comp1").physics("mbd").feature("rd6").selection().set(4);
    model.component("comp1").physics("mbd").create("rd7", "RigidDomain", 3);
    model.component("comp1").physics("mbd").feature("rd7").label("Rigid Material: Valve Guide");
    model.component("comp1").physics("mbd").feature("rd7").selection().set(2);

//    Rigid Materials
//    Create more components with the information given in the table below:
//    In the Model Builder window, click Rigid Material: Follower Guide.
//    In the Physics toolbar, click Attributes and choose Fixed Constraint.

    model.component("comp1").physics("mbd").feature("rd5").create("fix1", "FixedConstraint", -1);

//    In the Model Builder window, under Component 1 (comp1) > Multibody Dynamics (mbd), click Rigid Material: Pin.
//    In the Physics toolbar, click Attributes and choose Fixed Constraint.

    model.component("comp1").physics("mbd").feature("rd6").create("fix1", "FixedConstraint", -1);

//    In the Model Builder window, under Component 1 (comp1) > Multibody Dynamics (mbd), click Rigid Material: Valve Guide.
//    In the Physics toolbar, click Attributes and choose Fixed Constraint.

    model.component("comp1").physics("mbd").feature("rd7").create("fix1", "FixedConstraint", -1);

//    Now define the cam-follower connection and joints to connect different components of the mechanism.
//    In the Physics toolbar, click Global and choose Cam–Follower.

    model.component("comp1").physics("mbd").create("cfc1", "CamFollower", -1);

//    In the Settings window for Cam–Follower, locate the Boundary Selection, Cam section.
//    From the Selection list, select Cam Surface.

    model.component("comp1").physics("mbd").feature("cfc1").selection("bndCam").named("sel1");

//    Locate the Point Selection, Follower section.
//    Click Paste Selection.
//    In the Paste Selection dialog, type 148 164 in the Selection text field.
//    Click OK.

    model.component("comp1").physics("mbd").feature("cfc1").selection("PntFollower").set(148, 164);

//    In the Settings window for Cam–Follower, locate the Cam section.
//    In the \[X_{\textrm{offset}}\] text field, type rf.

    model.component("comp1").physics("mbd").feature("cfc1").set("X_off_bnd", "rf");

//    Locate the Connection Force section.
//    From the list, select Computed using weak constraints.

    model.component("comp1").physics("mbd").feature("cfc1").set("ConnectionForce", "ComputedUsingWeakConstraints");

//    In the Physics toolbar, click Global and choose Hinge Joint.

    model.component("comp1").physics("mbd").create("hgj1", "HingeJoint", -1);

//    In the Settings window for Hinge Joint, locate the Attachment Selection section.
//    From the Source list, select Fixed.

    model.component("comp1").physics("mbd").feature("hgj1").set("Source", "fixed");

//    From the Destination list, select Rigid Material: Cam.

    model.component("comp1").physics("mbd").feature("hgj1").set("Destination", "rd1");

//    Locate the Center of Joint section.
//    From the Entity level list, select Point.

    model.component("comp1").physics("mbd").feature("hgj1").set("EntityLevel", "Point");

//    Locate the Axis of Joint section.
//    Specify the \[\mathbf{e}_{_\textrm{0}}\] vector as

    model.component("comp1").physics("mbd").feature("hgj1").set("e", new int[]{0, 1, 0});

//    In the Model Builder window, click Center of Joint: Point 1.
//    In the Settings window for Center of Joint: Point, locate the Point Selection section.
//    Click Paste Selection.
//    In the Paste Selection dialog, type 108 128 in the Selection text field.
//    Click OK.

    model.component("comp1").physics("mbd").feature("hgj1").feature("cjp1").selection().set(108, 128);
    model.component("comp1").physics("mbd").feature().duplicate("hgj2", "hgj1");
    model.component("comp1").physics("mbd").feature("hgj2").set("Source", "rd6");
    model.component("comp1").physics("mbd").feature("hgj2").set("Destination", "rd3");
    model.component("comp1").physics("mbd").feature("hgj2").feature("cjp1").selection().set(94, 100);
    model.component("comp1").physics("mbd").create("prj1", "PrismaticJoint", -1);
    model.component("comp1").physics("mbd").feature("prj1").set("Source", "rd5");
    model.component("comp1").physics("mbd").feature("prj1").set("Destination", "rd2");
    model.component("comp1").physics("mbd").feature("prj1").set("EntityLevel", "Point");
    model.component("comp1").physics("mbd").feature("prj1").set("e", new int[]{0, 0, 1});
    model.component("comp1").physics("mbd").feature("prj1").feature("cjp1").selection().set(133, 147);
    model.component("comp1").physics("mbd").feature().duplicate("prj2", "prj1");
    model.component("comp1").physics("mbd").feature("prj2").set("Source", "rd7");
    model.component("comp1").physics("mbd").feature("prj2").set("Destination", "rd4");
    model.component("comp1").physics("mbd").feature("prj2").feature("cjp1").selection().set(35, 49);
    model.component("comp1").physics("mbd").create("slj1", "SlotJoint", -1);
    model.component("comp1").physics("mbd").feature("slj1").set("Source", "rd3");
    model.component("comp1").physics("mbd").feature("slj1").set("Destination", "rd2");
    model.component("comp1").physics("mbd").feature("slj1").set("EntityLevel", "Point");
    model.component("comp1").physics("mbd").feature("slj1").feature("cjp1").selection().set(151, 162);
    model.component("comp1").physics("mbd").feature().duplicate("slj2", "slj1");
    model.component("comp1").physics("mbd").feature("slj2").set("Destination", "rd4");
    model.component("comp1").physics("mbd").feature("slj2").feature("cjp1").selection().set(58, 62);

//    Joints
//    Create the remaining connections using the information given in the table below:
//    Next, prescribe the cam rotation and add a spring to the valve motion.
//    In the Model Builder window, click Hinge Joint 1.
//    In the Physics toolbar, click Attributes and choose Prescribed Motion.

    model.component("comp1").physics("mbd").feature("hgj1").create("pm1", "PrescribedMotion", -1);

//    In the Settings window for Prescribed Motion, locate the Prescribed Rotational Motion section.
//    From the Prescribed motion through list, select Angular velocity.

    model.component("comp1").physics("mbd").feature("hgj1").feature("pm1")
         .set("PrescribedMotionThroughRotational", "AngularVelocity");

//    In the \[\omega_{_\textrm{p}}\] text field, type omega*step1(t).

    model.component("comp1").physics("mbd").feature("hgj1").feature("pm1").set("omegap", "omega*step1(t)");

//    Click to expand the Reaction Force Settings section.
//    Select the Evaluate reaction forces using weak constraints checkbox.

    model.component("comp1").physics("mbd").feature("hgj1").feature("pm1").set("WeakConstraints", true);

//    In the Model Builder window, under Component 1 (comp1) > Multibody Dynamics (mbd), click Prismatic Joint 2.
//    In the Physics toolbar, click Attributes and choose Spring and Damper.

    model.component("comp1").physics("mbd").feature("prj2").create("sd1", "SpringAndDamper", -1);

//    In the Settings window for Spring and Damper, locate the Spring and Damper: Translational section.
//    In the \[k_{_\textrm{u}}\] text field, type k.

    model.component("comp1").physics("mbd").feature("prj2").feature("sd1").set("k_u", "k");

//    To create node groups for the physics features, do the following:
//    In the Model Builder window, under Component 1 (comp1) > Multibody Dynamics (mbd), Ctrl-click to select Rigid Material: Cam, Rigid Material: Follower, Rigid Material: Rocker Arm, Rigid Material: Valve, Rigid Material: Follower Guide, Rigid Material: Pin, Rigid Material: Valve Guide.
//    Right-click and choose Group.

    model.nodeGroup().create("grp1", "Physics", "mbd");
    model.nodeGroup("grp1").placeAfter("init1");
    model.nodeGroup("grp1").add("rd1");
    model.nodeGroup("grp1").add("rd2");
    model.nodeGroup("grp1").add("rd3");
    model.nodeGroup("grp1").add("rd4");
    model.nodeGroup("grp1").add("rd5");
    model.nodeGroup("grp1").add("rd6");
    model.nodeGroup("grp1").add("rd7");

//    In the Settings window for Group, type Rigid Materials in the Label text field.

    model.nodeGroup("grp1").label("Rigid Materials");

//    In the Model Builder window, under Component 1 (comp1) > Multibody Dynamics (mbd), Ctrl-click to select Hinge Joint 1, Hinge Joint 2.
//    Right-click and choose Group.

    model.nodeGroup().create("grp2", "Physics", "mbd");
    model.nodeGroup("grp2").placeAfter("cfc1");
    model.nodeGroup("grp2").add("hgj1");
    model.nodeGroup("grp2").add("hgj2");

//    In the Settings window for Group, type Hinge Joints in the Label text field.

    model.nodeGroup("grp2").label("Hinge Joints");

//    In the Model Builder window, under Component 1 (comp1) > Multibody Dynamics (mbd), Ctrl-click to select Prismatic Joint 1, Prismatic Joint 2.
//    Right-click and choose Group.

    model.nodeGroup().create("grp3", "Physics", "mbd");
    model.nodeGroup("grp3").placeAfter("cfc1");
    model.nodeGroup("grp3").add("prj1");
    model.nodeGroup("grp3").add("prj2");

//    In the Settings window for Group, type Prismatic Joints in the Label text field.

    model.nodeGroup("grp3").label("Prismatic Joints");

//    In the Model Builder window, under Component 1 (comp1) > Multibody Dynamics (mbd), Ctrl-click to select Slot Joint 1, Slot Joint 2.
//    Right-click and choose Group.

    model.nodeGroup().create("grp4", "Physics", "mbd");
    model.nodeGroup("grp4").placeAfter("cfc1");
    model.nodeGroup("grp4").add("slj1");
    model.nodeGroup("grp4").add("slj2");

//    In the Settings window for Group, type Slot Joints in the Label text field.

    model.nodeGroup("grp4").label("Slot Joints");

//    In the Mesh toolbar, click More Generators and choose Edge.

    model.component("comp1").mesh("mesh1").create("edg1", "Edge");

//    In the Settings window for Edge, locate the Edge Selection section.
//    From the Selection list, select Cam Surface: Adjacent Edges.

    model.component("comp1").mesh("mesh1").feature("edg1").selection().named("adj1");

//    Right-click Edge 1 and choose Size.

    model.component("comp1").mesh("mesh1").feature("edg1").create("size1", "Size");

//    In the Settings window for Size, locate the Element Size section.
//    Click the Custom button.

    model.component("comp1").mesh("mesh1").feature("edg1").feature("size1").set("custom", true);

//    Locate the Element Size Parameters section.
//    Select the Curvature factor checkbox.

    model.component("comp1").mesh("mesh1").feature("edg1").feature("size1").set("hcurveactive", true);

//    In the associated text field, type 0.015.

    model.component("comp1").mesh("mesh1").feature("edg1").feature("size1").set("hcurve", 0.015);

//    Select the Maximum element growth rate checkbox.

    model.component("comp1").mesh("mesh1").feature("edg1").feature("size1").set("hgradactive", true);

//    In the associated text field, type 1.1.

    model.component("comp1").mesh("mesh1").feature("edg1").feature("size1").set("hgrad", 1.1);

//    Click Build Selected.

    model.component("comp1").mesh("mesh1").run("edg1");

//    In the Mesh toolbar, click More Generators and choose Mapped.

    model.component("comp1").mesh("mesh1").create("map1", "Map");

//    In the Settings window for Mapped, locate the Boundary Selection section.
//    From the Selection list, select Cam Surface.

    model.component("comp1").mesh("mesh1").feature("map1").selection().named("sel1");

//    Right-click Mapped 1 and choose Distribution.

    model.component("comp1").mesh("mesh1").feature("map1").create("dis1", "Distribution");

//    In the Settings window for Distribution, locate the Edge Selection section.
//    Click Paste Selection.
//    In the Paste Selection dialog, type 199 in the Selection text field.
//    Click OK.

    return model;
  }

  public static Model run2(Model model) {

    model.component("comp1").mesh("mesh1").feature("map1").feature("dis1").selection().set(199);

//    In the Settings window for Distribution, locate the Distribution section.
//    In the Number of elements text field, type 3.

    model.component("comp1").mesh("mesh1").feature("map1").feature("dis1").set("numelem", 3);

//    In the Mesh toolbar, click Free Tetrahedral.

    model.component("comp1").mesh("mesh1").create("ftet1", "FreeTet");

//    In the Model Builder window, click Size.
//    In the Settings window for Size, locate the Element Size section.
//    From the Predefined list, select Extra fine.

    model.component("comp1").mesh("mesh1").feature("size").set("hauto", 2);

//    Click Build All.

    model.component("comp1").mesh("mesh1").run();

//    In the Model Builder window, under Study 1, click Step 1: Time Dependent.
//    In the Settings window for Time Dependent, locate the Study Settings section.
//    In the Output times text field, type range(0,T/400,T/2).

    model.study("std1").feature("time").set("tlist", "range(0,T/400,T/2)");

//    Click to expand the Study Extensions section.
//    Select the Auxiliary sweep checkbox.

    model.study("std1").feature("time").set("useparam", true);

//    Click Add.

    model.study("std1").feature("time").setIndex("pname", "rf", 0);
    model.study("std1").feature("time").setIndex("plistarr", "", 0);
    model.study("std1").feature("time").setIndex("punit", "m", 0);
    model.study("std1").feature("time").setIndex("pname", "rf", 0);
    model.study("std1").feature("time").setIndex("plistarr", "", 0);
    model.study("std1").feature("time").setIndex("punit", "m", 0);

//    In the table, enter the following settings:

    model.study("std1").feature("time").setIndex("pname", "k", 0);
    model.study("std1").feature("time").setIndex("plistarr", "5 10 20 30", 0);
    model.study("std1").feature("time").setIndex("punit", "kN/m", 0);

//    In the Study toolbar, click Show Default Solver.

    model.study("std1").showAutoSequences("all");

//    In the Model Builder window, expand the Solution 1 (sol1) node.
//    In the Model Builder window, expand the Study 1 > Solver Configurations > Solution 1 (sol1) > Dependent Variables 1 node, then click Connection Force (comp1.mbd.cfc1.F).
//    In the Settings window for State, locate the Scaling section.
//    In the Scale text field, type 1e9.

    model.sol("sol1").feature("v1").feature("comp1_mbd_cfc1_F").set("scaleval", "1e9");

//    In the Model Builder window, under Study 1 > Solver Configurations > Solution 1 (sol1) > Dependent Variables 1, click Reaction Moment (comp1.mbd.hgj1.pm1.RM).
//    In the Settings window for State, locate the Scaling section.
//    In the Scale text field, type 1e7.

    model.sol("sol1").feature("v1").feature("comp1_mbd_hgj1_pm1_RM").set("scaleval", "1e7");

//    In the Study toolbar, click Compute.

    model.study("std1").createAutoSequences("all");

    model.sol("sol1").runAll();

    model.result().create("pg1", "PlotGroup3D");
    model.result("pg1").label("Displacement (mbd)");
    model.result("pg1").set("frametype", "spatial");
    model.result("pg1").set("smooth", "internal");
    model.result("pg1").feature().create("surf1", "Surface");
    model.result("pg1").feature("surf1").label("Surface");
    model.result("pg1").feature("surf1").set("colortable", "SpectrumLight");
    model.result("pg1").feature("surf1").set("data", "parent");
    model.result("pg1").feature("surf1").feature().create("def1", "Deform");
    model.result("pg1").feature("surf1").feature("def1").label("Deformation");
    model.result("pg1").feature("surf1").feature("def1").set("scaleactive", true);
    model.result().create("pg2", "PlotGroup3D");
    model.result("pg2").label("Velocity (mbd)");
    model.result("pg2").set("frametype", "spatial");
    model.result("pg2").set("smooth", "internal");
    model.result("pg2").feature().create("vol1", "Volume");
    model.result("pg2").feature("vol1").label("Domain Numbers");
    model.result("pg2").feature("vol1").set("descractive", true);
    model.result("pg2").feature("vol1").set("expr", "mod(dom,10)");
    model.result("pg2").feature("vol1").set("descr", "Domain numbers");
    model.result("pg2").feature("vol1").set("rangecoloractive", "on");
    model.result("pg2").feature("vol1").set("rangecolormin", -0.5);
    model.result("pg2").feature("vol1").set("rangecolormax", 9.5);
    model.result("pg2").feature("vol1").set("colortable", "Cyclic");
    model.result("pg2").feature("vol1").set("colorlegend", false);
    model.result("pg2").feature("vol1").set("colortabletype", "discrete");
    model.result("pg2").feature("vol1").set("smooth", "none");
    model.result("pg2").feature("vol1").set("data", "parent");
    model.result("pg2").feature("vol1").feature().create("def1", "Deform");
    model.result("pg2").feature("vol1").feature("def1").label("Deformation");
    model.result("pg2").feature("vol1").feature("def1").set("scaleactive", true);
    model.result("pg2").feature().create("arwl1", "ArrowLine");
    model.result("pg2").feature("arwl1").label("Arrow Line");
    model.result("pg2").feature("arwl1").set("expr", new String[]{"mbd.u_tX", "mbd.u_tY", "mbd.u_tZ"});
    model.result("pg2").feature("arwl1").set("placement", "elements");
    model.result("pg2").feature("arwl1").set("data", "parent");
    model.result("pg2").feature("arwl1").feature().create("def1", "Deform");
    model.result("pg2").feature("arwl1").feature("def1").label("Deformation");
    model.result("pg2").feature("arwl1").feature("def1").set("scaleactive", true);
    model.result("pg1").run();

//    In the Results toolbar, click 1D Plot Group.

    model.result().create("pg3", "PlotGroup1D");
    model.result("pg3").run();

//    In the Settings window for 1D Plot Group, type Follower Velocity in the Label text field.

    model.result("pg3").label("Follower Velocity");

//    Click to expand the Title section.
//    From the Title type list, select Label.

    model.result("pg3").set("titletype", "label");

//    Locate the Data section.
//    From the Parameter selection (k) list, select First.

    model.result("pg3").setIndex("looplevelinput", "first", 1);

//    Locate the Plot Settings section.
//    Select the Two y-axes checkbox.

    model.result("pg3").set("twoyaxes", true);

//    Right-click Follower Velocity and choose Global.

    model.result("pg3").create("glob1", "Global");
    model.result("pg3").feature("glob1").set("markerpos", "datapoints");
    model.result("pg3").feature("glob1").set("linewidth", "preference");

//    In the Settings window for Global, click Replace Expression in the upper-right corner of the y-Axis Data section.
//    From the menu, choose Component 1 (comp1) > Multibody Dynamics > Prismatic joints > Prismatic Joint 1 > mbd.prj1.u - Relative displacement - m.

    model.result("pg3").feature("glob1").set("expr", new String[]{"mbd.prj1.u"});
    model.result("pg3").feature("glob1").set("descr", new String[]{"Relative displacement"});
    model.result("pg3").feature("glob1").set("unit", new String[]{"m"});

//    Locate the y-Axis section.
//    Select the Plot on secondary y-axis checkbox.

    model.result("pg3").feature("glob1").set("plotonsecyaxis", true);

//    Locate the x-Axis Data section.
//    From the Parameter list, select Expression.

    model.result("pg3").feature("glob1").set("xdata", "expr");

//    Click Replace Expression in the upper-right corner of the x-Axis Data section.
//    From the menu, choose Component 1 (comp1) > Multibody Dynamics > Hinge joints > Hinge Joint 1 > mbd.hgj1.th - Relative rotation - rad.

    model.result("pg3").feature("glob1").set("xdataexpr", "mbd.hgj1.th");
    model.result("pg3").feature("glob1").set("xdatadescr", "Relative rotation");

//    Locate the x-Axis Data section.
//    From the Unit list, select °.

    model.result("pg3").feature("glob1").set("xdataunit", "\u00b0");

//    Select the Description checkbox.

    model.result("pg3").feature("glob1").set("xdatadescractive", true);

//    In the associated text field, type Cam rotation.

    model.result("pg3").feature("glob1").set("xdatadescr", "Cam rotation");

//    Click to expand the Coloring and Style section.
//    Find the Line style subsection.
//    From the Line list, select Dashed.

    model.result("pg3").feature("glob1").set("linestyle", "dashed");

//    From the Width list, select 2.

    model.result("pg3").feature("glob1").set("linewidth", 2);

//    Click to expand the Legends section.
//    From the Legends list, select Manual.

    model.result("pg3").feature("glob1").set("legendmethod", "manual");

//    In the table, enter the following settings:

    model.result("pg3").feature("glob1").setIndex("legends", "Displacement", 0);

//    Right-click Global 1 and choose Duplicate.

    model.result("pg3").feature().duplicate("glob2", "glob1");
    model.result("pg3").run();

//    In the Settings window for Global, click Replace Expression in the upper-right corner of the y-Axis Data section.
//    From the menu, choose Component 1 (comp1) > Multibody Dynamics > Prismatic joints > Prismatic Joint 1 > mbd.prj1.u_t - Relative velocity - m/s.

    model.result("pg3").feature("glob2").set("expr", new String[]{"mbd.prj1.u_t"});
    model.result("pg3").feature("glob2").set("descr", new String[]{"Relative velocity"});
    model.result("pg3").feature("glob2").set("unit", new String[]{"m/s"});

//    Locate the y-Axis section.
//    Clear the Plot on secondary y-axis checkbox.

    model.result("pg3").feature("glob2").set("plotonsecyaxis", false);

//    Locate the Coloring and Style section.
//    Find the Line style subsection.
//    From the Line list, select Solid.

    model.result("pg3").feature("glob2").set("linestyle", "solid");

//    Locate the Legends section.
//    In the table, enter the following settings:

    model.result("pg3").feature("glob2").setIndex("legends", "Velocity", 0);

//    In the Follower Velocity toolbar, click Plot.

    model.result("pg3").run();

//    Click the Zoom Extents button in the Graphics toolbar.

    model.result("pg3").run();

//    In the Model Builder window, right-click Follower Velocity and choose Duplicate.

    model.result().duplicate("pg4", "pg3");
    model.result("pg4").run();

//    In the Settings window for 1D Plot Group, type Follower Acceleration in the Label text field.

    model.result("pg4").label("Follower Acceleration");

//    Locate the Legend section.
//    From the Position list, select Upper left.

    model.result("pg4").set("legendpos", "upperleft");
    model.result("pg4").run();

//    In the Model Builder window, expand the Follower Acceleration node, then click Global 2.
//    In the Settings window for Global, click Replace Expression in the upper-right corner of the y-Axis Data section.
//    From the menu, choose Component 1 (comp1) > Multibody Dynamics > Prismatic joints > Prismatic Joint 1 > mbd.prj1.u_tt - Relative acceleration - m/s².

    model.result("pg4").feature("glob2").set("expr", new String[]{"mbd.prj1.u_tt"});
    model.result("pg4").feature("glob2").set("descr", new String[]{"Relative acceleration"});
    model.result("pg4").feature("glob2").set("unit", new String[]{"m/s^2"});

//    Locate the Legends section.
//    In the table, enter the following settings:

    model.result("pg4").feature("glob2").setIndex("legends", "Acceleration", 0);

//    In the Follower Acceleration toolbar, click Plot.

    model.result("pg4").run();

//    Click the Zoom Extents button in the Graphics toolbar.
//    In the Results toolbar, click 1D Plot Group.

    model.result().create("pg5", "PlotGroup1D");
    model.result("pg5").run();

//    In the Settings window for 1D Plot Group, type Connection Force in the Label text field.

    model.result("pg5").label("Connection Force");

//    Locate the Title section.
//    From the Title type list, select Label.

    model.result("pg5").set("titletype", "label");

//    Locate the Data section.
//    From the Time selection list, select Manual.

    model.result("pg5").setIndex("looplevelinput", "manualindices", 0);

//    In the Time indices (1-201) text field, type range(25,1,201).

    model.result("pg5").setIndex("looplevelindices", "range(25,1,201)", 0);

//    Locate the Legend section.
//    From the Position list, select Upper left.

    model.result("pg5").set("legendpos", "upperleft");

//    Right-click Connection Force and choose Global.

    model.result("pg5").create("glob1", "Global");
    model.result("pg5").feature("glob1").set("markerpos", "datapoints");
    model.result("pg5").feature("glob1").set("linewidth", "preference");

//    In the Settings window for Global, click Replace Expression in the upper-right corner of the y-Axis Data section.
//    From the menu, choose Component 1 (comp1) > Multibody Dynamics > Cam–followers > Cam–Follower 1 > mbd.cfc1.F - Connection force - N.

    model.result("pg5").feature("glob1").set("expr", new String[]{"mbd.cfc1.F"});
    model.result("pg5").feature("glob1").set("descr", new String[]{"Connection force"});
    model.result("pg5").feature("glob1").set("unit", new String[]{"N"});

//    Locate the x-Axis Data section.
//    From the Parameter list, select Expression.

    model.result("pg5").feature("glob1").set("xdata", "expr");

//    Click Replace Expression in the upper-right corner of the x-Axis Data section.
//    From the menu, choose Component 1 (comp1) > Multibody Dynamics > Hinge joints > Hinge Joint 1 > mbd.hgj1.th - Relative rotation - rad.

    model.result("pg5").feature("glob1").set("xdataexpr", "mbd.hgj1.th");
    model.result("pg5").feature("glob1").set("xdatadescr", "Relative rotation");

//    Locate the x-Axis Data section.
//    From the Unit list, select °.

    model.result("pg5").feature("glob1").set("xdataunit", "\u00b0");

//    Select the Description checkbox.

    model.result("pg5").feature("glob1").set("xdatadescractive", true);

//    In the associated text field, type Cam rotation.

    model.result("pg5").feature("glob1").set("xdatadescr", "Cam rotation");

//    Locate the Coloring and Style section.
//    From the Width list, select 2.

    model.result("pg5").feature("glob1").set("linewidth", 2);

//    Locate the Legends section.
//    Find the Include subsection.
//    Clear the Description checkbox.

    model.result("pg5").feature("glob1").set("autodescr", false);

//    In the Connection Force toolbar, click Plot.

    model.result("pg5").run();

//    Click the Zoom Extents button in the Graphics toolbar.

    model.result("pg5").run();

//    In the Model Builder window, right-click Connection Force and choose Duplicate.

    model.result().duplicate("pg6", "pg5");
    model.result("pg6").run();

//    In the Settings window for 1D Plot Group, type Required Torque in the Label text field.

    model.result("pg6").label("Required Torque");

//    Locate the Legend section.
//    From the Position list, select Upper right.

    model.result("pg6").set("legendpos", "upperright");
    model.result("pg6").run();

//    In the Model Builder window, expand the Required Torque node, then click Global 1.
//    In the Settings window for Global, click Replace Expression in the upper-right corner of the y-Axis Data section.
//    From the menu, choose Component 1 (comp1) > Multibody Dynamics > Hinge joints > Hinge Joint 1 > mbd.hgj1.pm1.RM - Reaction moment - N·m.

    model.result("pg6").feature("glob1").set("expr", new String[]{"mbd.hgj1.pm1.RM"});
    model.result("pg6").feature("glob1").set("descr", new String[]{"Reaction moment"});
    model.result("pg6").feature("glob1").set("unit", new String[]{"N*m"});

//    In the Required Torque toolbar, click Plot.

    model.result("pg6").run();

//    Click the Zoom Extents button in the Graphics toolbar.
//    In the Results toolbar, click Animation and choose Player.

    model.result().export().create("anim1", "Animation");
    model.result().export("anim1").set("target", "player");
    model.result().export("anim1").set("fontsize", "9");
    model.result().export("anim1").set("colortheme", "globaltheme");
    model.result().export("anim1").set("customcolor", new double[]{1, 1, 1});
    model.result().export("anim1").set("background", "color");
    model.result().export("anim1").set("gltfincludelines", "on");
    model.result().export("anim1").set("title1d", "on");
    model.result().export("anim1").set("legend1d", "on");
    model.result().export("anim1").set("logo1d", "on");
    model.result().export("anim1").set("options1d", "on");
    model.result().export("anim1").set("title2d", "on");
    model.result().export("anim1").set("legend2d", "on");
    model.result().export("anim1").set("logo2d", "on");
    model.result().export("anim1").set("options2d", "off");
    model.result().export("anim1").set("title3d", "on");
    model.result().export("anim1").set("legend3d", "on");
    model.result().export("anim1").set("logo3d", "on");
    model.result().export("anim1").set("options3d", "off");
    model.result().export("anim1").set("axisorientation", "on");
    model.result().export("anim1").set("grid", "on");
    model.result().export("anim1").set("axes1d", "on");
    model.result().export("anim1").set("axes2d", "on");
    model.result().export("anim1").set("showgrid", "on");
    model.result().export("anim1").showFrame();

//    In the Settings window for Animation, locate the Frames section.
//    In the Number of frames text field, type 50.

    model.result().export("anim1").set("maxframes", 50);
    model.result("pg2").run();

    model.title("Modeling a Radial Cam Based Valve Opening Mechanism");

    model
         .description("In this example, a spring-loaded valve opening mechanism having a rocker arm and a radial cam is studied. All the components of the system are modeled as rigid, and are connected through prismatic, hinge, and slot joints. The cam\u2013follower connection as well as other joint connections are modeled using built-in nodes of the Multibody Dynamics interface.\n\nA transient analysis is performed for various spring stiffness values. The output from the model includes, among many things, the follower velocity, follower acceleration, cam\u2013follower connection force, and the required torque.");

    return model;
  }

  public static void main(String[] args) {
    Model model = run();
    run2(model);
  }

}
