Fix a bug in the inductance formula.

This commit is contained in:
Holger Vogt 2022-06-20 14:22:55 +02:00 committed by DSPOM
parent 55d96ad2c2
commit 2c8c5b11b1
1 changed files with 5 additions and 12 deletions

View File

@ -47,22 +47,15 @@ INDsetup(SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
model->INDmodNt = 0.0; model->INDmodNt = 0.0;
} }
if (!model->INDmuGiven) { if (!model->INDmuGiven) {
model->INDmu = 0.0; model->INDmu = 1.0;
} }
/* precompute specific inductance (one turn) */ /* precompute specific inductance (one turn) */
if((model->INDlengthGiven) if((model->INDlengthGiven) && (model->INDlength > 0.0)) {
&& (model->INDlength > 0.0)) { model->INDspecInd = (model->INDmu * CONSTmuZero
* model->INDcsect) / model->INDlength;
if (model->INDmuGiven)
model->INDspecInd = (model->INDmu * CONSTmuZero
* model->INDcsect * model->INDcsect) / model->INDlength;
else
model->INDspecInd = (CONSTmuZero * model->INDcsect
* model->INDcsect ) / model->INDlength;
} else { } else {
model->INDspecInd = 0.0; model->INDspecInd = 0.0;
} }
if (!model->INDmIndGiven) if (!model->INDmIndGiven)