/** * Represents an entry of parameters affected by Feed constant and SI unit velocity. * * Tuple format: [index, subindex, unit, affectedByFeedConstant, affectedBySiUnitVelocity] */ export type FeedConstantAndSiUnitVelocityAffectedParameterEntry = [number, number, number, boolean, boolean]; /** * List of parameters affected by Feed constant and SI unit velocity. * * This is derived from the Google Sheet document titled "Objects scaled with Feed and SI unit velocity". */ export declare const feedConstantAndSiUnitVelocityAffectedParameters: FeedConstantAndSiUnitVelocityAffectedParameterEntry[]; /** * Filters parameters affected by Feed constant, including only position parameters. */ export declare const feedConstantPositionAffectedParameters: number[][]; /** * Filters parameters affected by SI unit velocity, including both velocity and acceleration parameters excluding position parameters. */ export declare const siUnitVelocityAffectedParameters: [number, number][]; /** * Filters position parameters affected by the Feed constant, specifically those relevant to interface unit conversion in the UI. */ export declare const unitConverterPositionParameters: [number, number][]; /** * Filters velocity parameters affected by the Feed constant, specifically those relevant to interface unit conversion in the UI. */ export declare const unitConverterVelocityParameters: [number, number][]; /** * Filters acceleration parameters affected by the Feed constant, specifically those relevant to interface unit conversion in the UI. */ export declare const unitConverterAccelerationParameters: [number, number][]; export type SiUnitVelocitySymbol = '1e12 RPM' | '1e9 RPM' | '1e6 RPM' | '1e3 RPM' | 'RPM' | '1e-1 RPM' | '1e-2 RPM' | '1e-3 RPM' | '1e12 RPS' | '1e9 RPS' | '1e6 RPS' | '1e3 RPS' | 'RPS' | '1e-1 RPS' | '1e-2 RPS' | '1e-3 RPS'; /** * Maps the SI unit velocity value to the corresponding unit symbol. */ export declare const siUnitVelocityValueToSymbol: { [key: number]: SiUnitVelocitySymbol; }; export declare const symbolToSiUnitVelocityValue: { [key in SiUnitVelocitySymbol]: number; }; /** * Represents a SI unit velocity object with value, unit, scale, and type. */ export interface SiUnitVelocity { /** * The value of the SI unit velocity object. */ value: number; /** * The unit symbol of the SI unit velocity object. */ unit: string; /** * The scale factor of the SI unit velocity object. */ scale: number; /** * The type of the SI unit velocity object (minute or second). */ type?: 'minute' | 'second'; } /** * Parses a given SI Unit Velocity value to extract its scale, type, and unit symbol. * * This function decodes the given `value` (which represents an SI unit velocity) and returns an object * containing the scale factor, unit type (minute or second), and the corresponding unit symbol. * The value is validated against predefined SI unit velocity specifications, and errors are thrown if * the numerator or denominator are invalid. * * @param {number} value - The SI Unit Velocity value to be parsed. * @returns {SiUnitVelocity} An object containing the parsed scale, type, unit, and value: * - `scale`: The scale factor (e.g., 1e12, 1e-3) based on the prefix. * - `type`: The type of unit, either 'minute' or 'second'. * - `unit`: The unit symbol corresponding to the velocity. * - `value`: The original SI Unit Velocity value. * @throws {Error} Throws an error if the numerator or denominator values are invalid for SI Unit Velocity. */ export declare function parseSiUnitVelocityValue(value: number): SiUnitVelocity; /** * Use this function when SI unit velocity changes to update the affected parameters. * @example When changing from RPM to mRPM, a value of 2,500 will convert to 2,500,000. */ export declare function convertSiUnitVelocityAffectedValue(value: number, oldSiUnitVelocityValue: number, newSiUnitVelocityValue: number, round?: boolean): number; export declare function convertParameterSiUnitVelocityAffectedValue(index: number, subindex: number, value: number, oldSiUnitVelocityValue: number, newSiUnitVelocityValue: number, round?: boolean): number; /** * Use this function when the Feed constant changes to update the position affected parameters. * Depending on whether the Feed constant gets disabled, enabled, or its value changes, the function will perform conversion, inversion, or scaling. */ export declare function convertFeedConstantAffectedPositionValue(value: number, oldFeedConstant: number, newFeedConstant: number, resolution: number, round?: boolean): number; export declare function convertParameterFeedConstantAffectedPositionValue(index: number, subindex: number, value: number, oldFeedConstant: number, newFeedConstant: number, resolution: number, round?: boolean): number; /** * Use this function when the Feed constant changes to update the velocity affected parameters. * Depending on whether the Feed constant gets disabled, enabled, or its value changes, the function will perform conversion, inversion, or scaling. */ export declare function convertFeedConstantAffectedVelocityValue(value: number, oldFeedConstant: number, newFeedConstant: number, round?: boolean): number; export declare function convertParameterFeedConstantAffectedVelocityValue(index: number, subindex: number, value: number, oldFeedConstant: number, newFeedConstant: number, round?: boolean): number; /** * Adjusts the given value based on the SI unit velocity and Feed constant. * It checks if the parameters are influenced by either of these two factors and applies the appropriate conversions. * * @param {number} index - The index identifying the affected parameter. * @param {number} subindex - The subindex identifying the affected parameter. * @param {number} value - The value to be adjusted based on the SI unit velocity or Feed constant. * @param {number} oldSiUnitVelocity - The original SI unit velocity value. * @param {number} newSiUnitVelocity - The new SI unit velocity value to convert to. * @param {number} oldFeedConstant - The original Feed constant value. * @param {number} newFeedConstant - The new Feed constant value to convert to. * * @returns {number} The adjusted value after applying the necessary conversions. */ export declare function convertParameterVelocityAffectedValue(index: number, subindex: number, value: number, oldSiUnitVelocity: number, newSiUnitVelocity: number, oldFeedConstant: number, newFeedConstant: number, round?: boolean): number; /** * Represents a unit conversion object with formatting, parsing, and unit options. */ export interface UnitConverter { id: keyof UnitConverters; formatter: (unit: string, value: number, data: T) => string; options: { value: string; text: string; }[]; parser: (unit: string, value: number | string, data: T) => number; } /** * A collection of unit converters for different unit types. */ export interface UnitConverters { acceleration: UnitConverter<{ siUnitVelocity: number; feed?: number; }>; current: UnitConverter<{ motorRatedCurrent: number; }>; friction: UnitConverter; inductance: UnitConverter; inertia: UnitConverter; motorRatedCurrent: UnitConverter; position: UnitConverter<{ resolution: number; feed?: number; }>; resistance: UnitConverter; torque: UnitConverter<{ motorRatedTorque: number; motorRatedCurrent: number; }>; torqueConstant: UnitConverter; velocity: UnitConverter<{ siUnitVelocity: number; feed?: number; }>; } /** * A type representing the keys of the UnitConverters interface. * This allows referencing specific unit converter types (e.g., 'current', 'friction'). */ export type UnitConverterId = keyof UnitConverters; /** * Represents an instance of a unit converters. * Each unit type has dedicated formatter and parser functions: * - Formatter: Converts the original value to the desired unit, used for display purposes. * - Parser: Converts the value back to the original unit, used for transmitting values to devices in their original unit (e.g., position increments). * * Options allow selection of the desired unit. * Some formatter functions may require additional data, such as motor rated current, for accurate conversion. */ export declare const unitConverters: UnitConverters; export declare const unitConverterParameters: { [key in keyof UnitConverters]: [number, number][]; }; /** * Get the unit converter for a given parameter index and subindex. */ export declare function getUnitConverterForParameter(index: number, subindex: number): UnitConverter | undefined; /** * Formats the unit display based on feed constant settings and SI unit velocity scaling. * * @param {string} unit - The unit to be formatted (e.g., "RPM"). * @param {number} siUnitVelocityValue - The SI unit velocity value used for velocity or acceleration scaling. * @param {boolean} [feedConstantEnabled] - A flag indicating whether the feed constant is enabled. * @param {string} [feedConstantUnit] - The unit of the feed constant (e.g., "mm", "inches"). * * @returns {string} The formatted unit display. */ export declare function getFormattedUnitDisplay(unit: string, siUnitVelocityValue: number, feedConstantEnabled?: boolean, feedConstantUnit?: string, affectedByFeedConstant?: boolean, affectedBySiUnitVelocity?: boolean): string; /** * Determines the formatted unit display for a parameter, considering feed constant settings. * * This function checks whether a parameter (identified by `index` and `subindex`) * should have its unit transformed based on feed constant settings. If the feed constant * is enabled and the parameter is not in the list of unaffected parameters, it applies * formatting using `getFormattedUnitDisplay`. Otherwise, it returns the original unit. * * @param {number} index - The parameter index. * @param {number} subindex - The parameter subindex. * @param {string} unit - The base unit of the parameter (e.g., "Inc"). * @param {number} siUnitVelocityValue - The SI unit velocity value used for velocity or acceleration scaling. * @param {boolean} [feedConstantEnabled] - A flag indicating whether the feed constant is enabled. * @param {string} [feedConstantUnit] - The unit of the feed constant (e.g., "mm", "inches"). * * @returns {string} The formatted unit display if the feed constant applies, otherwise the original unit. */ export declare function getParameterFormattedUnitDisplay(index: number, subindex: number, unit: string, siUnitVelocityValue: number, feedConstantEnabled?: boolean, feedConstantUnit?: string): string;