Commit 389ed547 authored by Aaron Bray's avatar Aaron Bray
Browse files

Log advance time actions in scenarios

Format cleanup
parent b6f22a99
......@@ -93,6 +93,8 @@
},
"AnyAction":
[
{ "AdvanceTime": { "Time": { "ScalarTime": { "Value": 2.0, "Unit": "min" }}}}
{ "AdvanceTime": {
"Action": { "Comment": "Advance some time" },
"Time": { "ScalarTime": { "Value": 2.0, "Unit": "min" }}}}
]
}
\ No newline at end of file
......@@ -30,7 +30,7 @@ void SEAdvanceTime::ToString(std::ostream &str) const
{
if(HasComment())
str<<"\n\tComment : "<<m_Comment;
str << "Advance Time : " << m_Time;
str << "\n\tAdvance Time : " << m_Time;
}
bool SEAdvanceTime::HasTime() const
......
......@@ -121,6 +121,7 @@ void PBAction::Load(const CDM_BIND::AdvanceTimeData& src, SEAdvanceTime& dst)
}
void PBAction::Serialize(const CDM_BIND::AdvanceTimeData& src, SEAdvanceTime& dst)
{
PBAction::Serialize(src.action(), dst);
if (src.has_time())
PBProperty::Load(src.time(), dst.GetTime());
}
......@@ -132,6 +133,7 @@ CDM_BIND::AdvanceTimeData* PBAction::Unload(const SEAdvanceTime& src)
}
void PBAction::Serialize(const SEAdvanceTime& src, CDM_BIND::AdvanceTimeData& dst)
{
PBAction::Serialize(src, *dst.mutable_action());
if (src.HasTime())
dst.set_allocated_time(PBProperty::Unload(*src.m_Time));
}
......@@ -143,6 +145,7 @@ void PBAction::Load(const CDM_BIND::SerializeStateData& src, SESerializeState& d
}
void PBAction::Serialize(const CDM_BIND::SerializeStateData& src, SESerializeState& dst)
{
PBAction::Serialize(src.action(), dst);
dst.SetType((eSerialization_Type)src.type());
dst.SetFilename(src.filename());
}
......@@ -154,6 +157,7 @@ CDM_BIND::SerializeStateData* PBAction::Unload(const SESerializeState& src)
}
void PBAction::Serialize(const SESerializeState& src, CDM_BIND::SerializeStateData& dst)
{
PBAction::Serialize(src, *dst.mutable_action());
dst.set_type((CDM_BIND::SerializeStateData::eType)src.m_Type);
if (src.HasFilename())
dst.set_filename(src.m_Filename);
......@@ -166,6 +170,7 @@ void PBAction::Load(const CDM_BIND::OverridesData& src, SEOverrides& dst)
}
void PBAction::Serialize(const CDM_BIND::OverridesData& src, SEOverrides& dst)
{
PBAction::Serialize(src.action(), dst);
for (size_t i=0; i<src.scalaroverride_size(); i++)
{
const CDM_BIND::ScalarPropertyData& sp = src.scalaroverride()[i];
......@@ -180,6 +185,7 @@ CDM_BIND::OverridesData* PBAction::Unload(const SEOverrides& src)
}
void PBAction::Serialize(const SEOverrides& src, CDM_BIND::OverridesData& dst)
{
PBAction::Serialize(src, *dst.mutable_action());
for (auto& sp : src.GetScalarProperties())
{
CDM_BIND::ScalarPropertyData* so = dst.add_scalaroverride();
......
......@@ -133,7 +133,7 @@ bool SEScenarioExec::ProcessActions(const SEScenario& scenario)
Info("Executing Scenario");
double dT_s=m_Engine.GetTimeStep(TimeUnit::s);
double scenarioTime_s;
double scenarioTime_s = 0;
double statusTime_s = 0;// Current time of this status cycle
double statusStep_s = 60;//How long did it take to simulate this much time
......@@ -160,6 +160,9 @@ bool SEScenarioExec::ProcessActions(const SEScenario& scenario)
adv=dynamic_cast<const SEAdvanceTime*>(a);
if(adv!=nullptr)
{
m_ss << "[Action] " << *a;
Info(m_ss);
double time_s = adv->GetTime(TimeUnit::s);
int count = (int)(time_s/dT_s);
for(int i=0;i<=count;i++)
......
......@@ -233,7 +233,7 @@ public class CSVContents
list=results.get(header);
if(list==null)
{
list=new ArrayList<Double>();
list=new ArrayList<Double>();
results.put(header, list);
}
d=this.rowDoubles.get(h++);
......@@ -250,7 +250,7 @@ public class CSVContents
{
if(buff.readLine()==null)
{
eof=true;
eof=true;
break;
}
}
......
......@@ -242,7 +242,7 @@ public class CSVPlotTool
{
ValueAxis yAxis = plot.getRangeAxis();
yAxis.setRange(resMin0 + 0.05*resMin0, resMax0 + 0.15*Math.abs(resMax0));//5% buffer so we can see top and bottom clearly
}
}
}
}
......
Supports Markdown
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