[MUSIC] In this video, I will illustrate how to simulate an analog to digital converter using the Harrell equation toolbox. In this video, we're going to model the analog to each converter using the model that we saw in a previous video which is given in the following picture. We have an input VS that at every DS star seconds is being sampled and restoring a memory state column s. The timer of tau s grows with ordinary time and whenever it hits the value TS star we have a reset of the timer and then the memory state is being updated with the value of the input. So I already coded that using the Harvard equation toolbox block corresponding to ADC. You can find that one by going to the Library browser. And then click on the CPS modules that you'll find in Harvard equation tools, so here they are. And the converter is this one right here. So, we're providing a sine wave to it and that wane wave will be sample at a particular rate. And that rate, the measurement or memorize version of the input will restore in a component of the state which will be a ms, while another component of the state x would be and tau s component that triggers the event of the system. So, in the initialization file, what we have is the initial value of the state for the simulation is 0 for the memory and 0 for the timer. The rate for sampling is chosen to be pi over 8 and the horizon for simulation here and by these numbers, the usual choices for the rule and the tolerances. So we can launch this, By running the script then going to the block, and then running the simulation. I will show you how these ADCs coder inside this block by the proper choices of F, C, G and D. And we will see that the events are treated according to the timer and whenever those happening. Memory state is being recorded. So before we go there, let's see what result we get from this simulation. And what we see right here is what we expect. With a rate of pi over 8 which is the first monthly this number here, we set a timer which starts at 0, counts to the particular threshold and then gets reset to 0 and this occurs periodically. While at each one of those events the memory state that collects the input to the system is updated with the value of input and held constant until the next event. So now let's dig into the details of the block code in the ADC. Perhaps the more interesting one is the jump set which receives the parameter, the constant here is to define the rate for sampling. And whenever tau s is larger that TS you will report a jump. And whenever it's within the right range you will not report the jump. The choice here of the quality, for not reporting the jump at the highest value of tau s is arbitrary. It could be done only on the condition for reporting the jump actually. For the set you'll read just the complement of that, so these values are flipped and that implements the floor set. The jump map will actually read resetting the timer to zero as you see over here it's a component of the state text. Here it's set to zero, and the memory state which is the first component of the state of the system is reset to the input which is given to the gen map as an input. And then the floor map will actually keep the memory state to zero, and the timer will grow according to linear time. And there is a simulation of ADC using Harrell equation toolbox for in this case sampling a periodic sinusoidal signal [MUSIC]