Previous Icon 3

Next Icon 3

Rules

Rules are used to ensure that in-house guidelines for the ranges of validity of parameters are applied and adhered to. This typically concerns the maximum and minimum limits of input values, calculated values and the relationships between these values i.e. length-width relationships, length-diameter relationships or even the relationship between the module and the center distance.

These rules are defined by being stored in a <module>.rls file, where <module> stands for the calculation module's in-house label, e.g. Z012 for cylindrical gear pairs.

These rules are subdivided into those that must be fulfilled before the calculation is performed and those that must be checked afterwards. If a rule is infringed, the appropriate messages can be displayed. In the case of rules that must be checked before the calculation, variables can also be set to constant or calculated values.

The following statements are possible in this situation:

precalc: marks the beginning of the rules that must be checked before a calculation is performed.

postcalc: marks the beginning of the rules that must be checked after a calculation.

assert(<Condition>): The <condition> is ensured. In this case, the <condition> usually represents a comparison in which both the right-hand and left-hand side of the comparison can also be calculated.

action msg <Message>: If the <condition> of the previous assert has not been fulfilled, the <message> is output. Here the <message> can include variables, in the same way as report templates.

action set <Assignment>: If the <condition> of the previous assert has not been fulfilled, the <assignment> is performed. The assigned value can be a constant or be calculated from variables, in the same way as for the report templates.

An assignment is only really useful in the precalc section because changing the contents of variables after the calculation merely leads to inconsistent results and has no other effects.

Here is an example file for a helical gear calculation:

precalc

assert (ZR[0].x.nul < 1)

action msg "Profile shift for Gear 1 too big, is {ZR[0].x.nul}, maximum 1. It has been reset to 1."

action set ZR[0].x.nul = 1

assert (ZR[1].x.nul < 1)

action msg "Profile shift for Gear 2 too big, is {ZR[1].x.nul}, maximum 1. It has been reset to 1."

action set ZR[1].x.nul = 1

postcalc

assert ((ZP[0].a/ZS.Geo.mn) < 200)

action msg "Center distance too big for module (a={ZP[0].a}, mn={ZS.Geo.mn}, a/mn={ZP[0].a/ZS.Geo.mn})."

Explanations:

The "precalc" statement open the section of the rules that must be executed before the calculation.

The first "assert" statement checks whether the nominal profile shift of gear 1 is less than 1.0.

If this "assert" is not fulfilled, the "action msg" statement outputs the message that the profile shift is too big, displays the current value and tells you that the profile shift has been set to 1.0.

The "action set" then sets the profile shift to 1.0.

The second "assert" statement checks the same values for gear 2.

The "postcalc" statement signifies the end of the set of rules to be executed before the calculation and opens the section of the rules to be checked after the calculation. The example shows a definition of an "assert" statement. This checks the ratio from the center distance to the module. If the rule is infringed, the "action msg" statement triggers a message. However, there is no point in converting one of these two values after the calculation and this is why the "action set" statement is not present here.

The "General – Results and Reports – Report templates – Formatting – Calculation variables" section details which operators and functions can be used in the formulae.

The file containing the rules is stored in the template directory (TEMPLATEDIR, usually the "template" subdirectory, see the "Directory structure" section in the "Setting Up KISSsoft" section). As the template directory can also be project-specific, you can also define project-specific rules.