Update to command 'wrnodev':
Prevent crash if tran is not (yet) run. Open output file only when data are available. Enhanced comment and warning message.
This commit is contained in:
parent
e449c894ce
commit
28b495318d
|
|
@ -18,6 +18,8 @@ void com_wric(wordlist* wl);
|
|||
|
||||
/* Print the current node status to a file with format
|
||||
.ic V(node) = value
|
||||
during a transient simulation which has been stopped,
|
||||
by command 'stop' and which may continue by 'resume'.
|
||||
*/
|
||||
void
|
||||
com_wric(wordlist* wl) {
|
||||
|
|
@ -32,11 +34,6 @@ com_wric(wordlist* wl) {
|
|||
else
|
||||
file = "dot_ic_out.txt";
|
||||
|
||||
if ((fp = fopen(file, "w")) == NULL) {
|
||||
perror(file);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!ft_curckt) {
|
||||
fprintf(cp_err, "Error: there aren't any circuits loaded.\n");
|
||||
return;
|
||||
|
|
@ -48,6 +45,17 @@ com_wric(wordlist* wl) {
|
|||
|
||||
ckt = ft_curckt->ci_ckt;
|
||||
|
||||
if (!ckt->CKTrhsOld) {
|
||||
fprintf(stderr, "\nWarning: Command wrnodev is ignored!\n");
|
||||
fprintf(stderr, " You need to execute stop ... tran ... resume\n\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((fp = fopen(file, "w")) == NULL) {
|
||||
perror(file);
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(fp, "* Intermediate Transient Solution\n");
|
||||
fprintf(fp, "* Circuit: %s\n", ft_curckt->ci_name);
|
||||
fprintf(fp, "* Recorded at simulation time: %g\n", ckt->CKTtime);
|
||||
|
|
|
|||
Loading…
Reference in New Issue