Sunday, October 15, 2023
HomeIoTConstructing an EV Battery Monitoring answer with AWS IoT FleetWise (Half 1/2)

Constructing an EV Battery Monitoring answer with AWS IoT FleetWise (Half 1/2)


Introduction

Automakers, fleet operators, and automotive suppliers are recognizing the potential of car knowledge to remodel their enterprise fashions and optimize their operations. Nonetheless, implementing data-driven use circumstances is usually difficult. Proprietary car knowledge codecs, excessive prices of information ingestion and implementation complexity can decelerate innovation.
AWS IoT FleetWise is a service that makes it simpler for automakers to gather, remodel, and switch car knowledge to the cloud. As soon as transferred, clients can use breadth and depth of AWS analytics and machine studying companies to extract worth from the car knowledge. You probably have no earlier expertise with AWS IoT FleetWise, please take into account beginning with the weblog Producing insights from car knowledge with AWS IoT FleetWise. You’ll study use circumstances, technical capabilities, and a logical structure for AWS IoT FleetWise. In the identical weblog, we additionally launched an Electrical Automobile (EV) battery monitoring answer.

This put up will stroll you thru constructing that EV battery monitoring answer with AWS IoT FleetWise. First, you’ll deploy an EV simulation on an Amazon Elastic Compute Cloud (Amazon EC2) occasion in your AWS account. Then, you’ll configure AWS IoT FleetWise to gather, remodel, switch, and retailer the CAN bus indicators from the car. Lastly, you’ll question the collected knowledge utilizing the Amazon Timestream service.

Use case

Lithium-ion batteries (LiBs) are broadly used as vitality storage methods for EVs. When working EV fleets, steady monitoring and safety of battery cells is a crucial consideration.

For EV producers and fleet operators, the flexibility to detect and predict battery points comparable to overcurrent, overcharge or overheating is essential. For instance, it could enhance effectivity and security of fleet operations by enabling well timed planning for battery alternative. One other instance is that it permits EV producers to collaborate with battery suppliers on battery enchancment initiatives, by evaluating the circumstances of the battery in numerous situations.

The aim of this weblog is to exhibit how you need to use AWS IoT FleetWise to gather and switch BMS parameters to the cloud. For that function, we’ll use an instance of overcurrent detection use-case. After the info is transferred, it will likely be saved in a database, prepared for use for monitoring, alarming and ML mannequin traning.

Answer structure

The next diagram exhibits the structure of the answer. We additionally point out the scope of this weblog put up, that we’ll implement following the step-by-step walkthrough. The remaining a part of the structure shall be lined partly 2 of this weblog sequence.

Solution Architecture

Answer Structure

Please seek advice from the earlier a part of this weblog sequence for an in depth description of the answer structure.

Implementation strategy

The next pattern implementation makes use of two autos and two knowledge assortment campaigns.

Automobiles

The autos shall be simulated by one Amazon EC2 occasion every. The EC2 occasion will run a script producing CAN bus messages to simulate BMS. Each autos will deliberately use barely completely different CAN sign encodings to exhibit the flexibility of AWS IoT FleetWise to supply unified entry to heterogeneous car fleets.

Aspect comment: the car simulation could be simply adopted to breed any beforehand recorded CAN or OBD-II indicators on a simulated atmosphere. This may be helpful in a prototyping section of options primarily based on AWS IoT FleetWise. For instance, you possibly can document CAN knowledge out of your autos utilizing the instrument of your selection. As soon as recorded, you possibly can replay the car knowledge on a simulated atmosphere for AWS IoT FleetWise testing. You possibly can study extra about simulating your individual car knowledge in the GitHub repository .

Information assortment campaigns

