How to Reinitialize a Continuous Integrator Block

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.

For the non-experts in the crowd, please clarify, “continuous integrator block”?

Sorry, I just mean Modelica>Blocks>Continuous>Integrator

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

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;