Username:

Password:

UKAI is moving to Facebook

Author Topic: Digging into the innards of PHD2  (Read 3686 times)

0 Members and 1 Guest are viewing this topic.

Offline mechanoid

  • Full Member
  • ***
  • Posts: 134
Digging into the innards of PHD2
« on: 18:49:11, 01 April, 2015 »
Having nothing better to do on a wet afternoon, I thought I'd take a look at the source code for the guide algorithms used by PHD2. Here's what I've found so far ...

The default algorithm for controlling the RA axis is called "hysteresis". As written, this is actually something called an infinite impulse response (IIR) single pole filter. What it does is allow through low frequency things that you want to correct, such as periodic error, whilst blocking things such as atmospheric turbulence that you don't. The cutoff frequency is controlled by the hysteresis parameter, default 10%.  The overall gain is controlled by the aggressiveness parameter, default 70%.

However, the cutoff frequency is also a function of the sample time (frame exposure time). With the default settings and a 1 second exposure, the cutoff frequency is 0.23 Hz, which may or may not eliminate turbulence effects. Dunno.  However, if a bright star is selected for guiding at  say 0.1 sec exposure, then the cutoff frequency increases to 2.3 Hz.  As far as I can tell, the algorithm takes no account of the exposure time. I'll try and ask the developers about this in case I've overlooked something.

So selecting a bright guide star means that you may well end up trying to correct for turbulence !  OK, so select a dimmer star to average it out. My point is that it shouldn't make any difference if the algorithm  took account of the exposure time.  After all, it is supposed to be for Dummies !  One way to compensate for this is to note the hysteresis and exposure that work, and adjust the hysteresis for different exposures. The aggressiveness would stay the same.

Unfortunately there is one other confounding factor. Every time the correction falls below the minimum move, the filter gets reset to zero. I'm not sure if this was deliberate or just a mistake in the placement of one line of code.  I'll just have to ask the developers. I'm not too sure of the practical effect of this. Setting min. move to zero would avoid it, at the expense of continuous short correcting pulses.

If you want better consistency in RA guiding with this algorithm, maybe this will help. If the sky ever clears I might be able to find out.

If you really want to know, the cutoff frequency (Hz) is given by (1-h) / 2*pi*h*T  where h is the hysteresis parameter (as a fraction) and T the exposure time in seconds.

Don't get me wrong - I think PHD2 is an excellent program. I just like to understand things better if it makes my life easier.

Dave

Skywatcher Quattro 200mm C/F, Vixen GPDX, QHY10
Skywatcher ST80, QHY5II, PHD2
Images Plus

Offline Uplooker

  • Senior Member
  • ****
  • Posts: 617
Re: Digging into the innards of PHD2
« Reply #1 on: 20:13:27, 01 April, 2015 »
Hi Dave,
Thanks for that. I followed everything you said up to "The default algorithm..........." then I started feeling a bit faint :tease:

Ian
Ian

Scopes: SW 150P Newt, ST80, Celestron C8 XLT, TAL 100RS / PST Stage 2 Mod & BF10, SW 300PDS (soon to be on a Dob Mount)
Cameras: SPC900, QHY5, Canon 450D, DMK31AU03.AS
Mounts: NEQ6 powered by EQMod, EQ3-2

Online chris.bailey

  • Administrator
  • Galactic Poster
  • *****
  • Posts: 10012
  • If at last you do succeed, don't try again
    • Rosemount Observatory
Re: Digging into the innards of PHD2
« Reply #2 on: 22:19:21, 01 April, 2015 »
Dave

I'm afraid I got as far as Wet Afternoon as something I could relate to but turned off at Source Code in the direction of the beer fridge. I'm very much of the clicking on the guide button brigade but have tended towards longer and longer guide exposures and typically run at between 5 and 7 seconds depending on whether the cows were lying down in the field when I drove home  :sleepy: I find the seeing on a particular evening to have the biggest impact on guiding and long exposures tend to average this out a bit.

Chris
LX200|ZS70|FSQ85|FLT110|Altair DF250RC|EQ6 Pro(Rowan Belt Mod)|ParamountMX
ATIK383L+/EFW2/OAG|Lodestar|Baader 36mm LRGBHaSIIOIII
Starlight Express SXVRH16/ONAG/FW|Lodestar X2|Baader 2" Filters
Starlight Express SXVRH814/ONAG/FW|LodestarX2|Baader 2" Filters
Lunt LS60PTBF1200|DMK41|Quark Chromo
Samyang 135mm f1.8

Offline Phillyo

  • Poster God
  • *****
  • Posts: 1492
Re: Digging into the innards of PHD2
« Reply #3 on: 00:44:24, 02 April, 2015 »
Thanks for that Dave, interesting stuff.

Please let us know what the devs come back with in response to your questions?

From what you say it seems to me that using a mount with 0 backlash I would benefit from fast corrections with min movement set to 0?

Phil
Astrotrac | Avalon Linear Fast Reverse with EQmod | WO Star 71 | Astrodon 3nm Ha, 5nm SII and 5nm OIII | Astro-modded Canon 450D | QSI 583wsg | Lodestar X2 Guidecam | Sequence Generator Pro | Pixinsight