To discover ways to configure the info assortment options of AWS IoT FleetWise, you’ll arrange two knowledge assortment campaigns:

  • A knowledge assortment marketing campaign for steady, low frequency (1 second sampling charge) monitoring of EV battery pack present and battery cell temperature. For the sake of simplicity, we’ll embody just one single battery cell in our instance.
  • A conditional knowledge assortment marketing campaign to gather a high-resolution (50 ms sampling charge) snapshot of a number of Battery Administration System (BMS) indicators. This marketing campaign will solely gather knowledge beneath situation that the shunt present (represented by the sign EVBatterySample.BMS.BatteryPack01.ShuntPlusCurrent_a) is above 450 amperes, i.e. in overcurrent state of affairs.

Introducing the AWS IoT FleetWise logical knowledge mannequin

To deploy an answer primarily based on AWS IoT FleetWise, you’ll configure knowledge assortment, transformation, and switch out of your car fleet. AWS IoT FleetWise supplies APIs to attain that. You possibly can invoke these APIs through the use of the AWS Administration Console, AWS SDKs, or AWS CLI.

A lot of the APIs you’ll use on this weblog observe the CRUD (Create, Learn Replace, Delete) paradigm. For instance, you need to use the API motion CreateCampaign to configure a brand new knowledge assortment marketing campaign, or UpdateCampaign to alter the standing of the marketing campaign.

The CRUD operations seek advice from the next key components of the logical knowledge mannequin of AWS IoT FleetWise: Sign Catalog, Automobile Mannequin, Marketing campaign, Automobile, Fleet and DecoderManifest. The next diagram introduces these components and explains their relationships:

Logical data model

Logical knowledge mannequin of AWS IoT FleetWise

Please observe the rules on this weblog to discover ways to create every of those knowledge mannequin components utilizing the AWS IoT FleetWise APIs .

On this weblog you’ll use AWS CLI to work together with AWS IoT FleetWise APIs. You too can use the AWS IoT FleetWise Administration console to handle AWS IoT FleetWise.

Deploying the answer

Open AWS CloudShell

Please click on on this hyperlink to open AWS CloudShell (a browser-based shell). Please guarantee to alter your AWS area to one of many areas supported by AWS IoT FleetWise (e.g. Europe Frankfurt or US East Virginia).

Clone the repository

Please clone the GitHub repository with the sources for this weblog by operating the next instructions:

git clone https://github.com/aws-samples/aws-iot-fleetwise-evbatterymonitoring

Create Amazon EC2 keypair

Please run the next command to create and retailer a brand new Amazon EC2 keypair. You’ll use it to determine an SSH connection to an Amazon EC2 occasion with car simulation in a later step.

aws ec2 create-key-pair --key-name fleetwiseblogec2key | 
jq -r .KeyMaterial > fleetwiseblogec2key.pem

chmod 0600 fleetwiseblogec2key.pem

Deploy an answer for car simulation

On this step, you’ll deploy an AWS CloudFormation stack to arrange the simulation for 2 autos. This stack will provision the required sources in your AWS account.

Deploying this answer could incur prices in your AWS invoice, e.g., for Amazon EC2, AWS IoT and Amazon Timestream companies. Please keep in mind to take away these sources by deleting the AWS CloudFormation stack to keep away from unintended prices. You can find directions for deleting the stack on the finish of this weblog.

Please change the listing:


cd aws-iot-fleetwise-evbatterymonitoring

Please deploy the stack.


aws cloudformation deploy 
--template-file simulatedvehicle/ec2simulation/template.yaml 
--stack-name vehiclesimulation --disable-rollback 
--parameter-overrides Ec2KeyPair=fleetwiseblogec2key IoTCoreRegion=$AWS_REGION 
--capabilities "CAPABILITY_NAMED_IAM"

Please proceed with the rules of this weblog whereas the deployment of AWS CloudFormation stack runs (approx. 20 minutes). In the event you expertise issues with the stack deployment, please take into account the troubleshooting pointers.

You should use “New tab” perform in AWS CloudShell “Actions” menu to create a brand new tab for subsequent steps .

Configure CLI

To make use of AWS CLI v2 to entry AWS IoT FleetWise, full the next steps to configure the AWS CLI mannequin.


