Sort an Array

Hello,

I create an arry with two dimenions.

F1: ARRAY [0..3, 0..1] OF UDINT;

Now I would like to sort this array in the first dimension ascending.

Does somebody has any idea?


Add New Comment


TW   

asked 9 days ago



Answers

0

Hi,

given the small size a simple double For loop "bubble sort" should do it. Do you need to do this cyclically? What is the purpose?

Best regards

Jürgen

JuergenV   

answered 9 days ago


 


By TW on 8/10/2017 | Like (0) | Report

I have 4 Motors M1-M4.
In the array i would safe the running time in row one and in row two the name of the Motor.
then i will sort the array. So I have a list with the motor with the least running time to the max running time.
With row two i can check the motor to have the least running time.

Do you have an example for me? ;-)


By JuergenV on 8/10/2017 | Like (0) | Report

Check out https://en.wikipedia.org/wiki/Bubble_sort
There is a Pseudocode implementation which is pretty much like ST


By TW on 8/10/2017 | Like (1) | Report

REPEAT
Sort_Change := false ;
for i 0 to 2 by 1 do
if F1[i]>F[i+1] then
G:=F1[i+1];
F1[i+1]:=F1[i];
F1[i]:=G;
Sort_Change := true ;
end_if;
end_for ;

until not Sort_Change
end_Repeat ;


Add New Comment



Get weekly AKS updates


Partner Exclusive Webinars

 

> – Login to the partner portal to register



Points Redemption Program - Redeem your points for ABB training, Bluetooth speakers and mugs. Terms and conditions >


Earn points when you refer a friend
AKS Referral Program is "Live" - Learn more



AKS Experts


avatar
Ask Harsha.D   

Rank: 5

Tech.Support,software and commisioning engineer with Proficient knowledge in 800xA and its products, RNRP,Networking in general.


avatar
Ask Dieter Henkel   

Rank: 24


avatar
Ask Sumit Gargav   

Rank: 2

I have worked with Freelance in majority, with 800xA FD and Melody system partly. Also had opportunity to work with Protocols - HART,Profibus,FF & Modbus.


avatar
Ask Govindaraj   

Rank: 10

Working in ABB India Operation Center. Have Project engineering and commissioning experience in ABB 800xA, Freelance, AC500.


avatar
Ask Stefan Stromqvist   

Rank: 1

I joined ABB in the year of 1994 and has since 1999 been working as a Service & Support Engineer at BU Control Technologies in Västerås, Sweden. My areas of expertise are: 800xA Base, 800xA for Advant Master, Information Management, operating systems, RNRP and Ethernet comms/networking in general.


avatar
Ask Flavio Mussolin   

Rank: 6

ABB AVP, Senior Electronic and Automation Engineer with over 30 years of experience in the field of process automation automotive, pharmaceutical, hollow glass, steel and rolling.


avatar
Ask kstoilov   

Rank: 22

Control System Engineer: 800xA, Compact 800, AC500, AC31-50, Advant Master, Simatic, AC&DC Drives 11 years worked for ABB - Control Systems


avatar
Ask nikismith   

Rank: 258

I have been a part of the Recording & Control Factory team for 17 years in total, having spent a number of years as a repairs technician withi the manufacturing department, but being in my current role for 9 years now.


avatar
Ask MMM   

Rank: 4

ABB PA CT Technical Support


avatar
Ask Rob Lyon   

Rank: 3

info@lymac.co.nz I'm an independent DCS software and commissioning engineer with extensive experience in 800xA and other ABB products. I've worked in almost every corner of the world and still haven't seen it all.