程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Application of bubbling method in program thought in advanced scl programming in python and 1200PLC

編輯:Python
冒泡排序:It is an algorithm in the field of computer science.headerThe name of the algorithm comes from the fact that the smaller elements are slowly exchanged when the algorithm is executed“浮”到數列的頂端(升序或降序排列),就如同碳酸飲料中二氧化碳的氣泡最終會上浮到頂端一樣,所以叫做“冒泡排序”.header----------------------------------------------------------------------------------------------一、在python中排序1、在pythonto sort the data size in the list2、排序後的結果

二、在西門子1200PLC中用SCL排序

1、在1200PLC中,Sort an array of indeterminate length,For variable-length array data types can only be built inInOut引腳上



2、Create a new one of any numberArrayA variable of type integer data type,運行後的結果



三、總結

1、The two ideas are the same.Both exchange positions by cyclic comparison,Push data features to the end,It can also be the first.

2、在具體實現上,python用While循環,用的len()method to get the number of loop rounds and the number of comparisons;scl用FOR循環,用LOWER_BOUND()和UPPER_BOUND()to determine the lower and upper bounds of the comparison array,Then select the first one in the outer loop and compare them one by one in the inner loop.

四、擴展:sclUse existing functions to find the maximum and minimum values ​​in an array

1、對定長ArrayFind the maximum and minimum values,可以直接用FC功能塊



2、運行結果



3、改進,to indefinite lengthArrayFind the maximum and minimum values



4、修改後的scl,用了Static管腳的Upper上限,所以用的FB功能塊.



5、運行結果

The bubbling method in procedural thinkingpython和1200PLC中sclMore related articles on applications in advanced programming

  1. unixenvironment in advanced programmingerr_quit,err_sys用到的知識點

    unixenvironment in advanced programmingerr_quit,err_sys 環境 os CentOS release 6.7 (Final) gcc 4.4.7 c語言預備知識 標准輸入輸出文件 在linuxeverything in the system ...

  2. 2018.8.15 pythonBubble sort in

    # gives a list of pure numbers. Please sort the list. # 思路: # 1.完成a和b的數據交換. 例如, a = 10, b = 24 交換之後, a = 24, b = 10 # 2.循環列表. 判斷a[i ...

  3. 【Python學習之七】面向對象高級編程——__slots__的使用

    1.PythonBindings of properties and methods in 正常情況下,當我們定義了一個class,創建了一個class的實例後,我們可以給該實例綁定任何屬性和方法. (1)首先,定義一個class:  class Stu ...

  4. Python學習筆記捌——面向對象高級編程

    __slots__特殊變量的使用: 由於Python是動態語言,允許先編寫類,然後在創建實例的時候添加屬性或者方法:而__slots__特殊變量就是,限制往類裡添加屬性的: 在創建類的時候,使用__s ...

  5. 【Python學習之七】面向對象高級編程——使用@property

    Reference is from Liao XuefengPython教程:https://www.liaoxuefeng.com/wiki/0014316089557264a6b348958f449949df42a6d3a2e542c000/ ...

  6. js高級編程中命名空間的兩種用法

    第一種:// 聲明一個全局對象Namespace,用來注冊命名空間Namespace = new Object();// 全局對象僅僅存在register函數,參數為名稱空間全路徑,如"Gr ...

  7. 第51講:Scala中鏈式調用風格的實現代碼實戰及其在Spark編程中的廣泛運用

    今天學習了下scala中的鏈式調用風格的實現,在spark編程中,我們經常會看到如下一段代碼: sc.textFile("hdfs://......").flatMap(_.spl ...

  8. C程序數組算法 — 冒泡法排序【前冒 || 後冒】

    第一種寫法(前冒泡): /* C程序數組算法 - 冒泡法排序 * 此例子按照 大 -> 小 排序 * 原理:兩兩相比較,然後進行大小對調 * 比較次數: n^2 次 * 說明:冒泡排序是相對穩定 ...

  9. Python 冒泡法排序

    def sequence(disorder='', separators=''): arrays = disorder.split(separators) def desc(): for i in r ...

  10. [python,2018-01-15] 冒泡法排序

    想寫一個冒泡法排序,沒什麼思路,就先寫了個java的 public static void main(String[] args) { int array[] = {88,2,43,12,34,8,6 ...

隨機推薦

  1. Visual Studio 2013如何破解(密鑰激活)

    其實有個方法最簡單,就是點擊“幫助”,選擇注冊產品,點擊打開頁面右下邊的“使用秘鑰注冊產品”,輸入上述秘鑰即可.   在輸入密鑰界面,輸入密鑰“BWG7X-J98B3-W34RT-33B3R-JVYW ...

  2. hnnu 11546 Sum of f(x) (Find the sum of all divisors of a number)

    代碼: #include<cstdio> #include<cstring> #define N 200000 using namespace std; long long f ...

  3. 博客已遷移到lizhug.com

    New blog address http://lizhug.com

  4. CSU 1810 Reverse

    湖南省第十二屆大學生計算機程序設計競賽$H$題 規律,遞推. There are rules to this question.Contributions to the answer can be counted bit by bit.即第$1$How much the bit contributed to the answer,第$2$How much the bit contributed to the answer.....The cumulative sum is the answer. ...

  5. 解決window7 x64位Anaconda啟動報錯:AttributeError: '_NamespacePath' object has no attribute 'sort'

    Needed for recent paperspython做數據分析,python語法簡單,但是WindowsInstalling third-party packages is disgusting,statsmodels用pip死活安裝不上,I checked online that the packages are interdependentwindows下的pip不能下 ...

  6. SourceTree for Mac 破解版

    soureTree For mac 破解版下載地址:鏈接: https://pan.baidu.com/s/1c19kFRi 密碼: ai7f

  7. 3d-tiles、gltf 坐標系

    gltf 為 y 軸向上的右手坐標系 3d-tiles 為 z 軸向上的右手坐標系

  8. SQLThe statement deletes a field in a table leaving only the latest row

    方法一 DELETE FROM A WHERE `name` in ( SELECT a.name FROM( SELECT name FROM A a GROUP BY name HAVING CO ...

  9. Java多線程——Condition條件

    簡介 Condition中的await()方法相當於Object的wait()方法,Condition中的signal()方法相當於Object的notify()方法,Condition中的signa ...

  10. python中numpy的random模塊

    1. rand(d0,d1,.....,dn)產生[0,1]的浮點隨機數,Parameters inside parentheses can specify the shape of the resulting array    例如:np.random.rand(3,2)則產生 3×2的數組,裡面的數是0-1 ...


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved