필터 지우기
필터 지우기

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

조회 수: 5 (최근 30일)
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.

채택된 답변

David John
David John 2022년 11월 21일
(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
David John
David John 2022년 12월 16일
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 2022년 12월 16일
Thank you. I try it. if I have any problem I'll contact you through above-mentioned link.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Composite Components에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by