[Scilab-users] How to correctly simulate sample and hold process?
I have been developing a simulation in Scilab/Xcos 5.5.2. The simulation
basically consists of two main superblocks:
a) /state space model of a dynamic system in the continuous time domain/ -
block is based on the
b) /discrete observer for the dynamic system from point a)/ - block is based
on the CBLOCK block
The input signals for the discrete observer are the outputs of the
dynamic system from a) passing
through the SAMPLEHOLD_m blocks.
I have encountered following behavior which I don't understand:
1) In case I use one clock source (SampleCLK with Sample time set to 1 us
and Offset set to 0) for the timing of the SAMPLEHOLD_m blocks and another
clock source (CLOCK_c with period set to 100 us and Initialization time set
to 0) for the timing of the CSCOPE blocks the output of the observer follows
the outputs of the model very well.
2) In case I use both the clock sources from 1) but the sample time in the
SampleCLK is increased to 10 us and setting of the CLOCK_c block remains the
same the observer gives outputs with large estimation error.
3) In case I use one common clock source (CLOCK_c with period set to
sampling period) for the timing of the SAMPLEHOLD_m blocks and for
controlling of the CSCOPE blocks the observer outputs follow the outputs of
the model again very well despite the fact that the sampling period is set
to 10 us (which gives large estimation error in configuration in 2)).
I would like to ask you for answering following questions:
I. What is the cause of my observation?
II. What is the correct approach for timing of the SAMPLEHOLD_m blocks in