And it's a good idea to put a terminator here for the X minus output,
so that we won't have any warning.
So with this, now we can navigate inside the hybrid block model in the plant.
I'm going to the flow map to implement the temperature equation.
Let's take this arrow here.
The temperature equation is given by this expression that you see right here.
T dot equal minus aT plus Tr plus T delta times u.
And in order to do that within this function,
I would like to define T as the state and then define its derivative to be
minus a times T plus this constant Tr plus this constant T delta times u.
And that will be the derivative of this state which will
be equal to xdot in the general form of these flow map.
The one thing we don't have
is this constant a, or this constant Tr, or this constant T delta.
So what we're going to do
is to define them from a vector that we're going to call parameters.
The first entry of a vector will be a,
the second entry with be Tr,
and the third entry will be T delta.
So essentially,
this function here will include not only x and u but also parameters.
We need to define parameters in an initialization file,
and we're going to do that in a minute. Let me just show you that.
As soon as we add it into the argument of x this vector parameters,
Simulink believed that that was an input to the block,
certainly not the case,
so we need to simulate that that is
a parameter for which we'll click on the model explorer,
which is that button right there.
Go to the flow map,
and then with this parameters input,
we're going to change that to Parameter. And that's it.
Now, x and u's just the two inputs to the the flow maps.
And we're ready to go with an initialization file.
So let's start that initialization file,
which we're going to call just initialization.
And we're going to having that is as usual, clear everything.
So we'll start from scratch,
but in this case, we're going to have parameters.
So the first parameter will be a, which we're going to pick to equal to 1,
Tr, let's say somewhere of 65,
and T delta to be 20.
With these, we can now define the vectors parameters to be a, Tr, T delta.
And they have the order that we already specify.
After the parameters, we need to define the initial conditions.
So the temperature initial will
be all we need to set up because the system has only one state.
And let's say we set it up to below Tr.
So we see some change regardless of the value of the input.
And let's say it's 55.
We also need to determine the simulation horizon.
Let's say, we're going this simulate this for 20 seconds,
and the number of events.
And let's say, we say this is 10 seconds,
and let's say the number of events is 20.
As we did in previous simulation,
we need to define the rule for jumps.
And let's say that the rule for jumps is equal to one
corresponding that we give priority to jumps of a system,
which we shouldn't have any jumps.
And then for solver tolerances,
let's say we set them up to what we have done in previous simulations as well.