Commit 7c4f1061 authored by Ben Hein's avatar Ben Hein 🐼

Merge branch 'toxicity_analysis' into 'develop'

Toxicity analysis

See merge request !31
parents c14b7620 79c71c06
Pipeline #13866 passed with stages
in 6 minutes and 10 seconds
...@@ -161,9 +161,8 @@ double ToxicityAnalysis::CalculateFEDHeat(Pedestrian* p, double T, double FED_He ...@@ -161,9 +161,8 @@ double ToxicityAnalysis::CalculateFEDHeat(Pedestrian* p, double T, double FED_He
void ToxicityAnalysis::HazardAnalysis(Pedestrian* p) void ToxicityAnalysis::HazardAnalysis(Pedestrian* p)
{ {
double FEC_Smoke, FED_In = 0.0, FED_Heat = 0.0, FIC_Im, FIC_In; double FEC_Smoke, FED_In = 0.0, FED_Heat = 0.0, FIC_Im, FIC_In;
// Smoke extinction in 1/m // Smoke extinction in 1/m
double E = GetFDSQuantity(p, "SOOT_EXTINCTION_COEFFICIENT"); double E = GetFDSQuantity(p, "EXTINCTION_COEFFICIENT"); //TODO: check this string.. SOOT??
// gas species in ppm // gas species in ppm
double CO2 = 0., CO = 0., HCN = 0., HCL = 0., O2 = 0.; double CO2 = 0., CO = 0., HCN = 0., HCL = 0., O2 = 0.;
...@@ -199,8 +198,8 @@ void ToxicityAnalysis::HazardAnalysis(Pedestrian* p) ...@@ -199,8 +198,8 @@ void ToxicityAnalysis::HazardAnalysis(Pedestrian* p)
void ToxicityAnalysis::InitializeWriteOut() void ToxicityAnalysis::InitializeWriteOut()
{ {
string fileNameWithoutExtension = _projectFileName.substr(0, _projectFileName.find_last_of(".")); string fileNameWithoutExtension = _projectFileName.substr(0, _projectFileName.find_last_of("_"));
std::string ToxAnalysisXML = "fire_" + fileNameWithoutExtension + ".xml"; std::string ToxAnalysisXML = "toxicity_output_" + fileNameWithoutExtension + ".xml";
_outputhandler = std::make_shared<ToxicityOutputHandler>(ToxAnalysisXML.c_str()); _outputhandler = std::make_shared<ToxicityOutputHandler>(ToxAnalysisXML.c_str());
_outputhandler->WriteToFileHeader(); _outputhandler->WriteToFileHeader();
} }
......
...@@ -525,6 +525,14 @@ double Simulation::RunBody(double maxSimTime) ...@@ -525,6 +525,14 @@ double Simulation::RunBody(double maxSimTime)
// clock_t goal = timeToWait*1000 + clock(); // clock_t goal = timeToWait*1000 + clock();
// while (goal > clock()); // while (goal > clock());
++frameNr; ++frameNr;
//Trigger JPSfire Toxicity Analysis
//only executed every 3 seconds
if( fmod(Pedestrian::GetGlobalTime(), 3) == 0 ) {
for (auto&& ped: _building->GetAllPedestrians()) {
ped->ConductToxicityAnalysis();
}
}
} }
return t; return t;
} }
......
...@@ -109,7 +109,12 @@ Pedestrian::Pedestrian() ...@@ -109,7 +109,12 @@ Pedestrian::Pedestrian()
_agentsCreated++;//increase the number of object created _agentsCreated++;//increase the number of object created
_FED_In = 0.0; _FED_In = 0.0;
_FED_Heat = 0.0; _FED_Heat = 0.0;
_WalkingSpeed = nullptr;
_ToxicityAnalysis = nullptr;
} }
//const shared_ptr<ToxicityAnalysis> &Pedestrian::getToxicityAnalysis() { return _ToxicityAnalysis; }
Pedestrian::Pedestrian(const StartDistribution& agentsParameters, Building& building) Pedestrian::Pedestrian(const StartDistribution& agentsParameters, Building& building)
: :
_group(agentsParameters.GetGroupId()), _group(agentsParameters.GetGroupId()),
...@@ -185,6 +190,8 @@ Pedestrian::Pedestrian(const StartDistribution& agentsParameters, Building& buil ...@@ -185,6 +190,8 @@ Pedestrian::Pedestrian(const StartDistribution& agentsParameters, Building& buil
_agentsCreated++;//increase the number of object created _agentsCreated++;//increase the number of object created
_FED_In = 0.0; _FED_In = 0.0;
_FED_Heat = 0.0; _FED_Heat = 0.0;
_ToxicityAnalysis = nullptr;
_WalkingSpeed = nullptr;
} }
...@@ -651,9 +658,9 @@ double Pedestrian::GetV0Norm() const ...@@ -651,9 +658,9 @@ double Pedestrian::GetV0Norm() const
void Pedestrian::ConductToxicityAnalysis() void Pedestrian::ConductToxicityAnalysis()
{ {
if( _ToxicityAnalysis->ConductToxicityAnalysis() ) { if(_ToxicityAnalysis->ConductToxicityAnalysis()){
_ToxicityAnalysis->HazardAnalysis(this); _ToxicityAnalysis->HazardAnalysis(this);
} }
} }
// get axis in the walking direction // get axis in the walking direction
......
...@@ -494,6 +494,8 @@ public: ...@@ -494,6 +494,8 @@ public:
double GetSwayAmpA() const; double GetSwayAmpA() const;
double GetSwayAmpB() const; double GetSwayAmpB() const;
const std::shared_ptr<ToxicityAnalysis> &getToxicityAnalysis();
}; };
#endif /* _PEDESTRIAN_H */ #endif /* _PEDESTRIAN_H */
...@@ -198,6 +198,7 @@ Pedestrian* StartDistribution::GenerateAgent(Building* building, int* pid, vecto ...@@ -198,6 +198,7 @@ Pedestrian* StartDistribution::GenerateAgent(Building* building, int* pid, vecto
Pedestrian* ped = new Pedestrian(); Pedestrian* ped = new Pedestrian();
// PedIndex // PedIndex
ped->SetWalkingSpeed(building->GetConfig()->GetWalkingSpeed()); ped->SetWalkingSpeed(building->GetConfig()->GetWalkingSpeed());
ped->SetTox(building->GetConfig()->GetToxicityAnalysis());
ped->SetID(*pid); ped->SetID(*pid);
ped->SetAge(GetAge()); ped->SetAge(GetAge());
ped->SetGender(GetGender()); ped->SetGender(GetGender());
...@@ -426,3 +427,4 @@ const std::string& StartDistribution::GetUnitTraj() const ...@@ -426,3 +427,4 @@ const std::string& StartDistribution::GetUnitTraj() const
{ {
return _unit_traj; return _unit_traj;
} }
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