2020年3月31日 星期二

Check LIB-817 in Liberate

#!/usr/bin/perl
# set targeted files
$FILE1 = "sim.sp" ; $FILE2 = "sim.measure" ;
open (SP, "$FILE1"); open (MEAS, "$FILE2");

### Section 1
## glean initial-conditions (pulse results) from sim.measure
my %meas_hash;
while (<MEAS>) {
            chop $_;
            if (/altosinitialcondition/) {
                  @init = split("=",$_);
                  $init[0] =~ s/\s+//;  #remove space
                  $init[1] =~ s/\s+//;
                  #print "$init[0] $init[1]\n"; #print out for checking
                  $meas_hash { $init[0] } = $init[1];  #create hash table for measurement data
                  # another type
                  # %meas_hash = @init;
              }}
## uncomment following 3 lines to out measurement result we got from sim.measure
#foreach $key (keys %meas_hash){
#          print "pulse measured initial value of $key : $meas_hash{$key}\n";
#}
### Section 2
### glean node information from sim.sp
my %node_hash ;
while (<SP>) {
           chop $_;
           if(/AltosInitialCondition/) {
                   @node = split(" ",$_);
                   $node[2] =~ s/\s+//; $node[2] = lc($node[2]);
                   $node[4] =~ s/\s+//; $node[4] =~ s/v\(//; $node[4] =~ s/\)//;
                   #print "$node[2] $node[4]\n"; #print out for checking
                   $node_hash { $node[2] } = $node[4];
} }
close SP;

### Section 3 
### glean inside-view values from sim.sp 
open (SP, "$FILE1"); 
my %inside_view_hash; 
while (<SP>) { 
           chop $_; 
           if (/^.nodeset/ || /^.ic/) { 
                     s/=//; # remove '=' in .ic to align with format of .nodeset 
                     @inside_view = split(" ",$_); 
                     $inside_view[1] =~ s/\s+//; $inside_view[1] =~ s/v\(//; $inside_view[1] =~ s/\)//; 
                     $inside_view[2] =~ s/\s+//; 
                     foreach $key (keys %node_hash){ 
                           if ($inside_view[1] =~ $node_hash{$key}) { 
                                  $inside_view_hash { $inside_view[1] } = $inside_view[2]; 
                                  #print "$key : nodel= $node_hash{$key} of inside-view value is $inside_view[3]\n"; 
                     }} 
}}
## uncomment following 3 lines to print out inside view result we got from sim.sp 
#foreach $key (keys %inside_view_hash){ 
#             print "inside view initial value of $key : $inside_view_hash{$key}\n"; 
#} 
### Section 4 
### print out result 
#print "List inside-view vs pulse results\n"; 
#print " node inside-view pulse\n"; 
#print "***********************************************************************\n"; #foreach $key (keys %node_hash){ 
#              if (!$inside_view_hash{$node_hash{$key}}) { 
#                       if (defined $inside_view_hash{$node_hash{$key}}) { 
#                              print "";} 
#                       else { 
#                              $inside_view_hash{$node_hash{$key}}="9.99999";}} 
#               print "$key $node_hash{$key} "; print "$inside_view_hash{$node_hash{$key}} "; print "$meas_hash{$key}\n"; 
#}
print "List inside-view vs pulse results\n"; 
print " node inside-view pulse\n"; 
print "***********************************************************************\n"; foreach $key (keys %node_hash){ 
               if (!$inside_view_hash{$node_hash{$key}}) { 
                     if (defined $inside_view_hash{$node_hash{$key}}) { 
                                  print "";} 
                     else { 
                                  $inside_view_hash{$node_hashf$keyl}="9.99999";}}
               printf ("%30s %15s ",$key, $node_hash{$key}); printf ("%.5f  ",$inside_view_hash{$node_hash{$key}}); printf ("%.10f \n",$meas_hash{$key}); 
}

Results:

1 則留言:

  1. this is myemail:
    cook.wchen@gmail.com

    I have some technical problems to discuss with you about the cell characterization

    回覆刪除

標籤