Commit 47181969 authored by Aleksandr Bakhshiev's avatar Aleksandr Bakhshiev
Browse files

New Configuration option 'UseIndTimeStepFlag' has been added.

--HG--
branch : TimeDebug
parent 61711415fce8
......@@ -1144,6 +1144,12 @@ bool UApplication::UpdateProject(RDK::TProjectConfig &project_config)
{
GetEnvironmentLock()->SetMaxCalcTime(project_config.ChannelsConfig[i].MaxCalculationModelTime);
}
if(old_project_config.ChannelsConfig[i].UseIndTimeStepFlag != project_config.ChannelsConfig[i].UseIndTimeStepFlag)
{
GetEnvironmentLock()->SetUseIndTimeStepFlag(project_config.ChannelsConfig[i].UseIndTimeStepFlag);
}
}
return SaveProject();
......@@ -1263,7 +1269,8 @@ try{
if(Model_Check())
{
// Model_SetGlobalTimeStep("",channel_config.GlobalTimeStep);
if(!channel_config.UseIndTimeStepFlag)
Model_SetGlobalTimeStep("",channel_config.GlobalTimeStep);
if(channel_config.InitAfterLoad)
MEnv_ModelInit(i,0);
if(channel_config.ResetAfterLoad)
......@@ -1272,6 +1279,7 @@ try{
EngineControl->SetCalculateMode(i, channel_config.CalculationMode);
GetEnvironmentLock()->SetMaxCalcTime(channel_config.MaxCalculationModelTime);
GetEnvironmentLock()->SetUseIndTimeStepFlag(channel_config.UseIndTimeStepFlag);
}
catch(RDK::UException &exception)
{
......@@ -1391,6 +1399,8 @@ try
if(!is_saved)
MLog_LogMessage(RDK_SYS_MESSAGE, RDK_EX_ERROR, (std::string("Core-SaveProject: Can't save parameters file: ")+channel_config.ParametersFileName).c_str());
channel_config.UseIndTimeStepFlag=GetEnvironmentLock()->GetUseIndTimeStepFlag();
if(config.ProjectAutoSaveStatesFlag)
{
if(extract_file_path(channel_config.StatesFileName).empty())
......
......@@ -38,6 +38,8 @@ TProjectChannelConfig::TProjectChannelConfig(void)
DebuggerMessageFlag=false;
MaxCalculationModelTime=0;
UseIndTimeStepFlag=false;
}
TProjectChannelConfig::TProjectChannelConfig(const TProjectChannelConfig& copy)
......@@ -64,7 +66,8 @@ bool TProjectChannelConfig::operator != (const TProjectChannelConfig& copy) cons
(ChannelName != copy.ChannelName) ||
(DebugSysEventsMask != copy.DebugSysEventsMask) ||
(DebuggerMessageFlag != copy.DebuggerMessageFlag) ||
(MaxCalculationModelTime != copy.MaxCalculationModelTime);
(MaxCalculationModelTime != copy.MaxCalculationModelTime ||
(UseIndTimeStepFlag != copy.UseIndTimeStepFlag));
}
bool TProjectChannelConfig::operator == (const TProjectChannelConfig& copy) const
......@@ -101,6 +104,8 @@ TProjectChannelConfig& TProjectChannelConfig::operator = (const TProjectChannelC
ChannelName=copy.ChannelName;
MaxCalculationModelTime=copy.MaxCalculationModelTime;
UseIndTimeStepFlag=copy.UseIndTimeStepFlag;
return *this;
}
......@@ -519,6 +524,8 @@ bool UProject::ReadFromXmlOld(USerStorageXML &xml)
Config.ChannelsConfig[0].DebugSysEventsMask=xml.ReadUnsigned("DebugSysEventsMask",Config.ChannelsConfig[0].DebugSysEventsMask);
Config.ChannelsConfig[0].DebuggerMessageFlag=xml.ReadBool("DebuggerMessageFlag",false);
Config.ChannelsConfig[0].MaxCalculationModelTime=xml.ReadFloat("MaxCalculationModelTime", 0.0);
Config.ChannelsConfig[0].UseIndTimeStepFlag=xml.ReadBool("UseIndTimeStepFlag", false);
for(int i=1;i<num_engines;i++)
......@@ -542,6 +549,7 @@ bool UProject::ReadFromXmlOld(USerStorageXML &xml)
Config.ChannelsConfig[i].DebugSysEventsMask=xml.ReadUnsigned(std::string("DebugSysEventsMask_")+RDK::sntoa(i),Config.ChannelsConfig[i].DebugSysEventsMask);
Config.ChannelsConfig[i].DebuggerMessageFlag=xml.ReadBool(std::string("DebuggerMessageFlag_")+RDK::sntoa(i),false);
Config.ChannelsConfig[i].MaxCalculationModelTime=xml.ReadFloat(std::string("MaxCalculationModelTime_")+RDK::sntoa(i), 0.0);
Config.ChannelsConfig[i].UseIndTimeStepFlag=xml.ReadBool(std::string("UseIndTimeStepFlag")+RDK::sntoa(i), false);
}
// TODO:
......@@ -631,6 +639,7 @@ bool UProject::ReadFromXmlNew(USerStorageXML &xml)
Config.ChannelsConfig[0].DebugSysEventsMask=Config.ChannelsConfig[0].DebugSysEventsMask;
Config.ChannelsConfig[0].DebuggerMessageFlag=false;
Config.ChannelsConfig[0].MaxCalculationModelTime=0.0;
Config.ChannelsConfig[0].UseIndTimeStepFlag=false;
}
else
for(int i=0;i<num_engines;i++)
......@@ -655,6 +664,7 @@ bool UProject::ReadFromXmlNew(USerStorageXML &xml)
Config.ChannelsConfig[i].DebugSysEventsMask=xml.ReadUnsigned("DebugSysEventsMask",Config.ChannelsConfig[i].DebugSysEventsMask);
Config.ChannelsConfig[i].DebuggerMessageFlag=xml.ReadBool("DebuggerMessageFlag",false);
Config.ChannelsConfig[i].MaxCalculationModelTime=xml.ReadFloat("MaxCalculationModelTime", 0.0);
Config.ChannelsConfig[i].UseIndTimeStepFlag=xml.ReadBool("UseIndTimeStepFlag", false);
xml.SelectUp();
}
return true;
......@@ -774,6 +784,7 @@ bool UProject::WriteToXmlOld(USerStorageXML &xml)
xml.WriteUnsigned("DebugSysEventsMask",channel_config.DebugSysEventsMask);
xml.WriteBool("DebuggerMessageFlag",channel_config.DebuggerMessageFlag);
xml.WriteFloat("MaxCalculationModelTime",channel_config.MaxCalculationModelTime);
xml.WriteBool("UseIndTimeStepFlag",channel_config.UseIndTimeStepFlag);
}
else
{
......@@ -795,6 +806,7 @@ bool UProject::WriteToXmlOld(USerStorageXML &xml)
xml.WriteUnsigned(std::string("DebugSysEventsMask_")+suffix,channel_config.DebugSysEventsMask);
xml.WriteBool(std::string("DebuggerMessageFlag_")+suffix,channel_config.DebuggerMessageFlag);
xml.WriteFloat("MaxCalculationModelTime_"+suffix,channel_config.MaxCalculationModelTime);
xml.WriteBool(std::string("UseIndTimeStepFlag_")+suffix,channel_config.UseIndTimeStepFlag);
}
}
......@@ -935,6 +947,7 @@ bool UProject::WriteToXmlNew(USerStorageXML &xml)
xml.WriteUnsigned("DebugSysEventsMask",channel_config.DebugSysEventsMask);
xml.WriteBool("DebuggerMessageFlag",channel_config.DebuggerMessageFlag);
xml.WriteFloat("MaxCalculationModelTime",channel_config.MaxCalculationModelTime);
xml.WriteBool("UseIndTimeStepFlag",channel_config.UseIndTimeStepFlag);
xml.SelectUp();
}
......
......@@ -66,6 +66,10 @@ std::string ChannelName;
///
double MaxCalculationModelTime;
/// TimeStep
///
bool UseIndTimeStepFlag;
TProjectChannelConfig(void);
TProjectChannelConfig(const TProjectChannelConfig& copy);
......
......@@ -64,7 +64,7 @@ UContainer::UContainer(void)
{
AddLookupProperty("Id",ptParameter | pgSystem,new UVProperty<UId,UContainer>(this,&UContainer::SetId,&UContainer::GetId));
AddLookupProperty("Name",ptParameter | pgSystem,new UVProperty<NameT,UContainer>(this,&UContainer::SetName,&UContainer::GetName));
AddLookupProperty("TimeStep",ptPubParameter | pgSystem,new UVProperty<UTime,UContainer>(this,&UContainer::SetTimeStep,&UContainer::GetTimeStep));
AddLookupProperty("TimeStep",ptParameter | pgSystem,new UVProperty<UTime,UContainer>(this,&UContainer::SetTimeStep,&UContainer::GetTimeStep));
AddLookupProperty("Activity",ptParameter | pgPublic,new UVProperty<bool,UContainer>(this,&UContainer::SetActivity,&UContainer::GetActivity));
AddLookupProperty("Coord",ptParameter | pgPublic | pgSystem,new UVProperty<RDK::MVector<double,3>,UContainer>(this,&UContainer::SetCoord,&UContainer::GetCoord));
AddLookupProperty("MaxCalculationDuration",ptParameter | pgPublic,new UVProperty<long long,UContainer>(this,&UContainer::SetMaxCalculationDuration,&UContainer::GetMaxCalculationDuration));
......@@ -839,6 +839,21 @@ bool UContainer::SetTimeStep(const UTime &timestep)
return true;
}
/// TimeStep
/// UEnvironment
void UContainer::ChangeUseIndTimeStepMode(bool value)
{
if(value)
ChangeLookupPropertyType("TimeStep",ptPubParameter | pgSystem);
else
ChangeLookupPropertyType("TimeStep",ptParameter | pgSystem);
//
UEPtr<UContainer>* comps=PComponents;
for(int i=0;i<NumComponents;i++,comps++)
(*comps)->ChangeUseIndTimeStepMode(value);
}
//
bool UContainer::SetGlobalTimeStep(UTime timestep)
{
......@@ -1254,6 +1269,13 @@ UId UContainer::AddComponent(UEPtr<UContainer> comp, UEPtr<UIPointer> pointer)
comp->SetEnvironment(Environment);
const UEPtr<UIProperty> prop_ts=FindProperty("TimeStep");
unsigned int time_step_prop_type=prop_ts->GetType();
if(time_step_prop_type & ptPubParameter == ptPubParameter)
comp->ChangeUseIndTimeStepMode(true);
else
comp->ChangeUseIndTimeStepMode(false);
try{
AAddComponent(comp,pointer);
comp->SharesInit();
......@@ -1323,6 +1345,13 @@ void UContainer::AddStaticComponent(const NameT &classname, const NameT &name, U
comp->SetStaticFlag(true);
comp->SetName(name);
StaticComponents[comp]=classname;
const UEPtr<UIProperty> prop_ts=FindProperty("TimeStep");
unsigned int time_step_prop_type=prop_ts->GetType();
if(time_step_prop_type & ptPubParameter == ptPubParameter)
comp->ChangeUseIndTimeStepMode(true);
else
comp->ChangeUseIndTimeStepMode(false);
}
///
......
......@@ -350,6 +350,10 @@ bool SetTimeStep(const UTime &timestep);
//
bool SetGlobalTimeStep(UTime timestep);
/// TimeStep
/// UEnvironment
void ChangeUseIndTimeStepMode(bool value);
//
const bool& GetActivity(void) const;
virtual bool SetActivity(const bool &activity);
......
......@@ -55,6 +55,8 @@ UEnvironment::UEnvironment(void)
RTModelCalcTime=0.0;
MaxCalcTime=0.0;
CalcFinishedFlag=false;
UseIndTimeStepFlag=false;
}
UEnvironment::~UEnvironment(void)
......@@ -163,6 +165,23 @@ bool UEnvironment::SetMaxCalcTime(double value)
return true;
}
/// TimeStep
///
bool UEnvironment::GetUseIndTimeStepFlag(void) const
{
return UseIndTimeStepFlag;
}
bool UEnvironment::SetUseIndTimeStepFlag(bool value)
{
UseIndTimeStepFlag=value;
if(Model)
Model->ChangeUseIndTimeStepMode(value);
return true;
}
/*
///
......
......@@ -58,6 +58,10 @@ ULongTime MinInterstepsInterval;
/// 0 -
double MaxCalcTime;
/// TimeStep
///
bool UseIndTimeStepFlag;
protected: //
//
// true -
......@@ -159,6 +163,11 @@ bool SetMinInterstepsInterval(long long value);
double GetMaxCalcTime(void) const;
bool SetMaxCalcTime(double value);
/// TimeStep
///
bool GetUseIndTimeStepFlag(void) const;
bool SetUseIndTimeStepFlag(bool value);
///
//bool GetDebugMode(void) const;
//bool SetDebugMode(bool value);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment