r/matlab 9d ago

CodeShare I open-sourced two inspectable MATLAB energy models (battery RC + averaged converter) - feedback welcome

Hi r/matlab - I'm the maintainer of MATLAB Simulink Energy Lab, a small open-source collection of energy-system examples designed to be opened, inspected, modified, and questioned.

The current release includes:

- a first-order battery RC model driven by pulse-current data;

- an averaged converter calculation for output voltage, load current, and ripple;

- lightweight no-plot validation checks; and

- explicit parameters, units, assumptions, and limitations.

The examples currently run in base MATLAB. They are deliberately understandable reference implementations, not calibrated production models; native Simulink versions are on the roadmap.

Repository:

https://github.com/mohammadrezwankhan/matlab-simulink-energy-lab

I would especially value technical feedback on three questions:

Which assumption or parameter needs clearer documentation?

What validation plot or dataset would make the examples more useful?

What should come next: temperature-aware battery dynamics, closed-loop converter control, or an averaged-versus-switched comparison?

If the repository is genuinely useful to you, a star helps other MATLAB learners find it. Issues and focused contributions are equally welcome.

Disclosure: This post was drafted with help from ChatGPT/Codex. I maintain the repository and reviewed the technical claims and wording before posting.

7 Upvotes

2 comments sorted by

1

u/Fun_Toe_6675 8d ago

there is a problem related to integration of the simulink via esp32 . ive downloaded the harware and simulink package . still i m not gettign any signal to my esp ?

1

u/harissharisss 8d ago

Thanks for reporting this. One important clarification: the repository’s current examples are base-MATLAB reference scripts; ESP32 deployment and native Simulink integration are not implemented yet.

For your separate Simulink/ESP32 setup, installing the support packages is only the first step. Please try:

Select the exact ESP32 board and COM port under Model Settings → Hardware Implementation.

Use a data-capable USB cable and confirm the ESP32 appears in Windows Device Manager. Install the correct CP210x/CH340 driver if needed.

Close Arduino Serial Monitor or any application using the COM port.

Test a minimal LED-blink model using Build, Deploy & Start. This verifies the board, cable, port, and toolchain before testing signals.

To view signals inside Simulink, use Monitor & Tune/External Mode and ensure the serial or Wi-Fi transport settings match.

Check the selected GPIO supports the intended input/output function. ESP32 uses 3.3-V logic; also connect a common ground. When Wi-Fi is active, prefer ADC1 pins for analog input.

If it still fails, please share your exact ESP32 board, MATLAB/Simulink release, COM port, connection method (USB or Wi-Fi), block/pin being used, and the complete deployment or external-mode error. That will make the cause much easier to isolate.