- The
Componentclass is an abstract class to handle the electrical power and the update timing of components. - This class has two virtual functions:
MainRoutineandFastUpdate. Both are called periodically. Users can select the functions according to the required calling period.- The
MainRoutinefunction is the components' main function. Most of the processing is handled in this function. - The
FastUpdatefunction 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
ReactionWheelinS2E_COREis useful as a usage example of theFastUpdate.
- Users can set component update
prescalerand power port.
-
prescaler-
prescalerdetermines the execution cycle of theMainRoutinefunction. - The period of
MainRoutineequals toSimTime::compo_update_interval_sec$\times$ prescaler.
-
-
clock_gen-
clock_genis an instance that simulates the clock of a component. - Users do not need to care about this.
-
-
power_port-
power_portis an instance that simulates the power supply
-
-
fast_prescaler-
fast_prescalerdetermines the execution cycle of theFastUpdatefunction. - The period of
FastUpdateequals 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_counttime_countis incremented each time theTickfunction is called.- Users can use this timing information when they need for their components.
- N/A
- All the components have to override the
MainRoutinefunction.
- This function handles the processes that need to be computed in a high-speed cycle.
- N/A
- N/A
FastUpdatefunction is not a pure virtual function, so components without fast calculation do not need to override this function.- As explained in the
FastTicksection,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. ClockGeneratorclass calls this function.
countcountis incremented each time theTickfunction is called.
- Execute
MainRoutinewhen thecountis divisible by theprescaler. By this mechanism, the execution period ofMainRoutineis divided.
- N/A
- This function executes
FastUpdate. ClockGeneratorclass calls this function.
countcountis incremented each time theFastTickfunction is called.
- Execute
FastUpdatewhen thecountis divisible by thefast_prescaler. By this mechanism, the execution period ofFastUpdateis 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