Message Boards Message Boards

0
|
19164 Views
|
4 Replies
|
7 Total Likes
View groups...
Share
Share this post:

How to Reinitialize a Continuous Integrator Block

Posted 11 years ago
I am having trouble figuring out to reinitialize a continuous integrator block to its y_start value given a certain conditional state.

I am modeling a Heat Pump for a week that only turns on during daylight hours.
I have the On/Off states working fine, but I would like the integrator blocks to be able to be reset each morning to their intial values.
You can see here one of the integrator outputs. 

Thanks.



It's very easy to do this in Simulink - Integrator - as the integrator block has a state reset input built into it, but I can't figure out how do it in System Modeler. Any insights would be appreciated.

Many Thanks.
POSTED BY: nathan curry
4 Replies
Posted 11 years ago
Here's an add-on to Peter's answer:
It's easier to copy and paste the code if the annotations are included, that way the BooleanInput block is shown in the diagram view:
model IntegratorWithReset
  extends Modelica.Blocks.Continuous.Integrator;
  Modelica.Blocks.Interfaces.BooleanInput reset annotation(Placement(visible=true, transformation(origin={-120,-60}, extent={{-20,-20},{20,20}}, rotation=0), iconTransformation(origin={-120,-80}, extent={{-20,-20},{20,20}}, rotation=-360)));
equation
  when reset then
    reinit(y, y_start);
  end when;
end IntegratorWithReset;
POSTED BY: Johan Rhodin
This model achieves that:
model IntegratorWithReset
  extends Modelica.Blocks.Continuous.Integrator;
  Modelica.Blocks.Interfaces.BooleanInput reset;
equation
  when reset then
   reinit (y,y_start);
end when;
end IntegratorWithReset;
/Peter
POSTED BY: Peter Aronsson
Posted 11 years ago
Sorry, I just mean Modelica>Blocks>Continuous>Integrator   
POSTED BY: nathan curry
For the non-experts in the crowd, please clarify, "continuous integrator block"?
POSTED BY: Bruce Miller
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract