function pm = propagationModel(pmName, varargin)
% propagationModel   Create RF propagation model
%   PM = propagationModel(NAME) creates a propagation model object for the
%   named propagation model. A propagation model can be used to predict
%   path loss of a radio wave at a receiver site from a transmitter site.
%
%   PM = propagationModel(NAME,Name,Value) creates a propagation model
%   object with properties specified by one or more Name-Value pairs. The
%   valid Name-Value pairs correspond to properties of the named
%   propagation model.
%
%   The following table describes various types of propagation models.
%   
%   Type        | Description
%   -----------------------------------------------------------------------
%   Atmospheric | Atmospheric propagation models predict path loss between
%               | sites as a function of distance. These models assume
%               | line-of-sight (LOS) conditions and disregard the 
%               | curvature of the Earth, terrain, and other obstacles.
%   -----------------------------------------------------------------------
%   Empirical   | Like atmospheric propagation models, empirical models
%               | predict path loss as a function of distance. Unlike 
%               | atmospheric models, empirical models are derived from
%               | measurements, and the close-in empirical model supports
%               | non-line-of-sight (NLOS) conditions.
%   -----------------------------------------------------------------------
%   Terrain     | Terrain propagation models assume that propagation occurs
%               | between two points over a slice of terrain. Use these 
%               | models to calculate the point-to-point path loss between
%               | sites over irregular terrain, including buildings.
%   -----------------------------------------------------------------------
%   Ray Tracing | Ray tracing models compute propagation paths using 3-D
%               | environment geometry and predict path losses using
%               | environment materials with polarization being taken into
%               | account. While the other supported models compute single
%               | propagation paths, ray tracing models compute multiple
%               | propagation paths.
%   -----------------------------------------------------------------------
%
%   Atmospheric propagation models:
%
%      <a href="matlab:help('rfprop.FreeSpace')">freespace</a> - Free space propagation model
%      <a href="matlab:help('rfprop.Rain')">rain</a>      - Propagation model for rain
%      <a href="matlab:help('rfprop.Gas')">gas</a>       - Propagation model for gas
%      <a href="matlab:help('rfprop.Fog')">fog</a>       - Propagation model for fog
%
%   Empirical propagation models:
%
%      <a href="matlab:help('rfprop.CloseIn')">close-in</a>	- Close-In propagation model
%
%   Terrain propagation models: 
%
%      <a href="matlab:help('rfprop.LongleyRice')">longley-rice</a> - Longley-Rice propagation model
%      <a href="matlab:help('rfprop.TIREM')">tirem</a>        - Terrain Integrated Rough Earth Model (TIREM)
%
%   Ray tracing propagation models: 
%
%      <a href="matlab:help('rfprop.RayTracing')">raytracing</a> - Ray tracing propagation model
%
%   Notes
%   -----
%   - Antenna Toolbox is required to use the TIREM propagation model.
%
%   Example: Calculate signal strength at receiver in heavy rain conditions
%
%   % Specify transmitter and receiver sites
%   tx = txsite('Name','MathWorks Apple Hill',...
%      'Latitude',42.3001, ...
%      'Longitude',-71.3504, ...
%      'TransmitterFrequency', 2.5e9);
%
%   rx = rxsite('Name','Fenway Park',...
%      'Latitude',42.3467, ...
%      'Longitude',-71.0972);
%
%   % Create propagation model for heavy rainfall rate
%   pm = propagationModel('rain','RainRate',50);
%
%   % Calculate signal strength at receiver using rain propagation model
%   ss = sigstrength(rx,tx,pm);
%
%   See also txsite, rxsite, <a href="matlab:help rxsite.sigstrength">sigstrength</a>, <a href="matlab:help rxsite.link">link</a>, <a href="matlab:help txsite.coverage">coverage</a>, <a href="matlab:help txsite.raytrace">raytrace</a>

%   Copyright 2017-2023 The MathWorks, Inc.  

pmName = rfprop.PropagationModel.validateName(pmName, 'propagationModel');

switch (pmName)
    case 'freespace'
        pm = rfprop.FreeSpace(varargin{:});
    case 'rain'
        pm = rfprop.Rain(varargin{:});
    case 'fog'
        pm = rfprop.Fog(varargin{:});
    case 'gas'
        pm = rfprop.Gas(varargin{:});
    case 'close-in'
        pm = rfprop.CloseIn(varargin{:});
    case 'longley-rice'
        pm = rfprop.LongleyRice(varargin{:});
    case 'tirem'
        pm = rfprop.TIREM(varargin{:});
    case 'raytracing'
        pm = rfprop.RayTracing(varargin{:});
end
