⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 catcher2.mo

📁 在这个压缩文件中
💻 MO
字号:
package catcher2 
  model motor 
    Modelica.Electrical.Analog.Sources.SignalVoltage Vs annotation (extent=[-70,20;
          -50,0],            rotation=90);
    Modelica.Electrical.Analog.Basic.Ground G annotation (extent=[-70,-50; -50,
          -30]);
    Modelica.Electrical.Analog.Basic.Resistor Ra(R=1.69) 
                                                        annotation (extent=[-50,40;
          -30,60]);
    Modelica.Electrical.Analog.Basic.Inductor La(L=.00007) 
                                                         annotation (extent=[-10,40;
          10,60]);
    Modelica.Electrical.Analog.Basic.EMF emf(k=.0104) 
                                             annotation (extent=[10,0; 30,20]);
    Modelica.Mechanics.Rotational.Inertia Jm(J=.000000385) 
                                                      annotation (extent=[50,0; 70,
          20]);
    Modelica.Blocks.Interfaces.InPort inPort(final n=1) annotation (extent=[-118,0;
          -100,20]);
    Modelica.Mechanics.Rotational.Interfaces.Flange_b flange_b annotation (
        extent=[100,0; 120,20]);
  equation 
    connect(Ra.n,La. p) annotation (points=[-30,50; -10,50]);
    connect(La.n,emf. p) annotation (points=[10,50; 20,50; 20,20]);
    connect(emf.flange_b,Jm. flange_a) annotation (points=[30,10; 50,10]);
    connect(Ra.p,Vs. p) annotation (points=[-50,50; -60,50; -60,20]);
    connect(Vs.n,emf. n) annotation (points=[-60,0; -60,-10; 20,-10; 20,0]);
    connect(G.p,Vs. n) annotation (points=[-60,-30; -60,0]);
    connect(Jm.flange_b,flange_b)  annotation (points=[70,10; 110,10]);
    connect(inPort,Vs. inPort) annotation (points=[-109,10; -67,10]);
    annotation (Diagram);
  end motor;
  annotation (uses(
      Modelica(version="1.6"),
      MultiBody(version="1.0.1"),
      ModelicaAdditions(version="1.5")));
  model robot 
    annotation (Diagram, Icon(Bitmap(extent=[-100,104; 100,-102], name=
              "da1.JPG")));
    MultiBody.Joints.ActuatedRevolute ActuatedRevolute1(n={0,1,0},
      cylinderLength=.01,
      phi_offset=-90) 
      annotation (extent=[-40,40; -20,60],   rotation=0);
    MultiBody.Joints.ActuatedRevolute ActuatedRevolute2(n={0,0,1},
      cylinderLength=.04,
      cylinderDiameter=.02,
      phi_offset=0) 
      annotation (extent=[-80,-20; -60,0],
                                         rotation=0);
    MultiBody.Joints.ActuatedRevolute ActuatedRevolute3(
      cylinderLength=.04,
      cylinderDiameter=.02,
      phi_offset=0) 
      annotation (extent=[-80,-80; -60,-60]);
    MultiBody.Parts.BodyCylinder link1(
      animation=true,
      color={100,100,100},
      density=2.77,
      r={0,.01,0},
      diameter=.05) annotation (extent=[0,40; 20,60],      rotation=0);
    MultiBody.Parts.BodyBox link2(
      innerWidth=0,
      density=2.77,
      width=.03,
      height=.04,
      r={0,.2,0})  annotation (extent=[-40,-20; -20,0]);
    MultiBody.Parts.BodyBox link3(
      density=2.77,
      width=.03,
      height=.045,
      r={0,.23,0}) 
                  annotation (extent=[-40,-80; -20,-60]);
    inner MultiBody.World world annotation (extent=[-80,60; -60,80]);
    MultiBody.Parts.BodyBox base(
      innerWidth=0,
      width=.15,
      height=.15,
      r={0,0.1,0}) annotation (extent=[-80,40; -60,60],   rotation=0);
    MultiBody.Parts.BodyBox link4(
      width=.03,
      r={0,.01,0},
      height=.03,
      density=77.78) 
                  annotation (extent=[20,-80; 0,-60], rotation=180);
    Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensor 
      annotation (extent=[-20,70; 0,90], rotation=0);
    Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensor 
      annotation (extent=[20,70; 40,90], rotation=0);
    Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensor2 
      annotation (extent=[-60,-50; -40,-30]);
    Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensor2 
      annotation (extent=[-20,-50; 0,-30]);
    Modelica.Mechanics.Rotational.Sensors.AngleSensor angleSensor1 
      annotation (extent=[-60,10; -40,30]);
    Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensor1 
      annotation (extent=[-20,10; 0,30]);
    Modelica.Mechanics.Rotational.Interfaces.Flange_a torque3 
      annotation (extent=[-120,-70; -100,-50]);
    Modelica.Mechanics.Rotational.Interfaces.Flange_a torque2 
      annotation (extent=[-120,-10; -100,10]);
    Modelica.Mechanics.Rotational.Interfaces.Flange_a torque1 
      annotation (extent=[-120,50; -100,70]);
    Modelica.Blocks.Interfaces.OutPort alfad1 
      annotation (extent=[100,40; 120,60]);
    Modelica.Blocks.Interfaces.OutPort alfa1 
      annotation (extent=[100,60; 120,80]);
    Modelica.Blocks.Interfaces.OutPort alfad2 
      annotation (extent=[100,-20; 120,0]);
    Modelica.Blocks.Interfaces.OutPort alfa2 annotation (extent=[100,0; 120,20]);
    Modelica.Blocks.Interfaces.OutPort alfad3 
      annotation (extent=[100,-80; 120,-60]);
    Modelica.Blocks.Interfaces.OutPort alfa3 
      annotation (extent=[100,-60; 120,-40]);
  equation 
    connect(ActuatedRevolute2.frame_b,link2. frame_a)    annotation (points=[-59,-10;
          -41,-10],    style(
        color=0,
        rgbcolor={0,0,0},
        thickness=2));
    connect(link1.frame_b, ActuatedRevolute2.frame_a) annotation (points=[21,50;
          40,50; 40,34; -92,34; -92,-10; -81,-10], style(
        color=0,
        rgbcolor={0,0,0},
        thickness=2));
    connect(base.frame_b, ActuatedRevolute1.frame_a) annotation (points=[-59,50;
          -41,50], style(
        color=0,
        rgbcolor={0,0,0},
        thickness=2));
    connect(world.frame_b, ActuatedRevolute1.frame_a) annotation (points=[-59,
          70; -50,70; -50,50; -41,50], style(
        color=0,
        rgbcolor={0,0,0},
        thickness=2));
    connect(ActuatedRevolute1.frame_b, link1.frame_a) annotation (points=[-19,
          50; -1,50], style(
        color=0,
        rgbcolor={0,0,0},
        thickness=2));
    connect(ActuatedRevolute1.bearing, angleSensor.flange_a) annotation (points=
         [-36,60; -36,80; -20,80], style(color=0, rgbcolor={0,0,0}));
    connect(speedSensor.flange_a, ActuatedRevolute1.bearing) annotation (points=
         [20,80; 20,70; -36,70; -36,60], style(color=0, rgbcolor={0,0,0}));
    connect(link2.frame_b, ActuatedRevolute3.frame_a) annotation (points=[-19,
          -10; -12,-10; -12,-26; -92,-26; -92,-70; -81,-70], style(
        color=0,
        rgbcolor={0,0,0},
        thickness=2));
    connect(ActuatedRevolute3.frame_b, link3.frame_a) annotation (points=[-59,
          -70; -41,-70], style(
        color=0,
        rgbcolor={0,0,0},
        thickness=2));
    connect(link3.frame_b, link4.frame_a) annotation (points=[-19,-70; -1,-70],
        style(
        color=0,
        rgbcolor={0,0,0},
        thickness=2));
    connect(ActuatedRevolute2.bearing, angleSensor1.flange_a) annotation (
        points=[-76,0; -76,20; -60,20], style(color=0, rgbcolor={0,0,0}));
    connect(speedSensor1.flange_a, ActuatedRevolute2.bearing) annotation (
        points=[-20,20; -20,10; -76,10; -76,0], style(color=0, rgbcolor={0,0,0}));
    connect(ActuatedRevolute3.bearing, angleSensor2.flange_a) annotation (
        points=[-76,-60; -76,-40; -60,-40], style(color=0, rgbcolor={0,0,0}));
    connect(speedSensor2.flange_a, ActuatedRevolute3.bearing) annotation (
        points=[-20,-40; -20,-50; -76,-50; -76,-60], style(color=0, rgbcolor={0,
            0,0}));
    connect(ActuatedRevolute3.axis, torque3) annotation (points=[-70,-60; -110,
          -60], style(color=0, rgbcolor={0,0,0}));
    connect(ActuatedRevolute2.axis, torque2) 
      annotation (points=[-70,0; -110,0], style(color=0, rgbcolor={0,0,0}));
    connect(ActuatedRevolute1.axis, torque1) 
      annotation (points=[-30,60; -110,60], style(color=0, rgbcolor={0,0,0}));
    connect(speedSensor.outPort, alfad1) annotation (points=[41,80; 50,80; 50,
          50; 110,50], style(color=3, rgbcolor={0,0,255}));
    connect(angleSensor.outPort, alfa1) annotation (points=[1,80; 50,80; 50,70;
          110,70], style(color=3, rgbcolor={0,0,255}));
    connect(speedSensor1.outPort, alfad2) annotation (points=[1,20; 50,20; 50,
          -10; 110,-10], style(color=3, rgbcolor={0,0,255}));
    connect(angleSensor1.outPort, alfa2) annotation (points=[-39,20; 50,20; 50,
          10; 110,10], style(color=3, rgbcolor={0,0,255}));
    connect(speedSensor2.outPort, alfad3) annotation (points=[1,-40; 52,-40; 52,
          -70; 110,-70], style(color=3, rgbcolor={0,0,255}));
    connect(angleSensor2.outPort, alfa3) annotation (points=[-39,-40; 52,-40;
          52,-50; 110,-50], style(color=3, rgbcolor={0,0,255}));
  end robot;
  
  model test1 
    motor motor1 annotation (extent=[-60,48; -40,68]);
    motor motor2 annotation (extent=[-60,-12; -40,8]);
    motor motor3 annotation (extent=[-60,-72; -40,-52]);
    Modelica.Blocks.Interfaces.InPort v1 
      annotation (extent=[-120,50; -100,70]);
    Modelica.Blocks.Interfaces.InPort v2 
      annotation (extent=[-120,-10; -100,10]);
    Modelica.Blocks.Interfaces.InPort v3 
      annotation (extent=[-120,-70; -100,-50]);
    robot robot1 annotation (extent=[-6,-28; 60,28]);
    Modelica.Blocks.Interfaces.OutPort alfa1 
      annotation (extent=[100,80; 120,100]);
    Modelica.Blocks.Interfaces.OutPort alfad3 
      annotation (extent=[100,-100; 120,-80]);
    Modelica.Blocks.Interfaces.OutPort alfa3 
      annotation (extent=[100,-64; 120,-44]);
    Modelica.Blocks.Interfaces.OutPort alfad2 
      annotation (extent=[100,-30; 120,-10]);
    Modelica.Blocks.Interfaces.OutPort alfad1 
      annotation (extent=[100,44; 120,64]);
    Modelica.Blocks.Interfaces.OutPort alfa2 
      annotation (extent=[100,10; 120,30]);
  equation 
    connect(motor1.inPort, v1)      annotation (points=[-60.9,59; -80.45,59;
          -80.45,60; -110,60], style(color=3, rgbcolor={0,0,255}));
    connect(motor2.inPort, v2)      annotation (points=[-60.9,-1; -81.45,-1;
          -81.45,0; -110,0],   style(color=3, rgbcolor={0,0,255}));
    connect(motor3.inPort, v3)      annotation (points=[-60.9,-61; -79.45,-61;
          -79.45,-60; -110,-60], style(color=3, rgbcolor={0,0,255}));
    annotation (Diagram);
    connect(robot1.alfa1, alfa1) annotation (points=[63.3,19.6; 63.3,88.8; 110,
          88.8; 110,90], style(color=3, rgbcolor={0,0,255}));
    connect(robot1.alfad3,alfad3)  annotation (points=[63.3,-19.6; 64,-90; 110,
          -90], style(color=3, rgbcolor={0,0,255}));
    connect(robot1.alfa3,alfa3)  annotation (points=[63.3,-14; 80,-14; 80,-54; 
          110,-54], style(color=3, rgbcolor={0,0,255}));
    connect(robot1.alfad2, alfad2) annotation (points=[63.3,-2.8; 95.65,-2.8; 
          95.65,-20; 110,-20], style(color=3, rgbcolor={0,0,255}));
    connect(robot1.alfad1,alfad1)  annotation (points=[63.3,14; 80,14; 80,54; 
          110,54], style(color=3, rgbcolor={0,0,255}));
    connect(robot1.alfa2,alfa2)  annotation (points=[63.3,2.8; 95.65,2.8; 95.65,
          20; 110,20], style(color=3, rgbcolor={0,0,255}));
    connect(motor1.flange_b, robot1.torque1) annotation (points=[-39,59; -11.5,
          59; -11.5,16.8; -9.3,16.8], style(color=0, rgbcolor={0,0,0}));
    connect(motor2.flange_b, robot1.torque2) annotation (points=[-39,-1; -12.5,
          -1; -12.5,3.55271e-015; -9.3,3.55271e-015], style(color=0, rgbcolor={
            0,0,0}));
    connect(motor3.flange_b, robot1.torque3) annotation (points=[-39,-61; -13.5,
          -61; -13.5,-16.8; -9.3,-16.8], style(color=0, rgbcolor={0,0,0}));
  end test1;
  
  model test2 
    test1 test1_1 annotation (extent=[-20,0; 0,20]);
  end test2;
end catcher2;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -