-
Notifications
You must be signed in to change notification settings - Fork 0
Example_network_estimation
In this example, a physical plant, its output digitally transmitted through a network, and a state estimator are modeled in Simulink as a hybrid system.
The files for this example are found in the package hybrid.examples.network_estimation :
- initialize.m
- network_est.slx
- postprocess.m
The contents of this package are located in Examples\+hybrid\+examples\network_estimation (clicking this link changes your working directory).
Consider a physical process given in terms of the state-space model
where
We consider an estimation algorithm with a state variable
at every instant information is received. In between such events, the algorithm updates its state continuously so as to match the evolution of the state of the physical process, that is, via
Modeling the network as a hybrid system, which, in particular, assumes zero transmission delay, the state variables of the entire system are
and the state of the algorithm is updated via
In between events, the state of the network is updated as
the state of the algorithm changes continuously according to
Physical process:
where
Network:
where
Estimator:
where
the input and the state are given by
For each hybrid system in the Simulink Model (Continuous Process, network, and Estimator) we have the following Matlab embedded functions that describe the sets
The following procedure is used to simulate the example using the model in the file network_est.slx :
- Open network_est.slx in Simulink.
- Double-click the block labeled Double Click to Initialize .
- To start the simulation, click the run button or select Simulation>Run .
- Once the simulation finishes, click the block labeled Double Click to Plot Solutions . Several plots of the computed solution will open.
The following diagram shows the Simulink model of the estimator over a network example. The contents of the blocks flow map f , flow set C , etc., are shown below. When the Simulink model is open, the blocks can be viewed and modified by double clicking on them.
The Simulink blocks for the hybrid systems in this example are included below.
flow map f block
function zdot = f(z, u, parameters) % Flow map for Estimation over a networkA = parameters.A; B = parameters.B; zdot = A*z + B*u;
end
flow set C block
function inC = C(x, u, parameters) %#ok % Flow set indicator function. inC = 1; end
For more info about Continuous-time Plant blocks, such as Continuous Process , see here .
flow map f block
function xdot = f(x, u) % Network flow map n = length(u); % measured input sizemsdot = zeros(n,1); % measured continuous dynamics jdot = 0; tau_sdot = -1; % Timer tau_s xdot = [msdot; jdot; tau_sdot];
end
flow set C block
function inC = C(x, vs, T_max) % Flow set indicator function tau_s = x(end); % timer stateif tau_s >= 0 && tau_s <= T_max inC = 1; % report flow elseif tau_s> T_max inC = 0; % do not report flow else inC = 0; end
end
jump map g block
function xplus = g(x, vs, measurement_times) % Jump map for network.n = length(vs); % input size j = x(n+1); msplus = vs; % output = measured input % The value tau_s is updated as a function of vs. tau_splus = measurement_times(j+1); % Timer tau_s j_plus = j+1; xplus = [msplus; j_plus; tau_splus];
end
jump set D block
function inD = D(x, vs) % Jump set indicator function for network tau_s = x(end); % timer stateif tau_s>=0 inD = 0; % do not report jump elseif tau_s<= 0 inD = 1; % report jump else inD = 0; end
end
flow map f block
function xdot = f(x, v, parameters) % Estimator flow map for Estimation over a network A = parameters.A; B = parameters.B; n = length(A); u = v(end); z = x(1:n); jdot = 0; zdot = A*z + B*u; xdot = [zdot; jdot]; end
flow set C block
function inC = C(x, v) % Estimator flow set for Estimation over a network j = x(end); % internal communication memory event jnet = v(end-2); % communication eventif j == jnet inC = 1; % report flow else inC = 0; end
end
jump map g block
function xplus = g(x, v, parameters) % Estimator jump map for Estimation over a network A = parameters.A; M = parameters.M; L = parameters.L;n = length(A); z = x(1:n); jnet = v(end-2); % communication event y = v(1:end-3); jplus = jnet; zplus = z + L*(y-M*z); xplus = [zplus; jplus];
end
jump set D block
function inD = D(x, v) % Estimator jump set for Estimation over a network j = x(end); % internal communication memory event jnet = v(end-2); % communication eventif j ~= jnet inD = 1; % report jump else inD = 0; end
end
The solution to the estimation over network system from
[1] F. Ferrante, F. Gouaisbaut, R. G. Sanfelice, and S. Tarbouriech. State estimation of linear systems in the presence of sporadic measurements. Automatica, 73:101–109, November 2016.
- Creating and Simulating Hybrid Systems
- Plotting Hybrid Arcs
- Creating and Simulating Composite Hybrid Subsystems
- Updating Code Designed for HyEQ Toolbox v2.04 to Use v3.0 Features.
- Example: Composite Hybrid System with Zero-order Hold Subsystem.
- Example: Composite Hybrid System with Switched Subsystem.