Level 2 MATLAB S-function - Initial Condition Input

In Simulink, I am trying to implement a continuous limited integrator where the output is bounded by lower and upper bounds and includes initial conditions, all of which are taken from input signals on the block rather than entered parameters.
I have used this blog post to help me understand how to limit the upper and lower bounds using input signals on the block. However, when I try to do the same for the initial conditions, it does not work.
I was trying:
function InitConditions(block)
block.ContStates.Data = block.InputPort(1).Data;
No initial condition is being implemented. I also tried "Start" functions with no such luck. Any help would be great!
Thanks -Brian

답변 (1개)

Kaustubha Govind
Kaustubha Govind 2012년 7월 18일

2 개 추천

Brian: I have explained here why S-functions do not have the ability to take the Initial Condition as an input. However, the Integrator block in Simulink does allow you to specify a signal as an Initial Condition (just select "external" for "Initial condition source" on the dialog). However, since this block does not allow input signals to specify the upper/lower bounds, I will recommend that you add a Saturation Dynamic block after the Integrator block, where you can specify input signals for the upper/lower bounds - the saturation limits will then be applied to the output of the Integrator block.

댓글 수: 1

Brian
Brian 2012년 7월 25일
Thanks Kaustubha! The Saturation Dynamic block worked out well. I was unaware of this block in Simulink.

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

카테고리

도움말 센터File Exchange에서 Simulink에 대해 자세히 알아보기

질문:

2012년 7월 18일

Community Treasure Hunt

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

Start Hunting!

Translated by