And using the models that we already have derived,

we can actually come up with the full equations,

differential and difference equation with constraints that govern this whole system.

So we can assume here that we have a general plant with an input.

Its output is a function of the state and its Y.

The input to the system is,

being the ADC, is V S,

the output is M S,

and there are events that occur when Tau S is equal to T S star.

In the other side,

we have Tau H and we have here an input which will

be V H and an output that will be M H. For the cyber,

we can have different type of situations.

Imagine that we have a finite-state machine where you have Q plus equal to delta Q,

V where this is the input and that the output theta is given by kappa of Q,

where kappa defines the output.

So this interconnection is

defined by the following assignment.

So the input to the converter is assigned to the output of the physical.

The input to the cyber is assigned to the output of a converter from analog to digital,

the input to the digital to analog is assigned to the output of a cyber,

and then the input to the physics is assigned to

the output of the converter from digital to analog.

With those assignments and the individual models,

we can actually arrive to the equations for the full system,

and these equations will be also given by differential and difference equation.

The one thing that you need to realize here is that we have two different events.

One of the events is when the timer Tau S,

which is T S star,

and the other event is when the timer Tau H reaches Tau H star,

and this could occur simultaneously,

which is very unlikely, or independently.

So we need to handle all the possible situations.

Certainly, when there are no events,

which corresponds to the case where Tau S is in zero to

T S star and Tau H is in zero to T H star,

then what we are going to have here is

a variation of these variables according to the laws that were already described.

So, the only thing we need to keep in mind here are the assignments.

Since the input to the physics assigned to the memory M H,

this is what we should write here,

the next state is Tau S dot which should be equal to one.

We will have also Tau H dot equal to one.

We will have M S dot equal to zero and we will have M H dot equal to zero.

And because the cyber is given by a finite-state machine and the variable

there is Q which doesn't change in between updates is going to have Q dot equal to zero.

Now the events will be given when Tau S is equal to

T S star or when Tau H is equal to T H star.

So we need to post-process here the events or handle the events,

so we are going to consider first the case of Tau S equal to

Tau S star and Tau H in the range of no events,

and then we can do the case where Tau S is in the range of

no events and then Tau H is equal to T H star.

And we could do also the case where the two of them occur,

but you will see what will happen.

So when the events occur,

we need to come up with an update law

for all these variables.

So we're going to have one right

here and fill them up.

The first one I would like to process is the one corresponding to sampling.

When sampling occurs, Z does not change because Z is part of the model,

of the physics, so it should be reset.

The same occurs when the other occurs.

Okay, but let's go back to this.

When this sampling event occurs,

we already said that the input to the ADC will be

used to update this quantity M S,

so that will be equal to Y.

We are not having an update of this block,

so this body will remain the same and this time it will remain the same.

However, since we have reached an event because of this condition,

we will reset this to zero.

And as we did for the implementation of the FSM,

we can use now here the update of Q to be delta

Q to the input V which is equal to M S. Similarly,

for the other case,

the timer that corresponds to the event will need to be reset to zero.

The input to that block will reset to the output of the machine,

in this case, the cyber component,

and the other variables will remain the same.

What you can expect now is that when the two events occur at the same time,

which can be written down,

you will have that this and this update

occur as well as this and this update because of these mechanisms,

and because of the implementation of the finite-state machine,

this event will occur as well.

And that will give us the full model of this feedback coming from sample and hold

where now we will have to design these parameters in order to get a property,

for instance, that this state Z converges to a certain value.