diff --git a/SimPyLC/base.py b/SimPyLC/base.py index 8bd17aa..f196c23 100644 --- a/SimPyLC/base.py +++ b/SimPyLC/base.py @@ -29,7 +29,7 @@ from inspect import * programName = 'SimPyLC' -programVersion = '3.6.17' +programVersion = '3.6.18' programNameAndVersion = '{0} {1}'.format (programName, programVersion) programDir = os.getcwd () .replace ('\\', '/') .rsplit ('/', 3) [-1] diff --git a/SimPyLC/simpylc_howto.docx b/SimPyLC/simpylc_howto.docx index 6bf5c27..d912b52 100644 Binary files a/SimPyLC/simpylc_howto.docx and b/SimPyLC/simpylc_howto.docx differ diff --git a/SimPyLC/simpylc_howto.html b/SimPyLC/simpylc_howto.html index 873b3bb..88818e5 100644 --- a/SimPyLC/simpylc_howto.html +++ b/SimPyLC/simpylc_howto.html @@ -507,8 +507,9 @@

Introduction

(Programmable Logic Controller). A PLC has to perform a lot of tasks in parallel. It does so using design patterns that are very different from the ones used in mainstream design of non-control programs. When it comes to -performing tasks in parallel, traditionally things like interprocess communication, -threads, semaphores, queues en critical sections may come to mind.

+performing tasks in parallel, traditionally things like interprocess +communication, threads, semaphores, queues en critical sections may come to +mind.

Synchronizing tasks by means of these facilities is error prone. Problems may range from deadlocks, where processes are waiting for each @@ -544,26 +545,23 @@

Installation

Windows:

