Help improving 'if' loop and constraints

1 view (last 30 days)
Zena Assaad
Zena Assaad on 20 Jul 2015
Commented: Walter Roberson on 21 Jul 2015
Hi All,
I have the following problem. Pos1 and Pos2 represent position matrices [3,30]. The first row is x, the second row is y and the third row is z.
if F == 1
Pos1 = [(linspace(depairport(1),arrairport(1),30))
(linspace(depairport(2),arrairport(2),30))
(linspace(depairport(3),arrairport(3),30))]
else if F == 2
Pos2 = [(linspace(depairport(1),arrairport(1),30))
(linspace(depairport(2),arrairport(2),30))
(linspace(depairport(3),arrairport(3),30))]
end
for i = 1:30
%Avoidance Constraints
Pos1(1,2:i)-Pos2(1,1:i-1) >= 5;
Pos1(2,2:i)-Pos2(2,1:i-1) >= 5;
Pos1(3,2:i)-Pos2(3,1:i-1) >= 0.304799;
end
end
The departure and arrival airports are predefined. For this case the coordinates are:
Pos1 departure airport: Pos1(1,:) = (6025274.59584428, 2064061.77044699, 0.132000000000000)
Pos1 arrival airport: Pos1(30,:) = (-4843199.91696000, -1938663.56639792, 0.00900000000000000)
Pos2 departure airport: Pos2(1,:) = (-4843199.91696000, -1938663.56639792, 0.00900000000000000)
Pos 2 arrival airport: Pos2(1,:) = (6025274.59584428, 2064061.77044699, 0.132000000000000)
The avoidance constraints I have specified do not work. I am assuming it has something to do with my 'linspace' command but I'm not too sure.
Additionally, in the future I intend to increase the number of Pos to about 100 different matrices, i.e. I will have Pos1 to Pos100 different position matrices. Is there a better way to write the above loop and constraints without having to write it for each individual position matrix?
Thanks in advance.

Answers (1)

Walter Roberson
Walter Roberson on 20 Jul 2015
The line
Pos1(1,2:i)-Pos2(1,1:i-1) >= 5;
calculates the difference between two array entries, compares the result to 5, creating a logical values 0 (false) or 1 (true) depending on the outcome of the comparison -- and then the logical value is discarded because it has not been stored anywhere and the ";" at the end of the line says not to print it either.
  4 Comments
Zena Assaad
Zena Assaad on 21 Jul 2015
Essentially I have defined starting and ending positions. I need the path between these two points. I need to ensure that the paths of Pos1 and Pos2 do not intersect.
Walter Roberson
Walter Roberson on 21 Jul 2015
Both Pos1 and Pos2 are defined in terms of depairport(1) and arrairport(1). They intersect by construction.
Your variable names are suggestive of airplane planning. Actual airplanes are not everywhere along the route simultaneously: they have a start time and a speed (which might vary along the path). If two given airplanes are not in the air at the same time, their paths do not intersect.
If you have two airplanes flying in opposite directions between the same two locations, both following the straightest path, then their paths do intersect. The usual solution to this problem is to not require them to fly the straightest path, and to instead define avoidance strategies and plan with those strategies. You have not defined any avoidance strategy: you have only defined conditions that must be avoided. When the simulation predicts that the two planes are going to intersect at the midpoint of the flight, your conditions just metaphorically throw up their hands and say "Not allowed! Not allowed!"; you haven't defined anything that allows for fixing the problem. For example, which of the planes is the one with the responsibility to move out of the way? How long before the collision do they need to move? Where are they allowed to move to?
Air traffic controllers in practice assign "flight corridors". And they define protocols about use of that corridor. Protocols such as "North-West flying planes must keep to the North-East side of the corridor and South-East flying planes must keep to the South-West side of the corridor" Or "South-flying planes use flight level 210 through this section, while East-flying planes use flight level 230 through this section".
Your coordinates for the locations are unspecified. They sort of look like they might be positions in meters. But if so then the avoidance margins you defined for the first two coordinates would only be 5 meters, which would be far too little for an airplane.
So what are safe distances? A quick google finds http://aviation.stackexchange.com/questions/2806/how-much-is-the-minimum-safe-distance-between-two-planes-in-flight which says that under some conditions, the lateral distance must be as much as 5 miles. 5 miles, and your constraint is 5, so perhaps your units are miles? Your z avoidance is 0.304799 which just happens to be the number of feet per meter, so 1000 feet (FAA flight vertical flight separation) would be 0.304799 kilometers, which suggests that No, we are working in kilometers. Does 5 kilometers make sense for later separation? Well during the terminal portion of the flight, the FAA separation is 3 miles which is 4.82803 kilometers. So, no 5 kilometers does not make sense: when you specify the vertical separation to the millionth of a foot, you are not going to round 4.82803 to 5 kilometers. So we must be dealing with miles and the enroute portion of the flight... Or are we?
See how messy things get when you do not provide enough detail?

Sign in to comment.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!