Problem with zero-crossing

5 views (last 30 days)
Ubaldo Tiberi
Ubaldo Tiberi on 19 Mar 2013
Hello all,
I have a problem regarding a zero-crossing problem. Basically, I have a continuous-time system with two outputs. OUT1 shall be always positive and OUT2 is used to switch the input signal. At every zero-crossing of OUT2, a pulse is generated and sent to an input selector which will select an appropriate input. To enforce OUT1 always positive it is necessary that the input signal is zero when OUT1 is zero.
PROBLEM: I have to solve this problem only using very elementary blocks (like switches, constants, abs, unit delays, etc), or with some logic blocks (and,or, bit shift, etc). By using a variable-step solver, I get an error message related to zero-crossing (too many zero-crossings) and the simulation stops. Actually, I can imagine why this happens... For completeness reasons, I have also tried to use a "triggering window": by using two constants "0" and "1" as input of a switch, and by switching these inputs with a condition, e.g. -abs(OUT2) >= -0.001 does not help (I think this for the same reason of the previous point). However, by adding a delay block between the generated input and the process, I get rid off the Zeno problems. However, by doing that I am "delaying" my input signal, with the consequence that OUT1 becomes slightly negative.
Hence, I considered to use a fixed-step solver,but in that case there is the risk that the zero-crossing is not detected, since two consecutive samples maybe taken outside a predefined triggering window. The problem can be solved by checking when there is a switch in the sign of two consecutive samples, but I may detect the zero-crossing too late, and then I would still have the problem of negative OUT1.
Finally, I have the requirement that if OUT1 is zero, then the applied input is also zero. I implemented this in the same way: I used a switch block with the desired input signal and the constant "0" as inputs, and the switch between these inputs is commanded by the signal OUT1 (I set OUT1 <= 0.001 as a switching condition). In this case, I clearly have an algebraic loop that may be broken with the insertion of a time-delay block (or a memory block, initial condition block, etc.).
Without considering the utilization of saturation blocks (which are highly nonlinear), how can I get rid off these problems? It seems that if I avoid zero-crossing problems, then I have OUT1 that goes slightly negative, or I have Zeno behavior if I am sure that OUT1 will be always positive...

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!