I make a new RTM block named 'RAMPHOLD'. This block can hold the value and release it with the ramptime.
The attached figure shows the behaviour of that block. Hold button (top), input signal (second), output signal of this block (third), and ramp flag (forth). This block is in (usercode)/sys/common/model/KAGRA_UTIL.mdl.
----------
RAMPHOLD:
This is the hold block which can release the holded value with ramp time.
This block has input weight and hold value weight, and output (input*Input weiht) + (Holded value*holded value weiht).
Once hold flag changes to true, the block update the holded value to the output value at that moment, and set input weight to 0 and holded value weight to 1.
Then, the hold flag changes to false, the input weight and holded value weight will gradualy change to 1 and 0, respectively.
Input:
input value
hold flag
ramptime
sampling frequency
Output:
output value
is ramping: true in ramping time
Monitor channels
HOLD_VAL hold value
INPUT_WEIGHT: input weight
HOLD_VAL_WEIGHT: holded value weight
STATE: state of the block. 0=nominal state, 1= holded state, 2:ramping state