Blame | Last modification | View Log | RSS feed
$referenced_asy = @()
$unreferenced_asy = @()
$ltspiceDevices = @(
"res", # Resistor
"cap", # Capacitor
"ind", # Inductor
"v", # Voltage Source
"i", # Current Source
"GND", # Ground
"d", # Diode
"bjt", # Bipolar Junction Transistor (NPN)
"q", # Bipolar Junction Transistor (PNP)
"m", # MOSFET
"mf", # JFET
"sw", # Switch
"bv", # Voltage-controlled voltage source (VCVS)
"bi", # Current-controlled current source (CCCS)
"e", # Voltage-controlled voltage source (VCVS)
"g", # Current-controlled voltage source (CCVS)
"h", # Current-controlled current source (CCCS)
"f", # Voltage-controlled current source (VCCS)
"x", # Subcircuit
"a", # Behavioral voltage source
"b", # Behavioral current source
"e21", # Voltage-controlled current source (dependent)
"voltage", # General voltage source
"current", # General current source
"t", # Transmission line
"vdc", # DC Voltage source
"vac", # AC Voltage source
"vdep" # Dependent Voltage Source
)
$dir_schematic_list = Get-ChildItem . -Recurse -Include *.asc
$dir_symbols_list = Get-ChildItem . -Recurse -Include *.asy
$dir_symbols_list_str = @()
$sym_references = @()
foreach($sym in $dir_symbols_list)
{
$sym_name = Split-Path $sym -Leaf
$dir_symbols_list_str += $sym_name.Split('.')[0]
}
foreach($schematic_file in $dir_schematic_list)
{
$current_schematic_name = Split-Path $schematic_file -Leaf
#echo "looking at schematic : $current_schematic_name"
$content = Get-Content $schematic_file
foreach($line in $content)
{
if($line -match "SYMBOL\s+(\S+)\s+(.+)")
{
$sym_references += $matches[1]
}
}
}
$used_syms = @()
$unused_syms = @()
#which element of symbol list is not in the references list
foreach($existing_symbol in $dir_symbols_list_str)
{
if($sym_references.Contains($existing_symbol))
{
$used_syms += $existing_symbol
}
else
{
$unused_syms += $existing_symbol
}
}
echo ""
Write-Host "found " $sym_references.Count "references, " $dir_symbols_list.Count " symbols in current directory "
Write-Host "from which " $unused_syms.Count " are not referenced in any LTSpice schematic."
echo ""
echo "[Used symbols : ]"
echo "-------------------------------"
foreach($sym in $used_syms)
{
echo $sym
}
echo "-------------------------------"
echo ""
echo "[Unused symbols : ]"
echo "-------------------------------"
foreach($sym in $unused_syms)
{
echo $sym
}
echo "-------------------------------"