Sorting line by using the library WindowTracking
This example shows a small example of a sorting line with 4 exits.
In this example every second, a TransportWindow
will be created and one of 16 items in a list will be assigned to this window. Each item has one sort destination (exit point).
During the execution, a encoder will be simulated. This encoder will be incremented by 10mm every 10ms (corresponds 1m/s belt speed). In your application, the simulated encoder has to be replaced by a concrete one of type IEncoder
.
The TransportWindow
will be moved according the encoder values. When a TransportWindow
reaches a VirtualTrigger
, it will be activated and the event handler which belongs to the VirtualTrigger
, will be executed.
-
If the event handler is a
SortDecisionEvent
:The
SortDecisionEvent
check, if the assigned item in theTransportWindow
is designated for the activeTriggerPoint
.If yes, the exit handler of the
SortDecisionEvent
will be executed. In your application, you've to implement your own exit handler (e.g. if the exit is another conveyor, it has to be startup).If not, nothing happened.
-
If the event handler is a
TerminateWindowEvent
:In this case, the TransportWindow will be terminated. That has to be done at the end of the sorting line.
to use this application example you need to login into the GitHub registry. You'll find more information here
-
Open a CLI and switch to the target folder like:
D: cd \Git
-
Install the application example on your local PC
Run the following commands in a CLI
apax create @simatic-ax/ae-sortingline --registry https://npm.pkg.github.com ae-sortingline axcode ae-sortingline
-
If it is not open, open a terminal in
AX Code
(CTRL+SHIFT+ΓΆ
) -
Start a PLCSIM Advanced Instance (IP: Address 192.168.0.1). To change the IP you'll find information here
-
Install dependencies (if not yet done)
apax install -L
-
Update your dependencies (optionally)
apax update -a
-
If not done download a HWCN with the command:
apax loadhwcn
Result: a predefined HWCN from the folder
hwcn
will be downloaded. If the predefined HWCN (CPU 1516, FW2.8) is not compatible with your device, you've to create your own HWCN with TIA Portal and download it to the PLC/PLCSIM. -
Build in download the project to the PLC
-
Download to a PLCSIM Advanced
apax dlsim
-
Download to a real hardware PLC
apax dlhwplc
The project will be compiled and downloaded to the PLCSIM Advanced instance
-
-
Open the monitoring file mon.mon
-
Go online
-
Watch the values
To change the target IP address, open the apax.yml
and search the entry IP_ADDRESS
, Enter the IP address for your target.
To change the IP address for the debugging, open the file ./vscode/launch.json
and search the entry ip
, Enter the IP address for your device.
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.
Please read the Legal information