  The charging of a quantum battery by a four-stroke quantum machine that works
either as an engine or a refrigerator is investigated. The presented analysis
provides the energetic behavior of the combined system in terms of the heat and
workflows of the machine, the average, and variance of the battery's energy as
well as the coherent and incoherent parts of its ergotropy. To monitor the
battery state its energy is measured either after the completion of any cycle
or after a prescribed number of cycles is carried out. The resulting battery
performances greatly differ for those two cases. During the first charging
epoch with an engine, the regular measurements speed up the charging, whereas
the gain of ergotropy is more pronounced in the absence of measurements. In a
later stage, the engine fails to work as such while it still continues charging
the battery that eventually reaches the maximally charged state in the absence
of intermediate measurements and a suboptimally charged state for a
periodically measured battery. For a refrigerator, the charging of the measured
battery also proceeds faster during the first epoch. Only during the second
stage when the machine fails to extract heat from the cold bath the influence
of the measurements become less pronounced leading to rather similar asymptotic
states for the two measurement scenarios.