wget https://docs.aws.amazon.com/iot-fleetwise/newest/developerguide/
samples/iotfleetwise-preview.zip
unzip iotfleetwise-preview.zip
aws configure add-model --service-name iotfleetwise 
    --service-model file://iotfleetwise-preview.json

Create AWS CLI enter recordsdata

To enhance the readability of this weblog, we’ll present enter to AWS CLI instructions in JSON format. To create these JSON recordsdata specialised in your account and area, run the next instructions which is able to try this activity for you:

cd ~/aws-iot-fleetwise-evbatterymonitoring/cloud
./prepare_templates.sh
cd cli-inputs

Create an AWS IAM position

First, we’ll create an AWS Id and Entry Administration (IAM) position for the AWS IoT FleetWise service with the appropriate permissions to put in writing to the Amazon Timestream database:

aws iam create-role --role-name AWSIoTFleetWiseServiceRole
    --assume-role-policy-document file://1_setup/trustpol.json

aws iam create-policy --policy-name AWSIoTFleetwiseIAMUserPolicy 
                      --policy-document file://1_setup/coverage.json

aws iam attach-role-policy --cli-input-json file://1_setup/policy_attach.json

Please assessment the AWS IAM position coverage to study extra in regards to the essential permissions.

Preliminary AWS IoT FleetWise configuration

On this step, you configure AWS IoT FleetWise with the IAM position you created earlier and the Amazon Timestream database and desk names. It is advisable to carry out this configuration as soon as for the respective AWS area earlier than you need to use AWS IoT FleetWise.

aws iotfleetwise register-account 
    --cli-input-json file://1_setup/account_registration.json
# Examine if registration is successfull
aws iotfleetwise get-register-account-status

You possibly can study extra in regards to the preliminary configuration by reviewing the enter file account_registration.json . Please assessment to RegisterAccount API for particulars.

Create sign catalog

The sign catalog is a definition of standardized car indicators. To create a brand new sign catalog, please run the next command:

aws iotfleetwise create-signal-catalog
    --cli-input-json file://2_signal_catalog/create-signal-catalog.json

You possibly can study in regards to the construction of the sign catalog by reviewing the enter file create-signal-catalog.json . Please seek advice from the CreateSignalCatalog API for particulars.

Create car mannequin manifest

Let’s assessment the idea of a car mannequin in AWS IoT FleetWise. The aim of car mannequin is to implement constant knowledge construction throughout a number of autos of the identical sort, as a way to course of knowledge from fleets of autos. With AWS IoT FleetWise, we use the time period “sign” referring to the car knowledge.

For instance, a fleet operator could have a fleet of two autos sorts – EVs and electrical scooters. Each EVs and scooters could generate some frequent knowledge (additionally referred to as “car indicators”). An instance for that’s “present car velocity”. Nonetheless, the EVs could generate indicators which aren’t relevant for the scooters, for instance tire stress. To distinguish between knowledge schemas for EVs and electrical scooter, the fleet operator can create two car fashions in AWS IoT FleetWise.

The mannequin manifest formally describes the schema of the info to be collected from a particular sort of car. Please assessment the mannequin manifest examples in recordsdata vehicle-model1.json and vehicle-model2.json .

Please observe {that a} newly created mannequin manifest have to be activated earlier than additional use. As soon as activated, no additional adjustments of the mannequin manifest are attainable. To create and activate mannequin manifests for 2 car fashions, please run the next instructions.

# Mannequin 1
aws iotfleetwise create-model-manifest
    --cli-input-json file://3_model_manifest/vehicle-model1.json
aws iotfleetwise update-model-manifest --status ACTIVE --name blog-modelmanifest-01
# Mannequin 2
aws iotfleetwise create-model-manifest
    --cli-input-json file://3_model_manifest/vehicle-model2.json
aws iotfleetwise update-model-manifest --status ACTIVE --name blog-modelmanifest-02

Please seek advice from the CreateModelManifest documentation for particulars.

