Kstars
schedulerutils.cpp
167void SchedulerUtils::setupJob(SchedulerJob &job, const QString &name, const QString &group, const dms &ra, const dms &dec,
168 double djd, double rotation, const QUrl &sequenceUrl, const QUrl &fitsUrl, StartupCondition startup,
169 const QDateTime &startupTime, CompletionCondition completion, const QDateTime &completionTime, int completionRepeats,
170 double minimumAltitude, double minimumMoonSeparation, bool enforceWeather, bool enforceTwilight,
218 job.setStepPipeline(static_cast<SchedulerJob::StepPipeline>(job.getStepPipeline() | SchedulerJob::USE_TRACK));
220 job.setStepPipeline(static_cast<SchedulerJob::StepPipeline>(job.getStepPipeline() | SchedulerJob::USE_FOCUS));
222 job.setStepPipeline(static_cast<SchedulerJob::StepPipeline>(job.getStepPipeline() | SchedulerJob::USE_ALIGN));
224 job.setStepPipeline(static_cast<SchedulerJob::StepPipeline>(job.getStepPipeline() | SchedulerJob::USE_GUIDE));
235 const CapturedFramesMap &capturedFramesCount, SchedulerJob &schedJob, CapturedFramesMap &capture_map,
298void SchedulerUtils::updateLightFramesRequired(SchedulerJob *oneJob, const QList<SequenceJob *> &seqjobs,
314 if (oneSeqJob->getFrameType() == FRAME_LIGHT && expected[signature] * oneJob->getRepeatsRequired() > framesCount[signature])
346bool SchedulerUtils::loadSequenceQueue(const QString &fileURL, SchedulerJob *schedJob, QList<SequenceJob *> &jobs,
354 if (logger != nullptr) logger->appendLogText(i18n("Unable to open sequence queue file '%1'", fileURL));
403bool SchedulerUtils::estimateJobTime(SchedulerJob *schedJob, const QMap<QString, uint16_t> &capturedFramesCount,
411 bool result = loadSequenceQueue(schedJob->getSequenceFile().toLocalFile(), schedJob, seqJobs, hasAutoFocus, logger);
415 QString("Warning: Failed estimating the duration of job '%1', its sequence file is invalid.").arg(
424 if (schedJob != jobWarned && hasAutoFocus && !(schedJob->getStepPipeline() & SchedulerJob::USE_FOCUS))
427 i18n("Warning: Job '%1' has its focus step disabled, periodic and/or HFR procedures currently set in its sequence will not occur.",
434 * If option "Remember Job Progress" is disabled, this map will be empty, and the Capture module will process all requested captures unconditionally.
448 uint16_t totalCompletedCount = fillCapturedFramesMap(expected, capturedFramesCount, *schedJob, capture_map,
455 QString seqName = i18n("Job '%1' %2x%3\" %4", schedJob->getName(), seqJob->getCoreProperty(SequenceJob::SJ_Count).toInt(),
462 QString("%1 duration cannot be estimated time since the sequence saves the files remotely.").arg(seqName);
471 int captures_required = seqJob->getCoreProperty(SequenceJob::SJ_Count).toInt() * schedJob->getRepeatsRequired();
473 const int capturesRequiredPerRepeat = std::max(1, seqJob->getCoreProperty(SequenceJob::SJ_Count).toInt());
474 int capturesLeftThisRepeat = std::max(0, capturesRequiredPerRepeat - (captures_completed % capturesRequiredPerRepeat));
477 // Something else is causing this iteration to be incomplete. Nothing left to do for this seqJob.
485 * The objective of this block is to fill the storage map of the scheduler job with completed counts for each capture storage.
487 * Sequence jobs capture to a storage folder, and are given a count of captures to store at that location.
488 * The tricky part is to make sure the repeat count of the scheduler job is properly transferred to each sequence job.
490 * For instance, a scheduler job repeated three times must execute the full list of sequence jobs three times, thus
491 * has to tell each sequence job it misses all captures, three times. It cannot tell the sequence job three captures are
492 * missing, first because that's not how the sequence job is designed (completed count, not required count), and second
493 * because this would make the single sequence job repeat three times, instead of repeating the full list of sequence
496 * The consolidated storage map will be assigned to each sequence job based on their signature when the scheduler job executes them.
498 * For instance, consider a RGBL sequence of single captures. The map will store completed captures for R, G, B and L storages.
499 * If R and G have 1 file each, and B and L have no files, map[storage(R)] = map[storage(G)] = 1 and map[storage(B)] = map[storage(L)] = 0.
502 * In the case of a RGBLRGB sequence of single captures, the second R, G and B map items will count one less capture than what is really in storage.
503 * If R and G have 1 file each, and B and L have no files, map[storage(R1)] = map[storage(B1)] = 1, and all others will be 0.
506 * This doesn't handle the case of duplicated scheduler jobs, that is, scheduler jobs with the same storage for capture sets.
507 * Those scheduler jobs will all change state to completion at the same moment as they all target the same storage.
508 * This is why it is important to manage the repeat count of the scheduler job, as stated earlier.
513 qCInfo(KSTARS_EKOS_SCHEDULER) << QString("%1 sees %2 captures in output folder '%3'.").arg(seqName).arg(
516 // Enumerate sequence jobs to check how many captures are completed overall in the same storage as the current one
523 // If the previous sequence signature matches the current, skip counting to take duplicates into account
532 qCDebug(KSTARS_EKOS_SCHEDULER) << QString("%1 has completed %2/%3 of its required captures in output folder '%4'.").arg(
539 captures_completed = schedJob->getCompletedCount() / allCapturesPerRepeat * seqJob->getCoreProperty(
547 // Check if we still need any light frames. Because light frames changes the flow of the observatory startup
549 // We check if the frame type is LIGHT and if either the number of captures_completed frames is less than required
552 // FIXME: As it is implemented now, FINISH_LOOP may loop over a capture-complete, therefore inoperant, scheduler job.
553 bool const areJobCapturesComplete = (0 == captures_required || captures_completed >= captures_required);
558 qCInfo(KSTARS_EKOS_SCHEDULER) << QString("%1 completed its sequence of %2 light frames.").arg(seqName).arg(
574 imagingTimePerRepeat += fabs(secsPerCapture * seqJob->getCoreProperty(SequenceJob::SJ_Count).toInt());
582 // Wild guess, 10s of autofocus for each capture required. Can vary a lot, but this is just a completion estimate.
624 QString("Job '%1' is configured to loop until Scheduler is stopped manually, has undefined imaging time.")
635 qCDebug(KSTARS_EKOS_SCHEDULER) << QString("Job '%1' has a startup time and fixed completion time, will run for %2.")
646 QString("Job '%1' has no startup time but fixed completion time, will run for %2 if started now.")
650 // Rely on the estimated imaging time to determine whether this job is complete or not - this makes the estimated time null
657 qCDebug(KSTARS_EKOS_SCHEDULER) << QString("Job '%1' will not run, complete with %2/%3 captures.")
671 qCInfo(KSTARS_EKOS_SCHEDULER) << QString("Job '%1' estimated to take %2 to complete.").arg(schedJob->getName(),
681 /* FIXME: estimation should base on actual measure of each step, eventually with preliminary data as what it used now */
721 expected[signature] = static_cast<uint16_t>(seqJob->getCoreProperty(SequenceJob::SJ_Count).toInt()) + (expected.contains(
727double SchedulerUtils::findAltitude(const SkyPoint &target, const QDateTime &when, bool *is_setting, bool debug)
729 // FIXME: block calculating target coordinates at a particular time is duplicated in several places
731 // Retrieve the argument date/time, or fall back to current time - don't use QDateTime's timezone!
733 Qt::UTC == when.timeSpec() ? SchedulerModuleState::getGeo()->UTtoLT(KStarsDateTime(when)) : when :
746 CachingDms const LST = SchedulerModuleState::getGeo()->GSTtoLST(SchedulerModuleState::getGeo()->LTtoUT(ltWhen).gst());
758 qCDebug(KSTARS_EKOS_SCHEDULER) << QString("When:%9 LST:%8 RA:%1 RA0:%2 DEC:%3 DEC0:%4 alt:%5 setting:%6 HA:%7")
a dms subclass that caches its sine and cosine values every time the angle is changed.
Definition cachingdms.h:19
There are several time-dependent values used in position calculations, that are not specific to an ob...
Definition ksnumbers.h:43
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day,...
Definition kstarsdatetime.h:36
Sequence Job is a container for the details required to capture a series of images.
Provides all necessary information about an object in the sky: its coordinates, name(s),...
Definition skyobject.h:42
virtual void updateCoordsNow(const KSNumbers *num)
updateCoordsNow Shortcut for updateCoords( const KSNumbers *num, false, nullptr, nullptr,...
Definition skypoint.h:382
void EquatorialToHorizontal(const CachingDms *LST, const CachingDms *lat)
Determine the (Altitude, Azimuth) coordinates of the SkyPoint from its (RA, Dec) coordinates,...
Definition skypoint.cpp:77
QString i18n(const char *text, const TYPE &arg...)
char * toString(const EngineQuery &query)
QMap< QString, uint16_t > CapturedFramesMap
mapping signature --> frames count
Definition schedulertypes.h:131
QString path(const QString &relativePath)
QString name(StandardShortcut id)
const QList< QKeySequence > & completion()
QCA_EXPORT Logger * logger()
QDateTime fromString(QStringView string, QStringView format, QCalendar cal)
QString path() const const
Int toInt() const const
ReadOnly
QLocale c()
QString arg(Args &&... args) const const
int compare(QLatin1StringView s1, const QString &s2, Qt::CaseSensitivity cs)
ISODate
UTC
QTextStream & dec(QTextStream &stream)
QUrl fromUserInput(const QString &userInput, const QString &workingDirectory, UserInputResolutionOptions options)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 3 2024 11:49:51 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 3 2024 11:49:51 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.