TMMS04 Mechatronics -- Lesson 1 -- Sensors and Characteristics In [21]: # loading modules and stuff from IPython.display import display import sympy sympy.init_printing() In [22]: class Obj(object): pass Exercise 1 A linear position sensor based on a potentiometer is shown in Figure . The mechanical measurement range of this sensor is [1.8, 3.0]m . This potentiometer has a total resistance of 100Ω where the wiper (middle connector) can travel in a range of [5, 95]% . The sensor is connected to the data acquisition box with four wires. Each wire has a resistance of 1.7Ω/m and is 5m long. The two connectors of the differential analog input have infinite input resistance thus no current will flow at this connectors. The data acquisition box is exciting the sensor with 10V DC . In [6]: pot = Obj() pot.pos_range = r_[1.8, 3.0] # m pot.Rtot = 100 # Ohm pot.RrangeFract = r_[0.05, 0.95] pot.excitationVoltage = 10 # V DC pot.wire_length = 5 #m pot.wire_RpL = 1.7 # Ohm / m vars(pot) Out[6]: {'RrangeFract': array([ 0.05, 0.95]), 'Rtot': 100, 'excitationVoltage': 10, 'pos_range': array([ 1.8, 3. ]), 'wire_RpL': 1.7, 'wire_length': 5} a. Draw a simple connection diagram showing the potentiometer, the resistors of the wires, and the data acquisition box ports. b. Calculate the sensor gain Ks in V/m. In [8]: pot.wire_R = pot.wire_RpL * pot.wire_length 'Resistance of one wire: {:5.3g} Ohm'.format(pot.wire_R) Out[8]: 'Resistance of one wire: 8.5 Ohm' In [9]: def senser_out_voltage(x): Rp1 = pot.Rtot * ( pot.RrangeFract[0] + (pot.RrangeFract[1] - pot.RrangeFract[0]) / (pot.pos_range[1] - pot.pos_range[0]) * ( x - pot.pos_range[0])) iR = pot.excitationVoltage / (pot.Rtot + 2 * pot.wire_R) return Rp1 * iR In [10]: display(senser_out_voltage(pot.pos_range[0])) display(senser_out_voltage(pot.pos_range[1])) display(senser_out_voltage(pot.pos_range[0]+1)) 0.42735042735 8.11965811966 6.83760683761 In [15]: Ks = pot.excitationVoltage / (pot.Rtot + 2 * pot.wire_R) \ * pot.Rtot \ * (pot.RrangeFract[1] - pot.RrangeFract[0]) / (pot.pos_range[1] - pot.pos_rang e[0]) 'Ks is {:5.3g} V/m'.format(Ks) Out[15]: 'Ks is 6.41 V/m' In [16]: # Ks = senser_out_voltage(pot.pos_range[0]+1.0)-senser_out_voltage(pot.pos_ran ge[0]) c. Will the sensor gain be affected if the supply voltage used for exciting the sensor varies? d. What will the output signal be when a position 2.3m is measured? In [11]: 'ua is {:5.3g} V'.format(senser_out_voltage(2.3)) Out[11]: 'ua is 3.63 V' The data acquisition box has a input range of [0.0, 10.0]V and a resolution of 1mV . Which resolution (distance) may this sensor system have in the best case? How many distinct position can be measured? In [17]: 'The resolution is {:5.3g} mm'.format(0.001 / Ks * 1e3) Out[17]: 'The resolution is 0.156 mm' In [19]: (10.0-0.0) / 0.001 + 1 Out[19]: 10001.0 Exercise 2 A ``HEDS 5540E'' optical quadrature encoder is used to measure a linear motion. The encoder is attached to a rack and pinion (a gear wheel that rotates with the linear motion). The diameter of the wheel is 100mm and the gear ratio is 1:1. In [21]: HEDS5540E = {'pulsePerRev' : 200} HEDS5540E Out[21]: {'pulsePerRev': 200} In [22]: pinion_diameter = 0.100 # m a. If the linear motion is 200 mm long, how many pulses will the encoder give? In [23]: distance = 0.200 # m rotations = distance / (2*pinion_diameter/2*pi) rotations Out[23]: 0.636619772368 In [25]: pulses200 = rotations * HEDS5540E['pulsePerRev'] '{:5.1f} pulses'.format(pulses200) Out[25]: '127.3 pulses' Depending on counting and start position. 127 or 128 pulses. There are 127 rising or 127 falling edges. b. What is the system's resolution (distance) of the translational motion? In [31]: translation_res_pulse = 1. / HEDS5540E['pulsePerRev'] * 2*pi*pinion_diameter/2 translation_res_pulse # m/pulse '{:5.3g} mm/pulse'.format(translation_res_pulse*1e3) Out[31]: ' 1.57 mm/pulse' The resolution is 1.57 mm / pulse. This sensor has two channels with 90 deg phase shift. So the achievable resolution is 1/4 pulse and so 0.393 mm. In [32]: translation_resolution = translation_res_pulse/4. '{:5.3g} mm'.format(translation_resolution*1e3) Out[32]: '0.393 mm' c. What is the velocity limit for this system? What are the requirement on the data acquisition box to allow this velocity? In [33]: HEDS5540E['frequency_max'] = 100e3 #Hz In [36]: v_max = translation_res_pulse * HEDS5540E['frequency_max'] '{:5.3g} m/s'.format(v_max) Out[36]: ' 157 m/s' Exercise 3 Measurements from a pressure transducer IDA354-1,5C-10V is shown in figure 2. The transducer exhibits a non-linear behavior. In [23]: pTransducer = {'name':'IDA354-1,5C-10V'} pTransducer Out[23]: {'name': 'IDA354-1,5C-10V'} a. By approximating the curve with a straight line an approximate linear voltage/pressure relationship can be decided. What is it? There are more than one way to approximate this curve. In case very lower preassure is also interesting than 0 bar shall be 0 V. In [38]: K = 10./160. 'K = {:5.3g} V/bar'.format(K) Out[38]: 'K = 0.0625 V/bar' In [25]: 0.005 * 350 Out[25]: 1.75 In [26]: 0.01 * 35 Out[26]: 0.35 Exercise 4 In [37]: deadBand = r_[-0.2, +0.4] deadBand Out[37]: array([-0.2, 0.4]) Exercise 6 In [29]: t,b = sympy.symbols(("t", "b")) Ti = sympy.symbols("T_i") In [30]: eq = sympy.pi / 4 * (1 + sympy.sin(2*sympy.pi*0.5*t - sympy.pi / 2)) + b eq Out[30]: π b + (− cos (πt) + 1) 4 In [31]: eq2 = sympy.integrate(eq, (t,0,Ti)) eq2 Out[31]: π T ib + 4 1 (T i − π sin (πT i )) In [34]: sol_wB = {} sol_wB[2] = eq2.subs([(b, 0.2), (Ti, 2.)]).evalf()/pi*180 display(sol_wB[2]) sol_wB[5] = eq2.subs([(b, 0.2), (Ti, 5.)]).evalf()/pi*180 display(sol_wB[5]) 112.918311805233 282.295779513082 In [35]: sol_woB = {} sol_woB[2] = eq2.subs([(b, 0.), (Ti, 2.)]).evalf()/pi*180 display(sol_woB[2]) sol_woB[5] = eq2.subs([(b, 0.), (Ti, 5.)]).evalf()/pi*180 display(sol_woB[5]) 90.0 225.0 In [42]: sol_wB[2] - sol_woB[2] Out[42]: 22.9183118052329 In [43]: sol_wB[5] - sol_woB[5] Out[43]: 57.2957795130823 In [44]: (sol_wB[2] - sol_woB[2])/2., (sol_wB[5] - sol_woB[5])/5. Out[44]: In []: ( 11.4591559026165, 11.4591559026165 )
© Copyright 2024 Paperzz