Filter löschen
Filter löschen

Calling time step and values of Previous time step in a component file of simscape

5 Ansichten (letzte 30 Tage)
There is a PEMFC model for system modeling of polymer electrolyte membrane fuel cells, which can be opened using the command : "ssc_fuel_cell".
Here, you can find some more details about it.
The membrane electrode assembly (MEA) has a source code which has been written in simscape language.
I am trying to couple our 1D multiphase model with this code. now, I have some questions:
1- How is this "fuelcell.ssc" component file used in this simulink model? is it called in each time step?
2- My numerical model needs the values of some paprameters from previous time step. how can I call them? is there any way to store some parameters in workspace and call them again in the following time step?
3- how can I call the time step itself? I mean the length of each time step.
This is an example for updating a parameter in each time step. as it can be seen I need value of previous time step and length of each time step for finding the new one.
4- is there any way I can run the whole simulink model in steady state mode? I need some preliminary results in steady state but the main and final objective is constructing a transient model. So, in the end I need to find the way I can call values of previous time steps and length of each time step.

Akzeptierte Antwort

David John
David John am 21 Nov. 2022
(1) I'm not 100% sure what you mean with this question, but fuelcell.ssc defines the Simscape model for one block of the overall model. All of the Simscape blocks that are connected to the Solver Configuration block are analyzed together as a system of equations.
(2)-(3) Your equation looks like a forward Euler discretization of a differential equation. In general, I would say that you could consider using eta_a.der = (eta_a_new - eta_a_old)/dt and then you don't need to try and get old and new values everywhere, and you can just let Simscape discretize things. This would then work for both variable- and fixed-step solvers. If you really need to sample old values of variables, then you probably need an asynchronous sample-and-hold or an event that stores an old value. For your case, I would recommend just writing the equations as differential equations instead of as finite-difference equations.
  4 Kommentare
David John
David John am 16 Dez. 2022
If you have a valid license, please feel free to reach out to our Tech Support organization for more interactive help: Contact Us - MATLAB & Simulink (mathworks.com).
In general, if you have an equation that looks like:
eta_new == dt * f + eta_old
where f is some arbitrary function and dt is the timestep, then you can try replacing it with a continuous-time differential form of the equation:
eta.der == f
Hassan Salihi
Hassan Salihi am 16 Dez. 2022
Thank you. I try it. if I have any problem I'll contact you through above-mentioned link.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Composite Components finden Sie in Help Center und File Exchange

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by