I am building a model predictive controller for a reactor with two input streams and an output product. We control the input flow rates and measure the output concentration.
I have input and output values data and aim to build a model predictive controller by trying out different flow rates and measuring concentration on a physical setup.
The first step would be to identify the system to build a process model. I explored methods such as N4SID, but I was unable to find a library in Python that is equivalent to Systems Identification Toolbox in MATLAB.
I came across this library called SIPPY (SIPPY Github) and used their system identification functionality.
input = np.hstack((F_Na, F_Ag)).T # Input flow rates with shape (2, N)
output = sgf.T # Output shape (1, N)
sys_id = sippy.system_identification(y=output, u=input, id_method="N4SID", SS_fixed_order=4, centering="MeanVal")
xid, yid = sippy.functionsetSIM.SS_lsim_process_form(sys_id.A, sys_id.B, sys_id.C, sys_id.D, input, sys_id.x0)
The below two time series are the input data series
The below image depicts the output data series
After running SIPPY's system_identification function, the output generated from simulating the state equation is
I would appreciate help in the following areas.
- Why is the generated output simulation beginning from zero instead of 400's as in the target
- Suggest better approach or libraries for the same



