Exemple #1
0
        /// Use this function after gear creation, to initialize it, given
        /// two shafts to join. The first shaft is the 'output' shaft of the motor,
        /// the second is the 'truss', often fixed and not rotating.
        /// The torque is applied to the output shaft, while the truss shafts
        /// gets the same torque but with opposite sign.
        /// Each shaft must belong to the same ChSystem.
        public override bool Initialize(ChShaft mshaft1, //< first  shaft to join (motor output shaft)
                                        ChShaft mshaft2  //< second shaft to join (motor truss)
                                        )
        {
            // Parent class initialize
            if (!base.Initialize(mshaft1, mshaft2))
            {
                return(false);
            }

            ChShaft mm1 = mshaft1;
            ChShaft mm2 = mshaft2;

            constraint.SetVariables(mm1.Variables(), mm2.Variables());

            SetSystem(shaft1.GetSystem());

            return(true);
        }
Exemple #2
0
        /// Use this function after object creation, to initialize it, given
        /// the 1D shaft and 3D body to join.
        /// Each item must belong to the same ChSystem.
        /// Direction is expressed in the local coordinates of the body.
        public bool Initialize(ChShaft mshaft,    //< shaft to join
                               ChBodyFrame mbody, //< body to join
                               ChVector mdir      //< the direction of the shaft on 3D body (applied on COG: pure torque)
                               )
        {
            ChShaft     mm1 = mshaft;
            ChBodyFrame mm2 = mbody;

            //Debug.Assert(mm1 == null && mm2 == null);

            shaft          = mm1;
            body.BodyFrame = mm2;
            shaft_dir      = ChVector.Vnorm(mdir);

            constraint.SetVariables(mm1.Variables(), mm2.Variables());

            SetSystem(shaft.GetSystem());
            return(true);
        }