i5SAo

                  Close your eyes. See with mine.
                  .. The only thing in the universe
                  that travels faster than light
                  is the darkness.

                  A Wrinkle In Time, 2018, 00:45:22

GEB AUTOMATION SOFTWARE
-----------------------

1. Actually it is Eclipse and Java

2. Only graphic language POUs (LD, FBD) are able to connect device pins (visual controls in GEB Simulator (BYTE: %IXn.m, %QXn.m, %MXn.m, WORD: %IWn.m, %QWn.m, %MWn.m)

See prices: Download -> License Comparison

  Student, Pro, OEM.

Start from Desktop Icon with Properties:

  Target:   C:\geb3\geb.bat
  Start in: C:\geb3
  Run:      Normal Window

Tips:

1. Change POU Type

  Edit POU -> RClick on empty space: POU Properties

    name: pouButton
    type: FUNCTION_BLOCK
    function return datatype: --

Exploring video 0
.................

File -> New GEB 61131-3 project
  Project Name: project2
Project2 -> Create new POU
  POU name:     prog1
  POU language: ST
  POU type:     PROGRAM

prog1.st

  (* created by GEB Automation IDE Wizard, version 3.0.0.1 .. )
  PROGRAM prog1
    VAR
      I1 : INT;
    END_VAR
    (* Pou body: PROGRAM statements *)
    I1 := I1 + 3;
  END_PROGRAM

Project -> Build All

See problems with tab in Outputs: Problems, Ladder Variables, Console

Drag console to a suitable location.

Perspectives (as usual Eclipse perspectives) are IEC61131-3 and Debug

  Windows -> Perspective -> ..

Run vs Debug
............

Run:

  prog1.st -> Run as.. -> GEB Simulator.

  show variables: [v]
  times to run: 0 (infinite loop)
  cycle duration: 250 (minimum duration in ms)

See log in console.

Debug:

  prog1 -> Debug as.. -> GEB Simulator.

View variables and step through the code (eclipse buttons or Run menu)


Exploring Video 1 and 2
.......................

  + FBD Semaphore:

      RClick -> toggle breakpoint on FB-block.
      Debug as -> GEB Simulator,
      Resume after break point ("Play\" button is "Resume\" now)

  + ST source: Double click on gutter area to toggle breakpoint.

  + ST source: View variables only if you have at least 1 breakpoint set in ST or IL

  + Control inputs and view outputs on "I/O variables\" tab.


Lecture 28.05.2018 Quick notes:
-------------------------------

Set Device:

  GHello -> Project properties

Device Selected:

  BAD_DEVICE
  Arduino Mega 2560 R3
  WIN_LOCAL
  WIN_WITH_MODBUS
  rasp_ssh
  rasp_tcp

GHello -> New Pou

  pouHello: LD
  LD variables -> [Add Variable]
  name:    X
  type:    BOOL
  var:     EXTERNAL | IN_OUT | INPUT | OUTPUT | TEMP | VAR |
    (scope  global    by ref   by val  by ref   ?     local)
  at:      see Device Selected. Semaphore in sample project uses
             %IX54.1 %IX54.2 as digital inputs
             %QX55.1 as digital output
  comment: --

Connect: from left to right, mode: connections:connection (right, tools)
To set breakpoint: Double click on gutter area (left from source line)
To run the code: pouHello -> Debug as -> Simulator


First try
---------

Project name:

  GHello

  GHello -> Project Properties: WIN_LOCAL
  GHello -> Create new POU:
    name: pouHello
    lang: LD (select from: ld, fbd, ik, st)
    type: PROGRAM (select from: program, function_block, function)

Circuit:

  +V    X           Q     GND
  |----| |---------( )----|
  |     Y     |           |
  |----| |----            |

LD Variables

  name  type   modifier   AT
  X     BOOL   VAR        %IX54.1
  Y     BOOL   VAR        %IX54.2
  Q     BOOL   VAR        %QX55.1

  pouHello -> Debug as -> GEB Simulator

    Project: GHello
    File:    pouHello
    Show variables: [v]
    Verbosity: 0
    Times to run: 0 (0 = infinite loop)
    Cycle duration: 250 (minimum duration in msecs)

I/O variables tab (left panel) contains switches and lamps (momentary buttons have to be built as custom function blocks).

  Digital inputs:
  %IX54.1
  %IX54.2
  Digital outputs:
  %QX55.1
  Analog inputs:
  --
  Analog outputs:
  --


EX1. MODULES
------------

Learned:

  %IX54.1

  % Physical I/O
  I input Q output M flag
  X 0..1 W 0..255

Task:

  File -> New GEB IEC61131-3 Project: EX1
  EX1 -> Project Properties: WIN_LOCAL
  EX1 -> Create new POU:
    name: pouSTFoo
    lang: ST (select from: ld, fbd, ik, st)
    type: FUNCTION_BLOCK

Code:

  FUNCTION_BLOCK pouSTFoo
    VAR
    END_VAR
    VAR_INPUT
      AX : BOOL;
      AY : BOOL;
    END_VAR
    VAR_OUTPUT
      Q : BOOL;
    END_VAR

  (* BODY *)
    Q := AX AND AY;
  END_FUNCTION_BLOCK

NB! Build project before you are able to use "custom\" function block
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  EX1 -> Create new POU:
    name: pouCONTAINER
    lang: LD (select from: ld, fbd, ik, st)
    type: PROGRAM

  +V                               GND
  |            --------            |
  |           |pouSTFoo|           |
  |     X     |--------|    CR     |
  |----| |----|AX     Q|----( )----|
  |     Y     |        |           |
  |----| |----|        |           |
  |            --------            |

LD Variables

  name  type   modifier   AT
  X     BOOL   VAR        %IX54.1
  Y     BOOL   VAR        %IX54.2
  CR    BOOL   VAR        %QX55.1

Debugging like GHello.


EX2. FBD
--------

Learned:

  Inputs  -- type: EXPRESSION (Variable name or constant, like T#5s)
  Outputs -- type: VARIABLE REF

  Variable types (LD variables: Add variable -> Data Type)

  BOOL SINT INT DINT LINT USINT UINT UDINT ULINT
  REAL LREAL
  BYTE
  WORD DWORD LWORD
  DATE DATE_AND_TIME TIME TIME_OF_DAY
  STRING STRING[10]

  RClick on FB-block to toggle breakpoint.

Task:

  File -> New GEB IEC61131-3 Project: EX2
  EX2 -> Project Properties: WIN_LOCAL
  EX2 -> Create new POU:
    name: fbdFoo
    lang: FBD (select from: ld, fbd, ik, st)
    type: PROGRAM

  +V                            GND
  |            -----            |
  |           | NOT |           |
  |           |-----|    CR     |
  |----(A)----|N    |---- B ----|
  |            -----            |

LD Variables

  name  type   modifier   AT
  A     BOOL   VAR        %IX54.1
  B     BOOL   VAR        %QX55.1

Debugging like GHello.


EX3. FBD bricks
---------------

Categories:

  + Bit

    NOT (Function)  Bitwise/Logical NOT
    AND (Function)  Bitwise/Logical AND
    OR (Function)  Bitwise/Logical OR
    XOR (Function)  Bitwise/Logical XOR
      Inputs: IN1 (?), IN2 (?), IN3 (?), IN4 (?)
      Output type: ?
      This function is generic?, concrete variants:
        AND_BOOL   OR_BOOL   XOR_BOOL   NOT_BOOL
        AND_BYTE   OR_BYTE   XOR_BYTE   NOT_BYTE
        AND_WORD   OR_WORD   XOR_WORD   NOT_WORD
        AND_DWORD  OR_DWORD  XOR_DWORD  NOT_DWORD
        AND_LWORD  OR_LWORD  XOR_LWORD  NOT_LWORD

   + Bistables_Edge

      F_TRIG (Function Block)  Falling edge detector block
        Inputs: CLK (BOOL)
        Outputs: Q (BOOL)

      RS (Function Block)  Bistable function block (reset dominant)
        Inputs: S (BOOL), R1 (BOOL)
        Outputs: Q1 (BOOL)

      R_TRIG (Function Block)  Rising edge detector block
       Inputs: CLK (BOOL)
       Outputs: Q (BOOL)

      SR (Function Block)  Bistable function block (set dominant)
        Inputs: S1 (BOOL), R (BOOL)
        Outputs: Q1 (BOOL)

  + Time:

      TOF (Function Block)  Timer OFF-delay: delays the on-to-off transition of input by time PT
        Inputs: IN (BOOL), PT (TIME)
        Outputs: Q (BOOL), ET (TIME)

      TON (Function Block)  Timer ON-delay: delays the off-to-on transition of input by time PT
        Inputs: IN (BOOL), PT (TIME)
        Outputs: Q (BOOL), ET (TIME)

      TP (Function Block)  Timer Pulse: generates a pulse of width PT for each input rising edge
        Inputs: IN (BOOL), PT (TIME)
        Outputs: Q (BOOL), ET (TIME)

Task: momentary button

  button: oR( TP( T#10ms, R( i)), TP( T#10ms, F( i)))
  container: RS( button1, button2)

EX4. Generate C
---------------

  IEC 631131 ->  Generate C
  EX4 -> Output -> EX4.c
  For learning purposes generated code is overkill as usual
  Arduino Mega is not supported by SimulIDE
  WIN_LOCAL leads us to Fabrice Bellard tcc compiler in folder:
    C:\geb3\compilers\tcc

Links:
------

  https://gebautomation.com/downloads/gebsetup.exe
  youtube-dl.exe -f247+251 https://www.youtube.com/watch?v=7ZkRjIhvA8I
  youtube-dl.exe -f136+140 https://www.youtube.com/watch?v=8fP3R6sGfB4
  youtube-dl.exe -f136+140 https://www.youtube.com/watch?v=o-3wZFA4_64
  http://www.dee.ufrj.br/controle_automatico/cursos
    /IEC61131-3_Programming_Industrial_Automation_Systems.pdf


Annex A. Devices OCR (https://www.onlineocr.net/)
-------------------------------------------------

Device selected: WIN_LOCAL

  Device details
  DeviceName: WIN_LOCAL
  Local (Windows) sample device
  Enabled: true
  Mapped IO addresses:
    %IW51.1-16 : Input Word (16 bits) in file (R)
    %IW61.1-16 : Input Word (16 bits) in memory (R)
    %QW52.1-16 : Output Word (16 bits) in file (W)
    %QW62.1-16 : Output Word (16 bits) in memory (W)
    %MW53.1-16 : R/W Word (16 bits) in file (RW)
    %MW63.1-16 : R/W Word (16 bits) in memory (RW)
    %IX54.1-16 : Input bit in file (R)
    %IX64.1-16 : Input bit in memory (R)
    %QX55.1-16 : Output bit in file (W)
    %QX65.1-16 : Onput bit in memory (W)
    %MX56.1-16 : R/W bit in file (RW)
    %MX66.1-16 : R/W bit in memory (RW)
  Confiq file: C:\qeb3\devices\win local\device.properties

  Additional libraries
  [ ] WIN_LOCAL:nonnative
  [ ] WIN_LOCAL:native

---------------------

Device selected: WIN_WITH_MODBUS

  Device details
  DeviceName: WIN_WITH_MODBUS
  Local Windows sample device with MODBUS server over TCP Enabled: true
  Mapped IO addresses:
    %IW51.1-16 : Input Word (16 bits) in file (R)
    %IW61.1-16 : Input Word (16 bits) in memory (R)
    %IW3.1-16 : MODBUS HOLDING REGISTER (ANALOG 16-bits) (R)
    %QW52.1-16 : Output Word (16 bits) in file (W)
    %QW62.1-16 : Ouput Word (16 bits) in memory (W)
    %MW53.1-16 : R/W Word (16 bits) in file (RW)
    %MW63.1-16 : R/W Word (16 bits) in memory (RW)
    %MW4.1-16 : MODBUS INPUT REGISTER (ANALOG 16 bits) (RW)
    %IX54.1-16 : Input bit in file (R)
    %IX1.1-16 : MODBUS DIGITAL COIL TABLE (R)
    %IX64.1-16 : Input bit in memory (R)
    %QX55.1-16 : Output bit in file (W)
    %QX65.1-16 : Output bit in memory (W)
    %MX56.1-16 : R/W bit in file (RW)
    %MX2.1-16 : MODBUS DIGITAL INPUT TABLE (RW)
    %MX66.1-16 : R/W bit in memory (RW)
  Config file: C:\geb3\devices\win local\device2.properties

  Additional libraries
  [v] WIN_WITH_MODBUS:native
  [v] WIN_WITH_MODBUS:nonnative

-------------------

Device selected: ArduinoMega2560

  Device details
  DeviceName: ArduinoMega2560
  Arduino Mega2560 R3
  Enabled: true
  Mapped IO addresses:
    %QW1.2-13 : Analog output. PWM Pins 2-13 (0-255 range) (W)
    %IX1.2-53 : Digital inputs (2-53) (R)
    %QX1.2-53 : Digital output - pins 2-53 (W)
  Config file: C:\geb3\devices\arduino2560\device.properties

  Additional libraries
  No additional libraries available

-------------------

Device selected: rasp_ssh

  Device details
  DeviceName: rasp_ssh
  Raspberry PI, via SSH connection
  Enabled: true
  Mapped IO addresses:
    %IW1.0-31 (R)
    %QW1.0-31 (W)
    %IX0.0-31 : Digital inputs (R)
    %QX0.0-31 : Digital outputs (W)
  Config file: C:\geb3\devices\raspberrypi\device_ssh.properties

  Additional libraries
  No additional libraries available

------------------------

Device selected: rasp_tcp

  Device details
  DeviceName: rasp_tcp
  Rasperry PI box, via TCP server
  Enabled: true
  Mapped IO addresses:
    %IW1.0-31 (R)
    %QW1.0-31 (W)
    %IX0.0-31 : Digital inputs (R)
    %QX0.0-31 : Digital outputs (W)
  Config file: C:\geb3\devices\raspberrypi\device_tcp.properties

  Additional libraries
  No additional libraries available
