Modeling a Generator Set

The Constraint Model for a Generator Set examples use CML to define a technical power configuration, illustrating concepts such as calculated variables, enforcement of external standards, and component selection based on requirements.

The examples correspond to the CML core concepts linked here. See the Generator Set examples for code samples that use the core concepts.

  • Global Properties and Settings—VOLTAGE_REGEX is a global constant that defines a fixed regular expression pattern used for validation or parsing throughout the model.
  • Types—GeneratorSet is the root type that represents the main entity. GeneralModel represents a related component type.
  • Variables—The GeneratorSet type defines variables like requiredKW (the user’s power requirement), Voltage, and calculated variables like surgeLoadKW and Voltage3 (derived from parsing the Voltage string).
  • Relationships—The GeneralModels relation connects the GeneratorSet type to its possible configurations (GeneralModel).
  • Constraints—Constraints enforce critical business rules and safety standards, such as ensuring the selected generator model’s power meets the required threshold, or restricting configuration options (such as Voltage) based on the specified compliance standards (Listing-UL 2200).