hysteresis?
Hysteresis can be our friend, at least in certain control situations.
For example, I may have an adjustment knob (a pot) right on a spot
that causes a system to oscillate between two states (a step
function).
Question: How can you build hysteresis into a stamp program? I'm
reading a pulse width; once the pulse gets wider than X, I go from
one operating speed to another. I want to avoid juddering between the
two states.
patmat
For example, I may have an adjustment knob (a pot) right on a spot
that causes a system to oscillate between two states (a step
function).
Question: How can you build hysteresis into a stamp program? I'm
reading a pulse width; once the pulse gets wider than X, I go from
one operating speed to another. I want to avoid juddering between the
two states.
patmat
Comments
the change of pulse width remains constant for so many passes through
the loop then the transition may be considered valid.
This FOR NEXT loop would give you the hysteresis you require,
plus,the delay would be easy to fine tune.
Rich
http://geocities.com/rbc1956
--- In basicstamps@y..., patmat2350@a... wrote:
> Hysteresis can be our friend, at least in certain control
situations.
> For example, I may have an adjustment knob (a pot) right on a spot
> that causes a system to oscillate between two states (a step
> function).
> Question: How can you build hysteresis into a stamp program? I'm
> reading a pulse width; once the pulse gets wider than X, I go from
> one operating speed to another. I want to avoid juddering between
the
> two states.
>
> patmat
>>Hysteresis can be our friend, at least in certain control situations.
>>For example, I may have an adjustment knob (a pot) right on a spot
>>that causes a system to oscillate between two states (a step
>>function).
>>Question: How can you build hysteresis into a stamp program? I'm
>>reading a pulse width; once the pulse gets wider than X, I go from
>>one operating speed to another. I want to avoid juddering between the
>>two states.
>>patmat
peterverkaik@b... wrote
>Instead of a single point you could use a window
>For example
>If newvalue > oldvalue + 3 then speedup
>If newvalue < oldvalue - 3 then speeddown
>This implicates that if newvalue is within +/- 3 from oldvalue, speed is
>maintained
Another way to do uses math instead of IF-THEN. The following
function makes speedbit high when pulsewidth>threshold, without
hysteresis.
speedbit var bit ' 0 for low speed, 1 for high speed
speedbit = pulsewidth min threshold - threshold max 1
The following adds hystersis so that speedbit goes high when
pulsewidth>threshold, but speedbit does not return low until
pulsewidth<threshold-hysteresis.
speedbit var bit ' 0 for low speed, 1 for high speed
speedbit = (speedbit*hysteresis + pulsewidth) min threshold - threshold max 1
-- best regards
Tracy Allen
electronically monitored ecosystems
http://www.emesystems.com
mailto:tracy@e...
>Hysteresis can be our friend, at least in certain control situations.
>For example, I may have an adjustment knob (a pot) right on a spot
>that causes a system to oscillate between two states (a step
>function).
>Question: How can you build hysteresis into a stamp program? I'm
>reading a pulse width; once the pulse gets wider than X, I go from
>one operating speed to another. I want to avoid juddering between the
>two states.
>
>patmat
You almost answered your own question... create another "check" that
looks to see if the pulse gets narrower than X. One way is to use a
temp variable (bit). To avoid "juddering" set your MAXwidth and MINwidth
values to be outside of the normal noise-floor of your PWM signal.
'
Start Generalized Code
'Note: Generalized Code not actual Stamp code.
Initialize:
Temp=0
X1 = MAXwidth
X2 = MINwidth
Start:
X=inputPulseWidth
if Temp=0 and X>X1 then WidePulse
if Temp=1 and X<X2 then NarrowPulse
goto Start
WidePulse:
Temp=1
{do something here}
goto Start
NarrowPulse:
Temp=0
{Do something else here}
Joto Start
'
End Generalized Code
Beau Schwabe IC Mask Designer
National Semiconductor Wired Communications Division
500 Pinnacle Court, Suite 525 Mail Stop GA1 Norcross, GA 30071
At 04:56 PM 6/13/01 +0000, you wrote:
>Hysteresis can be our friend, at least in certain control situations.
>For example, I may have an adjustment knob (a pot) right on a spot
>that causes a system to oscillate between two states (a step
>function).
>Question: How can you build hysteresis into a stamp program? I'm
>reading a pulse width; once the pulse gets wider than X, I go from
>one operating speed to another. I want to avoid juddering between the
>two states.
>
>patmat
You almost answered your own question... create another "check" that
looks to see if the pulse gets narrower than X. One way is to use a
temp variable (bit). To avoid "juddering" set your MAXwidth and MINwidth
values to be outside of the normal noise-floor of your PWM signal.
'
Start Generalized Code
'Note: Generalized Code not actual Stamp code.
Initialize:
Temp=0
X1 = MAXwidth
X2 = MINwidth
Start:
X=inputPulseWidth
if Temp=0 and X>X1 then WidePulse
if Temp=1 and X<X2 then NarrowPulse
goto Start
WidePulse:
Temp=1
{do something here}
goto Start
NarrowPulse:
Temp=0
{Do something else here}
Joto Start
'
End Generalized Code
Beau Schwabe IC Mask Designer
National Semiconductor Wired Communications Division
500 Pinnacle Court, Suite 525 Mail Stop GA1 Norcross, GA 30071