Passing information between level-2 matlab s-functions
이전 댓글 표시
I am trying to model a two step chemical process using simulink and s function for each step. 5 outputs from step 1 are connected to the 5 inputs of step 2. I initialize the outputs of step 1 in its s function using read in parameters. When I initialize the state variables of step 2, which uses outputs from step 1, the values of the output the output variables of step 1 inside step 2 initialization are zero. What can I do to fix this?
Thanks. Girish
채택된 답변
추가 답변 (1개)
Girish
2011년 4월 12일
0 개 추천
댓글 수: 4
Jarrod Rivituso
2011년 4월 12일
Make sure you have defined continuous states if you want Simulink to numerically integrate them. The model "msfcndemo_limintm" has an example.
Some highlights from that are:
- Be sure to set the number of continuous states: block.NumContStates = 1;
- Be sure to register the derivatives block method: block.RegBlockMethod('Derivatives', @Derivative);
- Be sure to set the initial condition of the state in the InitConditions function: block.ContStates.Data = 1.5;
Girish
2011년 4월 13일
Jarrod Rivituso
2011년 4월 13일
Generally, continuous state blocks will have the following kind of flow during the simulation loop:
Outputs – creates the block output using the current value of the continuous state
Derivatives – creates the derivative of the block using the current value of the input signal, and possibly other factors as well
Girish
2011년 4월 14일
카테고리
도움말 센터 및 File Exchange에서 Simulink에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!