Create Charge Rule
Source file: create-charge-rule.htm
A charge rule is a JavaScript snippet that defines the location, quantity, and types of products that you plan to insert into each hole in a blast. The aim of the charge rule is to fill the hole with particular products using the following information:
-
Charge rule parameters
-
Hole length, geometry, and custom properties
-
Blast product catalogue
When you apply a charge rule to a set of holes, BlastLogic automatically creates a charge sheet that operators can access on the BlastLogic Tablet. Prior to confirming the application of a charge rule, BlastLogic will display a charge plan preview. This will contain information in a tabular format, as well as a 2D hole view for the selected hole. After you successfully apply a charge rule, BlastLogic will automatically publish the rule for future use.
Creating a charge rule
You can create charge rules using one of the following methods:
-
The
Blank charge rule allows you to create a charge rule from scratch. -
The
Assisted charge rule provides you with options that BlastLogic uses to build the charge rule.
To enter the charge rule creation panel, use either of the following paths:
-
On the Charging tab, in the Design group, go to
Create Charge Rule, and select either
Blank or
Assisted from the drop-down.
Or
-
Right-click on the
charge rulescontainer in the project explorer, go to Create Charge Rule in the context menu, and select either
Blank charge rule... or
Assisted charge rule....
Blank
The blank charge rule allows you to create a charge rule from scratch.
To create a blank charge rule, follow these steps:
-
Enter the Create Charge Rule panel by one of the paths listed above.
-
Enter the name and, optionally, the description of the new charge rule in the corresponding fields.
Tip: BlastLogic will use the name you enter to uniquely identify the charge rule. The name must be different from all other existing charge rules. Using a naming convention when you create charge rules will make it easier to find them later.
-
Go to the Parameters tab and click Edit parameters....
Important: The Parameters tab allows you to set blast products as general parameters. This step is crucial as setting these products as parameters allows you to access them in the charge rule script via the
paramsobjects.
The Edit Charge Rule Parameters panel will appear.
-
Click
to add a new parameter. BlastLogic will give the new parameter default names in the Identifier and Label fields.
-
Enter the required information into the Identifier, Label, and Description fields.
Note: The identifier must contain only letters, digits, and underscores.
-
If required, select the Tablet editing checkbox for the charge rule parameter to appear on the BlastLogic Tablet.
-
Select the property type using the Type drop-down. There are nine types to choose from in BlastLogic:
-
Blast product. This type contains information on blast products that you can use to fill holes.
-
Blast product family. These types contain information on a group of blast products. This group is known as a blast product family and typically contains one product with a set of varying densities.
-
Boolean. You can turn these types on or off via a checkbox.
-
Float. These types must have a range set as greater than a given value, less than a given value, in between two values, or all values. You must also define the dimension and units of float types.
-
Interval label. These types contain the interval labels you wish to include in the rule.
-
Load table. These types add load tables to the rule. Load tables allow you to set load designs in tabular form.
Note: When you add a Load table parameter, BlastLogic will add another tab for you to configure on the left-hand side of the Create Charge Rule panel. Assisted charge rules have this parameter and tab added by default. See Load table tab for details.
-
Select. These fields display a table in which you can enter each possible value for the field. These values will be shown in a drop-down list for the field and you can only select one value at a time.
-
Multi-select. These fields are the same as Select fields, except you can select multiple values from the drop-down list.
-
String. These types can be either a single line or a multiple line string. Single line strings can have one or more hints to store commonly entered values.
-
-
Specify the additional options. You can also set the following fields, depending on the selected type:
-
Blast product field options
Set the products by filtering using the Filter by products or Filter by types radio buttons and drop-downs.
-
Blast product family field options
Set the product family by filtering using the Filter by families or Filter by types radio buttons and drop-downs. To filter by families, enter the required family and delay using the Family and Delay columns and drop-downs.
-
Float field options
Range, dimension, and unit can be defined when the Float type is selected. To set the range of the parameter, select one of four range definitions (Range, Less than or equal, Greater than or equal, or All finite values), and enter the required values. To set the Dimension and Unit, use the corresponding drop-downs.
-
Interval label field options
Set the label for the interval using the Interval label choices drop-down.
-
Multi-select and Select field options
The label associated with a particular value can be assigned when Multi-select or Select type is chosen.
-
String field options
You can set commonly entered values in the Hint column. Optionally, select the Multiple lines radio button for a multiple line string. You cannot define hints when Multiple lines is selected.

