diff --git a/programs/general/propagatorv4.cpp b/programs/general/propagatorv4.cpp index 0c2a34ce..706cfa2c 100644 --- a/programs/general/propagatorv4.cpp +++ b/programs/general/propagatorv4.cpp @@ -5,7 +5,6 @@ #include "device/cpu/devicecpu.h" #include "device/disk/devicedisk.h" - int32_t parse_control(string args); int32_t request_get_sat_json(string &request, string &response, Agent *agent); int32_t request_get_node_json(string &request, string &response, Agent *agent); @@ -26,6 +25,8 @@ uint16_t postevent=0; double initialutc = 60107.01; double endutc = 0.; double deltautc = 0.; +double fov_override = 0.; +double ifov_override = 0.; string realmname = "propagate"; //string orbitfile = "/home/user/cosmos/source/projects/cosmos_sttr2020/cosmos/realms/sttr/orbit.dat"; //string satfile = "/home/user/cosmos/source/projects/cosmos_sttr2020/cosmos/realms/sttr/sats.dat"; @@ -219,8 +220,98 @@ size_t number_of_targets_observed( return indices_of_targets_observed(results, sat_nums, target_nums, start_timestep, stop_timestep).size(); } +double extract_results_min_resolution( + vector>& results, + vector& sat_nums, + vector& target_nums, + size_t start_timestep=0, + size_t stop_timestep=runcount-1 +) +{ + + cout<::max(); + // for each sat + for (size_t sat_num : sat_nums) { + // for each time step + for (size_t t=start_timestep; t<=stop_timestep; ++t) { + // for each target + for (size_t target_num : target_nums) { + // if target was observed + if(!results[t][sat_num].target[target_num].cover.empty()) { + // record minimum resolution + if(results[t][sat_num].target[target_num].cover[0].resolution>& results, + vector& sat_nums, + vector& target_nums, + size_t start_timestep = 0, + size_t stop_timestep = runcount - 1 +) { + cout << std::fixed << std::setprecision(7); + double average_percent = 0.0; // Start with 0 for running average + size_t count = 0; // Number of valid percent values + + // Iterate over satellites + for (size_t sat_num : sat_nums) { + // Iterate over timesteps + for (size_t t = start_timestep; t <= stop_timestep; ++t) { + // Iterate over targets + for (size_t target_num : target_nums) { + // If the target was observed + if (!results[t][sat_num].target[target_num].cover.empty()) { + // Update the running average + double percent = results[t][sat_num].target[target_num].cover[0].percent; + count++; + average_percent += (percent - average_percent) / count; + } + } + } + } + + // Return the computed average percent + return average_percent; +} + +double extract_results_total_area( + vector>& results, + vector& sat_nums, + vector& target_nums, + size_t start_timestep = 0, + size_t stop_timestep = runcount - 1 +) { + cout << std::fixed << std::setprecision(7); + double total_area = 0.0; // Initialize total area to zero + + // Iterate over satellites + for (size_t sat_num : sat_nums) { + // Iterate over timesteps + for (size_t t = start_timestep; t <= stop_timestep; ++t) { + // Iterate over targets + for (size_t target_num : target_nums) { + // If the target was observed + if (!results[t][sat_num].target[target_num].cover.empty()) { + // Accumulate the area + total_area += results[t][sat_num].target[target_num].cover[0].area; + } + } + } + } + + // Return the total area + return total_area; +} + // extract simulation results from results -// todo: fix this to be more generic... void extract_results( vector>& results, vector& sat_nums, @@ -231,8 +322,6 @@ void extract_results( ) { - - if(sat_nums.empty()) return; // check the ranges of the sat indices @@ -242,7 +331,7 @@ void extract_results( // try to open file out.open(filename); if(out.is_open()) { - + out< 1) { parse_control(argv[1]); + //debug + //cout<<"fov_override = "<ParseOrbitFile(orbitfile); if(iretn<0) { cout<<"unable to parse orbitfile = <"<"<"<cnodes.size() = "<cnodes.size()<cnodes.size() = "<cnodes.size()<detectors.size()<detectors) { + cout<<"detector name = "<"<targets.size() = "<targets.size()<targets.size() = "<targets.size()<cnodes.size(); ++i) { - cout<<"sim->cnodes["<currentinfo.target.size() = "<cnodes[i]->currentinfo.target.size()<cnodes["<currentinfo.target.size() = "<cnodes[i]->currentinfo.target.size()<cnodes[i]->currentinfo.target.size(); ++j) { //cout<<"sim->cnodes["<currentinfo.target["<cnodes[i]->currentinfo.target[j].loc.pos.geod.s.lat)<<", "<cnodes[i]->currentinfo.target[j].loc.pos.geod.s.lon)<<", "<cnodes[i]->currentinfo.target[j].loc.pos.geod.s.h<<")"<Target(results); sim->Metric(results); + //cout<<"number of detectors: "<detectors.size()< sat_nums; - sat_nums.push_back(0); + //sat_nums.push_back(0); sat_nums.push_back(1); sat_nums.push_back(2); sat_nums.push_back(3); @@ -508,15 +611,25 @@ int main(int argc, char *argv[]) target_nums.push_back(target_num); } +// RESULTS + // Extract the substring after the last slash + size_t last_slash_pos = satfile.find_last_of('/'); + std::string filename = (last_slash_pos == std::string::npos) ? satfile : satfile.substr(last_slash_pos + 1); + cout< single_target(1, target_num); + //cout<<"target #"< single_sat(1, s); - cout<<"sat #"<