You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
 
Thread Tools Display Modes
Old October 29th, 2018, 09:54 AM   #1
Aleksandra
Member
Serbia

Aleksandra is offline
 
Join Date: May 2018
Location: Belgrade
Posts: 18
STL Shell sorting algorithm

Hello,


I need to implement sorting algorithm in STL. I was thinking about using Shell sort, but I don't know how to do this with such a low programming language. Has anybody done something similar?


It doesn't have to be Shell, but since I have an array of 100 structs, it has to be fast.


Have in mind that I don't have much experience in programming with STL.


Any ideas?



Thanks in advance
  Reply With Quote
Old October 29th, 2018, 10:10 AM   #2
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 13,429
Do you have SCL ?
__________________
Jesper
3 strikes and you're out
  Reply With Quote
Old October 29th, 2018, 10:18 AM   #3
Aleksandra
Member
Serbia

Aleksandra is offline
 
Join Date: May 2018
Location: Belgrade
Posts: 18
I have SCL, but the project demands are such that it has to be done in STL (unfortunately )


I understand how the algorithm works, but I have no idea how to write this in STL...


Thanks for the reply
  Reply With Quote
Old October 29th, 2018, 10:20 AM   #4
geniusintraining
Lifetime Supporting Member + Moderator
United States

geniusintraining is offline
 
geniusintraining's Avatar
 
Join Date: Jun 2005
Location: SC
Posts: 5,864
Not sure if this will help

Also not sure what software you are using but they have you looked at LGF_ShellSortInt ? its for TIA portal

Page 40

https://cache.industry.siemens.com/d..._V1_0_1_en.pdf
__________________
www.PLCCable.com PLC Communication Cables, PLC Trainers, Fluke Meters, MicroLogix, ControlLogix, Siemens, Allen Bradley and more... all your automation needs... ((NEW)) After Market 1784-U2DHP Allen Bradley USB to DH+ and Gateways
  Reply With Quote
Old October 29th, 2018, 10:27 AM   #5
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 13,429
What is it that "demands" it to be done in STL ?

You could write it in SCL, compile it, and then open the compiled code as STL.
__________________
Jesper
3 strikes and you're out
  Reply With Quote
Old October 29th, 2018, 10:38 AM   #6
Aleksandra
Member
Serbia

Aleksandra is offline
 
Join Date: May 2018
Location: Belgrade
Posts: 18
That is not bad idea at all!


I have to write it in STL because the customer wants it.
  Reply With Quote
Old October 29th, 2018, 10:54 AM   #7
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 13,429
Tell the customer to grow up and use SCL.



No, seriously !
__________________
Jesper
3 strikes and you're out
  Reply With Quote
Old October 29th, 2018, 11:03 AM   #8
JesperMP
Lifetime Supporting Member + Moderator
Denmark

JesperMP is offline
 
JesperMP's Avatar
 
Join Date: Feb 2003
Location: Copenhagen.
Posts: 13,429
Btw, I would program it as an FB, with the data to be sorted as part of the declared STAT variables.
This because the access to the data will be much faster if it is local instance data, and not by refence, i.e. by pointer.
__________________
Jesper
3 strikes and you're out
  Reply With Quote
Old October 29th, 2018, 12:07 PM   #9
cardosocea
Member
United Kingdom

cardosocea is offline
 
Join Date: Nov 2016
Location: Fields of corn
Posts: 1,110
Quote:
Originally Posted by Aleksandra View Post
I have SCL, but the project demands are such that it has to be done in STL (unfortunately )
Is the customer internal? Is this on Step7 Classic or TIA Portal? Step7 Classic doesn't come with SCL by default, it's a separate bit you need to get license for I believe.
That is not the case for TIA Portal.
  Reply With Quote
Old October 29th, 2018, 01:33 PM   #10
Aleksandra
Member
Serbia

Aleksandra is offline
 
Join Date: May 2018
Location: Belgrade
Posts: 18
Quote:
Originally Posted by JesperMP View Post
Btw, I would program it as an FB, with the data to be sorted as part of the declared STAT variables.
This because the access to the data will be much faster if it is local instance data, and not by refence, i.e. by pointer.
I have made an FB where the sorting will be implemented, and at the beginning of the program I copy DB which I need to sort into the instance DB of that FB.
  Reply With Quote
Old October 29th, 2018, 01:36 PM   #11
Aleksandra
Member
Serbia

Aleksandra is offline
 
Join Date: May 2018
Location: Belgrade
Posts: 18
Quote:
Originally Posted by cardosocea View Post
is the customer internal? Is this on step7 classic or tia portal? Step7 classic doesn't come with scl by default, it's a separate bit you need to get license for i believe.
That is not the case for tia portal.
step 7
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Programming Exercise: Sorting Algorithm w/Dynamic AOI Results Paully's5.0 LIVE PLC Questions And Answers 19 January 29th, 2017 05:32 PM
S7 300 with Profibus communication jayasiri LIVE PLC Questions And Answers 26 August 27th, 2015 06:00 AM
The Difference between ladder logic diagrams (LDR) and statement list (STL) in PLC ? jimbojohn LIVE PLC Questions And Answers 9 March 14th, 2015 02:40 PM
Online status of STL code in Step 7 Outrage LIVE PLC Questions And Answers 5 August 2nd, 2006 03:06 AM
S5 STL Help......please Peter_d LIVE PLC Questions And Answers 19 June 28th, 2005 03:09 PM


All times are GMT -5. The time now is 11:56 PM.


.