/stepper motor model moto.cir * the motor model is implemented as a subcircuit .subckt motor 31 35 0 21 22 11 12 6 1 34 * direction, clock, 0, w1+, w1-, w2+, we-, speed, position, internal pos. * v(1) represents the position of the load. * v(2) represents the position of the rotor. * movement always has to start at a defined position * position is in rad! * the rotating mass consists of the rotor and the load coupled by * something elastic. c2 is the load. c3 is the rotor. * C the torque needed divided by the rotational speed change * Example: torque is 1Nm at a change of 2*pi/s^2 -> 0.1591 * Example of a rotating cylinder of iron (7000Kg/m^3) with 10cm length, 1cm * radius: m=219g -> J=mr^2/2 = 1.095e-5 (Nm/s^2) c1 1 0 10.95u * Example of a rotor: 1cm long, 1 cm radius, iron c2 2 0 1.095u * the load is coupled to the rotor by something elastic * without external force: J*d^2phi/dt^2 + phi*d = 0 * with phi corresponding the voltages the electrical equivalent is * C*d^2V/dt^2 + V/L=0 * so L expresses the torsion stiffness of the coupling between rotor and load * in Nm/rad * Example: G=8.5N/m^2, axis radius ra=2mm, axis length 1cm * d=pi*ra^4/(2*G)=295Nm/rad*m so L becomes 1/295 l13 1 3 0.00339 * by the way, the mechanical resonance is about 2.61kHz * this system must have some damping. Usually this is friction of the * moving load. Speed is the derivative of the position. * In electrical terms: I=C*dV/dt. So putting a resistor in series with l13 * is correct except for stick-slip conditions (then we need something non * linear). Xl at resonance is about 556 Ohm. Let's try periodic. r32 2 3 150 * Coupling between magnetic field and rotor: * K*phi + Jrotor*d^2phi/dt^2=0 * with K being dtorque/dphi of the magnetic field in the opreating point * electrical equivalent: * L*V+C*d^2V/dt^2 = 0 * so L corresponds K and C is coincident with C2 * K depends on the current the motor is excited with ,on the * stepping mode (full step type1, type2, half step etc.) and on the * step angle * example: phyton ZSS59.200.1.2 with max. torque 0.7Nm, 200Steps/6.28 * so stepping angle S=6.28/200 and torque=-h*sin(((pi/2)/S)*phi) * K at zero crossing becomes: K=h*50 = 0.7Nm*50 / rad =35Nm/rad * converted into electrical terms L is 1/35=0.0285 L25 2 5 0.0285 * resonance of the system magnetical spring to rotor is 899Hz * the rotor has a damping too ?????????????? r54 5 4 50 * to measure rotor speed V(2) must be differentiated g26 6 0 2 0 -1 l60 6 0 1 * electrical system * pins are 11, 12, 21, 22 le1 11 13 10m re1 13 14 5 le2 21 23 10m re2 23 24 5 * back emf coupling to electrical system * uses the speed information available at node 6 * transmission factor is motor dependent! ee1 14 12 6 0 1 ee2 24 22 6 0 1 * to make the simulated motor move we need as staircase * generator simulating the angle of the field * the generator is boilt as an ideal charge pump with two MOS * switches pumping it up. Direction is given by V(31) being +5 or -0 * the generator is clocked by node 35 changig from 0 to 5 cg4 0 34 900p eg1 4 0 34 0 1 cg33 33 4 314p .model mgen nmos tox=1e-8 vto=0.3 mgen1 33 36 34 4 mgen w=5u l=1u mgen2 32 37 33 4 mgen w=5u l=1u eg2 36 4 38 4 -1 vg1 37 38 dc 5 eg3 37 4 35 0 1 eg4 32 4 39 0 0.04 vg2 31 39 dc 2.5 .ends motor * end of subcircuit motor * test drive of generator vtdir 1 0 pulse (0 5 20m 1n 1n 20m 40m) vtsstep 2 0 pulse (0 5 2m 1n 1n 2m 4m) x1 1 2 0 3 4 5 6 7 8 9 motor .ic v(7)=0 .ic v(8)=0 .ic v(9)=0 * 1: direction, 2: clock, 3,4: winding 1, 5,6: winding 2, 7: speed, 8: position, 9: internal position stored in capacitor. * Current through L24 represents the speed of the rotor. * voltage at node 8 corresponds the position * Test case 1 *Vtgt 4 0 pwl(0 0 5m 0 5.1m 0.031415 10m 0.031415 10.1m 0.062831 15m 0.062831 15.1m 0.094248 20m 0.094248 20.1m 0.12566 ) * to prevent floating nets during test: ree1 0 4 1000 ree2 0 6 1000 * rdummy1 7 0 1000k * rdummy2 8 0 1000k * the OPUS environment doesn't like print and plot commands * such as: *.dc *.tran 1n 200n *.plot tran v(1) .end