位移传感器界面化角度
最近在研究一台磨床,上磨盘需要有一定的倾斜角,本文阐述了利用三个位移传感器通过测量位移转换成角度并界面化,分享给大家。
正向两个位移传感器,侧面方向一个位移传感器。主要的思路为:正向两个位移传感器取平均值作为正向位移,与侧向位移传感器组成三角函数关系,通过arctan算出夹角,内部红色光标设置成X/Y偏移变量,如图大圆半径为100,对应X偏移量为sina*100,对应Y偏移量为cosa*100。这样不但可以直观的观察角度,而且更能直观的观察红色光标的位置。附代码如下://///////羊角风发作的症状有哪些位移传感器数值整定 CALL FC 105 IN :=DB41.DBW232 HI_LIM :=2.000000e+000 LO_LIM :=0.000000e+000 BIPOLAR:=FALSE RET_VAL:=#_RetVal OUT :=#_Dist_S_Kipp_P2 CALL FC 105 IN :=DB41.DBW234 HI_LIM :=2.000000e+000 LO_LIM :=0.000000e+000 BIPOLAR:=FALSE RET_VAL:=#_RetVal OUT :=#_Dist_S_DKipp_P3 CALL 郑州军海医院FC 105 IN :=DB41.DBW230 HI_LIM :=2.000000e+000 LO_LIM :=0.000000e+000 BIPOLAR:=FALSE RET_VAL:=#_RetVal OUT :=#_Dist_S_Dreh_P1///////////////////////////////////////////数值校正 L #_Dist_S_Dreh_P1 L #_Zero_Val_S_Dreh_P1 -R L DB34.DBD 274 *R NEGR T #_Skal_Dist_Sensor_Dreh L #_Dist_S_Kipp_P2 L #_Zero_Val_S_Kipp_P2 癫痫病的日常护理-R L DB34.DBD 278 *R NEGR T #_Skal_Dist_Sensor_Kipp L #_Dist_S_DKipp_P3 L #_Zero_Val_S_DKipp_P3 -R L DB34.DBD 278 *R NEGR T #_Skal_Dist_Sensor_DKipp L #_Skal_Dist_Sensor_Kipp L #_Skal_Dist_Sensor_DKipp +R L 2.000000e+000 /R T #_Skal_Mwert_Kipp_DKipp//////////////////////////////////////////////////////////////清零操作 A DB34.DBX 268.0 A DB41.DBX 23.7 JCN N4_1 L #_Dist_S_Dreh_P1 T #_Zero_Val_S_Dreh_P1 L #_Dist_S_Kipp_P2 T #_Zero_Val_S_Kipp_P2 L #_Dist_S_DKipp_P3 T #_Zero_Val_S_DKipp_P3 R DB34.DBX 268.0N4_1: NOP 0 L #_Skal_Mwert_Kipp_DKipp L 0.000000e+000 >=R S #iv_jump1 //positiv L #_Skal_Mwert_Kipp_DKipp L 0.000000e+000 R #iv_jump1 //neg. L #_Skal_Dist_Sensor_Dreh L 0.000000e+000 >=R S #iv_jump2 //pos. L #_Skal_Dist_Sensor_Dreh L 0.000000e+000 R #iv_jump2 //neg. L #_Skal_Dist_Sensor_Dreh L 0.000000e+000 ==R JCN n5e L 1.000000e-006 T #_Skal_Dist_Sensor_Drehn5e: NOP 0/////////////////////////////////////////////////////////////四个象限,第一象限0-90° A #iv_jump1 A #iv_jump2 JCN e51 L #_Skal_Mwert_Kipp_DKipp L #_Skal_Dist_Sensor_Dreh /R ATAN T #_Temp_Winkel_Verh_Y_X //pos Winkel (rad) L 3.140000e+000 惠济军海脑科医院如何/R L 1.800000e+002 *R T #_vi_Winkel_A L #_Temp_Winkel_Verh_Y_X COS L 1.000000e+002 //hmi画的半径 *R RND T #_vi_EngsteStelle_X L #_Temp_Winkel_Verh_Y_X SIN L 1.000000e+002 *R RND T #_vi_EngsteStelle_Ye51: NOP 0/////////位移传感器数值整定 CALL FC 105 IN :=DB41.DBW232 HI_LIM :=2.000000e+000 LO_LIM :=0.000000e+000 BIPOLAR:=FALSE RET_VAL:=#_RetVal OUT :=#_Dist_S_Kipp_P2 CALL FC 105 IN :=DB41.DBW234 HI_LIM :=2.000000e+000 LO_LIM :=0.000000e+000 BIPOLAR:=FALSE RET_VAL:=#_RetVal OUT :=#_Dist_S_DKipp_P3 CALL FC 105 IN :=DB41.DBW230 HI_LIM :=2.000000e+000 LO_LIM :=0.000000e+000 BIPOLAR:=FALSE RET_VAL:=#_RetVal OUT :=#_Dist_S_Dreh_P1///////////////////////////////////////////数值校正 L #_Dist_S_Dreh_P1 L #_Zero_Val_S_Dreh_P1 -R L DB34.DBD 274 *R NEGR T #_Skal_Dist_Sensor_Dreh L #_Dist_S_Kipp_P2 L #_Zero_Val_S_Kipp_P2 -R L DB34.DBD 278 *R NEGR T #_Skal_Dist_Sensor_Kipp L #_Dist_S_DKipp_P3 L #_Zero_Val_S_DKipp_P3 -R L DB34.DBD 278 *R NEGR T #_Skal_Dist_Sensor_DKipp L #_Skal_Dist_Sensor_Kipp L #_Skal_Dist_Sensor_DKipp +R L 2.000000e+000 /R T #_Skal_Mwert_Kipp_DKipp//////////////////////////////////////////////////////////////清零操作 A DB34.DBX 268.0 A DB41.DBX 23.7 JCN N4_1 L #_Dist_S_Dreh_P1 T #_Zero_Val_S_Dreh_P1 L #_Dist_S_Kipp_P2 T #_Zero_Val_S_Kipp_P2 L #_Dist_S_DKipp_P3 T #_Zero_Val_S_DKipp_P3 R DB34.DBX 268.0N4_1: NOP 0 L #_Skal_Mwert_Kipp_DKipp L 0.000000e+000 >=R S #iv_jump1 //positiv L #_Skal_Mwert_Kipp_DKipp L 0.000000e+000 R #iv_jump1 //neg. L #_Skal_Dist_Sensor_Dreh L 0.000000e+000 >=R S #iv_jump2 //pos. L #_Skal_Dist_Sensor_Dreh L 0.000000e+000 R #iv_jump2 //neg. L #_Skal_Dist_Sensor_Dreh L 0.000000e+000 ==R JCN n5e L 1.000000e-006 T #_Skal_Dist_Sensor_Drehn5e: NOP 0/////////////////////////////////////////////////////////////四个象限,第一象限0-90° A #iv_jump1 A #iv_jump2 JCN e51 L #_Skal_Mwert_Kipp_DKipp L #_Skal_Dist_Sensor_Dreh /R ATAN T #_Temp_Winkel_Verh_Y_X //pos Winkel (rad) L 3.140000e+000 /R L 1.800000e+002 *R T #_vi_Winkel_A L #_Temp_Winkel_Verh_Y_X COS L 1.000000e+002 //HMI画的半径 *R RND T #_vi_EngsteStelle_X L #_Temp_Winkel_Verh_Y_X SIN L 1.000000e+002 *R RND T #_vi_EngsteStelle_Ye51: NOP 0////////////////////////////////////////////////////////其他三个象限同理。