# VIRTUALSENSOR

Piece-Wise Affine Simplicial virtual sensor

## Contents

Class of MOBY-DIC TOOLBOX.

## Description

The virtal sensor is a dynamical system which allows to estimate some unmeasurable outputs "z" of another dynamical systems starting from its inputs "u", its measurable outputs "y" and from the estimates of "z" at some previous time instants.

Let's consider the following dynamical system:

where u are the inputs (always measurables), y the outputs which can be measured at all times and z the outputs which can be measured for a finite time T. The aim of the virtual sensor is to estimate the value of z at istant k (k > T) starting from u at time istants (from to ), from y at time instants (from to ) and from the estimates of z at n time instants (from to ). The sensor is a Piecewise-Affine Simplicial function of all (or some of) these variables (collected in variable x) in the form:

where Nb is the number of vertices of the simplicial partition, alpha(x) are the alpha basis functions and w their corresponding weights (see pwas object for a more detailed description). The weights w are found with a least squares minimization starting from a training set of data (u, y and z). The training set can be created since z is measurable until a certain instant. A reduced complexity version of the PWAS virtual sensor can be designed by considering as a sum of PWAS functions defined over a subset of the domain; actually, a PWAS function for each time instant is used. The estimate, thus, is in the form:

where each of the is a PWAS function in the form (1). This solution allows to reduce the problem of the curse of dimensionality, since less weights w are needed. NOTE: if a variable is outside the time window associated to it, it is not considered in the function . For example, consider , for i = 3 in the sum, function takes as argument, but is outside the time window mu associated to it. In this case it is not passed to the function, so will be a function of only and .

## Syntax

vs = virtualsensor()

Build an empty virtualsensor object

vs = virtualsensor(nu,ny)

Build a virtual sensor defining the number of system inputs () and the number of measurable system outputs ().

vs = virtualsensor(nu,ny,options)

Build a virtual sensor defining the number of system inputs () and the number of measurable system outputs (). An options structure is also provided with the following fields:

• reducedComplexity - if it is set to 1 a reduced complexity virtual sensor is obtained (default value: 0)
• current - if it is set to 1 the values of u and y at the current time instant (, ) are used to estimate z at the same instant (); if it is 0, is estimated starting from , . Defalut value: 1.

## Properties

• nu - Number of system inputs
• ny - Number of measurable system outputs
• nz - Number of unmeasurable system outputs
• mu - Input time window
• my - Output time window
• n - Autoregressive time window
• np - Number of partitions per dimension
• fpwas - pwas object
• reducedComplexity - Flag indicating if the virtual sensor is a reduced complexity virtual sensor
• current - Flag indicating if u and y at current time instant are used to estimate z
• info - Information on virtual sensor identification
• identified - Flag indicating whether the virtual sensor has been identified or not

## Private methods

• writeInterface - Writes the VHDL code implementing block vs_ser_interface or block vs_par_interface in vs circuit
• writePackage - Writes the VHDL code implementing block pwag_ser_package or block pwag_par_package in vs circuit
• writeTest - Writes the VHDL code implementing block test_pwag_ser_interface or block test_pwag_par_interface in vs circuit

Contributors: