* Z:\home\khalils\Downloads\files\data\raw_asc\080cc0d086d0_Rotary_Switches_3.asc
* Generated by LTspice 26.0.1 for Windows.
S1 1 N001 31 0 SW1
S2 2 N001 32 0 SW1
S3 3 N001 33 0 SW1
R1 1 0 1
R2 2 0 1
R3 3 0 1
V2 N001 0 5
.model sw1 sw(Vt=0.5 Ron=0.01 Roff=1G)
.tran 0 160 0 10m
.options plotwinsize=0
* 1 = 1 turn = 360 degree
* Three Pole Rotary Sswitches\n \nBreak before make or make before break possible.\nDegree of break/make can be set with the parameter BRKF.\nMultiple forward nd backward turns are allowed.\nA turn of 1 means one full rotation.\n \nBreak Fraction Factor BRKF\nThe total break angle is 2*BRKF *360 degree\nNegative values mean an overlap (make before break)\nExample: .param BRKF=0.01
.subckt rty_switch3 rot sc1 sc2 sc3
* rot = 1 means 1 full turn
.param BRKF=0.01
BA a 0 V=V(rot)-floor(V(rot))
B1 sc1 0 V=if( {BRKF}>=0, if(V(a)>={0+BRKF} & V(a)<={1/3-BRKF}, 1, 0), if(V(a)>={1+BRKF} | V(a)<={1/3-BRKF}, 1, 0) )
B2 sc2 0 V=if(V(a)>{1/3+BRKF} & V(a)<={2/3-BRKF}, 1, 0)
B3 sc3 0 V=if( {BRKF}>=0, if(V(a)>{2/3+BRKF} & V(a)<={1-BRKF}, 1, 0), if(V(a)>{2/3+BRKF} | V(a)<={-BRKF},1,0) )
.ends
* X3p rot1 31 32 33 rty_switch3 BRKF=-0.01 ; overlap
* Control ouput signal for switches S1, S2, S3
* 3 Pole Rotary Switch
* Rotary Switch "Angle"
* Position Duration (s)\n1 5\n2 5\n3 15\n2 10\n1 5\n2 30\n3 60\n2
.param P1=1/6 P2=(1/3+1/6) P3= (2/3+1/6) P13=0 P12=1/3 P23=2/3
* V1 rot1 0 PWL(0 0 +1u {P1} +5 {P1} +1u {P2} +5 {P2} +1u {P3} +15 {P3} +1u {P2} +10 {P2} +1u {P1} +5 {P1} +1u {P2} +30 {P2} +1u {P3} +60 {P3} +1u {P2} )
* SEQUENCE with gap (BRKF=0.01) or overlap (BRKF=-0.01)\nWith gap : break before make\nWith overlap : make before break
X3p rot1 31 32 33 rty_switch3 BRKF=0.01 ; gap
* X3p rot1 31 32 33 rty_switch3 BRKF=0.01 ; gap
V1 rot1 0 PWL (0 0
+ +1u {P13} +20m {P13}
+ +1u {P1} +5 {P1}
+ +1u {P12} +20m {P12}
+ +1u {P2} +5 {P2}
+ +1u {P23} +20m {P23}
+ +1u {P3} +15 {P3}
+ +1u {P23} +20m {P23}
+ +1u {P2} +10 {P2}
+ +1u {P12} +20m {P12}
+ +1u {P1} +5 {P1}
+ +1u {P12} +20m {P12}
+ +1u {P2} +30 {P2}
+ +1u {P23} +20m {P23}
+ +1u {P3} +60 {P3}
+ +1u {P23} +20m {P23}
+ +1u {P2} )
* 1
* 2
* 3
* 2*BRKF=gap
* 20ms break or overlap time
.backanno
.end

