Algorithm of the artificial comparison star for the CCD photometry