State-space system identification using known states, inputs, outputs

16 visualizzazioni (ultimi 30 giorni)
Hi,
I am using System Identification Toolbox to identify a linear state-space model using n4sid algorithm. My model is a MISO. The data is formatted in a data object with several input channels and 1 output channel sampled with uniform sampling interval. The application of such identified model to act as a virtual sensor to estimate a quantity that can not be really measured using only input-output relation.
yEstimated = sim(mystatespacemodel, input_vector, estimated_state_from_previous_step, simopt);
However, during deployment I have to provide a vector of initial conditions besides the known input vector for each time instance. The states that the toolbox estimated during the fitting procedure are however artificial states, therefore I don't know in advance how I should initialize my model during deployment. Using the estimated initial conditions from the toolbox did not improve the results when I used them as an initial condition during deployment.
The idea now is to split some of the inputs as known states that can be used instead of the artificial states that Matlab derived in the form:
nx = size(x, 2);
sys = n4sid(u,y,x,nx,'Ts',Ts); % here is an extra input "x" which indicates the known states
% that should be used instead of the artificial states
I hope the question is clear and there is a solution for such problem.
Thanks in advance!

Risposte (2)

Star Strider
Star Strider il 21 Ott 2022
I generally use lsim rather than sim. Looking through the sim documentation for opt, the simOptions function has a way to specify the initial conditions in InitialCondition. (The lsim function has this as an argument option.)
  1 Commento
Omar Kamel
Omar Kamel il 23 Ott 2022
Modificato: Omar Kamel il 23 Ott 2022
Hi Star Strider, thanks a lot for your reply. However, this is what I didn't mean. I don't know any initial conditions in advance. I only have the inputs so I am trying to find a way to split the inputs list
to and train the model using the known , where I already know the initial states of .

Accedi per commentare.


Rajiv Singh
Rajiv Singh il 7 Nov 2022
Initial conditions are not a property of the model that you can estimate in advance. You really need to ask yourself regarding what you can assume regarding the system's state before the input is applied. As such, this must come from physical insight regarding the system's state.
Some common scenarios:
  • State of rest: you may be able to set initial states to zero
  • You have measurement history (I/O values) of the state that prevailed before the input was applied; this could be a steady-state at some operating condition. Consider using the data2state command to transform the past behavior history into an initial state vector.
  2 Commenti
Omar Kamel
Omar Kamel il 8 Nov 2022
Thanks Rajiv for your answer.
Probably I did not explain my problem well.
My measurement history for training is I/O values, but in deployment I only have the input time series, therefore I can't use data2state command to estimate the initial state vector based on the history.
What I want to do is to construct my idss system using iddata(inputs, outputs, states), for example I identify an unknown dynamic mass-spring-damper system where I have access to the control inputs (e.g. excitation force), states (e.g. displacements of masses), and my outputs, which I don't have access to during deployment are the internal forces.
I hope the problem is more clear now.
Omar Kamel
Omar Kamel il 17 Lug 2023
Modificato: Omar Kamel il 17 Lug 2023
@Rajiv Singh: I would like to revive this question again to see if there is any possible solution as it is still not yet solved.
Maybe I will try to redescribe my problem:
The standard usage of n4sid algorithm is as follows:
sys = n4sid(u,y,nx,'Ts',Ts);
where the algorithm uses the inputs u and outputs y.
What I really want is to identify a model where I know a priori inputs, outputs and states.
As an example: I have a dynamical system of a robotic arm (linearized version). My inputs are the standard control variables (e.g. motors torques at each joint). The states are some measurements, e.g. encoders angles at each joint, strains at different locations to monitor the mechanical loads. The outputs are the kinematics of the end gripper.
If we follow the approach from SysID toolbox, all the inputs and states will be fed to the algorithm for training as inputs in the u vector. I would like to restructure my model to use u and x independently. The reason behind that is the artificially created states of the model which actually have no physical meaning and can not be initiated correctly leading to loss of accuracy of the model.
I hope that I have clarified the problem much better now.

Accedi per commentare.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by