motion-master-client 0.0.363 → 0.0.366

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,75 @@
1
+ import { ProgressStep } from './types';
2
+ interface OpenPhaseDetectionStep extends ProgressStep<boolean> {
3
+ id: 'openPhaseDetection';
4
+ }
5
+ interface PhaseResistanceMeasurementStep extends ProgressStep<number> {
6
+ id: 'phaseResistanceMeasurement';
7
+ }
8
+ interface PhaseInductanceMeasurementStep extends ProgressStep<number> {
9
+ id: 'phaseInductanceMeasurement';
10
+ }
11
+ interface PolePairDetectionStep extends ProgressStep<number> {
12
+ id: 'polePairDetection';
13
+ }
14
+ interface MotorPhaseOrderDetectionStep extends ProgressStep<number> {
15
+ id: 'motorPhaseOrderDetection';
16
+ }
17
+ interface CommutationOffsetMeasurementStep extends ProgressStep<number> {
18
+ id: 'commutationOffsetMeasurement';
19
+ }
20
+ /**
21
+ * Tuple representing the ordered sequence of all offset detection steps.
22
+ *
23
+ * Each position in the tuple corresponds to a specific diagnostic step
24
+ * in the offset detection workflow.
25
+ */
26
+ export type OffsetDetectionSteps = [
27
+ OpenPhaseDetectionStep,
28
+ PhaseResistanceMeasurementStep,
29
+ PhaseInductanceMeasurementStep,
30
+ PolePairDetectionStep,
31
+ MotorPhaseOrderDetectionStep,
32
+ CommutationOffsetMeasurementStep
33
+ ];
34
+ /**
35
+ * Union type of all possible offset detection step identifiers.
36
+ */
37
+ export type OffsetDetectionStepId = OffsetDetectionSteps[number]['id'];
38
+ /**
39
+ * Template describing the ordered offset detection steps and their initial state.
40
+ *
41
+ * This array serves as the baseline structure for reporting progress during the
42
+ * offset detection procedure. It is typically cloned and mutated as the procedure
43
+ * executes, with each step transitioning through statuses such as:
44
+ * - 'idle'
45
+ * - 'running'
46
+ * - 'succeeded'
47
+ * - 'failed'
48
+ *
49
+ * The structure and order of this array define:
50
+ * - The sequence in which diagnostic steps are executed
51
+ * - The shape of progress updates emitted during the procedure
52
+ *
53
+ * Consumers should treat this array as immutable and use a cloned copy when
54
+ * tracking or displaying runtime progress.
55
+ */
56
+ export declare const offsetDetectionSteps: OffsetDetectionSteps;
57
+ /**
58
+ * Formats the value associated with a specific offset detection step.
59
+ *
60
+ * Depending on the provided `stepId`, this function will convert the raw `value` into a human-readable string
61
+ * or return the value as-is. The formatting is tailored to the type of step:
62
+ * - For 'openPhaseDetection', returns 'Yes' or 'No' based on the truthiness of `value`.
63
+ * - For 'phaseResistanceMeasurement', appends 'mΩ' to the value if defined.
64
+ * - For 'phaseInductanceMeasurement', appends 'μH' to the value if defined.
65
+ * - For 'polePairDetection', returns the value directly.
66
+ * - For 'motorPhaseOrderDetection', returns 'Normal' or 'Inverted' based on the value.
67
+ * - For 'commutationOffsetMeasurement', returns the value if defined.
68
+ * - For any other step, returns the value as-is.
69
+ *
70
+ * @param stepId - The identifier of the offset detection step.
71
+ * @param value - The value to be parsed and formatted.
72
+ * @returns The formatted value as a string or the original value, depending on the step.
73
+ */
74
+ export declare function formatOffsetDetectionStepValue(stepId: OffsetDetectionStepId, value: number): string | number;
75
+ export {};
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.formatOffsetDetectionStepValue = exports.offsetDetectionSteps = void 0;
4
+ /**
5
+ * Template describing the ordered offset detection steps and their initial state.
6
+ *
7
+ * This array serves as the baseline structure for reporting progress during the
8
+ * offset detection procedure. It is typically cloned and mutated as the procedure
9
+ * executes, with each step transitioning through statuses such as:
10
+ * - 'idle'
11
+ * - 'running'
12
+ * - 'succeeded'
13
+ * - 'failed'
14
+ *
15
+ * The structure and order of this array define:
16
+ * - The sequence in which diagnostic steps are executed
17
+ * - The shape of progress updates emitted during the procedure
18
+ *
19
+ * Consumers should treat this array as immutable and use a cloned copy when
20
+ * tracking or displaying runtime progress.
21
+ */
22
+ exports.offsetDetectionSteps = [
23
+ {
24
+ id: 'openPhaseDetection',
25
+ label: 'Open Phase Detection',
26
+ status: 'idle',
27
+ },
28
+ {
29
+ id: 'phaseResistanceMeasurement',
30
+ label: 'Phase Resistance Measurement',
31
+ status: 'idle',
32
+ },
33
+ {
34
+ id: 'phaseInductanceMeasurement',
35
+ label: 'Phase Inductance Measurement',
36
+ status: 'idle',
37
+ },
38
+ {
39
+ id: 'polePairDetection',
40
+ label: 'Pole Pair Detection',
41
+ status: 'idle',
42
+ },
43
+ {
44
+ id: 'motorPhaseOrderDetection',
45
+ label: 'Motor Phase Order Detection',
46
+ status: 'idle',
47
+ },
48
+ {
49
+ id: 'commutationOffsetMeasurement',
50
+ label: 'Commutation Offset Measurement',
51
+ status: 'idle',
52
+ },
53
+ ];
54
+ /**
55
+ * Formats the value associated with a specific offset detection step.
56
+ *
57
+ * Depending on the provided `stepId`, this function will convert the raw `value` into a human-readable string
58
+ * or return the value as-is. The formatting is tailored to the type of step:
59
+ * - For 'openPhaseDetection', returns 'Yes' or 'No' based on the truthiness of `value`.
60
+ * - For 'phaseResistanceMeasurement', appends 'mΩ' to the value if defined.
61
+ * - For 'phaseInductanceMeasurement', appends 'μH' to the value if defined.
62
+ * - For 'polePairDetection', returns the value directly.
63
+ * - For 'motorPhaseOrderDetection', returns 'Normal' or 'Inverted' based on the value.
64
+ * - For 'commutationOffsetMeasurement', returns the value if defined.
65
+ * - For any other step, returns the value as-is.
66
+ *
67
+ * @param stepId - The identifier of the offset detection step.
68
+ * @param value - The value to be parsed and formatted.
69
+ * @returns The formatted value as a string or the original value, depending on the step.
70
+ */
71
+ function formatOffsetDetectionStepValue(stepId, value) {
72
+ var _a;
73
+ switch (stepId) {
74
+ case 'openPhaseDetection': {
75
+ return value ? 'Yes' : 'No';
76
+ }
77
+ case 'phaseResistanceMeasurement': {
78
+ return typeof value !== 'undefined' ? `${value} mΩ` : '';
79
+ }
80
+ case 'phaseInductanceMeasurement': {
81
+ return typeof value !== 'undefined' ? `${value} μH` : '';
82
+ }
83
+ case 'polePairDetection': {
84
+ return value;
85
+ }
86
+ case 'motorPhaseOrderDetection': {
87
+ const phases = ['Normal', 'Inverted'];
88
+ return (_a = phases[value]) !== null && _a !== void 0 ? _a : '';
89
+ }
90
+ case 'commutationOffsetMeasurement': {
91
+ return typeof value !== 'undefined' ? value : '';
92
+ }
93
+ default: {
94
+ return value;
95
+ }
96
+ }
97
+ }
98
+ exports.formatOffsetDetectionStepValue = formatOffsetDetectionStepValue;
99
+ //# sourceMappingURL=offset-detection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"offset-detection.js","sourceRoot":"","sources":["../../../../../libs/motion-master-client/src/lib/offset-detection.ts"],"names":[],"mappings":";;;AA8CA;;;;;;;;;;;;;;;;;GAiBG;AACU,QAAA,oBAAoB,GAAyB;IACxD;QACE,EAAE,EAAE,oBAAoB;QACxB,KAAK,EAAE,sBAAsB;QAC7B,MAAM,EAAE,MAAM;KACf;IACD;QACE,EAAE,EAAE,4BAA4B;QAChC,KAAK,EAAE,8BAA8B;QACrC,MAAM,EAAE,MAAM;KACf;IACD;QACE,EAAE,EAAE,4BAA4B;QAChC,KAAK,EAAE,8BAA8B;QACrC,MAAM,EAAE,MAAM;KACf;IACD;QACE,EAAE,EAAE,mBAAmB;QACvB,KAAK,EAAE,qBAAqB;QAC5B,MAAM,EAAE,MAAM;KACf;IACD;QACE,EAAE,EAAE,0BAA0B;QAC9B,KAAK,EAAE,6BAA6B;QACpC,MAAM,EAAE,MAAM;KACf;IACD;QACE,EAAE,EAAE,8BAA8B;QAClC,KAAK,EAAE,gCAAgC;QACvC,MAAM,EAAE,MAAM;KACf;CACF,CAAC;AAEF;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,8BAA8B,CAAC,MAA6B,EAAE,KAAa;;IACzF,QAAQ,MAAM,EAAE;QACd,KAAK,oBAAoB,CAAC,CAAC;YACzB,OAAO,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;SAC7B;QACD,KAAK,4BAA4B,CAAC,CAAC;YACjC,OAAO,OAAO,KAAK,KAAK,WAAW,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1D;QACD,KAAK,4BAA4B,CAAC,CAAC;YACjC,OAAO,OAAO,KAAK,KAAK,WAAW,CAAC,CAAC,CAAC,GAAG,KAAK,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;SAC1D;QACD,KAAK,mBAAmB,CAAC,CAAC;YACxB,OAAO,KAAK,CAAC;SACd;QACD,KAAK,0BAA0B,CAAC,CAAC;YAC/B,MAAM,MAAM,GAAG,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;YACtC,OAAO,MAAA,MAAM,CAAC,KAAK,CAAC,mCAAI,EAAE,CAAC;SAC5B;QACD,KAAK,8BAA8B,CAAC,CAAC;YACnC,OAAO,OAAO,KAAK,KAAK,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;SAClD;QACD,OAAO,CAAC,CAAC;YACP,OAAO,KAAK,CAAC;SACd;KACF;AACH,CAAC;AAzBD,wEAyBC"}
@@ -316,7 +316,7 @@ export interface UIFeaturesConfig {
316
316
  disabledEncoderConfigurationIndexes?: number[];
317
317
  /**
318
318
  * Specifies the type of Setup Wizard to be used.
319
- * - `'actilink'`: Uses the Actilink Setup Wizard, which supports unit configuration, limits setup, and auto-tuning.
319
+ * - `'actilink'`: Uses the ACTILINK-S Setup Wizard, which supports unit configuration, limits setup, and auto-tuning.
320
320
  * - `'default'`: Uses the default Setup Wizard, which supports motor, brake, and encoder configuration.
321
321
  */
322
322
  setupWizard: 'actilink' | 'default';
@@ -1,11 +1,11 @@
1
1
  import { HardwareDescription } from './hardware-description';
2
2
  export declare const productCategories: readonly ["SOMANET", "ACTILINK", "OBLAC", "MOTORCORTEX"];
3
3
  export type ProductCategory = (typeof productCategories)[number];
4
- export declare const productFamilies: readonly ["Node", "Circulo", "Integro", "Core", "ACTILINK-S Integro"];
4
+ export declare const productFamilies: readonly ["Node", "Circulo", "Integro", "Core", "ACTILINK-S Integro", "ACTILINK-JD", "ACTILINK-JD Duo"];
5
5
  export type ProductFamily = (typeof productFamilies)[number];
6
- export declare const productGroups: readonly ["Node 400", "Node 1000", "Node 2000", "Circulo 7", "Circulo 9", "Integro 60", "Integro 80", "Actilink 60", "Actilink 80"];
6
+ export declare const productGroups: readonly ["Node 400", "Node 1000", "Node 2000", "Circulo 7", "Circulo 9", "Integro 60", "Integro 80", "ACTILINK-S Integro 60", "ACTILINK-S Integro 80", "ACTILINK-JD", "ACTILINK-JD Duo"];
7
7
  export type ProductGroup = (typeof productGroups)[number];
8
- export declare const somanetProductRangeNames: readonly ["Circulo", "Circulo Safe Motion", "Integro", "Node", "Node Safety", "Internal", "Actilink S"];
8
+ export declare const somanetProductRangeNames: readonly ["Circulo", "Circulo Safe Motion", "Integro", "Node", "Node Safety", "ACTILINK-S", "ACTILINK-JD", "ACTILINK-JD Duo"];
9
9
  export type SomanetProductRangeName = (typeof somanetProductRangeNames)[number];
10
10
  export type SomanetProductRangeNameAll = SomanetProductRangeName | 'Circulo All' | 'Node All';
11
11
  export interface SomanetProduct {
@@ -17,17 +17,91 @@ export interface SomanetProduct {
17
17
  name: string;
18
18
  }
19
19
  export declare const somanetProducts: SomanetProduct[];
20
+ /**
21
+ * Defines a Somanet product range, including its name and firmware ID bounds.
22
+ *
23
+ * @property name - The logical name of the product range, e.g., "Circulo", "Node Safety".
24
+ * Only values from `SomanetProductRangeName` are allowed.
25
+ *
26
+ * @property bounds - A tuple representing the inclusive firmware ID range for this product range.
27
+ * The first element is the minimum ID, and the second element is the maximum ID.
28
+ * Used for validating or filtering products by their firmware IDs.
29
+ * ```
30
+ */
20
31
  export interface SomanetProductRange {
21
32
  name: SomanetProductRangeName;
22
33
  bounds: [number, number];
23
34
  }
35
+ /**
36
+ * List of all defined SOMANET product ranges with their corresponding firmware ID bounds.
37
+ *
38
+ * Each entry maps a `SomanetProductRangeName` to a numeric range that represents
39
+ * the inclusive firmware IDs associated with that product range.
40
+ *
41
+ * These ranges are used for:
42
+ * - Validating firmware IDs for a given product.
43
+ * - Filtering or grouping products by range.
44
+ * - Mapping devices to their logical product ranges in the UI or API.
45
+ */
24
46
  export declare const somanetProductRanges: SomanetProductRange[];
47
+ /**
48
+ * Finds the Somanet product range corresponding to a given product ID.
49
+ *
50
+ * The function resolves the product ID (number, string, or `HardwareDescription`)
51
+ * to a numeric ID, and then searches through `somanetProductRanges` to find
52
+ * the range whose bounds include the ID.
53
+ *
54
+ * @param productId - The product identifier to look up. Can be:
55
+ * - A numeric product ID
56
+ * - A string representation of the ID
57
+ * - A `HardwareDescription` object
58
+ * - `null` or `undefined`, in which case the function returns `undefined`
59
+ *
60
+ * @returns The `SomanetProductRange` whose bounds contain the resolved ID,
61
+ * or `undefined` if no matching range is found or the input is invalid.
62
+ */
25
63
  export declare function findSomanetProductRangeByProductId(productId?: number | string | HardwareDescription | null): SomanetProductRange | undefined;
64
+ /**
65
+ * Finds a SOMANET product by its product ID.
66
+ *
67
+ * This function resolves the input `productId` (number, string, or `HardwareDescription`)
68
+ * to a numeric ID and searches the `somanetProducts` array for a product with a matching ID.
69
+ *
70
+ * @param productId - The product identifier to look up. Can be:
71
+ * - A numeric product ID
72
+ * - A string representing the product ID
73
+ * - A `HardwareDescription` object
74
+ * - `null` or `undefined`, in which case the function returns `undefined`
75
+ *
76
+ * @returns The matching `SomanetProduct` object if found, or `undefined` if no match exists
77
+ * or if the input is invalid.
78
+ */
26
79
  export declare function findSomanetProductById(productId?: number | string | HardwareDescription | null): SomanetProduct | undefined;
27
80
  /**
28
81
  * @deprecated use isSomanetProductIdInRange instead
29
82
  */
30
83
  export declare function isProductIdOfType(productId?: number | string | HardwareDescription | null, type?: SomanetProductRangeNameAll): boolean;
84
+ /**
85
+ * Checks whether a given product ID belongs to a specified SOMANET product range.
86
+ *
87
+ * This function resolves the `productId` to a numeric ID, determines the corresponding
88
+ * `SomanetProductRange`, and checks if it matches the provided `rangeName`.
89
+ *
90
+ * Special aggregate ranges (`Circulo All` and `Node All`) are supported:
91
+ * - `"Circulo All"` includes: `"Circulo"`, `"Circulo Safe Motion"`, `"ACTILINK-JD"`, `"ACTILINK-JD Duo"`
92
+ * - `"Node All"` includes: `"Node"`, `"Node Safety"`
93
+ *
94
+ * @param productId - The product identifier to check. Can be:
95
+ * - A numeric product ID
96
+ * - A string representing the product ID
97
+ * - A `HardwareDescription` object
98
+ * - `null` or `undefined`, in which case the function returns `false`
99
+ *
100
+ * @param rangeName - The product range to check against. Can be any `SomanetProductRangeName`
101
+ * or the aggregate values `"Circulo All"` / `"Node All"`.
102
+ *
103
+ * @returns `true` if the product belongs to the specified range; otherwise, `false`.
104
+ */
31
105
  export declare function isSomanetProductIdInRange(productId?: number | string | HardwareDescription | null, rangeName?: SomanetProductRangeNameAll): boolean;
32
106
  export type SomanetCirculoVariantId = 'ECDN_E1' | 'ECAN' | 'ECBN' | 'ECNN' | 'ECDL' | 'ECDB_E1';
33
107
  export interface SomanetCirculoVariant {
@@ -43,27 +117,86 @@ export declare const ECDB_E1_IDS: number[];
43
117
  export declare const usableCirculoEncoderPortProductIds: number[][];
44
118
  export declare const somanetCirculoVariants: SomanetCirculoVariant[];
45
119
  /**
46
- * Whether the encoder port is internal or not depends on the port position and product ID.
120
+ * Determines whether a given encoder port on a device is an internal port
121
+ * based on the product type and port number.
47
122
  *
48
- * Circulo has internal encoders, specifically at port positions 1 and 2.
49
- * Note that for Circulo variants that lack internal encoders on port positions 1 and 2, this function will return false.
123
+ * The function checks:
124
+ * - If the product belongs to specific Somanet ranges (`Integro` or `ACTILINK-S`) and the port is 1.
125
+ * - If the product ID matches known Circulo variants for specific ports (ECAN, ECBN, ECDN_E1, ECDL, ECDB_E1).
126
+ * - Special case product IDs (8510, 8511, 8610, 8611) on ports 1 or 2.
50
127
  *
51
- * Integro will have an internal encoder only at port position 1.
128
+ * @param port - The encoder port number (1-based index).
129
+ * @param productId - Optional product identifier. Can be a number, string, `HardwareDescription`, or `null`.
130
+ * If omitted, the function returns `false`.
131
+ * @returns `true` if the specified port is considered internal for the given product, otherwise `false`.
52
132
  */
53
133
  export declare function isEncoderPortInternal(port: number, productId?: number | string | HardwareDescription | null): boolean;
54
134
  /**
55
- * Whether the encoder port is usable or not depends on the port position and product ID.
135
+ * Determines whether a specific encoder port on a device is usable for a given product.
136
+ *
137
+ * The function checks:
138
+ * - If no product ID is provided or resolved, the port is considered usable (`true`).
139
+ * - For products in the SOMANET Circulo family (`Circulo All`):
140
+ * - Port 5 is always usable as a Digital I/O port.
141
+ * - Ports 1–4 are checked against the known usable product IDs for each internal/external port.
142
+ * - If a Circulo product ID is unrecognized, the port is considered usable by default.
56
143
  *
57
- * Circulo has many variants, such as having an internal encoder on both ports 1 and 2, or only on port 1, or only on port 2,
58
- * or having no internal encoders at all. If internal encoder port 1 is used, then external encoder port 1 cannot be used, and so on.
144
+ * @param port - The encoder port number (1-based index).
145
+ * @param productId - Optional product identifier. Can be a number, string, `HardwareDescription`, or `null`.
146
+ * If omitted, the function assumes the port is usable.
147
+ * @returns `true` if the port is usable for the specified product, otherwise `false`.
59
148
  */
60
149
  export declare function isEncoderPortUsable(port: number, productId?: number | string | HardwareDescription | null): boolean;
61
150
  /**
62
- * This function only considers the internal encoder ports of Circulo and Integro, specifically ports at positions 1 and 2.
63
- * It will return false for other port positions because they cannot serve as internal encoders.
64
- * The usability of encoder ports depends on the Circulo variant.
151
+ * Determines whether a given internal encoder port is usable for a specific product.
152
+ *
153
+ * Checks:
154
+ * - Circulo products: ports 1 and 2 are considered internal and checked via `isEncoderPortUsable`.
155
+ * - Integro products: port 1 is always usable.
156
+ *
157
+ * @param port - The encoder port number (1-based index).
158
+ * @param productId - Optional product identifier (number, string, or `HardwareDescription`).
159
+ * @returns `true` if the port is an internal port and usable, otherwise `false`.
65
160
  */
66
161
  export declare function isInternalEncoderPortUsable(port: number, productId?: number | string | HardwareDescription | null): boolean;
162
+ /**
163
+ * Returns a human-readable name for an encoder port for a given product.
164
+ *
165
+ * Circulo products:
166
+ * - Ports 1–2 → "Integrated encoder 1/2"
167
+ * - Ports 3–4 → "External encoder 1/2"
168
+ * - Port 5 → "Digital I/O"
169
+ *
170
+ * Other products: returns `"Port X"`.
171
+ *
172
+ * @param port - The encoder port number (1-based index).
173
+ * @param productId - Optional product identifier (number, string, or `HardwareDescription`).
174
+ * @returns The display name for the encoder port.
175
+ */
67
176
  export declare function getEncoderPortName(port: number, productId?: number | string | HardwareDescription | null): string;
177
+ /**
178
+ * Resolves a product ID from different possible representations.
179
+ *
180
+ * Supports:
181
+ * - Numbers → returned as-is
182
+ * - Strings → serial number format or 4-digit product ID
183
+ * - `HardwareDescription` objects → uses `getIdFromHardwareDescription`
184
+ *
185
+ * @param value - The value to resolve into a numeric product ID.
186
+ * @returns The numeric product ID, or `undefined` if it cannot be resolved.
187
+ */
68
188
  export declare function resolveProductId(value?: number | string | HardwareDescription | null): number | undefined;
189
+ /**
190
+ * Returns the number of encoder ports available for a given product.
191
+ *
192
+ * Mapping of product families to encoder ports:
193
+ * - **Circulo All** → 5 ports
194
+ * - **Integro** → 2 ports
195
+ * - **Node All** → 3 ports
196
+ * - **ACTILINK-S** → 2 ports
197
+ * - **Others** → 5 ports (fallback for unrecognized products)
198
+ *
199
+ * @param productId - Optional product identifier. Can be a number, string, or `HardwareDescription`.
200
+ * @returns The number of encoder ports for the specified product.
201
+ */
69
202
  export declare function getNumberOfEncoderPortsByProductId(productId?: number | string | HardwareDescription | null): number;