Xyce  6.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
N_DEV_DeviceModel.h
Go to the documentation of this file.
1 //-----------------------------------------------------------------------------
2 // Copyright Notice
3 //
4 // Copyright 2002 Sandia Corporation. Under the terms
5 // of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S.
6 // Government retains certain rights in this software.
7 //
8 // Xyce(TM) Parallel Electrical Simulator
9 // Copyright (C) 2002-2014 Sandia Corporation
10 //
11 // This program is free software: you can redistribute it and/or modify
12 // it under the terms of the GNU General Public License as published by
13 // the Free Software Foundation, either version 3 of the License, or
14 // (at your option) any later version.
15 //
16 // This program is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 // GNU General Public License for more details.
20 //
21 // You should have received a copy of the GNU General Public License
22 // along with this program. If not, see <http://www.gnu.org/licenses/>.
23 //-----------------------------------------------------------------------------
24 
25 //-----------------------------------------------------------------------------
26 // Filename : $RCSfile: N_DEV_DeviceModel.h,v $
27 //
28 // Purpose : This file contains the device model base class.
29 //
30 // Special Notes :
31 //
32 // Creator : Eric R. Keiter, SNL, Parallel Computational Sciences
33 //
34 // Creation Date : 04/03/00
35 //
36 // Revision Information:
37 // ---------------------
38 //
39 // Revision Number: $Revision: 1.52.2.2 $
40 //
41 // Revision Date : $Date: 2014/03/14 22:04:46 $
42 //
43 // Current Owner : $Author: jcverle $
44 //-----------------------------------------------------------------------------
45 
46 #ifndef Xyce_N_DEV_DeviceModel_h
47 #define Xyce_N_DEV_DeviceModel_h
48 
49 #include <iosfwd>
50 #include <map>
51 #include <string>
52 #include <vector>
53 
54 #include <N_DEV_fwd.h>
55 #include <N_DEV_Device.h>
56 #include <N_DEV_DeviceEntity.h>
57 #include <N_DEV_Pars.h>
58 
59 namespace Xyce {
60 namespace Device {
61 
62 /**
63  * @class DeviceModel N_DEV_DeviceModel.h
64  *
65  * @author Eric Keiter, SNL, Parallel Computational Sciences
66  * @date 4/03/00
67  */
68 class DeviceModel : public DeviceEntity
69 {
70  enum mType {TEMP, DOSE};
71  enum iType {LIN, QUAD, PWL};
73 
74 public:
75  /**
76  * Add the parameter "TEMPMODEL" to the parametric_data.
77  *
78  * @param parametric_data
79  */
80  template<class T>
81  static void initThermalModel(ParametricData<T> &parametric_data)
82  {
83  parametric_data.addPar("TEMPMODEL", "NONE", &DeviceModel::temperatureModel)
84  .setCategory(CAT_CONTROL)
85  .setDescription("Specifies the type of parameter interpolation over temperature");
86  }
87 
88  /**
89  * Add the parameter "DOSEMODEL" to the parametric_data.
90  *
91  * @param parametric_data
92  */
93  template<class T>
94  static void initDoseModel(ParametricData<T> &parametric_data)
95  {
96  parametric_data.addPar("DOSEMODEL", "NONE", &DeviceModel::doseModel);
97  }
98 
100  const ModelBlock & model_block,
101  ParametricData<void> & parametric_data,
102  const FactoryBlock & factory_block);
103 
104  virtual ~DeviceModel ();
105 
106 private:
107  DeviceModel();
108  DeviceModel(const DeviceModel &);
110 
111 public:
112  void setModParams(const std::vector<Param> &params);
113 
114  virtual void forEachInstance(DeviceInstanceOp &op) const = 0;
115 
116  virtual std::ostream &printOutInstances(std::ostream &os) const = 0;
117 
118  /**
119  * processParams
120  *
121  * @return true if parameter processing was successful
122  */
123  virtual bool processParams() = 0;
124 
125  /**
126  * processInstanceParams
127  *
128  * @return true if parameter processing was successful
129  */
130  virtual bool processInstanceParams() = 0;
131 
132  virtual bool clearTemperatureData ()
133  {
134  return true;
135  }
136 
137  // void perturbSensParam (Param & ndParam);
138 
139  void saveParams ();
140  bool interpolateTNOM (double);
141  bool interpolateDOSE (double);
142  void restoreParams ();
143 
144  virtual bool getBinPrefixFlag ()
145  {
146  return false;
147  }
148 
149 private:
150  bool interpolated ();
151  bool interpolate (double);
152 
153 public:
154  int getLevel() const
155  {
156  return level_;
157  }
158 
159  void setLevel(int level)
160  {
161  level_ = level;
162  }
163 
164  const std::string &getType() const
165  {
166  return type_;
167  }
168 
169 private:
170  std::string type_;
171  int level_;
172  std::string temperatureModel;
173  std::string doseModel;
176  double base_temp;
177  std::map<std::string, int> fitMap;
178  std::vector<double DeviceEntity::*> fitParams;
179  std::vector<double> oldParams;
180  std::vector<double> base;
181  std::vector< std::vector<double> > fit;
182  std::vector<double> min_par;
183  std::vector<double> max_par;
184  std::vector<fitType> parType;
185 };
186 
187 } // namespace Device
188 } // namespace Xyce
189 
191 
192 #endif
193