Search code examples
parametersgekko

If I have a parameter that changes of value at time 0 in GEKKO , will it actually change at 0 or at the next data point?


I have a GEKKO model to estimate parameters and I have a parameter defined as follows:

    step = [0 if z<0 else 1 for z in m.time]
    m_param = m.Param(step)

However, my array m.time does not contain 0, i.e, it might be [-20, 30, 60]. So I want to know if m_param will actually change the value at time 0 or at time 30 (next data point)


Solution

  • With m.time=[-20,30,60], the values of m_param are [0,1,1]. The causes a change at t=30 where it corresponds to the time value in m.time. You would need to include a time point at zero to have the switch occur at that point.

    m.time = [-20,0,30,60]
    step = [0 if z<0 else 1 for z in m.time]
    m_param = m.Param(step)