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.55 $
40 //
41 // Revision Date : $Date: 2014/05/16 15:06:08 $
42 //
43 // Current Owner : $Author: dgbaur $
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 
56 #include <N_DEV_Device.h>
57 #include <N_DEV_DeviceEntity.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  const std::string &getName() const
113  {
114  return name_;
115  }
116 
117  void setModParams(const std::vector<Param> &params);
118 
119  virtual void forEachInstance(DeviceInstanceOp &op) const = 0;
120 
121  virtual std::ostream &printName(std::ostream &os) const;
122 
123  virtual std::ostream &printOutInstances(std::ostream &os) const = 0;
124 
125  /**
126  * processParams
127  *
128  * @return true if parameter processing was successful
129  */
130  virtual bool processParams() = 0;
131 
132  /**
133  * processInstanceParams
134  *
135  * @return true if parameter processing was successful
136  */
137  virtual bool processInstanceParams() = 0;
138 
139  virtual bool clearTemperatureData ()
140  {
141  return true;
142  }
143 
144  // void perturbSensParam (Param & ndParam);
145 
146  void saveParams ();
147  bool interpolateTNOM (double);
148  bool interpolateDOSE (double);
149  void restoreParams ();
150 
151  virtual bool getBinPrefixFlag ()
152  {
153  return false;
154  }
155 
156 private:
157  bool interpolated ();
158  bool interpolate (double);
159 
160 public:
161  int getLevel() const
162  {
163  return level_;
164  }
165 
166  void setLevel(int level)
167  {
168  level_ = level;
169  }
170 
171  const std::string &getType() const
172  {
173  return type_;
174  }
175 
176 private:
177  std::string name_;
178  std::string type_;
179  int level_;
180  std::string temperatureModel;
181  std::string doseModel;
184  double base_temp;
185  std::map<std::string, int> fitMap;
186  std::vector<double DeviceEntity::*> fitParams;
187  std::vector<double> oldParams;
188  std::vector<double> base;
189  std::vector< std::vector<double> > fit;
190  std::vector<double> min_par;
191  std::vector<double> max_par;
192  std::vector<fitType> parType;
193 };
194 
195 } // namespace Device
196 } // namespace Xyce
197 
199 
200 #endif
201