¿ªÔÆÌåÓý

Re: Can't open library file.


 

Helmut you saved me again, thank you. Part of the confusion that I had
was that I don't really know what the syntax should be. What I did was
cut and pasted the example in the help file to my library and renamed
it. What I didn't realize was that the command didn't include
everything below the 'Example:'. After looking at your example the
help file made more sense. This got me thinking.

What would be helpful would be actual working examples (similar to
what you did for me) using the circuit elements and commands in a
single file. Also what would be useful would be an explanation of the
error codes (I figured out that multiple instances of W1 was a result
of having more than one library, I tried placing one in different
places to get one to open, with the same switch model in each). Maybe
the powers that be at Linear Technology can throw something together
and put it in the Files location on this site. Or if any of the
members have a little tidbit that they found useful maybe we can set
up a folder for them? Anyone have thoughts on this one?

Bunny

--- In LTspice@..., "Helmut Sennewald
<helmutsennewald@y...>" <helmutsennewald@y...> wrote:
--- In LTspice@..., "bunnyblues2001
<bunnyblues2001@y...>" <bunnyblues2001@y...> wrote:
OK where did I go wrong, I'm getting - Could not open include file
"MYLIBRARY1.LIB"
I copied the switch out of help, and the library is in the sub
directory.

MYLIBRARY1.lib

*SYM=CSW
.MODEL CSWITCH1 1 2
W1 out 0 Vsense CSWITCH1
Vsense a b 0.
.model CSWITCH1 CSW(Ron=.1 Roff=1Meg Vt=0 Vh=-.5)
.ENDS
Hello Bunny,
the problem is that your model/subcircuit doesn't follow SPICE
syntax.

Your switch model in the library has to be only:

.model CSWITCH1 CSW( Ron=0.1 Roff=1MEG It=1 Ih=0.5)

Only lines like these can model CSW switches. See the help pages.
All the other things have to be done in the schematic.
I have never used a CSW before and frankly speaking I tried in
the schematic until the netlist followed the syntax in the help
pages.
Finally I was successful. The value of the CSW symbol must contain
two values either in value-line or in the second field value2.
Right click over the symbol to look at.

value: V1 CSWITCH1

or

value: V1
value2: CSWITCH1

Best Regards
Helmut


CSW = (C)urrent controlled (SW)itch

Circuit example with CSW:
-------------------------


Version 4
SHEET 1 1424 692
WIRE 752 464 752 496
WIRE 752 496 480 496
WIRE 208 496 208 400
WIRE 208 496 208 512
WIRE 208 240 480 240
WIRE 480 384 480 352
WIRE 480 464 480 496
WIRE 480 272 480 240
WIRE 208 320 208 240
WIRE 752 272 752 240
WIRE 752 240 480 240
WIRE 752 352 752 384
WIRE 480 496 208 496
WIRE 752 80 752 112
WIRE 752 112 432 112
WIRE 208 112 208 16
WIRE 208 112 208 128
WIRE 208 -144 432 -144
WIRE 208 -64 208 -144
WIRE 752 -112 752 -144
WIRE 752 -32 752 0
WIRE 432 -48 432 -144
WIRE 432 -144 752 -144
WIRE 432 32 432 112
WIRE 432 112 208 112
FLAG 208 512 0
FLAG 208 128 0
SYMBOL C:&#92;PROGRAM&#92; FILES&#92;LTC&#92;SWCADIII&#92;lib&#92;sym&#92;csw 752 272 R0
WINDOW 0 55 20 Left 0
SYMATTR InstName W2
SYMATTR Value V2 CSWITCH1
SYMBOL C:&#92;PROGRAM&#92; FILES&#92;LTC&#92;SWCADIII&#92;lib&#92;sym&#92;res 736 368 R0
SYMATTR InstName R2
SYMATTR Value 10
SYMBOL F:&#92;PROGRAMME&#92;LTC&#92;SWCADIII&#92;lib&#92;sym&#92;res 464 368 R0
SYMATTR InstName R20
SYMATTR Value 10
SYMBOL F:&#92;PROGRAMME&#92;LTC&#92;SWCADIII&#92;lib&#92;sym&#92;voltage 480 256 R0
WINDOW 0 37 34 Left 0
WINDOW 3 38 80 Left 0
WINDOW 123 0 0 Left 0
WINDOW 39 0 0 Left 0
SYMATTR InstName V2
SYMATTR Value 0
SYMBOL F:&#92;PROGRAMME&#92;LTC&#92;SWCADIII&#92;lib&#92;sym&#92;voltage 208 304 R0
WINDOW 123 0 0 Left 0
WINDOW 39 24 132 Left 0
SYMATTR InstName V3
SYMATTR Value SINE(0 20 2k)
SYMBOL C:&#92;PROGRAM&#92; FILES&#92;LTC&#92;SWCADIII&#92;lib&#92;sym&#92;csw 752 -112 R0
WINDOW 0 55 20 Left 0
SYMATTR InstName W1
SYMATTR Value V1
SYMATTR Value2 CSWITCH1
SYMBOL C:&#92;PROGRAM&#92; FILES&#92;LTC&#92;SWCADIII&#92;lib&#92;sym&#92;res 736 -16 R0
SYMATTR InstName R1
SYMATTR Value 10
SYMBOL F:&#92;PROGRAMME&#92;LTC&#92;SWCADIII&#92;lib&#92;sym&#92;voltage 208 -80 R0
WINDOW 123 0 0 Left 0
WINDOW 39 24 132 Left 0
SYMATTR InstName V1
SYMATTR Value SINE(0 20 2k)
SYMBOL F:&#92;PROGRAMME&#92;LTC&#92;SWCADIII&#92;lib&#92;sym&#92;res 416 -64 R0
SYMATTR InstName R10
SYMATTR Value 10
TEXT 206 -256 Left 0 !.tran 0 1m 0 1u
TEXT 208 -216 Left 0 !.model CSWITCH1 CSW( Ron=0.1 Roff=1MEG It=1
Ih=0.5)
TEXT 208 -328 Left 0 ;CURRENT CONTROLLED SWITCH&#92;nValue must
be "Vsense modelname", e.g. "V1 CSWITCH1".
TEXT 208 -184 Left 0 ;.include mylibrary1.lib


New "mylibrary1.lib", but it is not needed in the example above.
----------------------------------------------------------------

.model CSWITCH1 CSW( Ron=0.1 Roff=1MEG It=1 Ih=0.5)

Join [email protected] to automatically receive all group messages.