Please observe that whereas there may be overlap between the indicators for each fashions, some indicators are solely accessible for the particular mannequin. For instance, “EVBatterySample.BMS.Relay01.Standing” is just accessible for the first mannequin, not the second mannequin. That is to exhibit how one can mannequin heterogeneous car fleets whereas offering constant entry to the frequent indicators.

Create decoder manifest

The decoder manifest describes the decoding guidelines for indicators of a selected car. To create and activate decoder manifests, please run the next instructions:

# Decoder manifest 1
aws iotfleetwise create-decoder-manifest
    --cli-input-json file://4_decoder_manifest/decoder-manifest1.json
aws iotfleetwise update-decoder-manifest --status ACTIVE --name blog-decodermanifest-01
# Decoder manifest 2
aws iotfleetwise create-decoder-manifest
    --cli-input-json file://4_decoder_manifest/decoder-manifest2.json
aws iotfleetwise update-decoder-manifest --status ACTIVE --name blog-decodermanifest-02

You possibly can study in regards to the mannequin manifest by reviewing the enter recordsdata decoder-manifest1.json and decoder-manifest2.json.

Please observe that encoding for the sign “EVBatterySample.BMS.BatteryPack01.ShuntPlusCurrent_a” is completely different between the primary and the second decoder manifest. That is to exhibit how AWS IoT FleetWise creates an abstraction of decoding from the car mannequin. This lets you deal with completely different encodings whereas offering constant entry to car indicators.

Please assessment CreateDecoderManifest API for particulars. Please observe that you would be able to additionally use the ImportDecoderManifest API to create a decoder manifest utilizing a DBC file.

Create a car

The car is an occasion of a car mannequin, representing a bodily car. To create autos, please run the next instructions:

aws iotfleetwise create-vehicle --cli-input-json file://5_vehicle/vehicle01.json
aws iotfleetwise create-vehicle --cli-input-json file://5_vehicle/vehicle02.json

You possibly can study in regards to the car by reviewing the enter recordsdata vehicle01.json and vehicle02.json . Please assessment the CreateVehicle API for particulars.

Create a fleet and affiliate autos with the fleet

With AWS IoT FleetWise, you’ll be able to goal a marketing campaign both in the direction of a particular car or a fleet, i.e. a set of autos. To create an instance fleet and affiliate each autos with the fleet, please run the next instructions:

aws iotfleetwise create-fleet --cli-input-json file://6_fleet/fleet.json
aws iotfleetwise associate-vehicle-fleet --fleet-id blog-fleet
    --vehicle-name blog-vehicle-01
aws iotfleetwise associate-vehicle-fleet --fleet-id blog-fleet
    --vehicle-name blog-vehicle-02

You possibly can study in regards to the fleet by reviewing the enter file fleet.json . Please assessment the CreateFleet and AssociateVehicleFleet API for particulars.

Provoke knowledge assortment campaigns

On this part, you’ll implement two typical use circumstances for car knowledge assortment. For this function, you’ll create two knowledge assortment campaigns.

To provoke a knowledge assortment marketing campaign with AWS IoT FleetWise, create a brand new marketing campaign by calling CreateCampaign API after which approve the marketing campaign calling UpdateCampaign API . By approving the marketing campaign, you instruct AWS IoT FleetWise to ship the configuration for knowledge assortment campaigns and decoders to the autos. Based mostly on this configuration, the AWS IoT FleetWise Edge Agent begins accumulating, reworking, and transferring knowledge to the AWS.

Allow us to check out the person campaigns.

Marketing campaign 1: repeatedly gather battery pack present and cell temperature

This marketing campaign will use a time-based assortment scheme, i.e. the Edge Agent will repeatedly gather car knowledge and switch it to the cloud within the specified time interval. To create this marketing campaign, please run the next instructions:

aws iotfleetwise create-campaign 
    --cli-input-json file://7_campaign/continious-monitoring-campaign.json
# Please wait 15 seconds earlier than operating the subsequent command to permit for marketing campaign creation to finish
aws iotfleetwise update-campaign --action APPROVE
    --name continious-monitoring-campaign

