Create/Add Worker
Workers Tools Menu
Last updated
Workers Tools Menu
Last updated
The Create/Add Worker tool allows you to build up the statically-linked Worker call-chain hierarchy of a Workers application.
First you must select the type of Worker you want to create. Here you can select:
Worker with EHL - The Worker's Main VI will contain an Event Handling Loop. Select this option if you need your Worker to handle events. E.g. events from front panel elements.
Worker without EHL - The Worker's Main VI will not contain an Event Handling Loop. This option is preferred if you do not need your Worker to handle events.
Worker from template - Create a new Worker from your own Worker template. See Creating Worker Templates.
Good to know
If you select a Worker without EHL and then later on realize that you need to handle events, you can simple add an EHL yourself, copied from another Worker with an EHL.
Select a name for your new Worker. This will be the name of the Worker's class. The name you select should be suitable to be a filename.
Select the class you want to directly inherit your new Worker from. By default every Worker inherits from Worker.lvclass [Workers.lvlib].
This option only appears if a real-time target has been selected in the Workers tools menu. By default this flag is ticked, meaning that a Worker with a Main NR.vi will be created (the non-reentrant version of a Worker's Main.vi).
The Worker's alias is what the Worker will be known as within a Workers application. This field is optional. If left blank, the Alias will be the same as the Name of your New Worker. If your Worker's name is long, you can create a shorter alias for your Worker. (This data is stored as a tag within the class's XML file).
A string for the header of your Worker's icon. Here you can also select the background and text color of the icon's header. (This data is stored as a tag within the class's XML file).
What the icon of your Worker will look like, based on the header and text/background colors you choose.
Tip
Right clicking over the icon preview and selecting Copy header colors from class allows you to take the text/background icon colors from another Worker or Worker base class.
When a new Worker is created, its class file is put in a folder with the same name as the Worker. The 'parent' folder is one level above the folder that is created for the new Worker.
When you select this flag, the new Worker you are creating (or if you select a Worker from the Add Exiting... tab) will be added as a statically-linked subWorker to the Worker you select directly below this field in the list titled Workers in (target).
Opens the Worker Hierarchy Viewer tool.
A summary of the scripting tasks performed by the Create/Add Worker will now be provided. This summary is for when a new Worker is created by the tool and then added as a statically-linked subWorker to another Worker (which will become the Caller).
The tool creates a new Worker from a template
A typedef Statically-Linked subWorkers.ctl is created and added to the Caller (if it doesn't exist)
Statically-Linked subWorkers.ctl is added to the Caller's private data cluster (if it doesn't exist)
Setup Statically-Linked subWorkers.vi is created and added to the Caller (if it doesn't exist)
Setup Statically-Linked subWorkers.vi is added to the Caller's Main VI block diagram (if it doesn't exist)
Setup subWorker - *New Worker's Alias*.vi is created and added to the Caller.
Setup subWorker - *New Worker's Alias*.vi is added to Setup Statically-Linked subWorkers.vi's block diagram
Set Initialization Data - *New Worker's Alias*.vi is created and added to the Caller
Set Initialization Data - *New Worker's Alias*.vi is added to the Caller's Main VI block diagram
The new Worker's Main VI is added to the Caller's Main VI, below the Caller's QMH and the VI is wired up
The result of the steps above can be seen in the example below. Below (left) is a screenshot of the items are that created by the tool (highlighted in blue) when adding a new Worker (Worker B) to a pre-existing Worker (Worker A). Below (right) shows that Statically-Linked subWorkers.ctl has been added to Worker A's private data cluster.
The VIs within the red boxes in the block diagram below have been added by the Create/Add Worker tool.
Setup Statically-Linked subWorkers.vi
Worker B.lvclass : Main.vi
Set Initialization Data - Worker B.vi