Fuel Cell EV reference application: how to monitor H2 tank level during simulation

4 views (last 30 days)
The Fuel Cell EV reference application has Fuel Tank size/capacity in properties, but I do not see where I can monitor Fuel Tank level (how full) during the simulation.
Any suggestions on how I can monitor Fuel Tank level?

Answers (1)

Hassaan
Hassaan on 12 Jan 2024
In MATLAB and Simulink, monitoring the fuel tank level in a Fuel Cell Electric Vehicle (FCEV) simulation can be accomplished through several methods. Since Simulink is a graphical programming environment for modeling, simulating, and analyzing multidomain dynamical systems, it offers a flexible platform for such tasks. Here's how you can approach this:
1. Use Built-in Blocks for Monitoring:
Simulink provides various blocks to display or log data. You can use blocks like Display, Scope, or Dashboard instruments (like Gauges, Lamps, etc.) to monitor the fuel tank level in real-time during the simulation.
2. Custom Script or Function Block:
If the fuel tank level is not directly available from your FCEV model, you might need to calculate it. You can use a MATLAB Function block to write custom code that calculates the fuel tank level based on fuel consumption and initial fuel level.
3. Data Logging:
Simulink allows for data logging during simulation. You can log the output of the block that represents the fuel tank level and then analyze this data in MATLAB after the simulation.
4. Integrating with MATLAB Code:
If you have a MATLAB script or function that can calculate or monitor the fuel tank level, you can integrate this script with your Simulink model. Use MATLAB Function blocks to embed MATLAB code in your Simulink model.
5. Event Listeners or Callbacks:
In more advanced scenarios, you can use event listeners or callback functions in MATLAB to trigger specific actions based on the fuel tank level during simulation.
Example Implementation:
Here's a simple example of how you might implement a fuel level monitoring system in Simulink:
  1. Calculate Fuel Consumption: Add blocks to your model that calculate the fuel consumption based on various parameters of the vehicle and its usage.
  2. Update Fuel Level: Use an Integrator block or a MATLAB Function block to subtract the consumed fuel from the initial fuel level to get the current fuel level.
  3. Display or Log the Data: Connect the output of the fuel level calculation to a Display, Scope, or Dashboard Gauge block to visualize the fuel level during the simulation. Alternatively, use a To Workspace or To File block for data logging.
  4. Analyze Post Simulation: If you logged the data, you can analyze it in MATLAB after the simulation to see how the fuel level changed over time.
Documentation and Community Resources:
  • Be sure to utilize MATLAB and Simulink’s extensive documentation for specific blocks or functions.
  • MATLAB Central, the user community forum, can be a valuable resource for specific questions or examples.
Remember, the exact implementation will depend on the specifics of your FCEV model and what you're trying to achieve with the simulation.
---------------------------------------------------------------------------------------------------------------------------------------------------------
If you find the solution helpful and it resolves your issue, it would be greatly appreciated if you could accept the answer. Also, leaving an upvote and a comment are also wonderful ways to provide feedback.
Professional Interests
  • Technical Services and Consulting
  • Embedded Systems | Firmware Developement | Simulations
  • Electrical and Electronics Engineering
Feel free to contact me.

Tags

Products


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!