Subversion Repositories Electronics.Rangefider

Rev

Rev 1 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 florent_ba 1
$referenced_asy = @()
2
$unreferenced_asy = @()
3
 
4
$ltspiceDevices = @(
5
    "res",     # Resistor
6
    "cap",     # Capacitor
7
    "ind",     # Inductor
8
    "v",       # Voltage Source
9
    "i",       # Current Source
10
    "GND",     # Ground
11
    "d",       # Diode
12
    "bjt",     # Bipolar Junction Transistor (NPN)
13
    "q",       # Bipolar Junction Transistor (PNP)
14
    "m",       # MOSFET
15
    "mf",      # JFET
16
    "sw",      # Switch
17
    "bv",      # Voltage-controlled voltage source (VCVS)
18
    "bi",      # Current-controlled current source (CCCS)
19
    "e",       # Voltage-controlled voltage source (VCVS)
20
    "g",       # Current-controlled voltage source (CCVS)
21
    "h",       # Current-controlled current source (CCCS)
22
    "f",       # Voltage-controlled current source (VCCS)
23
    "x",       # Subcircuit
24
    "a",       # Behavioral voltage source
25
    "b",       # Behavioral current source
26
    "e21",     # Voltage-controlled current source (dependent)
27
    "voltage", # General voltage source
28
    "current", # General current source
29
    "t",       # Transmission line
30
    "vdc",     # DC Voltage source
31
    "vac",     # AC Voltage source
32
    "vdep"     # Dependent Voltage Source
33
)
34
 
35
$dir_schematic_list = Get-ChildItem . -Recurse -Include *.asc
36
$dir_symbols_list = Get-ChildItem . -Recurse -Include *.asy
37
$dir_symbols_list_str = @()
38
$sym_references = @()
39
 
40
foreach($sym in $dir_symbols_list)
41
{
42
    $sym_name = Split-Path $sym -Leaf
43
    $dir_symbols_list_str += $sym_name.Split('.')[0]
44
}
45
 
46
 
47
 
48
foreach($schematic_file in $dir_schematic_list)
49
{
50
    $current_schematic_name = Split-Path $schematic_file -Leaf
51
    #echo "looking at schematic :  $current_schematic_name"
52
 
53
    $content = Get-Content $schematic_file
54
    foreach($line in $content)
55
    {
56
      if($line -match "SYMBOL\s+(\S+)\s+(.+)")
57
      {
58
        $sym_references += $matches[1]
59
      }
60
 
61
    }
62
}
63
 
64
 
65
 
66
$used_syms = @()
67
$unused_syms = @()
68
 
69
#which element of symbol list is not in the references list
70
foreach($existing_symbol in $dir_symbols_list_str)
71
{
72
    if($sym_references.Contains($existing_symbol))
73
    {
74
       $used_syms += $existing_symbol
75
    }
76
    else
77
    {
78
        $unused_syms += $existing_symbol
79
    }
80
}
81
 
82
echo ""
83
Write-Host "found " $sym_references.Count "references, " $dir_symbols_list.Count " symbols in current directory "
84
Write-Host "from which " $unused_syms.Count " are not referenced in any LTSpice schematic."
85
echo ""
86
 
87
 
88
 
89
echo "[Used symbols : ]"
90
echo "-------------------------------"
91
foreach($sym in  $used_syms)
92
{
93
    echo $sym
94
}
95
echo "-------------------------------"
96
echo ""
97
echo "[Unused symbols : ]"
98
echo "-------------------------------"
99
foreach($sym in  $unused_syms)
100
{
101
    echo $sym
102
}
103
echo "-------------------------------"
104
 
105