Sequence Diagram Scroll down (bug in rendering)
%%{init: {'theme':'forest'}}%% sequenceDiagram autonumber pntpos()->>pntpos(): satposs() satellite positons, velocities and clocks pntpos()->>estpos(): estimate receiver position and time with pseudorange loop (MAXITR) estpos()->>rescode(): pseudorange residuals (prefit residuals) loop (MAXOBS) rescode()->>rescode(): satsys() (valid satellite system) rescode()->>rescode(): reject duplicated observation data rescode()->>rescode(): satexclude() excluded satellite rescode()->>rescode(): geodist() geometric distance rescode()->>rescode(): satazel() elevation mask alt iter>0 rescode()->>rescode(): snrmask() test SNR mask rescode()->>rescode(): ionocorr() ionospheric correction rescode()->>rescode(): sat2freq() (check for valid frequency) rescode()->>rescode(): tropcorr() tropospheric correction end rescode()->>rescode(): prange() psendorange with code bias correction rescode()->>rescode(): pseudorange residual (prefit residuals) rescode()->>rescode(): design matrix rescode()->>rescode(): time system offset and receiver bias correction note over rescode(): Set valid satellite and count satellite rescode()->>rescode(): varerr() variance of pseudorange error rescode()->>rescode(): constraint to avoid rank-deficient rescode()->>estpos(): return nv (Number of valid measurements) end estpos()->>estpos(): weight by variance (lsq uses sqrt of weight) estpos()->>estpos(): lsq() least square estimation estpos()->>estpos(): norm(dx,NX)<1E-4 Update state terms estpos()->>estpos(): valsol() validate solution end alt norm(dx,NX)<1E-4 estpos()-->>pntpos(): return stat else (i >= MAXITR) estpos()-->>pntpos(): return 0 iteration divergent else estpos()-->>pntpos(): return stat end pntpos()->>pntpos(): raim_fde() RAIM FDE (failure detection and exclution) pntpos()->>estvel(): estimate receiver velocity with Doppler estvel()->>resdop(): range rate residuals loop (MAXOBS) resdop()->>resdop(): LOS (line-of-sight) vector in ECEF resdop()->>resdop(): satellite velocity relative to receiver in ECEF resdop()->>resdop(): range rate with earth rotation correction resdop()->>resdop(): Std of range rate error (m/s) resdop()->>resdop(): range rate residual (m/s) resdop()->>resdop(): design matrix end resdop()->>estvel(): return stat estvel()->>estvel(): lsq() least square estimation estvel()->>estvel(): (norm(dx,4)<1E-6) (Update state terms) estvel()->>estpos(): return estpos()->>pntpos(): return pntpos()->>pntpos(): return stat Reference : https://mermaid.