Indoor Propagation in Point Mode
Detailed Description
This is an example of how to use the WinProp API for indoor propagation in point mode. The full example is distributed with the installation.#include <stdio.h> #include <string> #include <iostream> #include "indoor_propagation_points.h" #ifndef API_DATA_FOLDER #define API_DATA_FOLDER "../../api/winprop/data/" #endif // !API_DATA_FOLDER int main(int argc, char** argv) { const int NrPoints = 3; int Error = 0, ProjectHandle = 0; WinProp_Scenario WinPropScenario; WinProp_Callback WinPropCallback; WinProp_Receiver WinPropReceiver[NrPoints]; WinProp_Antenna WinPropAntenna; WinProp_Pattern WinPropPattern; WinProp_Additional WinPropMore; WinProp_Propagation_Results OutputResults; /* ------------------ Initialization of structures --------------------------- */ WinProp_Structure_Init_Scenario(&WinPropScenario); WinProp_Structure_Init_Callback(&WinPropCallback); WinProp_Structure_Init_Antenna(&WinPropAntenna); WinProp_Structure_Init_Pattern(&WinPropPattern); WinProp_Structure_Init_Additional(&WinPropMore); WinProp_Structure_Init_Propagation_Results(&OutputResults); for (int loop = 0; loop < NrPoints; loop++) { WinProp_Structure_Init_Receiver(&WinPropReceiver[loop]); } /* ---------- Load indoor vector database and initialise scenario ------------ */ /* Assign database name. */ WinPropScenario.Scenario = WINPROP_SCENARIO_INDOOR; sprintf(WinPropScenario.VectorDatabase, "%s", API_DATA_FOLDER "../data/indoor/IndoorVectordatabase.idb"); /* Define callback functions. */ WinPropCallback.Percentage = CallbackProgress; WinPropCallback.Message = CallbackMessage; WinPropCallback.Error = CallbackError; /* Call the WinProp API to open a project and load the vector database. */ Error = WinProp_Open(&ProjectHandle, &WinPropScenario, &WinPropCallback); /* ----------------------- Set up prediction --------------------------------- */ if (Error == 0) { /* Definition of prediction points. */ WinPropReceiver[0].Location.x = 45.0; WinPropReceiver[0].Location.y = 12.0; WinPropReceiver[0].Location.z = 0.5; WinPropReceiver[1].Location.x = 70.0; WinPropReceiver[1].Location.y = -2.0; WinPropReceiver[1].Location.z = 1.5; WinPropReceiver[2].Location.x = 60.0; WinPropReceiver[2].Location.y = 2.0; WinPropReceiver[2].Location.z = 2.5; /* Definition of antenna pattern. */ WinPropPattern.Mode = PATTERN_MODE_FILE; // Load pattern from file sprintf(WinPropPattern.Filename, "%s", API_DATA_FOLDER "antennas/Antenna.apb"); // Pattern file (including extension) /* Defintion of antenna properties. */ WinPropAntenna.Enabled = 1; WinPropAntenna.Id = 1; WinPropAntenna.SiteId = 1; WinPropAntenna.Longitude_X = 60.25; WinPropAntenna.Latitude_Y = 6.25; WinPropAntenna.Height = 2.0; // Antenna height 2.0 meter WinPropAntenna.Model = WINPROP_MODEL_SRT; // Use the DPM WinPropAntenna.DataType = PROP_RESULT_POWER; // Compute received power WinPropAntenna.Power = 10.0; // Power in dBm WinPropAntenna.Frequency = 1800.0; // Frequency 1800 MHz WinPropAntenna.Pattern = &WinPropPattern; // Use pattern defined above WinPropAntenna.Azimuth = 270.0; // Antenna points in western direction WinPropAntenna.Downtilt = 1.0; // Downtilt of 1 degree sprintf(WinPropAntenna.Name, "%s", "my_antenna_name"); // name of the antenna /* Definition of outputs to be computed and written in WinProp format. */ WinPropMore.OutputResults = &OutputResults; sprintf(OutputResults.ResultPath, "%s", API_DATA_FOLDER "output/IndoorPoints_Output"); // Output data directory OutputResults.FieldStrength = 1; OutputResults.PathLoss = 1; OutputResults.Delay = 1; OutputResults.DelaySpread = 1; OutputResults.AngularSpreadMS = 1; OutputResults.AngularSpreadBS = 1; OutputResults.AngularMeans = 1; OutputResults.StatusLOS = 1; OutputResults.RayFilePropPaths = 1; OutputResults.StrFilePropPaths = 1; // OutputResults.StrFileTransMatrix = 1; // only possible for WINPROP_INTERACTION_MODEL_GTDUTD // WinPropMore.InteractionModel = WINPROP_INTERACTION_MODEL_GTDUTD; /* Further parameters: With filtering. */ WinPropMore.ResultFiltering = 1; /* ----------------------- Start prediction ------------------------------ */ WinProp_ResultPointsList* PowerResult = nullptr; Error = WinProp_Predict_Points( ProjectHandle, &WinPropAntenna, WinPropReceiver, NrPoints, nullptr, &WinPropMore, &PowerResult, nullptr, nullptr); /* Free memory */ WinProp_Structure_Free_ResultPointsList(PowerResult); } WinProp_Close(ProjectHandle); return 0; } int _STD_CALL CallbackMessage(const char * Text) { if (Text == nullptr) return 0; std::cout << "\n" << Text; return(0); } int _STD_CALL CallbackError(const char * Text, int Error) { if (Text == nullptr) return 0; std::cout << "\n"; #ifdef __LINUX std::cout << "\033[31m" << "Error (" << Error << "): "; // highlight error in red color #else HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); SetConsoleTextAttribute(hConsole, FOREGROUND_RED); std::cout << "Error (" << Error << "): "; #endif // __LINUX std::cout << Text; #ifdef __LINUX std::cout << "\033[0m"; // highlight error in red color #else SetConsoleTextAttribute(hConsole, FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_GREEN); #endif // __LINUX return 0; } int _STD_CALL CallbackProgress(int value, const char* text) { char Line[200]; sprintf(Line, "\n%d%% %s", value, text); std::cout << Line; return(0); }