Coder Social home page Coder Social logo

windowtracking's Introduction

Window Tracking

Description

In many automation applications items will be transported on a transport route through a machine. During the transport it's necessary to track the item position to execute some actions on specific positions. This library provide some support for position tracking on a transport route (e.g. a conveyor).

The sketch below shows the main objects of that solution. The main objects are:

  • VirtualWindow
  • VirtualWindowList
  • VirtualTrigger
  • VirtualTriggerList
  • EventHandler
  • Item

The VirtualWindowList can create new Virtual Windows and is responsible for managing the virtual windows.

Each VirtualWindow has a position within the transport route relative to the Reference point. When the item will be transported, the position will be updated cyclically.

When a VirtualWindow reaches a VirtualTrigger then then the VirtualTrigger will be activated. And if an EventHandler ITriggerevent is configured, the method Action of the event handler will be called.

When a VirtualWindow leaves a VirtualTrigger then then the VirtualTrigger will be deactivated. And if an EventHandler ITriggerevent is configured, the method ActionAfter of the event handler will be called.

If the VirtualWindow reaches the end of the transport route, it must by terminated by the application.

Conceptual overview over the window tracking

Objects:

Install this package

Enter:

apax add @simatic-ax/windowtracking

to install this package you need to login into the GitHub registry. You'll find more information here

Namespace

Simatic.Ax.WindowTracking;

VirtualTriggerList

Definition

NAMESPACE Simatic.Ax.WindowTracking.Trigger
    CLASS VirtualTriggerList IMPLEMENTS ITriggerList
        VAR PUBLIC
            PositiveTolerance : DINT := 5;
            NegativeTolerance : DINT := 5;
        END_VAR
    END_CLASS
END_NAMESPACE

Public Interface

Add(tp : IVirtualTrigger): BOOL Add an Element of IVirtualTrigger to the list. Returns TRUE when it was successful.
Count : UINT Returns the number of IVirtualTrigger in the VirtualTriggerList
GetTriggerPoint(Id :UINT) Returns an element IVirtualTrigger with the Id. Returns NULL if the Id was not found in the list
Check(tw : ITransportWindow) : BOOL Check if the TransportWindow tw is in the range of any IVirtualTrigger in the list. Returns TRUE the TransportWindow has checked all IVirtualTrigger. FALSE when there are no IVirtualTrigger in the list.

VirtualTrigger

Definition

The class VirtualTrigger will be activated when a virtual TransportWindow

NAMESPACE Simatic.Ax.WindowTracking.Trigger
    CLASS VirtualTrigger IMPLEMENTS IVirtualTrigger

        VAR PUBLIC
            Position : DINT;
            Id : UINT;
            EventHandler : ITriggerEvent;
            PositiveTolerance : DINT := -1;
            NegativeTolerance : DINT := -1;            
        END_VAR 
    END_CLASS
END_NAMESPACE

Public Interface

ActivateEvent(tw : ITransportWindow) When the virtual window reaches the virtual trigger point, this method will be called. If an EventHandler : ITriggerEvent is configured, the EventHandler.Action(IVirtualTrigger, ITransportWindow) method will be called. When the IsActivated() method returns FALSE, it will not executed
IsActivated() : BOOL Returns TRUE when the VirtualTrigger is active window has reached the trigger point
GetID() : UINT Returns the Id of the VirtualTrigger
GetPosition() : DINT Returns the configured position of the VirtualTrigger
IsEnabled() : BOOL Returns TRUE when the VirtualTrigger is enabled (default TRUE)
Check(tw : ITransportWindow, ul : DINT, ll : DINT) : BOOL Returns TRUE (One Shot) when the TransportWindow tw is in the range of the VirtualTrigger position.

VAR PUBLIC Interface

Id : UINT Identifier of the VirtualTrigger (you've to take care that it is unique)
Position : DINT Position of the VirtualTrigger absolute to the reference point. Resolution depends on the encoder resolution
EventHandler : ITriggerEvent The EventHandler which will be executed, when the VirtualTrigger is activated
PositiveTolerance : DINT := -1 Individual positive tolerance for this VirtualTrigger if it's <> -1. When it is equal to -1, then the global tolerance from the TriggerPointList will be used
NegativeTolerance : DINT := -1 Individual positive tolerance for this VirtualTrigger if it's <> -1. When it is equal to -1, then the global tolerance from the TriggerPointList will be used

Example Configuration

USING Simatic.Ax.WindowTracking.Trigger;
USING Simatic.Ax.WindowTracking.EventHandler;

VAR_GLOBAL
    eventHandler : ITriggerEvent;
    trig01 : VirtualTrigger := (ID := UINT#101, Position := 2000, [PositiveTolerance := 50,] [NegativeTolerance := 50,] EventHandler := eventHandler);
END_VAR

Contribution

Thanks for your interest in contributing. Anybody is free to report bugs, unclear documentation, and other problems regarding this repository in the Issues section or, even better, is free to propose any changes to this repository using Merge Requests.

License and Legal information

Please read the Legal information

windowtracking's People

Contributors

beckersts avatar kruegerfelix avatar simatic-ax-bot avatar sjuergen avatar thkindler avatar web-flow avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

windowtracking's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.