AIDA is a study case for model based system engineering, made by MOISE project. This project contains the simulation model of AIDA (made with SimulationX in Modelica)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
4.2 KiB

within AIDAModelica;
model ControlAltitudeEx "[SF2.4] Control altitude Ex"
// CP: 65001
// SimulationX Version: 3.8.2.45319 x64
Modelica.Blocks.Interfaces.RealOutput TotalThrustManual(quantity = "Mechanics.Translation.Force", displayUnit = "N") "Desired total thrust autopilot mode output" annotation(
Placement(transformation(extent = {{80, -20}, {100, 0}}), iconTransformation(origin = {100, 0}, extent = {{-10, -10}, {10, 10}})));
Modelica.Blocks.Interfaces.RealInput VSpeed(quantity = "Mechanics.Translation.Velocity", displayUnit = "m/s") "Real drone speed feedback" annotation(
Placement(transformation(extent = {{-145, -15}, {-105, 25}}), iconTransformation(origin = {-50, -100}, extent = {{-20, -20}, {20, 20}}, rotation = 90)));
Modelica.Blocks.Interfaces.RealInput RCVerticalSpeedCommand(quantity = "Mechanics.Translation.Velocity", displayUnit = "m/s") "'input Real' as connector" annotation(
Placement(transformation(extent = {{-145, 35}, {-105, 75}}), iconTransformation(origin = {-100, 0}, extent = {{-20, -20}, {20, 20}})));
Modelica.Blocks.Interfaces.RealInput Acceleration(quantity = "Acceleration", displayUnit = "m/s²") "To prevent PID derivation of speed" annotation(
Placement(transformation(extent = {{-125, -75}, {-85, -35}}), iconTransformation(origin = {50, -100}, extent = {{-20, -20}, {20, 20}}, rotation = 90)));
ComputeTotalThrustCA computeTotalThrustCA1 annotation(
Placement(transformation(extent = {{25, -20}, {45, 0}})));
AIDAModelica.ComputeAltitudeConsign computeAltitudeConsign1 annotation(
Placement(visible = true, transformation(extent = {{-11, 28}, {9, 48}}, rotation = 0)));
PID_2 pID_2 annotation(
Placement(transformation(extent = {{-15, -20}, {5, 0}})));
equation
connect(computeAltitudeConsign1.VSpeed, VSpeed) annotation(
Line(points = {{-11, 33}, {-120, 33}, {-120, 5}, {-125, 5}}, color = {0, 0, 127}));
connect(computeAltitudeConsign1.RCVerticalSpeedCommand, RCVerticalSpeedCommand) annotation(
Line(points = {{-11, 43}, {-120, 43}, {-120, 55}, {-125, 55}}, color = {0, 0, 127}, thickness = 0.0625));
connect(computeTotalThrustCA1.TotalThrustAP, TotalThrustManual) annotation(
Line(points = {{45, -10}, {50, -10}, {85, -10}, {90, -10}}, color = {0, 0, 127}, thickness = 0.0625));
connect(RCVerticalSpeedCommand, pID_2.Consign) annotation(
Line(points = {{-125, 55}, {-120, 55}, {-20, 55}, {-20, -10}, {-15, -10}}, color = {0, 0, 127}, thickness = 0.0625));
connect(VSpeed, pID_2.u) annotation(
Line(points = {{-125, 5}, {-120, 5}, {-120, -25}, {-10, -25}, {-10, -20}}, color = {0, 0, 127}, thickness = 0.0625));
connect(Acceleration, pID_2.du) annotation(
Line(points = {{-105, -55}, {-100, -55}, {0, -55}, {0, -25}, {0, -20}}, color = {0, 0, 127}, thickness = 0.0625));
connect(pID_2.y, computeTotalThrustCA1.AccelerationConsign) annotation(
Line(points = {{6, -10}, {11, -10}, {20, -10}, {25, -10}}, color = {0, 0, 127}, thickness = 0.0625));
annotation(
Speed(flags = 2),
TotalThrustManual(flags = 2),
RCVerticalSpeedCommand(flags = 2),
computeTotalThrustCA1(AccelerationConsign(flags = 2), TotalThrustAP(flags = 2), AC(flags = 2)),
computeAltitudeConsign1(RCVerticalSpeedCommand(flags = 2), AccelerationConsign(flags = 2), PID1(u(flags = 2), y(flags = 2), P(u(flags = 2), y(flags = 2)), I(u(flags = 2), y(flags = 2)), D(u(flags = 2), y(flags = 2), x(flags = 2)), Gain(u(flags = 2), y(flags = 2)), Add(u1(flags = 2), u2(flags = 2), u3(flags = 2), y(flags = 2))), speedErrorModelSAC1(SpeedConsign(flags = 2), Speed(flags = 2), SpeedError(flags = 2), vzd(flags = 2), vz(flags = 2), ASE(flags = 2))),
Icon(graphics = {Rectangle(fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, 100}, {100, -100}}), Text(origin = {0, 3}, extent = {{-40, 13}, {40, -13}}, textString = "Control Altitude")}, coordinateSystem(initialScale = 0.1)),
experiment(StopTime = 1, StartTime = 0, Interval = 0.002, MaxInterval = "0.001"),
Diagram(graphics = {Text(origin = {26, 54}, extent = {{-8, 4}, {72, -26}}, textString = "Initial solution, with no acceleration as input"), Text(origin = {32, 27}, extent = {{-10, -3}, {76, 23}}, textString = "Need for speed derivation, bad choice in cosimulation")}));
end ControlAltitudeEx;