public MoterModel(IMyMotorStator moter, MotorOperationDataEntity entity) { MyMotor = moter; this.DataEntity = entity; nowTime = DateTime.UtcNow; befTime = DateTime.UtcNow; }
public static void setDataEntityToMotorCustomData(MotorOperationDataEntity dataEntity, ref IMyMotorStator motorStator) { string text = ""; text += "Angle:" + dataEntity.GetTargetAngle().ToString(); text.AddNewLine(); text += "Velocity:" + dataEntity.GetVelocity().ToString(); text.AddNewLine(); text += "Reverce:" + dataEntity.GetReverce().ToString(); motorStator.CustomData = text; }
public bool Update(MotorOperationDataEntity dataEntity = null) { nowTime = DateTime.UtcNow; if (dataEntity != null) { this.DataEntity = dataEntity; } else { this.DataEntity = MotorOperationFormatter.getDataEntityFromMoterCustomData(MyMotor, this.DataEntity); } return(fastMove()); }
public static MotorOperationDataEntity setToDataEntityFromValue(MotorOperationDataEntity dataEntity, float?targetAngle = null, float?velocity = null, bool?reverce = null) { if (targetAngle != null) { dataEntity.SetTargetAngle((float)targetAngle); } if (velocity != null) { dataEntity.SetVelocity((float)velocity); } if (reverce != null) { dataEntity.SetReverce((bool)reverce); } return(dataEntity); }
public static MotorOperationDataEntity getDataEntityFromMoterCustomData(IMyMotorStator motor, MotorOperationDataEntity dataEntity) { string text = motor.CustomData; var arr = text.Split(Environment.NewLine.ToArray(), StringSplitOptions.None); foreach (var item in arr) { var array = item.Split(':'); switch (array[0]) { case "Angle": dataEntity.SetTargetAngle(float.Parse(array[1])); break; case "Velocity": dataEntity.SetVelocity(float.Parse(array[1])); break; case "Reverce": dataEntity.SetReverce(bool.Parse(array[1])); break; default: break; } } return(dataEntity); }
public void setData(MoterModel moter, MotorOperationDataEntity dataEntity) { this.entiityDictionaly[moter] = dataEntity; }
public void setValue(MoterModel moterModel, MotorOperationDataEntity dataEntity) { entiityDictionaly[moterModel] = dataEntity; }