Passing information between level-2 matlab s-functions
Mostra commenti meno recenti
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
Risposta accettata
Più risposte (1)
Girish
il 12 Apr 2011
0 voti
4 Commenti
Jarrod Rivituso
il 12 Apr 2011
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
il 13 Apr 2011
Jarrod Rivituso
il 13 Apr 2011
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
il 14 Apr 2011
Categorie
Scopri di più su Simulink in Centro assistenza e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!