You possibly can study extra about this marketing campaign by reviewing continious-monitoring-campaign .

Marketing campaign 2: conditionally gather a high-resolution (50 ms sampling charge) snapshot of a number of Battery Administration System (BMS) indicators.

An instance of a use case for this marketing campaign is the evaluation of potential issues with the battery packs of a pre-production car fleet. To carry out an evaluation, car high quality engineers may have a high-resolution snapshot for a number of indicators (e.g., temperature improvement of particular battery cells). Nonetheless, allow us to assume that the car engineers are solely within the knowledge if overcurrent occasion happens.

To implement this use case, you’ll create a marketing campaign with a condition-based assortment scheme. The Edge Agent will consider an expression that you would be able to outline (for instance, $variable.`EVBatterySample.BMS.BatteryPack01.ShuntPlusCurrent_a` > 450.0). Provided that this expression evaluates to true does the Edge Agent gather car knowledge and switch it to the cloud.

To create this marketing campaign, please run the next instructions:

aws iotfleetwise create-campaign
     --cli-input-json file://7_campaign/conditional-snapshot-campaign.json
# Please wait 15 seconds earlier than operating the subsequent command to permit for marketing campaign creation to finish
aws iotfleetwise update-campaign --action APPROVE
    --name conditional-snapshot-campaign

You possibly can study extra about this marketing campaign by reviewing conditional-snapshot-campaign.json .

Testing the answer

You have got efficiently deployed a simulation and configured the AWS IoT FleetWise service. Now it’s time to see the general answer in motion. Please observe the directions beneath.

Step 1: Hook up with the simulated car

On this step, you’ll connect with the Amazon EC2 occasion that simulates the car. You’ll then assessment the output of two software program parts: Edge Agent and the CAN bus simulation script. Please full the next steps:

1. Get the output of the stack

aws cloudformation describe-stacks 
    --stack-name vehiclesimulation 
    --query "Stacks[0].Outputs[?OutputKey=='Ec2Instance1SSH'].OutputValue" 
    --output textual content

In the event you see “None” as output, it implies that stack deployment has not accomplished but. Please retry in couple of minutes. In the event you expertise issues with the stack deployment, please take into account the troubleshooting pointers.

2. SSH into the Amazon EC2 occasion
Please copy and paste the SSH command from the stack output above and run it. When requested if you wish to connect with the occasion, please verify with “sure”:

ssh -i ~/fleetwiseblogec2key.pem ubuntu@<Worth of Vehicle1EC2PublicIP>

3. View CAN messages

Please view the CAN knowledge generated by the car simulation script that runs as a system service .

candump vcan0

You possibly can exit the output mode utilizing Ctrl-C command.

4. You possibly can view Edge Agent output

sudo journalctl -fu fwe@0

You possibly can safely ignore error message “Did not obtain VIN from Engine ECU”.

Step 2: Evaluation collected car knowledge in Amazon Timestream

On this step, you’ll assessment the outcomes of the info assortment campaigns saved within the Amazon Timestream desk.

1. Open the Amazon Timestream Console

Please navigate to “Amazon Timestream” service in AWS administration console or click on on this hyperlink. Subsequent, choose the Question editor menu merchandise.

Amazon Timestream console

Amazon Timestream console

2. Evaluation car knowledge collected by marketing campaign 1 “Repeatedly gather battery pack present and cell temperature”

Within the textual content discipline for the question, enter the next pattern question and select Run :

SELECT time, vehicleName, measure_name, measure_value::double, VehicleVIN
FROM "FleetWiseDatabase"."FleetWiseTable"
WHERE campaignName="continious-monitoring-campaign" AND
      time between in the past(15m) and now()
ORDER BY time DESC LIMIT 10

Now you can view the collected car knowledge as you see in instance beneath:

Amazon Timestream Query
Despite the truth that each autos encode the CAN message for the sign EVBatterySample.BMS.BatteryPack01.ShuntPlusCurrent_a in numerous methods (see DBC recordsdata for car 1 and car 2), you’ll be able to entry and analyze the car knowledge beneath a uniform title!