Online chris.bailey

  • Administrator
  • Galactic Poster
  • *****
  • Posts: 10012
  • If at last you do succeed, don't try again
    • Rosemount Observatory
Re: Digging into the innards of PHD2
« Reply #4 on: 08:34:32, 02 April, 2015 »
Phil

I dont think that is the case as that would require a mount movement in every guide cycle even if the movement is stupidly small. See http://www.ccdware.com/resources/autoguidercalcv4.cfm

Chris
LX200|ZS70|FSQ85|FLT110|Altair DF250RC|EQ6 Pro(Rowan Belt Mod)|ParamountMX
ATIK383L+/EFW2/OAG|Lodestar|Baader 36mm LRGBHaSIIOIII
Starlight Express SXVRH16/ONAG/FW|Lodestar X2|Baader 2" Filters
Starlight Express SXVRH814/ONAG/FW|LodestarX2|Baader 2" Filters
Lunt LS60PTBF1200|DMK41|Quark Chromo
Samyang 135mm f1.8

Offline mechanoid

  • Full Member
  • ***
  • Posts: 134
Re: Digging into the innards of PHD2
« Reply #5 on: 11:47:30, 02 April, 2015 »
Chris

At the risk of driving you to drink again, I think that guiding on a bright start with the shortest exposure should be best.  In a control system, the faster the update time, the better the control. However, it is essential that unwanted errors, particularly turbulence, are eliminated.  This is what the filter in the hysteresis control algorithm should do (but doesn't appear to do correctly). A longer exposure time also achieves filtering at the expense of the control responsiveness.  Anyway, enough.  My brain hurts ...

Dave
Skywatcher Quattro 200mm C/F, Vixen GPDX, QHY10
Skywatcher ST80, QHY5II, PHD2
Images Plus

Offline ChrisLX200

  • Poster God
  • *****
  • Posts: 2281
  • Macclesfield UK
Re: Digging into the innards of PHD2
« Reply #6 on: 12:17:07, 02 April, 2015 »
Chris

At the risk of driving you to drink again, I think that guiding on a bright start with the shortest exposure should be best.  In a control system, the faster the update time, the better the control. However, it is essential that unwanted errors, particularly turbulence, are eliminated.  This is what the filter in the hysteresis control algorithm should do (but doesn't appear to do correctly). A longer exposure time also achieves filtering at the expense of the control responsiveness.  Anyway, enough.  My brain hurts ...

Dave

The mount isn't going to be quick enough to respond to very short/rapid move commands (and this is especially problematic if the mount is asked to reverse direction).  Corrections here should be for general drift and PE, if you want a faster response then an AO unit is the way to go.

ChrisH
Chris Heapy - current: 10-Micron GM2000HPS-II U/P, G11/Gemini, TV NP127is, Altair 8" RC, TV Genesis SDF, TV Pronto, SW Equinox 80ED, 10" LX200, 12" f/5.4 Newt, Vixen 90mm.
Atik 490EX, Atik EFW, Baader LRGB filters, Astrodon 3nM NB filters, Lodestar, QHY5L-II all-sky, Canon 70D and 350D
Whirley Obs., MPC Code Z89

Offline mechanoid

  • Full Member
  • ***
  • Posts: 134
Re: Digging into the innards of PHD2
« Reply #7 on: 12:02:41, 03 April, 2015 »
ChrisH

I agree - you definitely don't want to send multiple short moves.  No conventional mount is going to be capable of responding.  To up the frequency response requires at least a tilt-tip mirror type of adaptive optics.

Preventing rapid change demands is exactly what a low pass filter should achieve.  My point was it doesn't do this fully because no account seems to have been taken for the exposure time.  So as the exposure time gets shorter, the very short commands you don't want are allowed to pass through!

One way to filter turbulence errors is to integrate the signal on the detector - faint star and long exposure.  Sometimes only faint stars are visible anyway, so the problem sort of solves itself.  I maintain that this shouldn't be necessary, and that short exposures on a bright guide star should result in exactly the same control, provided that the correct digital filtering is applied.  Moves less than a specified size are removed (correctly) by a deadband.

Since PHD stands for Press Here Dummy, I think anything that could make it closer to this ideal would be a good thing. All any of us really want to do is take pictures with the least hassle. Most people aren't (and shouldn't be) concerned with this stuff.

I don't want to take this discussion further without having the courtesy of discussing this with the developers. Anyway, only they can change anything. But the great thing about open source software is that you can see exactly how things are done, and hopefully help make it better.

Dave

Skywatcher Quattro 200mm C/F, Vixen GPDX, QHY10
Skywatcher ST80, QHY5II, PHD2
Images Plus

Offline swashy

  • UKAI GFX Guru
  • Administrator
  • Galactic Poster
  • *****
  • Posts: 14669
Re: Digging into the innards of PHD2
« Reply #8 on: 16:30:08, 03 April, 2015 »
Dave, if you do speak to the developers, can you ask them to install this option

Ade

Imagine...  above us only sky!

 

ukbuysellRemote Imaging from AustraliaSharpSkyblank APTUKAI on Facebook
Powered by SMF 2.0.15 | SMF © 2006, Simple Machines LLC
DarkBreak by DzinerStudio. Theme modified by The UKAI Team

Page created in 0.908 seconds with 38 queries.
TinyPortal © 2005-2012