Updated documentation of SCHEDULER and ZONE and FSM

This commit is contained in:
FlightControl
2017-04-17 07:49:11 +02:00
parent 0e7ebff9a2
commit a89c469130
10 changed files with 532 additions and 233 deletions

View File

@@ -101,33 +101,30 @@
<hr/>
<h1>1) <a href="Scheduler.html##(SCHEDULER)">Scheduler#SCHEDULER</a> class, extends <a href="Base.html##(BASE)">Base#BASE</a></h1>
<p>The <a href="Scheduler.html##(SCHEDULER)">Scheduler#SCHEDULER</a> class creates schedule.</p>
<h2>1.1) SCHEDULER constructor</h2>
<p>The SCHEDULER class is quite easy to use, but note that the New constructor has variable parameters:</p>
<p>SCHEDULER manages the <strong>scheduling of functions</strong>:</p>
<ul>
<li><a href="Scheduler.html##(SCHEDULER).New">Scheduler#SCHEDULER.New</a>( nil ): Setup a new SCHEDULER object, which is persistently executed after garbage collection.</li>
<li><a href="Scheduler.html##(SCHEDULER).New">Scheduler#SCHEDULER.New</a>( Object ): Setup a new SCHEDULER object, which is linked to the Object. When the Object is nillified or destroyed, the SCHEDULER object will also be destroyed and stopped after garbage collection.</li>
<li><a href="Scheduler.html##(SCHEDULER).New">Scheduler#SCHEDULER.New</a>( nil, Function, FunctionArguments, Start, ... ): Setup a new persistent SCHEDULER object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.</li>
<li><a href="Scheduler.html##(SCHEDULER).New">Scheduler#SCHEDULER.New</a>( Object, Function, FunctionArguments, Start, ... ): Setup a new SCHEDULER object, linked to Object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.</li>
<li>optionally in an optional specified time interval, </li>
<li>optionally <strong>repeating</strong> with a specified time repeat interval, </li>
<li>optionally <strong>randomizing</strong> with a specified time interval randomization factor, </li>
<li>optionally <strong>stop</strong> the repeating after a specified time interval. </li>
</ul>
<h2>1.2) SCHEDULER timer stopping and (re-)starting.</h2>
<hr/>
<p>The SCHEDULER can be stopped and restarted with the following methods:</p>
<h1>Demo Missions</h1>
<ul>
<li><a href="Scheduler.html##(SCHEDULER).Start">Scheduler#SCHEDULER.Start</a>(): (Re-)Start the schedules within the SCHEDULER object. If a CallID is provided to :Start(), only the schedule referenced by CallID will be (re-)started.</li>
<li><a href="Scheduler.html##(SCHEDULER).Stop">Scheduler#SCHEDULER.Stop</a>(): Stop the schedules within the SCHEDULER object. If a CallID is provided to :Stop(), then only the schedule referenced by CallID will be stopped.</li>
</ul>
<h3><a href="https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master-release/SCH%20-%20Scheduler">SCHEDULER Demo Missions source code</a></h3>
<h2>1.3) Create a new schedule</h2>
<h3><a href="https://github.com/FlightControl-Master/MOOSE_MISSIONS/tree/master/SCH%20-%20Scheduler">SCHEDULER Demo Missions, only for beta testers</a></h3>
<p>With <a href="Scheduler.html##(SCHEDULER).Schedule">Scheduler#SCHEDULER.Schedule</a>() a new time event can be scheduled. This function is used by the :New() constructor when a new schedule is planned.</p>
<h3><a href="https://github.com/FlightControl-Master/MOOSE_MISSIONS/releases">ALL Demo Missions pack of the last release</a></h3>
<hr/>
<h1>YouTube Channel</h1>
<h3><a href="">SCHEDULER YouTube Channel (none)</a></h3>
<hr/>
@@ -143,12 +140,6 @@
<li>FlightControl : Design &amp; Programming</li>
</ul>
<h3>Test Missions:</h3>
<ul>
<li>SCH - Scheduler</li>
</ul>
<hr/>
@@ -157,19 +148,15 @@
<tr>
<td class="name" nowrap="nowrap"><a href="#SCHEDULER">SCHEDULER</a></td>
<td class="summary">
<h1>SCHEDULER class, extends <a href="Base.html##(BASE)">Base#BASE</a></h1>
<p>The SCHEDULER class creates schedule.</p>
</td>
</tr>
</table>
<h2><a id="#(SCHEDULER)">Type <code>SCHEDULER</code></a></h2>
<table class="function_list">
<tr>
<td class="name" nowrap="nowrap"><a href="##(SCHEDULER).ClassName">SCHEDULER.ClassName</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(SCHEDULER).Clear">SCHEDULER:Clear()</a></td>
<td class="summary">
<p>Clears all pending schedules.</p>
@@ -203,12 +190,6 @@
<td class="name" nowrap="nowrap"><a href="##(SCHEDULER).SchedulerObject">SCHEDULER.SchedulerObject</a></td>
<td class="summary">
</td>
</tr>
<tr>
<td class="name" nowrap="nowrap"><a href="##(SCHEDULER).Schedules">SCHEDULER.Schedules</a></td>
<td class="summary">
</td>
</tr>
<tr>
@@ -236,6 +217,169 @@
</dt>
<dd>
<h1>SCHEDULER class, extends <a href="Base.html##(BASE)">Base#BASE</a></h1>
<p>The SCHEDULER class creates schedule.</p>
<p>A SCHEDULER can manage <strong>multiple</strong> (repeating) schedules. Each planned or executing schedule has a unique <strong>ScheduleID</strong>.
The ScheduleID is returned when the method <a href="##(SCHEDULER).Schedule">SCHEDULER.Schedule</a>() is called.
It is recommended to store the ScheduleID in a variable, as it is used in the methods <a href="SCHEDULER.Start.html">SCHEDULER.Start</a>() and <a href="SCHEDULER.Stop.html">SCHEDULER.Stop</a>(),
which can start and stop specific repeating schedules respectively within a SCHEDULER object.</p>
<h2>SCHEDULER constructor</h2>
<p>The SCHEDULER class is quite easy to use, but note that the New constructor has variable parameters:</p>
<p>The <a href="##(SCHEDULER).New">SCHEDULER.New</a>() method returns 2 variables:</p>
<ol>
<li>The SCHEDULER object reference.</li>
<li>The first schedule planned in the SCHEDULER object.</li>
</ol>
<p>To clarify the different appliances, lets have a look at the following examples: </p>
<h3>Construct a SCHEDULER object without a persistent schedule.</h3>
<ul>
<li><p><a href="##(SCHEDULER).New">SCHEDULER.New</a>( nil ): Setup a new SCHEDULER object, which is persistently executed after garbage collection.</p>
<p>SchedulerObject = SCHEDULER:New()
SchedulerID = SchedulerObject:Schedule( nil, ScheduleFunction, {} )</p></li>
</ul>
<p>The above example creates a new SchedulerObject, but does not schedule anything.
A separate schedule is created by using the SchedulerObject using the method :Schedule..., which returns a ScheduleID</p>
<h3>Construct a SCHEDULER object without a volatile schedule, but volatile to the Object existence...</h3>
<ul>
<li><p><a href="##(SCHEDULER).New">SCHEDULER.New</a>( Object ): Setup a new SCHEDULER object, which is linked to the Object. When the Object is nillified or destroyed, the SCHEDULER object will also be destroyed and stopped after garbage collection.</p>
<p>ZoneObject = ZONE:New( "ZoneName" )
SchedulerObject = SCHEDULER:New( ZoneObject )
SchedulerID = SchedulerObject:Schedule( ZoneObject, ScheduleFunction, {} )
...
ZoneObject = nil
garbagecollect()</p></li>
</ul>
<p>The above example creates a new SchedulerObject, but does not schedule anything, and is bound to the existence of ZoneObject, which is a ZONE.
A separate schedule is created by using the SchedulerObject using the method :Schedule()..., which returns a ScheduleID
Later in the logic, the ZoneObject is put to nil, and garbage is collected.
As a result, the ScheduleObject will cancel any planned schedule.</p>
<h3>Construct a SCHEDULER object with a persistent schedule.</h3>
<ul>
<li><p><a href="##(SCHEDULER).New">SCHEDULER.New</a>( nil, Function, FunctionArguments, Start, ... ): Setup a new persistent SCHEDULER object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.</p>
<p>SchedulerObject, SchedulerID = SCHEDULER:New( nil, ScheduleFunction, {} )</p></li>
</ul>
<p>The above example creates a new SchedulerObject, and does schedule the first schedule as part of the call.
Note that 2 variables are returned here: SchedulerObject, ScheduleID...</p>
<h3>Construct a SCHEDULER object without a schedule, but volatile to the Object existence...</h3>
<ul>
<li><p><a href="##(SCHEDULER).New">SCHEDULER.New</a>( Object, Function, FunctionArguments, Start, ... ): Setup a new SCHEDULER object, linked to Object, and start a new schedule for the Function with the defined FunctionArguments according the Start and sequent parameters.</p>
<p>ZoneObject = ZONE:New( "ZoneName" )
SchedulerObject, SchedulerID = SCHEDULER:New( ZoneObject, ScheduleFunction, {} )
SchedulerID = SchedulerObject:Schedule( ZoneObject, ScheduleFunction, {} )
...
ZoneObject = nil
garbagecollect()</p></li>
</ul>
<p>The above example creates a new SchedulerObject, and schedules a method call (ScheduleFunction),
and is bound to the existence of ZoneObject, which is a ZONE object (ZoneObject).
Both a ScheduleObject and a SchedulerID variable are returned.
Later in the logic, the ZoneObject is put to nil, and garbage is collected.
As a result, the ScheduleObject will cancel the planned schedule.</p>
<h2>SCHEDULER timer stopping and (re-)starting.</h2>
<p>The SCHEDULER can be stopped and restarted with the following methods:</p>
<ul>
<li><p><a href="##(SCHEDULER).Start">SCHEDULER.Start</a>(): (Re-)Start the schedules within the SCHEDULER object. If a CallID is provided to :Start(), only the schedule referenced by CallID will be (re-)started.</p></li>
<li><p><a href="##(SCHEDULER).Stop">SCHEDULER.Stop</a>(): Stop the schedules within the SCHEDULER object. If a CallID is provided to :Stop(), then only the schedule referenced by CallID will be stopped.</p>
<p>ZoneObject = ZONE:New( "ZoneName" )
SchedulerObject, SchedulerID = SCHEDULER:New( ZoneObject, ScheduleFunction, {} )
SchedulerID = SchedulerObject:Schedule( ZoneObject, ScheduleFunction, {}, 10, 10 )
...
SchedulerObject:Stop( SchedulerID )
...
SchedulerObject:Start( SchedulerID )</p></li>
</ul>
<p>The above example creates a new SchedulerObject, and does schedule the first schedule as part of the call.
Note that 2 variables are returned here: SchedulerObject, ScheduleID... <br/>
Later in the logic, the repeating schedule with SchedulerID is stopped. <br/>
A bit later, the repeating schedule with SchedulerId is (re)-started. </p>
<h2>Create a new schedule</h2>
<p>With the method <a href="##(SCHEDULER).Schedule">SCHEDULER.Schedule</a>() a new time event can be scheduled.
This method is used by the :New() constructor when a new schedule is planned.</p>
<p>Consider the following code fragment of the SCHEDULER object creation.</p>
<pre><code>ZoneObject = ZONE:New( "ZoneName" )
SchedulerObject = SCHEDULER:New( ZoneObject )
</code></pre>
<p>Several parameters can be specified that influence the behaviour of a Schedule.</p>
<h3>A single schedule, immediately executed</h3>
<pre><code>SchedulerID = SchedulerObject:Schedule( ZoneObject, ScheduleFunction, {} )
</code></pre>
<p>The above example schedules a new ScheduleFunction call to be executed asynchronously, within milleseconds ...</p>
<h3>A single schedule, planned over time</h3>
<pre><code>SchedulerID = SchedulerObject:Schedule( ZoneObject, ScheduleFunction, {}, 10 )
</code></pre>
<p>The above example schedules a new ScheduleFunction call to be executed asynchronously, within 10 seconds ...</p>
<h3>A schedule with a repeating time interval, planned over time</h3>
<pre><code>SchedulerID = SchedulerObject:Schedule( ZoneObject, ScheduleFunction, {}, 10, 60 )
</code></pre>
<p>The above example schedules a new ScheduleFunction call to be executed asynchronously, within 10 seconds,
and repeating 60 every seconds ...</p>
<h3>A schedule with a repeating time interval, planned over time, with time interval randomization</h3>
<pre><code>SchedulerID = SchedulerObject:Schedule( ZoneObject, ScheduleFunction, {}, 10, 60, 0.5 )
</code></pre>
<p>The above example schedules a new ScheduleFunction call to be executed asynchronously, within 10 seconds,
and repeating 60 seconds, with a 50% time interval randomization ...
So the repeating time interval will be randomized using the <strong>0.5</strong>, <br/>
and will calculate between <strong>60 - ( 60 * 0.5 )</strong> and <strong>60 + ( 60 * 0.5 )</strong> for each repeat,
which is in this example between <strong>30</strong> and <strong>90</strong> seconds.</p>
<h3>A schedule with a repeating time interval, planned over time, with time interval randomization, and stop after a time interval</h3>
<pre><code>SchedulerID = SchedulerObject:Schedule( ZoneObject, ScheduleFunction, {}, 10, 60, 0.5, 300 )
</code></pre>
<p>The above example schedules a new ScheduleFunction call to be executed asynchronously, within 10 seconds,
The schedule will repeat every 60 seconds.
So the repeating time interval will be randomized using the <strong>0.5</strong>, <br/>
and will calculate between <strong>60 - ( 60 * 0.5 )</strong> and <strong>60 + ( 60 * 0.5 )</strong> for each repeat,
which is in this example between <strong>30</strong> and <strong>90</strong> seconds.
The schedule will stop after <strong>300</strong> seconds.</p>
</dd>
@@ -250,20 +394,6 @@
<dl class="function">
<dt>
<em>#string</em>
<a id="#(SCHEDULER).ClassName" >
<strong>SCHEDULER.ClassName</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">
<dt>
<a id="#(SCHEDULER).Clear" >
<strong>SCHEDULER:Clear()</strong>
</a>
@@ -461,20 +591,6 @@ The ScheduleID of the planned schedule.</p>
</dd>
</dl>
<dl class="function">
<dt>
<em></em>
<a id="#(SCHEDULER).Schedules" >
<strong>SCHEDULER.Schedules</strong>
</a>
</dt>
<dd>
</dd>
</dl>
<dl class="function">