Location:

EV Routing

EV Routing

The tram calculation method is to plan a reasonable driving route for the electric vehicle based on the starting point and the end point coordinates and the route conditions. The sample code is as follows:

            // Set the starting point and end point coordinates
            GeoPoint startGeoPoint = new GeoPoint(116.39750, 39.90850); //Tiananmen
            GeoPoint endGeoPoint = new GeoPoint(116.43423, 39.93766); //Dongzhimen Street
            RoutePlan routePlan = new RoutePlan();
            // Set the listener
            routePlan.setListener(new RoutePlan.Listener() {
                @Override
                public void onSuccess(final RouteResult result) {
                    //search successful
                }
    
                @Override
                public void onFail(final APIStatus status) {
                    //Query failed
                }
            });
            // Set the request parameters
            RoutePlan.Query query = RoutePlan.Query.newQuery(startGeoPoint, endGeoPoint, RoutePlanType.ELE_CAR);
            // Set the route mode
            query.setPolicy(0);
            // Set to return a route, the value range is 1 <= num <= 3;
            query.setNum(1);
            // Set the remaining power of the electric car
            query.setSoc(50);
            // Set the electric car's power to recharge
            query.setCapacity(50);
            routePlan.setQuery(query);
            //Initiate a request
            routePlan.plan();
        

RoutePlan.Query Description:
1. Obtain an instance by using the newQuery (GeoPoint startPoint, GeoPoint endPoint, int queryType) method in RoutePlan.Query; 2. startPoint starting point GeoPoint coordinates;
3. endPoint endpoint GeoPoint coordinates;
4. queryType calculation type, driving calculation type is RoutePlanType.ELE_CAR;
5. setSoc (double soc) sets the remaining power of the electric car, the tram circuit must call this method; 6. setCapacity(double capacity) sets the amount of power that you want to recharge on the charging post, which is less than the rated power of the vehicle. The tram circuit must call this method;
7. setNum(int num) sets the number of rows returned by the algorithm, num takes the range 1 <= num <= 3;
8. The setPolicy(int policy) method is used to set the conditions for the calculation. The value of the policy is as follows:

valuemeaning

0

Default (road condition + time + mileage comprehensive consideration)

1

Dodge congestion

2

Do not take high speed

3

High Speed ​​Priority

4

Avoid Charge

5

Dod to avoid congestion & not to go high speed

6

Dodge congestion & high speed priority

7

Dodge congestion & avoid charges

8

Dod to avoid congestion & avoid high speed & avoid charges

0

Do not go high speed & avoid charges

Note: The result return interface is an asynchronous thread interface.

Vehicle Driving Range

The vehicle travel range function is based on the remaining battery capacity and current position of the electric vehicle, and displays the range in which the vehicle can travel in real time.

The sample code is as follows:

            // Set parameters and results listener, initiate a search
            EVRange.searchRange(EVRange.Query.newQuery(new GeoPoint(116.39750, 39.90850), 8), new EVRange.Listener() {
                @Override
                public void onSuccess(final GeoPolygon range) {
                    // Get the scope is successful
                }
    
                @Override
                public void onFail(final APIStatus status) {
                    // Get the scope failed
                }
            });
        

EVRange.Query gets the instance EVRange.Query.newQuery(GeoPoint geoPoint, double int soc);
Parameters:
geoPoint: The location of the current vehicle, such as "new GeoPoint (116.39750, 39.90850)".
Soc: The amount of electricity remaining in the current vehicle, in kilowatts, for example, 8 kilowatts is passed in 8.
Note: The result return interface is an asynchronous thread interface.

TOP