- The
Component
class is an abstract class to handle the electrical power and the update timing of components. - This class has two virtual functions:
MainRoutine
andFastUpdate
. Both are called periodically. Users can select the functions according to the required calling period.- The
MainRoutine
function is the components' main function. Most of the processing is handled in this function. - The
FastUpdate
function handles the processes that need to be computed in a high-speed cycle. So, users will use this function only when high-frequency disturbances need to be calculated (e.g., RW jitter).
- The
- Main file:
component.hpp
,component.cpp
- Inherit this class by the user's component class.
- The
ReactionWheel
inS2E_CORE
is useful as a usage example of theFastUpdate
.
- Users can set component update
prescaler
and power port.
-
prescaler
-
prescaler
determines the execution cycle of theMainRoutine
function. - The period of
MainRoutine
equals toSimTime::compo_update_interval_sec
$\times$ prescaler
.
-
-
clock_gen
-
clock_gen
is an instance that simulates the clock of a component. - Users do not need to care about this.
-
-
power_port
-
power_port
is an instance that simulates the power supply
-
-
fast_prescaler
-
fast_prescaler
determines the execution cycle of theFastUpdate
function. - The period of
FastUpdate
equals toSimTime::compo_update_interval_sec
$\times$ fast_prescaler
. - If you don't need to use
FastUpdate
, you don't need to specify this (it is set to 1 by default).
-
- N/A
- N/A
- Components' main function
time_count
time_count
is incremented each time theTick
function is called.- Users can use this timing information when they need for their components.
- N/A
- All the components have to override the
MainRoutine
function.
- This function handles the processes that need to be computed in a high-speed cycle.
- N/A
- N/A
FastUpdate
function is not a pure virtual function, so components without fast calculation do not need to override this function.- As explained in the
FastTick
section,ITickable::needs_fast_update_
flag must be true to callFastUpdate
. So, if users want to useFastUpdate
, callITickable::SetNeedsFastUpdate(true)
in the constructor of each component.
- This function executes
MainRoutine
. ClockGenerator
class calls this function.
count
count
is incremented each time theTick
function is called.
- Execute
MainRoutine
when thecount
is divisible by theprescaler
. By this mechanism, the execution period ofMainRoutine
is divided.
- N/A
- This function executes
FastUpdate
. ClockGenerator
class calls this function.
count
count
is incremented each time theFastTick
function is called.
- Execute
FastUpdate
when thecount
is divisible by thefast_prescaler
. By this mechanism, the execution period ofFastUpdate
is divided.
ITickable::needs_fast_update_
flag must be true to callFastUpdate
. So, if you want to useFastUpdate
, callITickable::SetNeedsFastUpdate(true)
in the constructor of each component.
- N/A
- N/A