# Simulink simulation doesn't end

80 views (last 30 days)
Tobia De Benedictis on 18 Jul 2024 at 18:49
Commented: Yifeng Tang on 24 Jul 2024 at 15:30
Hello, I'm simulating a Fuel Cell system with the fuel cell simscape's block. Is a simple system, constant in input for fuel and air pressures, stoichioimetric rate for "qair" and "qfuel", in the outport "p" and "n" i connected a power sensor and then a scope connected to the latter. I use a probe to read the value of "iFC" that is a result of the simulation to input it into a MatLab Function block to calculate the rate of production of water as a function of the current generated by the cell because I need it as an output as well. The problem I encounter is that during the simulation the little loading bar stays at 0% and it appears a writing next to it that says "T = a very little number". I am fairly new to simscape that i'm using for my bachel thesis. Is there someone that knows what is happening? Thanks so much in advance, i will attach an image of the model and write the code inside the matlab function block.
code:
function H2Opr = H2O_produced(area_cell,i_cell,Ncell)
MW_H2O = 18.01528; %g/mol
F = 9.64853321233100184*10^4; %C/mol
H2Opr = (Ncell * MW_H2O * area_cell * i_cell)/(2*F);
end
##### 2 CommentsShow NoneHide None
Umar on 18 Jul 2024 at 21:04
Hi Tobia,
I don’t have access to simulink but I will do my best to help you out. Your MATLAB function for calculating water production seems correct. The message "T = a very little number" indicates a numerical issue in the simulation. Review the simulation time and step size to ensure numerical stability. Check for any singularities or discontinuities in the system that could affect the simulation progress. Add disp statements within the MATLAB function to print intermediate values for debugging.Check if any variables become NaN (Not a Number) during the calculation. Ensure that the input arguments passed to the function are valid.
By following these steps and carefully reviewing your simulation setup and MATLAB function block, you should be able to identify and resolve the issue causing the simulation progress bar to stay at 0% and the "T = a very little number" message.
Yifeng Tang on 24 Jul 2024 at 15:30
It smells like initial condition issue to me. Any chance you could share the model here for diagnostics?

### Categories

Find more on Troubleshooting in Help Center and File Exchange

R2023b

### Community Treasure Hunt

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

Start Hunting!