-
Notifications
You must be signed in to change notification settings - Fork 25
SimionSrcParser
BorjaFG edited this page Mar 22, 2017
·
4 revisions
This C# app is executed each time the source code of a simion app is recompiled, parsing it and outputting the hierarchical structure and parameters of the app. It mainly focuses on class constructors that take a pointer to a CConfigNode node. This is a node in an XML file from which the values of the parameters are taken.
If our Simion app has the following classes/parameters:
RLSimionApp::RLSimionApp(CConfigNode* pConfigNode)
{
pLogger= CHILD_OBJECT<CLogger>(pConfigNode, "Log", "The logger class");
pWorld = CHILD_OBJECT<CWorld>(pConfigNode, "World", "The simulation environment and its parameters");
}
CLogger::CLogger(CConfigNode* pConfigNode)
{
m_bLogEvaluationEpisodes= BOOL_PARAM(pConfigNode,"Log-eval-episodes", "Log evaluation episodes?",true);
m_bLogTrainingEpisodes= BOOL_PARAM(pConfigNode,"Log-training-episodes", "Log training episodes?",false);
m_logFreq= DOUBLE_PARAM(pConfigNode,"Log-Freq","Log frequency. Simulation time in seconds.",0.25);
}
CWorld::CWorld(CConfigNode* pConfigNode)
{
m_numIntegrationSteps= INT_PARAM(pConfigNode,"Num-Integration-Steps","The number of ...",4);
m_dt= DOUBLE_PARAM(pConfigNode,"Delta-T","The delta-time between simulation steps", 0.01);
}
then, SimionSrcParser will parse these constructors and output them in a definition file:
<CLASS Name="RLSimionApp">
<BRANCH Name="Log" Class="CLogger" Comment="The logger class"/>
<BRANCH Name="World" Class="CWorld" Comment="The simulation environment and its parameters"/>
</CLASS>
<CLASS Name="CLogger">
<DOUBLE-VALUE Name="Log-Freq" Comment="Log frequency. Simulation time in seconds." Default="0.25"/>
<BOOL-VALUE Name="Log-eval-episodes" Comment="Log evaluation episodes?" Default="true"/>
<BOOL-VALUE Name="Log-training-episodes" Comment="Log training episodes?" Default="false"/>
</CLASS>
<CLASS Name="CWorld">
<INTEGER-VALUE Name="Num-Integration-Steps" Comment="The number of integration steps performed each simulation time-step" Default="4"/>
<DOUBLE-VALUE Name="Delta-T" Comment="The delta-time between simulation steps" Default="0.01"/>
</CLASS>