Passing information between level-2 matlab s-functions
Mostrar comentarios más antiguos
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
Respuesta aceptada
Más respuestas (1)
Girish
el 12 de Abr. de 2011
0 votos
4 comentarios
Jarrod Rivituso
el 12 de Abr. de 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
el 13 de Abr. de 2011
Jarrod Rivituso
el 13 de Abr. de 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
el 14 de Abr. de 2011
Categorías
Más información sobre Simulink en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!