Activate: how to keep integrator initialized until a control variable is 1 and then switches to 0

Hello,
I need to use the integrator block 1/s and use the activation port until a variable is 1. When the variable switches to 0, I do not want to re-initialize the integral.
How?
Answers
-
Hi @Luca Cavagna,
If I'm understanding correctly, you want to send an activation into the integrator once an independent signal reaches a value of 1, but when that independent variable switches to 0 you do not want to send an activation into the integrator?
Please elaborate further if this is not what you mean, you can include diagrams as well.
Rafael
0 -
correct. Usually this control variable is 1, so I initialize each time the integrator. Once the control variable is 0, I do not want to send the initialiaze command
The Simulink model is the following. Initialization value is 0. Function to integrate is 1. The control variable (second port) transitions from 1 to 0 with a negative ramp.
I cant replicate the same with Activate
0 -
Have a look at this simple example. Every time the output signal reaches one, an activation will reinitialize the integrator. You can adapt that to your own needs.
0 -
I understand the example, thanks. However here you check the crossing to activate the initialization which is not my case. The activation mush switch from ON to OFF
0 -
Activations in Twin Activate are discrete events which trigger the execution of a block. There's no such thing as an OFF activation signal.
If what you want to do is to keep the integrator at zero while the other signal is below one, you can implement some logic with the logical operations blocks. E.g., you can see a block that reads "u1 >= 1" in the example I shared, this block will output a value of 0 if its input is less than 1, so you could use a block like that as the input to the integrator.
If I'm still not understanding your request, please share a diagram of the intended behavior of all relevant signals, as that will be much clearer.
0 -
This is the original Simulink function block. The fuel cut off variable is the one controlling the integral at the second port. Usually that variable is zero, so by using NOT, 1 is entering the second port. While the input is >0, re-initialization occurs.
I modified the integral by adding a conditional switch on the fuel_cut_off variable and outputing the integral or IC. So problem solved :D
Thanks @RSGarciarivas for your help and kindness
0 -
Hi @Luca Cavagna,
Hope this is what you are looking for:
In this implementation, when the square wave has a value of 1, a stream of activations is sent into the integrator, effectively keeping it at zero. initial condition can be set up as a parameter in the integrator block (right now it's 0.2), but every time it's reinitialized, it will jump to the value on its second input.
Rafael
0