-
    +
    1. Install MiniConda - for Python 3.6 from https://conda.io/miniconda.html
    2. Open a command prompt
    3. -
    4. Type Type conda install numpy
    5. Type conda install pyopengl
    6. -
    7. Type python +
    8. Type python -m pip install simpylc
    9. Perform one of the following alternatives:
      1. -
      2. Install freeglut - as explained on Install FreeGlut + as explained on http://freeglut.sourceforge.net/index.php#download
      3. Copy SimPyLC\SimPyLC\freeglut.dll to @@ -573,31 +571,25 @@

        Installation

        copy SimPyLC\SimPyLC\QuartzMS.TTF to C:\\Windows\\Fonts
      -

      Linux:

      +

      Linux:

      -
        +
        1. Install MiniConda - for Python 3.6 from https://conda.io/miniconda.html
        2. Open a command prompt
        3. -
        4. Type conda install numpy
        5. +
        6. Type conda install numpy
        7. Type conda install pyopengl
        8. -
        9. Type python +
        10. Type python -m pip install simpylc
        11. Perform one of the following alternatives:
          1. -
          2. Install freeglut - as explained on Install FreeGlut + as explained on http://freeglut.sourceforge.net/index.php#download.
          3. OSX:

            +

            OSX:

            -
              +
              1. Install MiniConda - for Python 3.6 from https://conda.io/miniconda.html
              2. Open a command prompt
              3. -
              4. Type Type conda install numpy
              5. -
              6. Type Type conda install pyopengl
              7. Type python -m pip install simpylc
              8. @@ -637,15 +623,24 @@

                Installation

                line-height:normal'>Perform one of the following alternatives:
                1. Install FreeGlut - as explained on http://freeglut.sourceforge.net/index.php#download
                2. -
                3. Type brew install freeglut
                4. +
                5. Type: brew install + freeglut
              9. Install the XQuartz - X-window system from https://www.xquartz.org
              10. + X-window system from https://www.xquartz.org +
              11. If during use the message No matching pixelformats + found is displayed then type export LIBGL_ALLOW_SOFTWARE=1 prior to starting SimPyLC, or adapt this environment + variable permanently.
              # Edge detector

                              def __init__ (self, condition -= False):

              +normal'>                def __init__ (self, +condition = False):

                              Basic control elements condition was False previously

                                             # Resets theboolean -value of the oneshot to False in all other cases

              +normal'>                               # Resets +theboolean value of the oneshot to False in all other cases

                                             # So a @@ -881,8 +876,8 @@

              Basic control elements

              condition = False):

                                             # Sets -the boolean value of the latch to condition

              +normal'>                               # Sets the +boolean value of the latch to condition

                              def latch (self, @@ -1083,8 +1078,9 @@

              The PLC programming paradigm

              ·         Within one sweep, at first all input from sensors, operator -controls and external control systems is read. This is indicated by the function -readInputFromSensorsAndControls ().

              +controls and external control systems is read. This is indicated by the +function readInputFromSensorsAndControls (). +

              ·         @@ -1099,9 +1095,9 @@

              The PLC programming paradigm

              motors, electromagnets, indicator lamps to inform humans or signals and reports for external control systems.

              -

              After this, the whole sequence starts all over again: the -next sweep. In a real world PLC, the sweeptime is guarded by a watch dog timer. -If it exceeds a maximum, the system is brought to a halt in a safe manner.

              +

              After this, the whole sequence starts all over again: the next +sweep. In a real world PLC, the sweeptime is guarded by a watch dog timer. If +it exceeds a maximum, the system is brought to a halt in a safe manner.

              What is crucial to the way PLC programs operate, is that all inputs are read at the start of every sweep. So what e.g. is bad style for a @@ -1123,8 +1119,8 @@

              The PLC programming paradigm

              will halt the car, thereby avoiding the risk of damaging the engine by lack of lubrication. Since a lamp switching off draws less attention than a lamp switching on, a solution where a green light indicates enough oil and a red or -blinking light or no light at all (lamp failure) indicates a problem, is probably -the optimum.

              +blinking light or no light at all (lamp failure) indicates a problem, is +probably the optimum.


              @@ -1205,13 +1201,13 @@

              PLC programming rules

              The third point of the PLC programming rules, be brief and concise, is probably the most important one. One way to obtain reliable -software is intervision. Such intervision, called deskchecking or peer -reviewing if software is involved, relies on the observation that explaining -something to another person is a very good way to reach a thorough -understanding of it yourself. You and a colleague go through the program step -by step. Explain to your colleague what you have done and why, and you'll -discover your own mistakes. And maybe your colleague will discover some too, -but that's just a bonus.

              +software is intervision. Such intervision, called deskchecking or peer reviewing +if software is involved, relies on the observation that explaining something to +another person is a very good way to reach a thorough understanding of it +yourself. You and a colleague go through the program step by step. Explain to +your colleague what you have done and why, and you'll discover your own +mistakes. And maybe your colleague will discover some too, but that's just a +bonus.

              To be able to go through a program in this way, it must not be too bulky. Reading through ten pages of sourcecode and keeping track of the @@ -1245,8 +1241,8 @@

              What is wrong with encapsulation and control complexity behind a very simple and well defined interface.

              But this is system software, which means: it is thoroughly -tested part of the PLC itself, not of the ever changing control programs you -write for it. So encapsulation does its work behind the scenes.

              +tested part of the PLC itself, not of the ever changing control programs you write +for it. So encapsulation does its work behind the scenes.

              Something similar holds for control structures like loops (while, for, @@ -1257,10 +1253,9 @@

              What is wrong with encapsulation and control The whole PLC concept revolves around one central loop, the sweep. And to facilitate efficient IO, even the dreaded multithreading and interprocess communication are utilized by the PLC itself. And of course the system software -that is a fixed, non user programmable part of any  PLC, uses conditional -statements. But as said: this complexity is restricted to exhaustively tested -system software in any real PLC (as opposed to a simulator for learning -purposes).

              +that is a fixed, non user programmable part of any  PLC, uses conditional statements. +But as said: this complexity is restricted to exhaustively tested system +software in any real PLC (as opposed to a simulator for learning purposes).

              The control program running on top of this system software should be simple, straight and brief. Fortunately, switching from a typical @@ -1303,9 +1298,9 @@

              But what makes controlling a robot system so

              Let's see what this means for noble concepts like encapsulation on the application (rather than internal PLC system) level. Since -every output depends upon tens or hundreds of inputs, the public interface of classes -in object oriented controls (or the parameter lists in function structured -controls) turns out to be excessively large.

              +every output depends upon tens or hundreds of inputs, the public interface of +classes in object oriented controls (or the parameter lists in function +structured controls) turns out to be excessively large.

              Another observation is that while control program parts for e.g. the upper arm, the forearm and the wrist of a robot control at first sight @@ -1502,8 +1497,8 @@

              Putting a robot system into active operation

              What this means for robot control programs is the need for efficient debugging and alteration. You will have to be able to experiment and -repair on the spot, under the real circumstances, interacting with real hardware -and other automated systems.

              +repair on the spot, under the real circumstances, interacting with real +hardware and other automated systems.

              To this end, every PLC control allows for real time inspection and alteration of all control objects (timers, latches, oneshots, @@ -1548,8 +1543,8 @@

              The SimPyLC simulator

              itself. So you'll know that there's no magic involved. The goal is to gain the insight and confidence that you could have written it yourself and that you understand exactly how it behaves and why. This is how PLC's work. And -hopefully the assignments make clear why these simple and robust control devices -are ubiquitous in the world of industrial production and logistics.

              +hopefully the assignments make clear why these simple and robust control +devices are ubiquitous in the world of industrial production and logistics.


              @@ -1784,8 +1779,8 @@

              The arduinoTraficLight example

              The arduinoTrafficLight example requires a bit more hardware, but not too much. The subject is a four legged crossing with a red and a green light at each leg. The hardware used was -an Arduino Due, but should also run on an Arduino Uno if PWM is used and the port -addresses are adapted in native.cpp.

              +an Arduino Due, but should also run on an Arduino Uno if PWM is used and the +port addresses are adapted in native.cpp.

              The arduinoStove example

              Once power is switched on, use the plate select button to select a plate and then the up and down buttons to adjust its temperature. The dot of the digit of the selected plate lights up. Pressing the child lock -button for more than five seconds will lock c.q. unlock the child lock. If the child -lock is active, pressing any other button will generate an alarm, resulting in -a buzzer sounding with varying pitch. Pressing the alarm select button allows -for adjustment of the alarm time with the up and down buttons. The longer these -buttons are pressed, the more speedy the adjustment changes.

              +button for more than five seconds will lock c.q. unlock the child lock. If the +child lock is active, pressing any other button will generate an alarm, +resulting in a buzzer sounding with varying pitch. Pressing the alarm select +button allows for adjustment of the alarm time with the up and down buttons. +The longer these buttons are pressed, the more speedy the adjustment changes.

               

              diff --git a/SimPyLC/~$mpylc_howto.html b/SimPyLC/~$mpylc_howto.html new file mode 100644 index 0000000..8823c35 Binary files /dev/null and b/SimPyLC/~$mpylc_howto.html differ