6#include "../Global/fmodule.h"
7#include "../Scheduler/Scheduler.h"
8#include "../Branch/BranchRecord.h"
9#include <boost/serialization/export.hpp>
10#include "../Global/SimulationContext.h"
11#include <boost/archive/binary_oarchive.hpp>
12#include <boost/archive/binary_iarchive.hpp>
13BOOST_CLASS_EXPORT_IMPLEMENT(
SPDS)
39 for(i = 0; i < 10; i++){
42 for(i = 0; i < 10; i++){
49 elem->calculateSPDSUnitValue(_perceived_info_ptr);
63 auto pt = std::make_unique<SPDSUnit>();
64 pt->copySPDSUnit(*src);
70 for(i = 0; i < _spds.
time.size(); i++){
71 this->
time.push_back(_spds.
time.at(i));
80 string str, file_name;
82 ifstream fin(_str.c_str(), ios::in);
84 cout <<
"File: " << file_name <<
" cound not be found" << endl;
85 ofstream fout(
"err messages.txt", ios::app);
86 fout <<
r5pars_.timesno <<
" File: " << file_name <<
" cound not be found\n";
94 for (i = 0; i < num_spds_unit; i++){
95 auto pt = std::make_unique<SPDSUnit>();
96 pt->readInfoFromFile(fin);
107 double total_weight, total_weighted_sum;
108 double x1, x2, x21, x22, x3, x4;
110 total_weighted_sum = 0.0;
116 deque<double>::iterator spds_history_itr;
117 deque<double>::iterator time_itr;
123 total_weight += elem->getSPDSUnitWeight();
124 total_weighted_sum += elem->getSPDSUnitWeight() * elem->getSPDSUnitValue();
137 time_itr =
time.begin();
139 x1 += (*spds_history_itr) * (*time_itr);
140 x21 += (*spds_history_itr);
142 x3 += (*time_itr) * (*time_itr);
152 SPDS_rate = (x1 - x2)/(x3 - x4) * 60.0 * (100. /10.);
162 fout <<
"\t" << str+
"SPDS_Value"<<
"\t" << str +
"SPDS_Rate";
165 fout <<
'\t' << str1;;
170 fout <<
"\t Range:_0-10\t%_Full_Scale_per_minute";
184 elem->saveSPDSUnitToFile(fout);
191 fout << this->
time.size() <<
'\n';
192 for(
auto& val :
time){
207 for(i = 0; i < num_obj; i++){
208 auto pt = std::make_unique<SPDSUnit>();
209 pt->retrieveSPDSUnitFromFile(fin);
213 for(i = 0; i < num_obj; i++){
218 for(i = 0; i < num_obj; i++){
220 this->
time.push_back(t_value);
SimulationContext g_sim
Global simulation context: the single instance, defined in SimulationContext.cpp.
void setTempTypeOfConsequence(Consequence)
Stores the consequence of the end state the running sequence will get.
void setTempESMessage(std::string)
Stores the description of the end state the running sequence will get if it is terminated (set by mod...
void setSPDSValue(double)
void outputSPDSUnitToFile(std::ofstream &)
void retrieveSPDSFromFile(std::ifstream &)
void saveSPDSToFile(std::ofstream &)
double getTimeLapseForUpdate()
void initiationForSimulation(std::string)
void outputSPDSLabelToFile(std::string, std::ofstream &)
void updateAllSPDSValueAndRate(InfoChunk *)
void setTimeLapseForUpdate(double)
std::deque< double > time
std::deque< double > spds_history
void updateAllSPDSUnitValues(InfoChunk *)
void setLastUpdateTime(double)
void readInfoFromFile(std::string)
std::vector< std::unique_ptr< SPDSUnit > > spds_input_array
double getLastUpdateTime()
double time_lapse_for_update
BranchRecord Branch_center
Dynamic event tree state.