-
-
Optionally, use the following actions to edit the parameters:
-
To remove a parameter, select the parameter and click
. -
To clone a parameter, select the parameter and click
. -
To reorder the parameters, select the parameter you wish to move and click the
or
arrow.
-
-
After adding the required parameters, click OK.
The parameters you added will appear in the Parameters tab in the Create Charge Rule panel. You can edit them as required.
-
Apply a script to your charge rule using one of the following tabs:
-
Expand for more information.
The Script builder tab provides a user-friendly interface to define the conditions under which to fill holes. BlastLogic generates the script based on the options you select.
Note: Building an auto-generated script will overwrite anything currently contained in the script.
Note: Selecting the Debug boolean flag option allows you to print debug statements to the report window using a Boolean charge rule parameter.

The Script builder tab consists of the following subtabs:
Note: Each subtab lists the conditions that can be applied to a charge rule. Select the checkbox corresponding to the required condition to enable editing and include the condition in the charge rule.

The Pre-processing subtab contains the following options:
-
(1) Fill short holes. Set the maximum depth at which a hole should be filled with a product selected from the drop-down. The next operational steps will depend on whether you select the Stop processing for a hole if it is filled checkbox, as follows:
-
When you select the checkbox, any later steps do not occur if the hole is filled, meaning that future steps will not add to or overwrite filling the hole.
-
When you do not select the checkbox, BlastLogic will fill the hole, but future steps, which could change or add to the filled hole, will also apply.
Note: The products available in the drop-down are Air, Water, Drill Cuttings, and any Blast product charge rule parameter defined in the Edit Charge Rule Parameters panel.
-
-
(2) Backfill holes. Set the minimum depth error at which to backfill holes with a product selected from the drop-down.
ImportantThe depth error is defined as follows:
Note: The products available in the drop-down are Air, Water, Drill Cuttings, and any Blast product charge rule parameter defined in the Edit Charge Rule Parameters panel.
Note: The default option provided in the Holes with drill depth error greater than drop-down is Site backfill tolerance (see Process tolerances for more information). The drop-down can contain more options, depending on the charge rule parameters you have set.
The Water displacement method defines how the water level in the hole should be recalculated, as a result of any backfill. Depending on the selected option, this will give you a new water level to use in future calculations. You can select from the following:
-
Displacement. Any length of backfill completely displaces any length of water in the hole, that is a water length of 2 m before backfill will result in a water length of 2 m after backfill.
-
50% partial displacement. The length of backfill will displace 50% of the same length of water, that is a water length of 1 m before 1 m of backfill results in a final water length of 0.5 m after backfill.
-
Replacement. The length of backfill completely replaces the same length of water, that is a water length of 1 m before 0.5 m of backfill results in a final water length of 0.5 m after backfill.
-
Use the Hole fill method subtab to define a set of conditions: a default condition and other specified conditions.
The Default fill method is the only mandatory field that needs to be set to generate scripts. It defines the method according to which a hole should be filled. The options available in the drop-down list are Air, Water, Drill Cuttings, any Load table charge rule parameter defined in the Edit Charge Rule Parameters panel.
You can also add hole fill conditions to the table. The first row to satisfy all conditions will be used to fill each hole. A specified condition consists of the following components:
-
Parameter
A parameter can be a standard parameter (e.g. an angle, diameter, length, or a hole property set in the Hole Properties panel (Home > Setup >
Site) or a charge rule parameter defined in the Edit Charge Rule Parameters panel. -
Operator
-
Fill method
BlastLogic applies the fill method when the said condition is true. If a hole does not satisfy any of the specified conditions, BlastLogic will use the default fill method.
-
When specifying the rows in the Criteria column, right-click on the required cell and select Toggle Parameter/Number from the context menu to switch between selecting a drop-down option and value input.
-
To remove a row you no longer need, click on a cell corresponding to that row and click
(Remove the selected row). -
To reorder the rows within the table, use the
and
buttons. -
To duplicate a row in the table, click on the row and click
(Duplicate the selected row).Tip: Use the
button to simplify adding similar condition sets. After duplicating a condition set, you can edit its properties as needed. -
To add more conditions, click the Add condition column button.
-
To remove a condition that is no longer needed, click on a cell corresponding to that condition column and click the Remove condition column button.
Use the Post-processing 1 subtab to address intervals added to affected holes, as well as to address water and wet sides.
The subtab contains the following options:
-
(4) Fill and interval
Expand for details.
Enabling this option will fill a given interval with the product selected from the drop-down.
Note: The products available in the drop-down are Air, Water, Drill Cuttings, any Blast product or Load table charge rule parameter defined in the Edit Charge Rule Parameters panel.
In addition, the section above and below the interval can be filled to the required length. The intervals available for selection are defined by the Interval label charge rule parameters in the Edit Charge Rule Parameters panel. The Extend above the interval and Extend below the interval options fill the section above or below the interval by the specified length using the selected product. Optionally, intervals shorter than a specified tolerance can be ignored by entering a value greater than 0 in the Ignore intervals less than field.
Note: This will overwrite any products currently in the interval.
Tip: Optionally, select the Do not overwrite backfill checkbox if this behaviour is required.

-
(5) Enforce minimum stemming
Expand for details.
The Enforce minimum stemming option will replace explosive product at the top of the hole with stemming product, should the amount of explosive product be below the set minimum stemming length.
-
(6) Replace explosive decks affected by water and wet sides
Expand for details.
When you enable this option, you can choose to replace Decks touching wet sides and (or) Decks touching water with the products selected from the drop-downs.
Note: It is recommended that the replacement product is water-resistant or damp-resistant, but this is not mandatory.
Note: The products available in the drop-downs are Air, Water, Drill Cuttings, or any Blast product charge rule parameter defined in the Edit Charge Rule Parameters panel.
If you enable both the Decks touching wet sides and Decks touching water options, the decks touching water will be tested and replaced first.
Note: For both these options, you can select the Force product change when original product deemed suitable. checkbox if this behaviour is required.
The following methods can be used to replace decks:
-
All explosive decks
If any explosive deck is affected by more water or wet sides than the given tolerance, all explosive decks in the hole are replaced.
-
Affected explosive decks (whole decks)
If any individual explosive deck is affected by more water or wet sides than the given tolerance, that specific explosive deck is replaced.
-
Affected explosive decks (partial decks)
If any individual explosive deck is affected by more water or wet sides than the given tolerance, only the portion affected by water or wet sides is replaced.
Note: For this method, you can additionally supply a Cover length that will extend the fill above the water or wet sides level.

-
Use the Post-processing 2 subtab to combine and replace explosive and (or) inert decks based on height.
You can set the following behaviour:
-
Replace short decks
Expand for more information.
Enabling this option will remove decks shorter than the supplied tolerance, and attempt to combine with nearby decks.
Identified short decks are then consolidated with nearby decks by the following methods:
-
Adjacent explosive deck
The product of the bottom adjacent deck is checked first. If it is explosive, this product is used. If the product is not explosive, the product of the top adjacent deck is checked. Again, if it is explosive, this product is used. If the product is not explosive, the function will return an error explaining it cannot replace the product using the required option. This can be avoided by enabling the Revert option that will fallback to using an inert deck instead (see the next option).
-
Adjacent inert deck
The product of the top adjacent deck is checked first. If it is inert, this product is used. If the product is not inert, the product of the bottom adjacent deck is checked. Again, if it is inert, this product is used. If the product is not inert, the function will return an error explaining it cannot replace the product using the required option. This can be avoided by enabling the Revert option that will fallback to using an explosive deck instead (see the option above).
-
-
Replace short inert decks
Expand for more information.
Enabling this option will remove inert decks shorter than the supplied tolerance, and attempt to combine with nearby decks.
-
Adjacent explosive deck
If the inert deck is shorter than the defined length, it will be combined with the adjacent explosive deck, should this option be chosen.
-
Adjacent inert deck
If the inert deck is shorter than the defined length, it will be combined with the adjacent inert deck, should this option be chosen.
-
Use the Primers subtab to add primers to the selected holes. in a pattern specified in one of the options.
You can configure the following:
-
Load <number> primers per explosive column using products/product family. Add the required number of primers to the Blast product or Blast product family charge rule parameter defined in the Edit Charge Rule Parameters panel.
-
Conditional primers. Specify the number of primers to be added if certain conditions are met. If more than one condition is satisfied, the largest number of primers is used. You can specify the following:
-
Column length. If the column length exceeds y metres, at least x primers will be loaded in that explosive column.
-
Hole length. If the hole length exceeds y metres, at least x primers will be loaded in each explosive column.
-
Columns deeper than explosive column y. If the column length exceeds the length of the specified explosive column (to select the first column for example, y = 0), at least x primers will be loaded in that column.
-
-
Loading style. Determine the relative position of loaded primers by selecting the required radio button and specifying the starting position.
Note: The starting position setting is disabled for the Evenly spaced loading style.
Or
-
-
Expand for more information.
The Script tab is designed to create complex charge rules using an external editor. These editors provide tools that support JavaScript, such as hints, and syntax highlighting.
Charge rule parameters and custom hole properties can be referenced while scripting using the Charge Rule API. Charge rule parameters are defined in the Edit charge parameters tab and set in the Parameters tab. Custom hole properties are defined in the Hole properties tab (Home > Setup >
Site; see Hole properties). Fill out the charge rule script in the Script tab, using the JavaScript programming language. The script is responsible for calculating a set of decks that completely fill the hole with required blast products.
Creating and editing charge rule scripts using an external editor
Two editors are currently supported for creating and editing charge rule scripts:
-
Notepad++ (64-bit version). Notepad++ is a small and simple text editor, regularly used for its ability to recognise hundreds of file formats. Even though its usage as a code editor is not widespread, it still provides the minimum functionality required to support JavaScript editing.
-
Microsoft Visual Studio Code. A small and lightweight code editor, released as a stripped-down free version of Visual Studio, which is Microsoft's flagship code editor. This editor is best supported by installing the extension ESLint. This can be added inside Visual Studio Code, once it has installed.
Both supported editors provide a functionality known as Auto-complete. This serves to provide helpful hints for functions and parameters to use within the associated script.
ExampleWhen you type in hole.fill, the following information explaining the usage of the fill function will be provided:

This shows us that the fill function takes in two parameters:
An interval (of Interval type)
A product (of BlastProduct type)
In addition, the function will also return an interval (of Interval type).
Microsoft Visual Studio Code is the preferred code editor, as it provides the most functionality. There is no additional work required in order for auto-complete to work as explained above. The charge rule parameters you provide will also be available through the use of the params object (i.e. params.dryChargeProduct).
In Notepad++ (64-bit version), auto-complete will only provide help for hole-related functions and properties. In order to enable this functionality, the javascript.xml provided in
Program Files/Maptek/BlastLogic 2020/etc/snippetsmust be copied toProgram Files/Notepad++/plugins/APIs.Selecting a preferred editor
You can select the preferred editor in the Preferences panel (Home tab > Setup group >
Preferences). If none of the supported editors are installed, only the built-in will be selectable.Note: Selecting an external editor will disable the built-in editor, which will still be available to view, however it will be read-only.
Launching an editor and editing guidelines
You can edit a charge rule script using an external editor by clicking the Launch code editor button, available at the top of the Script tab.
Note: This button will be disabled if there is no external editor selected in user preferences.
Note: Closing the charge rule will also sever the connection between the charge rule and the external editor. This may result in the script closing in the external editor.
Note: Editing within the external editor will automatically be recognised by the charge rule every time you save the document (Ctrl+S). Frequent saving is recommended.
Editing guidelines
To allow the auto-complete functions to provide the best hints for your script, JavaScript functions must be commented using strict JSDoc format. This format outlines the function parameter types, and enables auto-complete to provide hints for that specific parameter type.
Functions should be commented similarly to the method shown in the image above for the Rule function. Without this information, auto-complete will not show hints during editing.
At a minimum, functional documentation should contain:
-
A comment about what the function will do.
-
A list of @param {<object>} <parameter_name> entries describing the parameter types and what they represent.
-
(Optional) An @returns {<object>} entry describing what type the function will return.
The supported object types are as follows:
-
Params: A parameters object, containing the user-specified charge rule parameters, for example params.dryChargeProduct.
-
Hole: A hole object, containing functions and properties relating to the specific hole.
-
BuiltInProduct: Holds a predefined list of built-in blast products that are of BlastProduct type.
-
LoadTable: A load table, defining specific rules about how a hole is to be loaded.
-
FilteredBlastProductFamily: A filtered family of blast products, usually corresponding to down hole delays and surface delays.
-
BlastProductFamily: A family of blast products, usually corresponding to electronic detonators and detonating cord delays.
-
Deck: Contains deck properties, corresponding to a deck in the hole.
-
DeckList: A list of decks, corresponding to those loaded into specific sections of the hole.
-
Interval: An object that contains information corresponding to a top and bottom depth; this object may also have sub intervals.
-
IntervalLabel: A label given to at least one interval, usually corresponding to an interval intersecting with a hole.
-
BlastProduct: A product for use to charge a hole.
Click OK or Apply to save the charge rule edits.
See also: Edit Charge Rule
-
Tip: Use the What-if Analysis section to visualise the charge application within a hole in a 2D preview. The section does not create a new hole or modify an existing hole; instead, it uses the values selected in the Copy values from drop-down to visualise how the charge rule would be applied.

-
-
Save the new charge rule by clicking OK or Apply.
Note: The new charge rule does not exist in the database until you save it for the first time. If you decide you do not want to save the new charge rule, click Cancel.
Assisted
The procedure for creating an assisted charge rule is similar to that for creating a blank charge rule, with the following differences:
-
When you enter the Create Charge Rule panel for an assisted charge rule, BlastLogic automatically fills the Name and Description fields. You can enter a custom name and the description as required.
-
The assisted charge rule automatically sets up standard parameters, enabling additional options in the Script Builder to help you create the charging logic.
-
The Create Charge Rule panel for an assisted charge rule includes the Load table parameter and Load table tab by default (see Load table tab below for details).
See also: Creating a blank charge rule
Load table tab
There are two tables in the load tables tab: the Interval lengths table and the Decks table. Each row in the Interval lengths table defines a range of interval lengths using the From and To columns. Each range has an associated list of decks that is applied when the interval length falls within that range. You can define these deck lists in the Decks table.
The interval length is the length of the region of the hole to which the load table is applied. If the load table is applied to the entire hole, the interval length is equal to the hole length. If it is applied to only part of the hole, the interval length is equal to the length of that portion.
Use the Load table tab to fill holes based on the interval length of the region to which the load table is applied, as follows:
-
Enter the required length intervals into the Interval lengths table.
You can define the interval boundaries using the From and To columns.
Note: The last row of this table always has a blank To value as BlastLogic applies it to all the remaining holes with a length greater than or equal to the From value of that row.
-
Specify the decks for each interval by selecting the interval and adding the required information into the Decks table. The table contains the following fill method headings:
-
Product: The type of product you wish to add.
-
Quantity: The quantity of the product you wish to add.
-
Amount: The amount of the product you wish to add.
-
Maximum: The maximum length of the deck you wish to use.
There are six different ways to specify the size of a deck, as provided in the Quantity drop-down:
-
Variable ratio
The ratio of the deck to be filled with the specified product. Ratio values for non-explosive decks are considered ratios of length, whereas ratio values for explosive decks are considered ratios of mass.
Note: Variable length decks can optionally use the Maximum column. This column defines the maximum length of a given deck. The remainder of the hole should be covered by other deck options as specified above, including at least one variable length deck with no maximum.
-
Fixed length
The deck is always a specified length in the hole, with the length given in metres. The sum of all fixed length decks must not exceed the minimum length specified in the Interval lengths table.
-
Fixed volume
The deck always takes up a specified volume in the hole. BlastLogic calculates the length of this deck based on the diameter of the hole when you apply the charge rule.
-
Fixed mass
The deck will always be a specified mass. BlastLogic automatically calculates the length of the deck based on the density of the chosen blast product and the diameter of the hole when you apply the charge rule.
Note: This option is not available for products with an undefined density.
-
Target powder factor
The deck will always be specified by meeting a target powder factor, determined by the products density and the current hole diameter. This value is on a per-deck basis, independent of any other explosive deck.
Note: This option is only applicable for explosive decks with a valid density.
-
Length above water
The top of this deck will extend to the specified distance above the wet part of the hole. By default, the length above water decks will use the wet-sides measurement of the hole as the reference water level. However, a charge rule script can choose to calculate its own value to use as this water level.
The decks specified as Length above water also contain the following properties:
-
Cannot be placed on top of variable length decks.
-
If the hole is dry, BlastLogic will exclude these decks from the resulting charge plan.
-
BlastLogic will reduce the length of the deck if either of the following occurs:
-
There is insufficient space remaining in the hole.
Or
-
The blast product is explosive and the target explosive mass has been reached.
-
Example
In the screenshot above, the Quantity column is set to Variable ratio with the Amount column set to
1.000. This corresponds to each product having a variable mass ratio of 1:1 in the hole. You can view this in the 2D hole preview.You can view the density of each material in the Blast Product Catalogue. To open it, navigate to the Home tab, go to the Setup group, and click
Blast Product Catalogue. In this view, you can see that BlastLogic has increased the amount of AFO85, due to its lower density. For more information, see Blast Product Catalogue.
-
Note: After you fill in the required parameters in the Load table tab, BlastLogic creates a simple script in the Script builder tab. In this tab, you can view and edit the preselected options to generate a new script if you desire. Alternatively, fill out the charge rule script manually in the Script tab, using the JavaScript programming language. The script is responsible for calculating a set of decks that completely fill the hole with the required blast products. See Script builder and Script for more information.
-
See also: Edit Charge Rule
Loading a charge rule
To load a charge rule from the Server, see the Load Charge Rules or Load Charge Rules From Holes sections of the Load topic.
Cloning an existing charge rule
After publishing a charge rule, you can only modify its name and description. BlastLogic prevents further editing to preserve the charge rule settings for historical accuracy.
To make changes to an existing charge rule, you must make an editable copy of the charge rule by cloning it. The cloned charge rule contains exactly the same information, parameters and rules as the original, but you can modify all aspects of it.
To clone a charge rule, follow these steps:
-
In the project explorer, in the
charge rulescontainer, double-click on the charge rule you wish to change. The Edit Charge Rule Defaults panel will appear. -
Select Clone.... BlastLogic will display the same panel but with a cloned version of the charge rule, named Copy of <charge rule name>.
Note: Alternatively, clone a charge rule by right-clicking on the charge rule, located in the
charge rules container in the project explorer, and select
Clone from the context menu.

This tab will only appear if you have defined a load table parameter in the Parameters tab. To add a load table, select Edit parameters... and click
to add a new parameter. Enter the appropriate information into the parameter fields and select Load table from the Type drop-down. Click OK to save the parameter.