Ejemplo n.º 1
0
	public Rotor(IMyMotorStator rotor) {
		this.theBlock = rotor;


		if(Program.maxRotorRPM <= 0) {
			maxRotorRPM	= rotor.GetMaximum<float>("Velocity");
		} else {
			maxRotorRPM = Program.maxRotorRPM;
		}
	}
Ejemplo n.º 2
0
        bool powerUpRotors(List <IMyTerminalBlock> rotorList, float targetPower) // power is 0 to 100
        {
            for (int i = 0; i < rotorList.Count; i++)
            {
                IMyMotorStator rotor = rotorList[i] as IMyMotorStator;

                float maxVelocity = rotor.GetMaximum <float>("Velocity");
                if (!rotor.Enabled)
                {
                    rotor.Enabled = true;
                }
                float targetVelocity = maxVelocity * (targetPower / 100.0f);
                Echo(rotor.CustomName + ":MV=" + maxVelocity.ToString("0.00") + ":V=" + targetVelocity.ToString("0.00"));

                /*
                 *      float rv = rotor.TargetVelocity;
                 *      if (rv > maxVelocity) rv = maxVelocity;
                 *      if (rv < -maxVelocity) rv = -maxVelocity;
                 *      if(rv<(targetVelocity))
                 *      {
                 *          targetVelocity = rv + 5;
                 *      }
                 *      if(rv>targetVelocity)
                 *      {
                 * //            targetVelocity = rv - 5;
                 *      }
                 *      if (targetVelocity > maxVelocity) targetVelocity = maxVelocity;
                 *      if (targetVelocity < -maxVelocity) targetVelocity = -maxVelocity;
                 * Echo("CurrentV:"+rv.ToString("0.00")+":ADJV=" + targetVelocity.ToString("0.00"));
                 */
//                rotor.TargetVelocity = targetVelocity;
                rotor.TargetVelocityRPM = targetVelocity;
            }

            return(true);
        }