mirror of
https://github.com/ra3xdh/qucs_s
synced 2025-03-28 21:13:26 +00:00
Check LEVEL when importing SPICE model
This commit is contained in:
parent
edd4be1826
commit
f1807463ff
@ -15,6 +15,7 @@ fillFromSpiceDialog::fillFromSpiceDialog(Component *pc, QWidget *w)
|
||||
: QDialog(w)
|
||||
{
|
||||
Comp = pc;
|
||||
ModelLevel = 1;
|
||||
|
||||
edtModel = new QPlainTextEdit;
|
||||
QLabel *lblModel = new QLabel(tr("Insert .MODEL text here"));
|
||||
@ -127,6 +128,17 @@ int fillFromSpiceDialog::parseModelcard()
|
||||
value += "M";
|
||||
}
|
||||
|
||||
if (ModelType == "nmos" || ModelType == "pmos") { // check MOS level
|
||||
if (name == "level") {
|
||||
ModelLevel = value.toInt();
|
||||
QList<int> allowed_levels;
|
||||
allowed_levels<<1<<2<<3<<4<<5<<6<<7<<9;
|
||||
if (!allowed_levels.contains(ModelLevel)) {
|
||||
return wrongLevel;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (value.size() >=2) {
|
||||
// Ngspice doesn't accept numbers without leading zero
|
||||
if (value.at(0) == '.' && value.at(1).isDigit()) {
|
||||
@ -187,6 +199,11 @@ void fillFromSpiceDialog::showErrorMsg(int code)
|
||||
msg = tr("Subcircuit model (.SUBCKT) found\n"
|
||||
"Modelcard (.MODEL) expected");
|
||||
break;
|
||||
case wrongLevel:
|
||||
msg = QString(tr("Model LEVEL=%1 is not allowed for unified MOS device\n"
|
||||
"Use red SPICE device from Microelectronics group\n"
|
||||
"Allowed LEVELS are: 1,2,3,4,5,6,9")).arg(ModelLevel);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -19,9 +19,10 @@ private:
|
||||
QMap<QString,QString> parsedProps;
|
||||
QString ModelName;
|
||||
QString ModelType;
|
||||
int ModelLevel;
|
||||
|
||||
enum errorCode { noError = 0, noModel = 1, modelMismatch = 2, wrongModel = 3, subcirFound = 4,
|
||||
numberError = 5 };
|
||||
numberError = 5, wrongLevel = 6 };
|
||||
|
||||
QPlainTextEdit *edtModel;
|
||||
QPushButton *btnOK, *btnCancel;
|
||||
|
Loading…
x
Reference in New Issue
Block a user