Define Requirements for Battery State of Charge Estimation
This example shows how to define requirements for an end-to-end workflow for battery state of charge (SOC) estimation.
Battery state of charge is the level of charge of an electric battery relative to its capacity, measured as a percentage. For more information about the task, see Battery State of Charge Estimation Using Deep Learning.
This example is step one in a series of examples that take you through this workflow. You can run each step independently or work through the steps in order.
The first step in this workflow is to set up requirements. This functionality requires Requirements Toolbox™. To verify and implement each of the requirements, follow the subsequent steps of the workflow.
Types of Requirements
Requirements are a collection of statements describing the desired behavior and characteristics of a system. Requirements ensure system design integrity and are achievable, verifiable, unambiguous, and consistent with each other. Each stage of design should have appropriate requirements. This example for SOC estimation has four types of requirements:
Data — A set of requirements for the data you use to train and test the model on.
Network — A set of requirements for the AI model you use to estimate the battery state of charge. You can split these requirements into two subsets: requirements for the model architecture and requirements for the model performance.
System-level model integration — A set of requirements for how the AI model integrates into the Simulink model.
Code generation — A set of requirements for how the generated code from the system behaves.
This example includes a small set of realistic requirements as illustration. If a system needs to meet specific safety criteria, then it will likely have many more requirements. For an example of a complete requirements set, see Verify an Airborne Deep Learning System.
A requirement describes behavior that a design must satisfy. Requirements typically take the form of natural language statements, formulas, tables, and graphics. In Requirements Toolbox™, you use the Requirements Editor (Requirements Toolbox) to author requirements and create requirement sets to contain the requirements. By linking one requirement set to another, each high-level requirement can be traced to implementation. As the system design evolves, you can use iterative requirements analysis to enhance requirement traceability and coverage. You can use the traceability diagram to visualize requirement traceability.
Open Requirements Editor to inspect requirements for the AI component. For information on how to add and manage requirements, see Use Requirements to Develop and Verify MATLAB Functions (Requirements Toolbox).
Each requirements has two properties that you can check the status of:
Implemented — Indicates whether the requirement has been incorporated into the system or software design and development.
Verified — Indicates whether the implementation of the requirement passes the test and meets the specified criteria.
Data Requirements
Data requirements are important for verifying that the data on which the system acts has enough coverage on data that is appropriate for the given task. Data requirements can also cover checks that help to avoid biases, improve how well the model performs, and meet privacy considerations. Data requirements are among the most important requirements for deep learning tasks, ensuring your data is suitable for the task is vital to producing a well-performing model. Data requirements are also important for ensuring that your model generalizes well when deployed.
View the data requirements. In this example, the data must be for SOC taken at four ambient temperatures: -10, 0, 10, and 25 degrees Celsius. These requirements ensure that the model has suitable coverage across different temperatures.
slreq.open("Requirements\batterySOCReqDataExample.slreqx");
Select one of the requirements. You can see information about what each requirement is testing. For more information about implementing and verifying data requirements, see Prepare Data for Battery State of Charge Estimation Using Deep Learning.
Network Architecture Requirements
Network architecture requirements outline how to build the AI model. For example, a network requirement can specify how many inputs and outputs the network must have. You can also specify a requirement that the network has an architecture that is suitable for the task.
View the network requirements. In this example, the network must take as input a 1-by-3 array and must output a single array (SOC).
slreq.open("Requirements\batterySOCReqNetworkExample.slreqx");
For more information about implementing and verifying network architecture requirements, see Train Deep Learning Network for Battery State of Charge Estimation.
Network Inference Requirements
Network inference requirements outline performance requirements such as for accuracy and speed, and if the network is robust to different types of data.
In this example, the trained network must achieve a suitable RMSE on the test data and must be able to detect out-of-distribution data.
slreq.open("Requirements\batterySOCReqNetworkInferenceExample.slreqx");
To see how to implement and test network inference requirements, see Test Deep Learning Network for Battery State of Charge Estimation.
System-Level Model Integration Requirements
System-level model integration requirements check that the model performs just as well when converted into a Simulink model.
View the Simulink requirements. In this example, the predictions generated by the Simulink model must have an RMSE of less than 0.05 for each ambient temperature.
slreq.open("Requirements\batterySOCReqSimulinkExample.slreqx");
For more information about implementing and verifying system-level model integration requirements, see Integrate AI Model into Simulink for Battery State of Charge Estimation.
Code Generation Requirements
Code generation requirements check that the model performs just as well when converted into generated code.
View the code generation requirements. In this example, the Simulink model and SIL must be in agreement up to a suitable tolerance at each ambient temperature.
slreq.open("Requirements\batterySOCReqSILExample.slreqx");
For more information about implementing and verifying code generation requirements, see Generate Code for Battery State of Charge Estimation Using Deep Learning.
You will implement and verify each of these requirements using the next steps in the workflow.
Next step: Prepare Data for Battery State of Charge Estimation Using Deep Learning. Before the next step, it is recommended that you close all the requirements in the Requirements Editor. You can also open the next example using the openExample
function.
openExample("deeplearning_shared/PrepareDataForBatteryStateOfChargeModelExample")
See Also
Requirements Editor (Requirements Toolbox)
Related Topics
- Use Requirements to Develop and Verify MATLAB Functions (Requirements Toolbox)
- Battery State of Charge Estimation Using Deep Learning
- Author Requirements in MATLAB or Simulink (Requirements Toolbox)