public void CreateVehicleProfileTest() { var route4Me = new Route4MeManagerV5(c_ApiKey); var vehProfileParams3 = new VehicleProfile() { Name = "Heavy Duty - 48 Semitrailer " + DateTime.Now.ToString("yyMMddHHmmss"), HeightUnits = VehicleSizeUnits.Foot.Description(), WidthUnits = VehicleSizeUnits.Foot.Description(), LengthUnits = VehicleSizeUnits.Foot.Description(), Height = 11, Width = 6.6, Length = 52, IsPredefined = false, IsDefault = false, WeightUnits = VehicleWeightUnits.Kilogram.Description(), Weight = 35000, MaxWeightPerAxle = 17500, FuelType = FuelTypes.Unleaded_87.Description(), FuelConsumptionCity = 6, FuelConsumptionHighway = 11, FuelConsumptionCityUnit = FuelConsumptionUnits.MilesPerGallonUS.Description(), FuelConsumptionHighwayUnit = FuelConsumptionUnits.MilesPerGallonUS.Description() }; var result = route4Me.CreateVehicleProfile(vehProfileParams3, out ResultResponse resultResponse2); Assert.NotNull(result); Assert.IsType <VehicleProfile>(result); lsVehicleProfiles.Add(result); }
public IVehicleProfile Build(IPsdzFp fp) { VehicleProfile vehicleProfile = (VehicleProfile)this.Build(fp); vehicleProfile.Baureihenverbund = fp.Baureihenverbund; vehicleProfile.Entwicklungsbaureihe = fp.Entwicklungsbaureihe; return(vehicleProfile); }
public bool Equals(VehicleProfile p) { return( Name.Equals(p.Name) && AutoTransmission == p.AutoTransmission && Weight == p.Weight && DynoDriveRatio == p.DynoDriveRatio && DragCoefficient == p.DragCoefficient && Wheel.Width == p.Wheel.Width && Wheel.AspectRatio == p.Wheel.AspectRatio && Wheel.RimDiameter == p.Wheel.RimDiameter && ElmTimeout == p.ElmTimeout && Notes.Equals(p.Notes) ); }
public bool Equals(VehicleProfile p) { return ( Name.Equals(p.Name) && AutoTransmission == p.AutoTransmission && Weight == p.Weight && DynoDriveRatio == p.DynoDriveRatio && DragCoefficient == p.DragCoefficient && Wheel.Width == p.Wheel.Width && Wheel.AspectRatio == p.Wheel.AspectRatio && Wheel.RimDiameter == p.Wheel.RimDiameter && ElmTimeout == p.ElmTimeout && Notes.Equals(p.Notes) ); }
public List <TraverseAlgorithm> GetAlgoritmsForPlatform(VehicleProfile vehicleProfile) { _profile = vehicleProfile; if (_response == null || _response.AlgorithmsMapping == null || _response.AlgorithmsMapping.Algorithms == null) { return(new List <TraverseAlgorithm>()); } var platform = _response .AlgorithmsMapping .Algorithms .FirstOrDefault(algotithm => algotithm.PlatformAndVehicleType.Platform.Id == _profile.Platform.Id && algotithm.PlatformAndVehicleType.VehicleType == _profile.VehicleType); return(platform != null ? platform.AlgorithmAndActionCodes.Select(x => x.Algorithm).OrderBy(o => o.Order).ToList() : new List <TraverseAlgorithm>()); }
public void _createCar(VehicleProfile vt) { vehicleProfile = vt; GameObject newVehicle = Instantiate(vehicleProfile.vehicleModel); newVehicle.transform.parent = gameObject.transform; //reset all position after puting to the right parent newVehicle.transform.localRotation = Quaternion.identity; newVehicle.transform.localPosition = Vector3.zero; //init motor parameters motor.jumpStr = vehicleProfile.motorJumpStr; motor.jumpDec = vehicleProfile.motorJumpDec; motor.amtOfAccel = vehicleProfile.motorAmtAccel; playerModel = newVehicle; Debug.Log(playerModel.transform.localPosition); }
public DynoForm(OBDInterface obd2) { m_obdInterface = obd2; m_profile = obd2.GetActiveProfile(); InitializeComponent(); Data = new DataList(); m_bCapture = false; m_dtDynoTime = DateTime.Now; btnStart.Enabled = false; btnReset.Enabled = false; printDocument1.DefaultPageSettings = new PageSettings() { Margins = new Margins(100, 100, 100, 100), Landscape = true }; pageSetupDialog1.Document = printDocument1; }
private void btnSave_Click(object sender, EventArgs e) { VehicleProfile vehicleProfile = new VehicleProfile(); if (txtName.Text.Length > 0) { vehicleProfile.Name = txtName.Text; Decimal num1 = numTimeout.Value; vehicleProfile.ElmTimeout = Convert.ToInt32(num1); vehicleProfile.AutoTransmission = radioAutomatic.Checked; try { vehicleProfile.SpeedCalibrationFactor = Convert.ToSingle(txtSpeedoFactor.Text); vehicleProfile.Weight = Convert.ToSingle(txtWeight.Text); vehicleProfile.DragCoefficient = Convert.ToSingle(txtDragCoeff.Text); vehicleProfile.Wheel.Width = Convert.ToInt32(txtTireWidth.Text); vehicleProfile.Wheel.AspectRatio = Convert.ToInt32(txtAspectRatio.Text); vehicleProfile.Wheel.RimDiameter = Convert.ToInt32(txtRimDiameter.Text); vehicleProfile.Notes = txtNotes.Text; } catch (FormatException) { MessageBox.Show("Make sure that numeric fields contain only numeric data, and make sure that you are not forgetting a required field.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); return; } m_arrayVehicleList[listVehicles.SelectedIndex] = (object)vehicleProfile; MarkProfileDirty(false); int selectedIndex = listVehicles.SelectedIndex; UpdateProfileList(m_arrayVehicleList); listVehicles.SetSelected(selectedIndex, true); } else { MessageBox.Show("You must enter a name for your profile.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); } }
public ArrayList LoadVehicleProfiles() { FileStream file = null; BinaryFormatter binaryFormatter = new BinaryFormatter(); ArrayList profiles = new ArrayList(); try { if (File.Exists("vehicles.dat")) file = new FileStream("vehicles.dat", FileMode.Open, FileAccess.Read); else { VehicleProfile profile = new VehicleProfile(); file = new FileStream("vehicles.dat", FileMode.Create, FileAccess.ReadWrite); binaryFormatter.Serialize((Stream)file, profile); } file.Position = 0L; while (true) { VehicleProfile vehicleProfile = binaryFormatter.Deserialize(file) as VehicleProfile; profiles.Add((object)vehicleProfile); } } catch (SerializationException) { } catch (Exception) { } finally { if (file != null) file.Close(); } return profiles; }
public void SaveActiveProfile(VehicleProfile profile) { Preferences settings = GetCommSettings(); settings.ActiveProfileIndex = GetVehicleProfiles().IndexOf((object)profile); SaveCommSettings(settings); }
/// <summary> /// Example how to create route on server with route parameters /// Minimum parameters is specified /// </summary> /// <param name="mission">Mission where create route</param> /// <param name="vehicleProfile">Profile for route</param> /// <param name="name">Route name</param> /// <returns></returns> public Route CreateNewRoute(Mission mission, VehicleProfile vehicleProfile, String name = "TestRoute") { var routeName = string.Format("{0} {1}", name, DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString()); Route route = new Route { CreationTime = ServiceHelpers.CreationTime(), Name = routeName, Mission = mission }; ChangeRouteVehicleProfileRequest request = new ChangeRouteVehicleProfileRequest { ClientId = _connect.AuthorizeHciResponse.ClientId, Route = route, NewProfile = new VehicleProfile { Id = vehicleProfile.Id } }; MessageFuture <ChangeRouteVehicleProfileResponse> future = _connect.Executor.Submit <ChangeRouteVehicleProfileResponse>(request); future.Wait(); route = future.Value.Route; route.Mission = mission; route.TrajectoryType = TrajectoryType.TT_STAIR; route.MaxAltitude = 50.0; route.SafeAltitude = 3.0; route.CheckAerodromeNfz = false; route.CheckAerodromeNfzSpecified = true; route.InitialSpeed = 0.0; route.MaxSpeed = 0.0; route.CheckCustomNfz = false; route.CheckCustomNfzSpecified = true; route.Failsafes.Add(new Failsafe() { Action = FailsafeAction.FA_GO_HOME, ActionSpecified = true, Reason = FailsafeReason.FR_RC_LOST, ReasonSpecified = true, }); route.Failsafes.Add(new Failsafe() { Action = FailsafeAction.FA_LAND, ActionSpecified = true, Reason = FailsafeReason.FR_LOW_BATTERY, ReasonSpecified = true }); route.Failsafes.Add(new Failsafe() { Action = FailsafeAction.FA_WAIT, ActionSpecified = true, Reason = FailsafeReason.FR_GPS_LOST, ReasonSpecified = true }); route.Failsafes.Add(new Failsafe() { Action = FailsafeAction.FA_GO_HOME, ActionSpecified = true, Reason = FailsafeReason.FR_DATALINK_LOST, ReasonSpecified = true }); return(SaveUpdatedRoute(route)); }
public void setProfile(VehicleProfile profile) { m_profile = profile; }
public VehiclesApiTests(ITestOutputHelper output) { _output = output; #region Create Test Vehicles lsVehicles = new List <Vehicle>(); var class6TruckParams = new Vehicle() { VehicleAlias = "GMC TopKick C5500 TST 6", VehicleVin = "SAJXA01A06FN08012", VehicleLicensePlate = "CVH4561", VehicleModel = "TopKick C5500", VehicleModelYear = 1995, VehicleYearAcquired = 2008, VehicleRegCountryId = 223, VehicleRegStateId = 12, VehicleMake = "GMC", VehicleTypeId = "pickup_truck", VehicleCostNew = 60000, PurchasedNew = true, MpgCity = 7, MpgHighway = 14, FuelConsumptionCity = 7, FuelConsumptionHighway = 14, FuelType = "diesel", LicenseStartDate = "2021-01-01", LicenseEndDate = "2031-01-01", }; var class6Truck = createVehicle(class6TruckParams); Assert.NotNull(class6Truck); Assert.IsType <Vehicle>(class6Truck); lsVehicles.Add(class6Truck); var class7TruckParams = new Vehicle() { VehicleAlias = "FORD F750 TST 7", VehicleVin = "1NPAX6EX2YD550743", VehicleLicensePlate = "FFV9547", VehicleModel = "F-750", VehicleModelYear = 2010, VehicleYearAcquired = 2018, VehicleRegCountryId = 223, VehicleMake = "Ford", VehicleTypeId = "livestock_carrier", VehicleCostNew = 60000, PurchasedNew = true, MpgCity = 7, MpgHighway = 14, FuelConsumptionCity = 7, FuelConsumptionHighway = 14, FuelType = "diesel", LicenseStartDate = "2021-01-01", LicenseEndDate = "2031-01-01", }; var class7Truck = createVehicle(class7TruckParams); Assert.NotNull(class7Truck); Assert.IsType <Vehicle>(class7Truck); lsVehicles.Add(class7Truck); #endregion #region Create Test Vehicle Profiles lsVehicleProfiles = new List <VehicleProfile>(); var route4me = new Route4MeManagerV5(c_ApiKey); var vehProfileParams1 = new VehicleProfile() { Name = "Heavy Duty - 28 Double Trailer " + DateTime.Now.ToString("yyMMddHHmmss"), HeightUnits = VehicleSizeUnits.Foot.Description(), WidthUnits = VehicleSizeUnits.Foot.Description(), LengthUnits = VehicleSizeUnits.Foot.Description(), IsPredefined = false, IsDefault = false, Height = 13, Width = 8, Length = 40, WeightUnits = VehicleWeightUnits.Kilogram.Description(), Weight = 20400, MaxWeightPerAxle = 15400, FuelType = FuelTypes.Unleaded_91.Description(), FuelConsumptionCity = 6, FuelConsumptionHighway = 12, FuelConsumptionCityUnit = FuelConsumptionUnits.MilesPerGallonUS.Description(), FuelConsumptionHighwayUnit = FuelConsumptionUnits.MilesPerGallonUS.Description() }; var vehProfile1 = route4me.CreateVehicleProfile(vehProfileParams1, out ResultResponse resultResponse); if (vehProfile1 != null && vehProfile1.GetType() == typeof(VehicleProfile) && vehProfile1.VehicleProfileId > 0) { lsVehicleProfiles.Add(vehProfile1); } var vehProfileParams2 = new VehicleProfile() { Name = "Heavy Duty - 40 Straight Truck " + DateTime.Now.ToString("yyMMddHHmmss"), HeightUnits = VehicleSizeUnits.Foot.Description(), WidthUnits = VehicleSizeUnits.Foot.Description(), LengthUnits = VehicleSizeUnits.Foot.Description(), IsPredefined = false, IsDefault = false, Height = 13, Width = 8, Length = 48, WeightUnits = VehicleWeightUnits.Kilogram.Description(), Weight = 36300, MaxWeightPerAxle = 15400, FuelType = FuelTypes.Unleaded_87.Description(), FuelConsumptionCity = 5, FuelConsumptionHighway = 10, FuelConsumptionCityUnit = FuelConsumptionUnits.MilesPerGallonUS.Description(), FuelConsumptionHighwayUnit = FuelConsumptionUnits.MilesPerGallonUS.Description() }; var vehProfile2 = route4me.CreateVehicleProfile(vehProfileParams2, out ResultResponse resultResponse2); if (vehProfile2 != null && vehProfile2.GetType() == typeof(VehicleProfile) && vehProfile2.VehicleProfileId > 0) { lsVehicleProfiles.Add(vehProfile2); } #endregion }
private void EditProfile(VehicleProfile profile) { txtName.Text = profile.Name; decimal num = new decimal(); num = new decimal(profile.ElmTimeout); numTimeout.Value = num; if (profile.AutoTransmission) { radioAutomatic.Checked = true; } else { radioManual.Checked = true; } txtSpeedoFactor.Text = profile.SpeedCalibrationFactor.ToString("0.000"); txtWeight.Text = profile.Weight.ToString(); txtDragCoeff.Text = profile.DragCoefficient.ToString("0.000"); txtTireWidth.Text = profile.Wheel.Width.ToString(); txtAspectRatio.Text = profile.Wheel.AspectRatio.ToString(); txtRimDiameter.Text = profile.Wheel.RimDiameter.ToString(); txtNotes.Text = profile.Notes; MarkProfileDirty(false); }
private ArrayList LoadVehicleProfiles() { FileStream fileStream = (FileStream)null; BinaryFormatter binaryFormatter = new BinaryFormatter(); ArrayList arrayList = new ArrayList(); try { if (File.Exists("vehicles.dat")) { fileStream = new FileStream("vehicles.dat", FileMode.Open, FileAccess.Read); } else { VehicleProfile vehicleProfile = new VehicleProfile(); fileStream = new FileStream("vehicles.dat", FileMode.Create, FileAccess.ReadWrite); binaryFormatter.Serialize((Stream)fileStream, (object)vehicleProfile); } fileStream.Position = 0L; while (true) { VehicleProfile vehicleProfile = binaryFormatter.Deserialize((Stream)fileStream) as VehicleProfile; arrayList.Add((object)vehicleProfile); } } catch (SerializationException) { } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { if (fileStream != null) fileStream.Close(); } return arrayList; }
private void btnNewVehicle_Click(object sender, EventArgs e) { VehicleProfile vehicleProfile = new VehicleProfile(); listVehicles.Items.Add((object)vehicleProfile); m_arrayVehicleList.Add((object)vehicleProfile); listVehicles.SetSelected(listVehicles.Items.Count - 1, true); }
public void _setVehicleType(int VT) { chosen_VehProfile = list_VehProfile[VT]; MenuManager.instance._tranverseMenu(); }