upon alter the trnoise or trrandom states get re-written.

so delete the old state first.
This commit is contained in:
Holger Vogt 2018-08-23 10:13:17 +02:00
parent b4c6a7d324
commit aedd9d92ee
1 changed files with 6 additions and 0 deletions

View File

@ -230,6 +230,9 @@ VSRCparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
if (here->VSRCfunctionOrder > 6 && RTSAM != 0.0)
RTSEMT = here->VSRCcoeffs[6]; // RTS trap emission time
/* after an 'alter' command to the TRNOISE voltage source the state gets re-written
with the new parameters. So free the old state first. */
trnoise_state_free(here->VSRCtrnoise_state);
here->VSRCtrnoise_state =
trnoise_state_init(NA, TS, NALPHA, NAMP, RTSAM, RTSCAPT, RTSEMT);
}
@ -256,6 +259,9 @@ VSRCparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
if (here->VSRCfunctionOrder > 4)
PARAM2 = here->VSRCcoeffs[4]; // second parameter
/* after an 'alter' command to the TRRANDOM voltage source the state gets re-written
with the new parameters. So free the old state first. */
tfree(here->VSRCtrrandom_state);
here->VSRCtrrandom_state =
trrandom_state_init(rndtype, TS, TD, PARAM1, PARAM2);
}