In this video, we'll demonstrate how
to perform parameter tuning for a digital twin of a pump system
with Simulink Design Optimization.
A digital twin is a digital representation
of a physical or virtual product, process, or system.
In this demonstration, we have a physical pump system,
and its digital twin model is created
using Simscape, which is a physical modeling tool.
The real system consists of different components
such as the displacement pump, reservoir,
motorized and solenoid valves in a pressure sensor.
And the digital twin contains blocks
modeling the corresponding components of the actual pump
system.
In this system, we drive the motor using an RPM input,
and the output we measure is the pressure.
Using the measured data, we can tune the parameters
of our digital twin, such that it reflects
the most up-to-date state of the real system that
is in operation.
Being able to monitor the real system's current state
lets us perform various tasks using the digital twin.
For example, we can perform what-if simulations
to analyze the pump system under different operating conditions.
And we can run fault detection algorithms
to estimate potential faults in advance
and take maintenance actions accordingly.
For these algorithms to work accurately,
the digital twin needs to be tuned to the real pump.
So before we discuss how to set up
a digital twin parameter tuning algorithm,
let's take a closer look at our digital twin model.
Here's the RPM input to the motor and the output pressure
that we measure.
Under the subsystem, we have the displacement pump block,
which models the pump by using a set of parameters,
as seen here.
Among these parameters, we're interested in tuning
the displacement per revolution, the nominal angular
velocity, and the nominal pressure gain,
as these three parameters have the most significant impact
on the output pressure.
We want to know whether these parameters are up to date
with the real pump or not.
And the way to check that is to compare the simulated pressure
to the measured data collected from the pump.
If there's a good match between the two,
that means the digital twin accurately
represents the current condition of the real pump.
Otherwise, we will need to tune the digital twin parameters.
This picture shows how different things
are connected through IoT.
After we create the digital twin model and the parameter tuning
algorithm, we deploy these to a Production Server.
This algorithm runs Simulink Design Optimization
in the background, and it communicates
with an edge device that is directly
connected with the pump.
And finally, we have a dashboard that
lets the front end user to remotely
connect to the Production Server and monitor and tune
the digital twin.
Currently, as seen from this plot,
the digital twin simulation doesn't match well
with the field measurements.
And that's why we will now tune the current parameters
of our digital twin by clicking this button.
Once the algorithm is run and the parameters are updated,
we get much better alignment between the two responses.
What we're not seeing here is Simulink Design Optimization
that is running in the background
to tune the parameters.
Let's learn how to use this tool for creating our tuning
algorithm.
We will start with these pump parameters which currently
result in a pressure response that significantly differs
from the measured pressure.
To tune the digital twin parameters
to match the real pump, we will use a parameter estimator
app that is a part of Simulink Design Optimization.
The app lets us estimate parameters
by formulating and automatically solving an optimization
problem to minimize the error between the simulated and
measured responses.
We'll start by specifying the parameters
that we want to estimate.
To do so, we will simply copy over these three pump
parameters to our app.
Once this is done, we're able to view the current parameter
values.
Based on our knowledge of the real system,
we can determine a reasonable range
for each of the pump parameters by specifying
their minimum and maximum values.
Having finite numbers here will help the optimization algorithm
narrow down its search space and converge to a solution
in shorter amount of time.
After setting up the estimation parameters,
next we create an experiment to specify the measurement data
that we got from the real pump.
The measured signals are sorted as time series data in the RPM
input and pressure output factors, which
we enter into corresponding fields in the app.
The associated inputs and outputs in the simulation
are these two signals.
The RPM input to the induction model
is imported into the model externally using
this input part and is the same exact signal as this one.
Whereas, the output is the pressure
measured by the sensor.
By selecting this option, we can view
simulated versus measured data.
As expected, initially there isn't a good match
between the two responses.
So we will start parameter estimation
by pressing this button.
Once the summation starts, we can
monitor the estimation status from the progress report.
With every iteration, the app runs multiple simulations
and using optimization, adjusts the parameters
based on the difference between simulated and measured data
while trying to meet the specified constraints.
After several iterations, we see that our simulated response
gets much closer to the measured response.
Once the estimation is done, the model
is updated with the tuned parameters.
And now, our digital twin accurately
represents the current state of the real pump.
In the next step, we can generate code
from within this app by clicking here.
You can now use Matlab and Simulink compilers
to compile and deploy the code.
To do so, you'll need to create a setup and a run file.
This example has instructions on how
you can start with the generated Matlab script
and then split and modify it to create these two files.
Please find the link to the example
in the video description.
The setup file sets up the parameter estimation objects
for use in deployed mode.
And the run file is a Matlab function
for parameter estimation that can
be compiled with the mcc command and then run in deployed mode.
If you want to operate multiple pumps,
you will need to have a digital twin for each of the pumps.
As we see in this dashboard here,
we have a database of digital twins
against sets of real systems.
The model structures for these digital twins are identical.
What's different between them is the recorded data
and the parameters.
Using this dashboard, we can tune multiple digital twins.
We can even create an algorithm to enable
either periodic or event-based parameter tuning
for each of the digital twins.
As we discussed previously, once the digital twin is available
and up to date, you can use it to run hundreds of simulations
under different operating conditions
and assess feature operating envelopes
of your physical system.
You can also run fault detection and classification algorithms
and optimize operation of the physical system.
This concludes the video.