ns-3 PLC model
model/plc-cable.h
00001 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
00002 /*
00003  * Copyright (c) 2012 University of British Columbia, Vancouver
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License version 2 as
00007  * published by the Free Software Foundation;
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software
00016  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017  *
00018  * Author: Alexander Schloegl <alexander.schloegl@gmx.de>
00019  */
00020 
00021 #ifndef PLC_CABLE_H_
00022 #define PLC_CABLE_H_
00023 
00024 #include <cmath>
00025 #include <iostream>
00026 #include <complex>
00027 
00028 #include <ns3/object.h>
00029 #include <ns3/type-id.h>
00030 #include <ns3/spectrum-model.h>
00031 
00032 #include "plc-defs.h"
00033 #include "plc-value.h"
00034 
00035 // Cable model parameters
00036 #define EPS_0   8.854188e-12    // F/m
00037 #define MU_0    12.566371e-7    // H/m
00038 #define MU_R    1
00039 #define RHO             2.82e-8                 // for aluminium (multiple references; to fit Dostert's curves)
00040 #define TAND    0.01                    // depends on insulation
00041 #define MU              (MU_0 * MU_R)
00042 #define EPS_R   4
00043 #define EPS_P   (EPS_0 * EPS_R)
00044 
00045 #define NAYY150SE_D             1.8e-3          // insulation, m
00046 #define NAYY150SE_A             6e-4            // conductor area, 4*150e-6m^2
00047 #define NAYY150SE_THETA 3.6e-3          // 2*NAYY150SE_D
00048 #define NAYY150SE_R             13.82e-3        // radius, m, r = sqrt(A/pi)
00049 
00050 #define NAYY50SE_D              1.4e-3          // insulation, m
00051 #define NAYY50SE_A              2e-4            // conductor area, 4*50e-6m^2
00052 #define NAYY50SE_THETA  2.8e-3          // 2*NAYY50SE_D
00053 #define NAYY50SE_R              7.98e-3         // radius, m, r = sqrt(A/pi)
00054 
00055 #define AL3X95XLPE_EPS_R        0.9
00056 #define AL3X95XLPE_KAPPA        0.285714286
00057 #define AL3X95XLPE_R_A          10e-3
00058 #define AL3X95XLPE_R_I          9.52e-3
00059 #define AL3X95XLPE_TAND         0.004
00060 
00061 #define COPPER_CONDUCTIVITY     5.96e7 // (S/m) at 20 degree celcius
00062 #define NYCY70SM35_R_O 8.448e-3 // radius to outer conductor
00063 #define NYCY70SM35_R_I 7.048e-3 // inner conductor radius
00064 
00065 namespace ns3 {
00066 
00072 class PLC_Cable : public Object
00073 {
00074 public:
00075         static TypeId GetTypeId(void);
00076 
00080         PLC_Cable () {}
00081 
00086         PLC_Cable(Ptr<const SpectrumModel> sm);
00087 
00088         virtual void Calculate() = 0;
00089 
00098         PLC_Cable(const PLC_FreqSelectiveResistance& R, const PLC_FreqSelectiveConductance& G, const PLC_FreqSelectiveInductance& L, const PLC_FreqSelectiveCapacitance& C, Ptr<const SpectrumModel> sm);
00099 
00100         void SetSpectrumModel(Ptr<const SpectrumModel> sm);
00101         Ptr<const SpectrumModel> GetSpectrumModel(void) { return m_spectrum_model; }
00102 
00107         Ptr<const PLC_FreqSelectiveImpedance> GetCharImp(void) const;
00108 
00113         Ptr<const PLC_FreqSelectiveImpedance> GetTransConst(void) const;
00114 
00120         double GetPropSpeedApprox(void) { return v; }
00121 
00126         Ptr<const SpectrumModel> GetSpectrumModel(void) const { return m_spectrum_model; }
00127 
00131         void Lock()             { m_cable_mutex.Lock(); }
00132         void Unlock()   { m_cable_mutex.Unlock(); }
00133 
00138         PLC_FreqSelectiveResistance *GetDistResRef(void) { return &R; }
00139 
00144         PLC_FreqSelectiveResistance *GetDistConRef(void) { return &G; }
00145 
00146 private:
00147         mutable PLC_Mutex                       m_cable_mutex;
00148 
00149 protected:
00150         virtual void DoDispose();
00151 
00152         Ptr<const SpectrumModel>        m_spectrum_model;
00153 
00157         PLC_FreqSelectiveResistance R;
00161         PLC_FreqSelectiveConductance G;
00165         PLC_FreqSelectiveInductance L;
00169         PLC_FreqSelectiveCapacitance C;
00173         Ptr<PLC_FreqSelectiveImpedance> z_c;
00177         Ptr<PLC_FreqSelectiveImpedance> gamma;
00178 
00184         double v;
00185 
00189         void CalcCharImp(void);
00190 
00194         void CalcTransConst(void);
00195 };
00196 
00201 class PLC_ThreeCoreConcentricCable : public PLC_Cable
00202 {
00203 public:
00204         static TypeId GetTypeId(void);
00205 
00206         PLC_ThreeCoreConcentricCable() : PLC_Cable() {}
00207 
00208         virtual void Calculate() = 0;
00209 
00219         PLC_ThreeCoreConcentricCable(double eps_r, double kappa, double r_a, double r_i, double tand, Ptr<const SpectrumModel> sm);
00220 
00221         PLC_ThreeCoreConcentricCable(PLC_FreqSelectiveRealValue eps_r, double kappa, double r_a, double r_i, PLC_FreqSelectiveRealValue tand, Ptr<const SpectrumModel> sm);
00222 
00223         void Calculate(double eps_r, double kappa, double r_a, double r_i, double tand, Ptr<const SpectrumModel> sm);
00224         void Calculate(PLC_FreqSelectiveRealValue eps_r, double kappa, double r_a, double r_i, PLC_FreqSelectiveRealValue tand, Ptr<const SpectrumModel> sm);
00225 };
00226 
00230 class PLC_FourSectorPowerSupplyCable : public PLC_Cable
00231 {
00232 public:
00233         static TypeId GetTypeId(void);
00234 
00235         PLC_FourSectorPowerSupplyCable() : PLC_Cable() {}
00236 
00237         virtual void Calculate() = 0;
00238 
00247         PLC_FourSectorPowerSupplyCable(double radius, double conductor_distance, double tan_loss_angle, double epsilon_r, double rho, Ptr<const SpectrumModel> sm);
00248         PLC_FourSectorPowerSupplyCable(double radius, double conductor_distance, PLC_FreqSelectiveRealValue tan_loss_angle, PLC_FreqSelectiveRealValue epsilon_r, double rho, Ptr<const SpectrumModel> sm);
00249 
00250         void Calculate(double radius, double conductor_distance, double tan_loss_angle, double epsilon_r, double rho, Ptr<const SpectrumModel> sm);
00251         void Calculate(double radius, double conductor_distance, PLC_FreqSelectiveRealValue tan_loss_angle, PLC_FreqSelectiveRealValue epsilon_r, double rho, Ptr<const SpectrumModel> sm);
00252 };
00253 
00257 class PLC_NAYY150SE_Cable : public PLC_FourSectorPowerSupplyCable
00258 {
00259 public:
00260         static TypeId GetTypeId(void);
00261 
00262         PLC_NAYY150SE_Cable() : PLC_FourSectorPowerSupplyCable() {}
00263         PLC_NAYY150SE_Cable(Ptr<const SpectrumModel> sm);
00264         void Calculate();
00265 };
00266 
00270 class PLC_NAYY50SE_Cable : public PLC_FourSectorPowerSupplyCable
00271 {
00272 public:
00273         static TypeId GetTypeId(void);
00274 
00275         PLC_NAYY50SE_Cable() : PLC_FourSectorPowerSupplyCable() {}
00276         PLC_NAYY50SE_Cable(Ptr<const SpectrumModel> sm);
00277         void Calculate();
00278 };
00279 
00283 class PLC_AL3x95XLPE_Cable : public PLC_ThreeCoreConcentricCable
00284 {
00285 public:
00286         static TypeId GetTypeId(void);
00287 
00288         PLC_AL3x95XLPE_Cable() : PLC_ThreeCoreConcentricCable() {}
00289         PLC_AL3x95XLPE_Cable(Ptr<const SpectrumModel> sm);
00290         void Calculate();
00291 };
00292 
00296 class PLC_NYCY70SM35_Cable : public PLC_ThreeCoreConcentricCable
00297 {
00298 public:
00299         static TypeId GetTypeId(void);
00300 
00301         PLC_NYCY70SM35_Cable() : PLC_ThreeCoreConcentricCable() {}
00302         PLC_NYCY70SM35_Cable(Ptr<const SpectrumModel> sm);
00303         void Calculate();
00304 };
00305 
00306 }
00307 
00308 #endif /* PLC_CABLE_H_ */
 All Classes Functions Variables Enumerations