* LTspice schematic (.asc):
Version 4
SHEET 1 2372 1284
WIRE 944 -304 800 -304
WIRE 1168 -304 944 -304
WIRE 1392 -304 1168 -304
WIRE 800 -288 800 -304
WIRE 944 -224 944 -304
WIRE 1168 -224 1168 -304
WIRE 1392 -224 1392 -304
WIRE 1024 -208 992 -208
WIRE 1248 -208 1216 -208
WIRE 1472 -208 1440 -208
WIRE 800 -192 800 -208
WIRE 992 -128 992 -160
WIRE 1216 -128 1216 -160
WIRE 1440 -128 1440 -160
WIRE 944 -80 944 -144
WIRE 976 -80 944 -80
WIRE 1168 -80 1168 -144
WIRE 1200 -80 1168 -80
WIRE 1392 -80 1392 -144
WIRE 1424 -80 1392 -80
WIRE 944 -48 944 -80
WIRE 1168 -48 1168 -80
WIRE 1392 -48 1392 -80
WIRE 944 64 944 32
WIRE 1168 64 1168 32
WIRE 1392 64 1392 32
WIRE 480 496 480 464
WIRE 1072 608 1040 608
WIRE 1072 640 1040 640
WIRE 1072 672 1040 672
WIRE 480 720 480 688
FLAG 480 720 0
FLAG 480 464 rot1
FLAG 1072 608 31
FLAG 1072 640 32
FLAG 1072 672 33
FLAG 944 64 0
FLAG 1168 64 0
FLAG 1392 64 0
FLAG 992 -128 0
FLAG 1216 -128 0
FLAG 1440 -128 0
FLAG 1024 -208 31
IOPIN 1024 -208 In
FLAG 1248 -208 32
IOPIN 1248 -208 In
FLAG 1472 -208 33
IOPIN 1472 -208 In
FLAG 976 -80 1
FLAG 1200 -80 2
FLAG 1424 -80 3
FLAG 800 -192 0
SYMBOL sw 944 -128 R180
SYMATTR InstName S1
SYMATTR Value SW1
SYMBOL sw 1168 -128 R180
SYMATTR InstName S2
SYMATTR Value SW1
SYMBOL sw 1392 -128 R180
SYMATTR InstName S3
SYMATTR Value SW1
SYMBOL res 928 -64 R0
SYMATTR InstName R1
SYMATTR Value 1
SYMBOL res 1152 -64 R0
SYMATTR InstName R2
SYMATTR Value 1
SYMBOL res 1376 -64 R0
SYMATTR InstName R3
SYMATTR Value 1
SYMBOL voltage 800 -304 R0
SYMATTR InstName V2
SYMATTR Value 5
TEXT 800 -344 Left 0 !.model sw1 sw(Vt=0.5 Ron=0.01 Roff=1G)
TEXT 24 -16 Left 0 !.tran 0 160 0 10m
TEXT 24 8 Left 0 !.options plotwinsize=0
TEXT 112 624 Left 0 ;1 = 1 turn = 360 degree
TEXT 32 -360 Left 0 ;Three Pole Rotary Sswitches\n \nBreak before make or make before break possible.\nDegree of break/make can be set with the parameter BRKF.\nMultiple forward nd backward turns are allowed.\nA turn of 1 means one full rotation.\n \nBreak Fraction Factor BRKF\nThe total break angle is 2*BRKF *360 degree\nNegative values mean an overlap (make before break)\nExample: .param BRKF=0.01
TEXT 24 968 Left 0 !.subckt rty_switch3 rot sc1 sc2 sc3 \n* rot = 1 means 1 full turn\n.param BRKF=0.01\nBA a 0 V=V(rot)-floor(V(rot))\nB1 sc1 0 V=if( {BRKF}>=0, if(V(a)>={0+BRKF} & V(a)<={1/3-BRKF}, 1, 0), if(V(a)>={1+BRKF} | V(a)<={1/3-BRKF}, 1, 0) )\nB2 sc2 0 V=if(V(a)>{1/3+BRKF} & V(a)<={2/3-BRKF}, 1, 0)\nB3 sc3 0 V=if( {BRKF}>=0, if(V(a)>{2/3+BRKF} & V(a)<={1-BRKF}, 1, 0), if(V(a)>{2/3+BRKF} | V(a)<={-BRKF},1,0) )\n.ends
TEXT 24 336 Left 0 ;X3p rot1 31 32 33 rty_switch3 BRKF=-0.01 ; overlap
TEXT 1032 552 Left 0 ;Control ouput signal for switches S1, S2, S3
TEXT 24 888 Left 0 ;3 Pole Rotary Switch
TEXT 112 592 Left 0 ;Rotary Switch "Angle"
TEXT 1040 272 Left 0 ;Position Duration (s)\n1 5\n2 5\n3 15\n2 10\n1 5\n2 30\n3 60\n2
TEXT 696 208 Left 0 !.param P1=1/6  P2=(1/3+1/6)  P3= (2/3+1/6)  P13=0  P12=1/3  P23=2/3
TEXT 24 784 Left 0 ;V1 rot1 0 PWL(0 0 +1u {P1} +5 {P1} +1u {P2} +5 {P2} +1u {P3} +15 {P3} +1u {P2} +10 {P2} +1u {P1} +5 {P1} +1u {P2} +30 {P2} +1u {P3} +60 {P3} +1u {P2} )
TEXT 24 208 Left 0 ;SEQUENCE with gap (BRKF=0.01) or overlap (BRKF=-0.01)\nWith gap : break before make\nWith overlap : make before break
TEXT 24 304 Left 0 !X3p rot1 31 32 33 rty_switch3 BRKF=0.01 ; gap
TEXT 16 928 Left 0 ;X3p rot1 31 32 33 rty_switch3 BRKF=0.01 ; gap
TEXT 696 272 Left 0 !V1 rot1 0 PWL (0 0 \n+ +1u {P13} +20m {P13}\n+ +1u {P1} +5 {P1} \n+ +1u {P12} +20m {P12}\n+ +1u {P2} +5 {P2} \n+ +1u {P23} +20m {P23}\n+ +1u {P3} +15 {P3} \n+ +1u {P23} +20m {P23}\n+ +1u {P2} +10 {P2} \n+ +1u {P12} +20m {P12}\n+ +1u {P1} +5 {P1} \n+ +1u {P12} +20m {P12}\n+ +1u {P2} +30 {P2} \n+ +1u {P23} +20m {P23}\n+ +1u {P3} +60 {P3} \n+ +1u {P23} +20m {P23}\n+ +1u {P2} )
TEXT 480 520 Left 0 ;1
TEXT 408 592 Left 0 ;2
TEXT 512 648 Left 0 ;3
TEXT 272 472 Left 0 ;2*BRKF=gap
TEXT 1296 272 Left 0 ;20ms break or overlap time
LINE Normal 573 606 482 594 2
LINE Normal 416 521 480 594 2
LINE Normal 415 663 481 594 2
LINE Normal 443 503 481 595 2
LINE Normal 573 580 481 594 2
LINE Normal 442 678 481 594 2
LINE Normal 528 528 480 595
LINE Normal 528 544 528 528
LINE Normal 511 534 528 528
LINE Normal 500 545 489 548
LINE Normal 499 551 490 548
LINE Normal 397 497 414 517
LINE Normal 431 475 441 499
LINE Normal 432 485 405 503
LINE Normal 408 495 405 503
LINE Normal 413 502 405 503
LINE Normal 429 493 432 485
LINE Normal 424 486 432 485
LINE Normal 595 592 563 592
LINE Normal 599 586 599 589
LINE Normal 603 582 599 586
LINE Normal 607 582 603 582
LINE Normal 608 582 607 582
LINE Normal 612 586 608 582
LINE Normal 612 597 612 586
LINE Normal 608 601 612 597
LINE Normal 603 601 608 601
LINE Normal 599 597 603 601
LINE Normal 599 589 599 597
RECTANGLE Normal 1760 1184 -16 864
RECTANGLE Normal 1776 112 736 -368
RECTANGLE Normal 1776 816 -8 160
CIRCLE Normal 576 688 384 496
CIRCLE Normal 496 608 464 576
ARC Normal 471 548 519 596 519 567 491 547