We recommend to run your individual experiments with visualizing the car knowledge through the use of Amazon Managed Grafana with instance dashboards, as you’ll be able to see within the instance beneath:
Amazon Managed Grafana

3. Evaluation car knowledge collected by marketing campaign 2

Let’s question the statistics of a particular cell temperature. Enter the next question and choose Run :

SELECT vehicleName, measure_name,
       hour(time) as hour, minute(time) as minute,
       max(measure_value::double) as MaxTemperature,
       min(measure_value::double) as MinTemperature
FROM "FleetWiseDatabase"."FleetWiseTable"
WHERE campaignName="conditional-snapshot-campaign"
      AND measure_name="EVBatterySample.BMS.BatteryPack01.Cell001.CellTemperature"
      AND (time between in the past(10m) and now())
GROUP by vehicleName, measure_name, hour(time), minute(time)
ORDER by vehicleName,hour(time), minute(time)

Now you can view the aggregated car knowledge as you see in instance beneath. In accordance with the marketing campaign configuration , the info was transferred solely when battery pack shunt present was over 450 amperes. For 19:42 and 19:43, shunt present was beneath 450 amperes, so no knowledge was transferred.

We recommend to run your individual experiments with the car knowledge by following Amazon Timestream Question Language reference pointers or by creating Amazon Managed Grafana dashboards like beneath utilizing offered examples:

Cleansing up

Please guarantee to exit the SSH session to the Amazon EC2 occasion earlier than you proceed. Please run the next instructions in AWS CloudShell to take away the created sources out of your AWS account:

aws cloudformation delete-stack --stack-name vehiclesimulation
sh ~/aws-iot-fleetwise-evbatterymonitoring/cloud/automation/fleetwise-cleanup.sh

Abstract and subsequent steps

You have got discovered use AWS IoT FleetWise to implement the gathering, conversion, transmission, and storage of CAN bus indicators and question these indicators utilizing Amazon Timestream. Within the subsequent a part of this weblog sequence, we’ll introduce you to how you need to use AWS companies to investigate saved knowledge.

Go to the AWS IoT FleetWise webpage to study extra.

Particular thanks

Geoffrey Phillips (Senior Software program Growth Engineer) contributed main components of the AWS CloudFormation template and the CAN Interactive Generator library.

In regards to the authors

Andrei Svirida is Senior Specialist Options Architect at Amazon Net Companies. He’s obsessed with enabling firms of all sizes and industries to turn into data-driven companies. To that finish, he helps AWS clients to architect and construct safe and scalable options on AWS, specializing in IoT, Analytics and Information Engineering. Previous to becoming a member of AWS, Andrei labored at KUKA AG as Head for IoT Supply and as VP in in-house consulting at Deutsche Telekom AG. Andrei has a pc science background and extra then 18 years of business expertise.

Suvendu Rath
Suvendu Rath is Senior Engagement Supervisor at Amazon Net Companies. He’s obsessed with strong innovation methods for Automotive clients. He helps AWS clients to run innovation tasks from preliminary temporary by means of to last deliverable, specializing in IoT, AI/ML and Information Engineering. Previous to becoming a member of AWS, Suvendu labored as Software program Mission Lead at BMW AG and as Software program Engineer in Automotive/Avionics business . Suvendu has an Electrical Engineering background and greater than 15 years of business expertise in Automotive and Avionics area.

Katja Kroedel

Katja-Maja Kroedel is IoT Specialist Answer Architect at Amazon Net Companies. She works with AWS clients to supply steering on cloud adoption, migration, and technique within the space of IoT. She is obsessed with expertise and enjoys constructing and experimenting within the cloud with progressive companies, comparable to AWS IoT FleetWise. Katja has a Laptop Engineering background and already labored at completely different roles inside AWS, beginning together with her Masterthesis in addition to her position as Generalist Options Architect in Germany, serving to small- and middle-sized clients develop and study in regards to the cloud.



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments