Writing PAMGUARD Plug-ins

Adding plug-ins to the Core PAMGUARD model

To make a PAMGUARD plug-in available to PAMGUARD users it is necessary to edit the java file PamModel/PamModel.java.

First you register the module with PAMGUARD using

PamModuleInfo myModule = PamModuleInfo.registerControlledUnit(String className, String description);

where className is the class name of the class PamControlledUnit and description is the descriptive name of the module.

For example

PamModuleInfo myModule = registerControlledUnitjava.lang.String,
jPamModuleInfo.registerControlledUnit
("GPS.GPSControl", "GPS Processing");

adds the GPS module.

The module will now be listed in the PAMGUARD File/Add Modules menu from where the user can create instances of the module.

The PAMGUARD settings manager will be aware of the new module and will automatically create the module the next time PAMGUARD is run.

Add the module to a menu group

Due to the large number of PAMGUARD modules now in existence, you will want to have your module listed in one of the sub menus of the File/Add Modules menu. You can add your module to one of the existing groups or you can create a new group of your own. For example, the following code adds the GPS module to the Map menu group

myModule.setModulesMenuGroup(mapsGroup);

Set module data dependencies

It is likely that your module will be dependent on data from some other PAMGUARD module. For example, the click detector requires raw data from an acquisition module, the whistle detector required raw data from a FFT module and the GPS module requires data from an NMEA data source.

You can set module dependencies using

PamModuleInfo.addDependency(PamDependency dependancy)

for example

myModule.addDependency(new PamDependency(NMEADataUnit.class, "NMEA.NMEAControl"));

tells PAMGUARD that myModule is dependent on some source of NMEADataUnit and that a possible source of this type of data is the NMEA.NMEAControl module.

Note that some types of data may be produced by many different modules, so here you should specify the most common source of the data your module will use.

Setting the minimum and maximum numbers of module instances

You can use functions

PamModuleInfo.setMinNumber(int minNumber)
and
PamModuleInfo.setMaxNumber(int maxNumber)

to set the minimum and maximum numbers of a given module type.

If these are not set (which is generally the case), then the minimum number defaults to zero and there is no maximum number.

If you set a minimum number, then PAMGUARD will automatically create that number of modules at start up.

If you set a maximum number then PAMGUARD will prevent you from creating more than that number of modules.