PW_PowerSystem.mo 7.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. model PW_PowerSystem
  2. Modelica.Electrical.Machines.BasicMachines.DCMachines.DC_ElectricalExcited motor(Jr(start = 0.085), Js = 0.085, La = 0.036, Le = 4, Ra = 0.15, Re = 1.5, TaOperational = 293.15, TaRef = 293.15, TeOperational = 293.15, TeRef = 293.15, alpha20a = 0, alpha20e = 0, frictionParameters = motor_frictionParameters, sigmae = 0.2, useSupport = false, useThermalPort = false) annotation(Placement(visible = true, transformation(origin = {-8, -28}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  3. Modelica.Electrical.Analog.Basic.Ground voltage_ground annotation(Placement(visible = true, transformation(origin = {-70, -34}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  4. Modelica.Electrical.Analog.Sources.ConstantVoltage dc_motor_power(V = 12) annotation(Placement(visible = true, transformation(origin = {-48, -8}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  5. Modelica.Electrical.Analog.Sources.ConstantVoltage up_voltage(V = 12) annotation(Placement(visible = true, transformation(origin = {-62, 48}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  6. Modelica.Electrical.Analog.Basic.Ground up_ground annotation(Placement(visible = true, transformation(origin = {-90, 24}, extent = {{-10, -10}, {10, 10}}, rotation = -90)));
  7. Modelica.Blocks.Logical.GreaterThreshold convertToBoolean(threshold = 0.5) annotation(Placement(visible = true, transformation(origin = {-64, 84}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  8. Modelica.Blocks.Logical.GreaterThreshold greaterThreshold1(threshold = 0.5) annotation(Placement(visible = true, transformation(origin = {64, 84}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  9. input Modelica.Blocks.Interfaces.RealInput up_input annotation(Placement(visible = true, transformation(origin = {-100, 84}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-68, 60}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
  10. input Modelica.Blocks.Interfaces.RealInput down_input annotation(Placement(visible = true, transformation(origin = {100, 84}, extent = {{20, -20}, {-20, 20}}, rotation = 0), iconTransformation(origin = {-68, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
  11. input Modelica.Blocks.Interfaces.RealInput input_torque annotation(Placement(visible = true, transformation(origin = {100, -76}, extent = {{20, -20}, {-20, 20}}, rotation = 0), iconTransformation(origin = {-68, -60}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
  12. Modelica.Mechanics.Rotational.Sources.Torque torque1 annotation(Placement(visible = true, transformation(origin = {62, -76}, extent = {{10, -10}, {-10, 10}}, rotation = 0)));
  13. Modelica.Mechanics.Rotational.Sensors.SpeedSensor speedSensor1 annotation(Placement(visible = true, transformation(origin = {60, -28}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  14. output Modelica.Blocks.Interfaces.RealOutput speed annotation(Placement(visible = true, transformation(origin = {94, -28}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {70, -64}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  15. Modelica.Electrical.Analog.Sensors.CurrentSensor arm_sensor annotation(Placement(visible = true, transformation(origin = {16, -4}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
  16. output Modelica.Blocks.Interfaces.RealOutput arm_current annotation(Placement(visible = true, transformation(origin = {94, -4}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {70, 58}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  17. parameter Modelica.Electrical.Machines.Losses.FrictionParameters motor_frictionParameters(PRef = 1, power_w = 1, wRef = 1000) annotation(Placement(visible = true, transformation(origin = {-6, -60}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
  18. Modelica.Electrical.Analog.Ideal.IdealCommutingSwitch idealCommutingSwitch1 annotation(Placement(visible = true, transformation(origin = {16, 28}, extent = {{-10, 10}, {10, -10}}, rotation = 90)));
  19. Modelica.Electrical.Analog.Ideal.IdealCommutingSwitch idealCommutingSwitch2 annotation(Placement(visible = true, transformation(origin = {-14, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
  20. equation
  21. connect(speedSensor1.w, speed) annotation(Line(points = {{71, -28}, {94, -28}}, color = {0, 0, 127}));
  22. connect(motor.flange, speedSensor1.flange) annotation(Line(points = {{2, -28}, {50, -28}}));
  23. connect(idealCommutingSwitch2.n1, up_voltage.p) annotation(Line(points = {{-18, 10}, {-20, 10}, {-20, 58}, {-62, 58}, {-62, 58}}, color = {0, 0, 255}));
  24. connect(idealCommutingSwitch1.n2, up_voltage.n) annotation(Line(points = {{16, 38}, {16, 38}, {16, 42}, {-52, 42}, {-52, 38}, {-62, 38}, {-62, 38}}, color = {0, 0, 255}));
  25. connect(up_voltage.p, idealCommutingSwitch1.n1) annotation(Line(points = {{-62, 58}, {20, 58}, {20, 38}, {22, 38}}, color = {0, 0, 255}));
  26. connect(greaterThreshold1.y, idealCommutingSwitch1.control) annotation(Line(points = {{54, 84}, {32, 84}, {32, 28}, {24, 28}, {24, 28}, {24, 28}}, color = {255, 0, 255}));
  27. connect(arm_sensor.n, idealCommutingSwitch1.p) annotation(Line(points = {{16, 6}, {16, 18}}, color = {0, 0, 255}));
  28. connect(idealCommutingSwitch2.n2, up_ground.p) annotation(Line(points = {{-14, 10}, {-14, 10}, {-14, 24}, {-80, 24}, {-80, 24}}, color = {0, 0, 255}));
  29. connect(motor.pin_an, idealCommutingSwitch2.p) annotation(Line(points = {{-14, -18}, {-14, -18}, {-14, -10}, {-14, -10}}, color = {0, 0, 255}));
  30. connect(convertToBoolean.y, idealCommutingSwitch2.control) annotation(Line(points = {{-52, 84}, {-28, 84}, {-28, 0}, {-22, 0}, {-22, 0}}, color = {255, 0, 255}));
  31. connect(arm_sensor.i, arm_current) annotation(Line(points = {{26, -4}, {94, -4}}, color = {0, 0, 127}));
  32. connect(arm_sensor.p, motor.pin_ap) annotation(Line(points = {{16, -14}, {16, -18}, {-2, -18}}, color = {0, 0, 255}));
  33. connect(up_input, convertToBoolean.u) annotation(Line(points = {{-100, 84}, {-76, 84}}, color = {0, 0, 127}));
  34. connect(down_input, greaterThreshold1.u) annotation(Line(points = {{100, 84}, {76, 84}}, color = {0, 0, 127}));
  35. connect(torque1.flange, motor.flange) annotation(Line(points = {{52, -76}, {22, -76}, {22, -28}, {2, -28}, {2, -28}}));
  36. connect(torque1.tau, input_torque) annotation(Line(points = {{74, -76}, {100, -76}}, color = {0, 0, 127}));
  37. connect(dc_motor_power.p, motor.pin_ep) annotation(Line(points = {{-48, 2}, {-33, 2}, {-33, -22}, {-18, -22}}, color = {0, 0, 255}));
  38. connect(motor.pin_en, voltage_ground.p) annotation(Line(points = {{-18, -34}, {-60, -34}}, color = {0, 0, 255}));
  39. connect(up_voltage.n, up_ground.p) annotation(Line(points = {{-62, 38}, {-62, 24}, {-80, 24}}, color = {0, 0, 255}));
  40. connect(dc_motor_power.n, voltage_ground.p) annotation(Line(points = {{-48, -18}, {-48, -18}, {-48, -34}, {-60, -34}, {-60, -34}}, color = {0, 0, 255}));
  41. annotation(Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), Diagram(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = true, initialScale = 0.1, grid = {2, 2})), experiment(StartTime = 0, StopTime = 8, Tolerance = 0.0001, Interval = 0.004), uses(Modelica(version = "3.2.2")));
  42. end PW_PowerSystem;