Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Dynamic Systems Question

16 views
Skip to first unread message

Thomas D. Dean

unread,
Feb 8, 2012, 9:35:09 PM2/8/12
to
I am using Maple 15.

I have an electronic module containing a VCTCXO and a microprocessor to
phase lock the VCTCXO to a gps 1pps signal.

It works OK. Some times the system loses phase lock and it takes a long
time to stabilize, again.

I am looking at Dynamic Systems to develop a model to play with the
parameters and possibly improve the code.

The uProcessor code is:

F1:=1/2^6; F2:=2^10;
y(n) = (1/F1 + 1/F2)x(n) + (1/F1 - 1/F2)*x(n-1) + y(n-1)

An IIR filter.

y(n) is multiplied by a gain factor and added to a DAC setting.

I tried

num:=[(1/F1 + 1/F2) + (1/F1 - 1/F2)];
den = [0,1]
sys1 := TransferFunction(num, den, sampletime = 1/30); PrintSystem(%);

This looks OK for the feedforward portion of the controller.

However, I cannot get the feedback to work;
sys_feedback := SystemConnect(sys1, connection = positivefeedback)

Error, (in unknown) cannot convert improper transfer function to
state-space model

I cannot convert sys1 to state-space.

I realize num > denom.

Any ideas?

Tom Dean

Thomas D. Dean

unread,
Feb 8, 2012, 10:02:53 PM2/8/12
to
On 02/08/12 18:35, Thomas D. Dean wrote:

>
> F1:=1/2^6; F2:=2^10;

Obviously, I cannot type.
F1:=2^6; F2:=2^10;

Sorry,
Tom Dean

Joe Riel

unread,
Feb 9, 2012, 12:47:21 AM2/9/12
to
"Thomas D. Dean" <tom...@speakeasy.org> writes:

> I am using Maple 15.
>
> I have an electronic module containing a VCTCXO and a microprocessor
> to phase lock the VCTCXO to a gps 1pps signal.
>
> It works OK. Some times the system loses phase lock and it takes a
> long time to stabilize, again.
>
> I am looking at Dynamic Systems to develop a model to play with the
> parameters and possibly improve the code.
>
> The uProcessor code is:
>
> F1:=1/2^6; F2:=2^10;
> y(n) = (1/F1 + 1/F2)x(n) + (1/F1 - 1/F2)*x(n-1) + y(n-1)
>
> An IIR filter.
>
> y(n) is multiplied by a gain factor and added to a DAC setting.
>
> I tried
>
> num:=[(1/F1 + 1/F2) + (1/F1 - 1/F2)];
> den = [0,1]

Are you sure num and den are correct?
den is equivalent to [1], the result is a transfer function
with a constant gain (num).

> sys1 := TransferFunction(num, den, sampletime = 1/30); PrintSystem(%);
>
> This looks OK for the feedforward portion of the controller.
>
> However, I cannot get the feedback to work;
> sys_feedback := SystemConnect(sys1, connection = positivefeedback)
>
> Error, (in unknown) cannot convert improper transfer function to
> state-space model
>
> I cannot convert sys1 to state-space.
>
> I realize num > denom.
>
> Any ideas?
>
> Tom Dean

--
Joe Riel

Thomas D. Dean

unread,
Feb 9, 2012, 1:36:01 AM2/9/12
to
On 02/08/12 21:47, Joe Riel wrote:

>> The uProcessor code is:
>>
>> F1:=1/2^6; F2:=2^10;
>> y(n) = (1/F1 + 1/F2)x(n) + (1/F1 - 1/F2)*x(n-1) + y(n-1)
>>

This is the equation in the code.

There is an output gain factor after the filter.

Tom Dean

Joe Riel

unread,
Feb 9, 2012, 12:58:36 PM2/9/12
to
"Thomas D. Dean" <tom...@speakeasy.org> writes:

> On 02/08/12 21:47, Joe Riel wrote:
>
>>> The uProcessor code is:
>>>
>>> F1:=1/2^6; F2:=2^10;
>>> y(n) = (1/F1 + 1/F2)x(n) + (1/F1 - 1/F2)*x(n-1) + y(n-1)
>>>

For that discrete equation, shouldn't the corresponding
input

num := [(1/F1 + 1/F2), (1/F1 - 1/F2)]:
den := [1,-1]:

sys1 := TransferFunction(num,den,sampletime=1/30);

That doesn't cause a problem:

sys_feedback := SystemConnect(sys1, connection = positivefeedback);


--
Joe Riel

Thomas D. Dean

unread,
Feb 9, 2012, 2:37:05 PM2/9/12
to
On 02/09/12 09:58, Joe Riel wrote:

>
> num := [(1/F1 + 1/F2), (1/F1 - 1/F2)]:
> den := [1,-1]:

Yes. Thanks.

Maybe I am beginning to understand.

Tom Dean

Thomas D. Dean

unread,
Feb 11, 2012, 8:02:47 AM2/11/12
to
On 02/08/12 18:35, Thomas D. Dean wrote:
> I am using Maple 15.
>

I want to create a transfer function to model a DAC with limited input
and 1lsb noise.


restart; with(DynamicSystems)
eqn:=piecewise(c<6553,ztrans((5*6553)/(2^16-1),c,z),c>58982,
ztrans((5*58982)/(2^16-1),c,z),ztrans((5*c)/(2^16-1),c,z));

dac:=TransferFunction(eqn, sampletime = 30):PrintSystem(dac);

## does not like the non-rational poly, but, creates the tf, anyway
Warning, transfer-function(s) are not rational-polynomial(s) in z

How do I handle random noise on the order of 1 lsb?

eqn:=ztrans(1+'rand(1..100)'/100,c,z);
dacNoise:=TransferFunction(eqn,sampletime=30);

## and, maple really does not like this, returning an error
Error, (in DynamicSystems:-FormatTF) invalid arguments to sort

How do I do this?

Tom Dean

Joe Riel

unread,
Feb 11, 2012, 3:51:42 PM2/11/12
to
"Thomas D. Dean" <tom...@speakeasy.org> writes:

> On 02/08/12 18:35, Thomas D. Dean wrote:
>> I am using Maple 15.
>>
>
> I want to create a transfer function to model a DAC with limited input
> and 1lsb noise.
>
>
> restart; with(DynamicSystems)
> eqn:=piecewise(c<6553,ztrans((5*6553)/(2^16-1),c,z),c>58982,
> ztrans((5*58982)/(2^16-1),c,z),ztrans((5*c)/(2^16-1),c,z));
>
> dac:=TransferFunction(eqn, sampletime = 30):PrintSystem(dac);
>
> ## does not like the non-rational poly, but, creates the tf, anyway
> Warning, transfer-function(s) are not rational-polynomial(s) in z

Hmm. DynamicSystems wasn't designed to handle such systems,
but possibly could be extended. How do you hope to use this
system? That is, what would you like to do with it? How
would c be used?


> How do I handle random noise on the order of 1 lsb?
>
> eqn:=ztrans(1+'rand(1..100)'/100,c,z);
> dacNoise:=TransferFunction(eqn,sampletime=30);
>
> ## and, maple really does not like this, returning an error
> Error, (in DynamicSystems:-FormatTF) invalid arguments to sort

That is more challenging. Again, if this could be
handled, what would you do with it?

--
Joe Riel

Thomas D. Dean

unread,
Feb 11, 2012, 7:55:54 PM2/11/12
to
On 02/11/12 12:51, Joe Riel wrote:

I have a module that locks a VCTCXO to the GPS 1PPS.

I am trying to understand the module and its software.

The module was described in a Brooks Shera article in the July 1998 QST
magazine.

I changed the software from PIC asm to C and used an Atmel uP. The
module functions, but, maybe not as well as it should.

I have an octave .m file that sort of almost simulates the module. I
can work with that.

This is a hobby, not worth changes or extensions to Maple.

The Maple Dynamic Systems code has helped with generating control
systems. I use ztrans a lot.

If you are interested, I can send you a schematic.

Thanks,
Tom Dean
0 new messages