@synnaxlabs/client 0.26.7 → 0.28.0
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.
- package/.turbo/turbo-build.log +7 -7
- package/README.md +36 -10
- package/api/client.api.md +3121 -0
- package/api-extractor.json +7 -0
- package/dist/access/client.d.ts +0 -1
- package/dist/access/payload.d.ts +0 -1
- package/dist/auth/auth.d.ts +0 -1
- package/dist/channel/client.d.ts +6 -2
- package/dist/channel/client.d.ts.map +1 -1
- package/dist/channel/creator.d.ts +0 -1
- package/dist/channel/payload.d.ts +4 -1
- package/dist/channel/payload.d.ts.map +1 -1
- package/dist/channel/retriever.d.ts +0 -1
- package/dist/channel/writer.d.ts +0 -1
- package/dist/client.cjs +23 -19
- package/dist/client.d.ts +10 -7
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +2326 -1904
- package/dist/connection/checker.d.ts +21 -2
- package/dist/connection/checker.d.ts.map +1 -1
- package/dist/control/client.d.ts +0 -1
- package/dist/control/client.d.ts.map +1 -1
- package/dist/control/state.d.ts +0 -1
- package/dist/errors.d.ts +0 -1
- package/dist/framer/adapter.d.ts +0 -1
- package/dist/framer/client.d.ts +0 -1
- package/dist/framer/client.d.ts.map +1 -1
- package/dist/framer/deleter.d.ts +0 -1
- package/dist/framer/frame.d.ts +11 -12
- package/dist/framer/iterator.d.ts +0 -1
- package/dist/framer/streamProxy.d.ts +0 -1
- package/dist/framer/streamer.d.ts +0 -1
- package/dist/framer/writer.d.ts +0 -1
- package/dist/framer/writer.d.ts.map +1 -1
- package/dist/hardware/client.d.ts +0 -1
- package/dist/hardware/device/client.d.ts +0 -1
- package/dist/hardware/device/payload.d.ts +0 -1
- package/dist/hardware/device/payload.d.ts.map +1 -1
- package/dist/hardware/rack/client.d.ts +0 -1
- package/dist/hardware/rack/payload.d.ts +0 -1
- package/dist/hardware/rack/payload.d.ts.map +1 -1
- package/dist/hardware/task/client.d.ts +12 -3
- package/dist/hardware/task/client.d.ts.map +1 -1
- package/dist/hardware/task/ni/types.d.ts +14495 -0
- package/dist/hardware/task/ni/types.d.ts.map +1 -0
- package/dist/hardware/task/payload.d.ts +6 -1
- package/dist/hardware/task/payload.d.ts.map +1 -1
- package/dist/label/client.d.ts +8 -6
- package/dist/label/client.d.ts.map +1 -1
- package/dist/label/payload.d.ts +0 -1
- package/dist/label/retriever.d.ts +0 -1
- package/dist/label/retriever.d.ts.map +1 -1
- package/dist/label/writer.d.ts +32 -2
- package/dist/label/writer.d.ts.map +1 -1
- package/dist/ontology/client.d.ts +136 -12
- package/dist/ontology/client.d.ts.map +1 -1
- package/dist/ontology/group/client.d.ts +0 -1
- package/dist/ontology/group/group.d.ts +0 -1
- package/dist/ontology/group/payload.d.ts +0 -1
- package/dist/ontology/group/writer.d.ts +0 -1
- package/dist/ontology/group/writer.d.ts.map +1 -1
- package/dist/ontology/payload.d.ts +6 -3
- package/dist/ontology/payload.d.ts.map +1 -1
- package/dist/ontology/writer.d.ts +4 -5
- package/dist/ontology/writer.d.ts.map +1 -1
- package/dist/ranger/alias.d.ts +0 -1
- package/dist/ranger/client.d.ts +57 -14
- package/dist/ranger/client.d.ts.map +1 -1
- package/dist/ranger/external.d.ts +1 -1
- package/dist/ranger/external.d.ts.map +1 -1
- package/dist/ranger/kv.d.ts +42 -5
- package/dist/ranger/kv.d.ts.map +1 -1
- package/dist/ranger/payload.d.ts +5 -2
- package/dist/ranger/payload.d.ts.map +1 -1
- package/dist/ranger/writer.d.ts +107 -2
- package/dist/ranger/writer.d.ts.map +1 -1
- package/dist/setupspecs.d.ts +0 -1
- package/dist/signals/observable.d.ts +0 -1
- package/dist/transport.d.ts +0 -1
- package/dist/user/client.d.ts +0 -1
- package/dist/user/payload.d.ts +0 -1
- package/dist/util/retrieve.d.ts +0 -1
- package/dist/util/telem.d.ts +0 -1
- package/dist/util/zod.d.ts +0 -1
- package/dist/workspace/client.d.ts +0 -1
- package/dist/workspace/lineplot/client.d.ts +0 -1
- package/dist/workspace/lineplot/payload.d.ts +0 -1
- package/dist/workspace/lineplot/retriever.d.ts +0 -1
- package/dist/workspace/lineplot/writer.d.ts +0 -1
- package/dist/workspace/payload.d.ts +0 -1
- package/dist/workspace/retriever.d.ts +0 -1
- package/dist/workspace/schematic/client.d.ts +0 -1
- package/dist/workspace/schematic/payload.d.ts +0 -1
- package/dist/workspace/schematic/retriever.d.ts +0 -1
- package/dist/workspace/schematic/writer.d.ts +0 -1
- package/dist/workspace/writer.d.ts +0 -1
- package/package.json +14 -12
- package/src/access/access.spec.ts +11 -11
- package/src/channel/batchRetriever.spec.ts +2 -0
- package/src/channel/channel.spec.ts +51 -31
- package/src/channel/client.ts +7 -0
- package/src/channel/payload.ts +1 -0
- package/src/client.ts +17 -8
- package/src/connection/checker.ts +58 -1
- package/src/connection/connection.spec.ts +43 -3
- package/src/control/client.ts +9 -0
- package/src/errors.spec.ts +9 -0
- package/src/framer/client.ts +0 -1
- package/src/framer/frame.spec.ts +2 -2
- package/src/framer/frame.ts +22 -22
- package/src/framer/writer.ts +2 -1
- package/src/hardware/device/payload.ts +9 -0
- package/src/hardware/rack/payload.ts +9 -0
- package/src/hardware/task/client.ts +82 -6
- package/src/hardware/task/ni/types.ts +1716 -0
- package/src/hardware/task/payload.ts +10 -0
- package/src/hardware/task/task.spec.ts +45 -30
- package/src/label/client.ts +49 -19
- package/src/label/label.spec.ts +9 -0
- package/src/label/retriever.ts +2 -1
- package/src/label/writer.ts +11 -3
- package/src/ontology/client.ts +227 -14
- package/src/ontology/group/writer.ts +10 -12
- package/src/ontology/ontology.spec.ts +3 -5
- package/src/ontology/payload.ts +5 -1
- package/src/ontology/writer.ts +26 -12
- package/src/ranger/client.ts +223 -41
- package/src/ranger/external.ts +1 -1
- package/src/ranger/kv.ts +50 -11
- package/src/ranger/payload.ts +9 -5
- package/src/ranger/ranger.spec.ts +114 -49
- package/src/ranger/writer.ts +7 -2
- package/src/vite-env.d.ts +1 -1
- package/vite.config.ts +6 -1
- package/dist/ranger/active.d.ts +0 -11
- package/dist/ranger/active.d.ts.map +0 -1
- package/dist/ranger/range.d.ts +0 -32
- package/dist/ranger/range.d.ts.map +0 -1
- package/src/ranger/active.ts +0 -74
- package/src/ranger/range.ts +0 -98
|
@@ -0,0 +1,1716 @@
|
|
|
1
|
+
// Copyright 2024 Synnax Labs, Inc.
|
|
2
|
+
//
|
|
3
|
+
// Use of this software is governed by the Business Source License included in the file
|
|
4
|
+
// licenses/BSL.txt.
|
|
5
|
+
//
|
|
6
|
+
// As of the Change Date specified in that file, in accordance with the Business Source
|
|
7
|
+
// License, use of this software will be governed by the Apache License, Version 2.0,
|
|
8
|
+
// included in the file licenses/APL.txt.
|
|
9
|
+
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
|
|
12
|
+
import { device } from "@/hardware/device";
|
|
13
|
+
import { task } from "@/hardware/task";
|
|
14
|
+
|
|
15
|
+
export const unitsVoltsZ = z.literal("Volts");
|
|
16
|
+
export type UnitsVolts = z.infer<typeof unitsVoltsZ>;
|
|
17
|
+
export const unitsAmpsZ = z.literal("Amps");
|
|
18
|
+
export type UnitsAmps = z.infer<typeof unitsAmpsZ>;
|
|
19
|
+
export const unitsDegFZ = z.literal("DegF");
|
|
20
|
+
export type UnitsDegF = z.infer<typeof unitsDegFZ>;
|
|
21
|
+
export const unitsDegCZ = z.literal("DegC");
|
|
22
|
+
export type UnitsDegC = z.infer<typeof unitsDegCZ>;
|
|
23
|
+
export const unitsDegRZ = z.literal("DegR");
|
|
24
|
+
export type UnitsDegR = z.infer<typeof unitsDegRZ>;
|
|
25
|
+
export const unitsKelvinsZ = z.literal("Kelvins");
|
|
26
|
+
export type UnitsKelvins = z.infer<typeof unitsKelvinsZ>;
|
|
27
|
+
export const unitsStrainZ = z.literal("Strain");
|
|
28
|
+
export type UnitsStrain = z.infer<typeof unitsStrainZ>;
|
|
29
|
+
export const unitsOhmsZ = z.literal("Ohms");
|
|
30
|
+
export type UnitsOhms = z.infer<typeof unitsOhmsZ>;
|
|
31
|
+
export const unitsHzZ = z.literal("Hz");
|
|
32
|
+
export type UnitsHz = z.infer<typeof unitsHzZ>;
|
|
33
|
+
export const unitsSecondsZ = z.literal("Seconds");
|
|
34
|
+
export type UnitsSeconds = z.infer<typeof unitsSecondsZ>;
|
|
35
|
+
export const unitsMetersZ = z.literal("Meters");
|
|
36
|
+
export type UnitsMeters = z.infer<typeof unitsMetersZ>;
|
|
37
|
+
export const unitsInchesZ = z.literal("Inches");
|
|
38
|
+
export type UnitsInches = z.infer<typeof unitsInchesZ>;
|
|
39
|
+
export const unitsDegAngleZ = z.literal("Degrees");
|
|
40
|
+
export type UnitsDegAngle = z.infer<typeof unitsDegAngleZ>;
|
|
41
|
+
export const unitsRadiansAngleZ = z.literal("Radians");
|
|
42
|
+
export type UnitsRadiansAngle = z.infer<typeof unitsRadiansAngleZ>;
|
|
43
|
+
export const unitsGravityZ = z.literal("g");
|
|
44
|
+
export type UnitsGravity = z.infer<typeof unitsGravityZ>;
|
|
45
|
+
export const unitsMetersPerSecondSquaredZ = z.literal("MetersPerSecondSquared");
|
|
46
|
+
export type UnitsMetersPerSecondSquared = z.infer<typeof unitsMetersPerSecondSquaredZ>;
|
|
47
|
+
export const unitsNewtonsZ = z.literal("Newtons");
|
|
48
|
+
export type UnitsNewtons = z.infer<typeof unitsNewtonsZ>;
|
|
49
|
+
export const unitsPoundsZ = z.literal("Pounds");
|
|
50
|
+
export type UnitsPounds = z.infer<typeof unitsPoundsZ>;
|
|
51
|
+
export const unitsKgForceZ = z.literal("KilogramForce");
|
|
52
|
+
export type UnitsKgForce = z.infer<typeof unitsKgForceZ>;
|
|
53
|
+
export const unitsLbsPerSquareInch = z.literal("PoundsPerSquareInch");
|
|
54
|
+
export type UnitsLbsPerSquareInch = z.infer<typeof unitsLbsPerSquareInch>;
|
|
55
|
+
export const unitsBarZ = z.literal("Bar");
|
|
56
|
+
export type UnitsBar = z.infer<typeof unitsBarZ>;
|
|
57
|
+
export const unitsPascalsZ = z.literal("Pascals");
|
|
58
|
+
export type UnitsPascals = z.infer<typeof unitsPascalsZ>;
|
|
59
|
+
export const unitsVoltsPerVoltZ = z.literal("VoltsPerVolt");
|
|
60
|
+
export type UnitsVoltsPerVolt = z.infer<typeof unitsVoltsPerVoltZ>;
|
|
61
|
+
export const unitsmVoltsPerVoltZ = z.literal("mVoltsPerVolt");
|
|
62
|
+
export type UnitsmVoltsPerVolt = z.infer<typeof unitsmVoltsPerVoltZ>;
|
|
63
|
+
export const unitsNewtonMetersZ = z.literal("NewtonMeters");
|
|
64
|
+
export type UnitsNewtonMeters = z.infer<typeof unitsNewtonMetersZ>;
|
|
65
|
+
export const unitsInchLbsZ = z.literal("InchPounds");
|
|
66
|
+
export type UnitsInchLbs = z.infer<typeof unitsInchLbsZ>;
|
|
67
|
+
export const unitsInOzZ = z.literal("InchOunces");
|
|
68
|
+
export type UnitsInOz = z.infer<typeof unitsInOzZ>;
|
|
69
|
+
export const unitsFtLbsZ = z.literal("FootPounds");
|
|
70
|
+
export type UnitsFtLbs = z.infer<typeof unitsFtLbsZ>;
|
|
71
|
+
|
|
72
|
+
export const unitsZ = z.union([
|
|
73
|
+
unitsVoltsZ,
|
|
74
|
+
unitsAmpsZ,
|
|
75
|
+
unitsDegFZ,
|
|
76
|
+
unitsDegCZ,
|
|
77
|
+
unitsDegRZ,
|
|
78
|
+
unitsKelvinsZ,
|
|
79
|
+
unitsStrainZ,
|
|
80
|
+
unitsOhmsZ,
|
|
81
|
+
unitsHzZ,
|
|
82
|
+
unitsSecondsZ,
|
|
83
|
+
unitsMetersZ,
|
|
84
|
+
unitsInchesZ,
|
|
85
|
+
unitsDegAngleZ,
|
|
86
|
+
unitsRadiansAngleZ,
|
|
87
|
+
unitsGravityZ,
|
|
88
|
+
unitsMetersPerSecondSquaredZ,
|
|
89
|
+
unitsNewtonsZ,
|
|
90
|
+
unitsPoundsZ,
|
|
91
|
+
unitsKgForceZ,
|
|
92
|
+
unitsLbsPerSquareInch,
|
|
93
|
+
unitsBarZ,
|
|
94
|
+
unitsPascalsZ,
|
|
95
|
+
unitsVoltsPerVoltZ,
|
|
96
|
+
unitsmVoltsPerVoltZ,
|
|
97
|
+
unitsNewtonMetersZ,
|
|
98
|
+
unitsInchLbsZ,
|
|
99
|
+
unitsInOzZ,
|
|
100
|
+
unitsFtLbsZ,
|
|
101
|
+
]);
|
|
102
|
+
|
|
103
|
+
export type Units = z.infer<typeof unitsZ>;
|
|
104
|
+
|
|
105
|
+
export const linScaleZ = z.object({
|
|
106
|
+
type: z.literal("linear"),
|
|
107
|
+
slope: z.number().refine((val) => val !== 0, {
|
|
108
|
+
message: "Value must be non-zero",
|
|
109
|
+
}),
|
|
110
|
+
yIntercept: z.number(),
|
|
111
|
+
preScaledUnits: unitsZ,
|
|
112
|
+
scaledUnits: unitsZ,
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
export type LinScale = z.infer<typeof linScaleZ>;
|
|
116
|
+
|
|
117
|
+
export const ZERO_LIN_SCALE: LinScale = {
|
|
118
|
+
type: "linear",
|
|
119
|
+
slope: 1,
|
|
120
|
+
yIntercept: 0,
|
|
121
|
+
preScaledUnits: "Volts",
|
|
122
|
+
scaledUnits: "Volts",
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
export const mapScaleZ = z.object({
|
|
126
|
+
type: z.literal("map"),
|
|
127
|
+
preScaledMin: z.number(),
|
|
128
|
+
preScaledMax: z.number(),
|
|
129
|
+
scaledMin: z.number(),
|
|
130
|
+
scaledMax: z.number(),
|
|
131
|
+
preScaledUnits: unitsZ,
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
export type MapScale = z.infer<typeof mapScaleZ>;
|
|
135
|
+
|
|
136
|
+
export const ZERO_MAP_SCALE: MapScale = {
|
|
137
|
+
type: "map",
|
|
138
|
+
preScaledMin: 0,
|
|
139
|
+
preScaledMax: 0,
|
|
140
|
+
scaledMin: 0,
|
|
141
|
+
scaledMax: 0,
|
|
142
|
+
preScaledUnits: "Volts",
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
export const tableScaleZ = z.object({
|
|
146
|
+
type: z.literal("table"),
|
|
147
|
+
preScaledVals: z.array(z.number()),
|
|
148
|
+
scaledVals: z.array(z.number()),
|
|
149
|
+
preScaledUnits: unitsZ,
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
export type TableScale = z.infer<typeof tableScaleZ>;
|
|
153
|
+
|
|
154
|
+
export const ZERO_TABLE_SCALE: z.infer<typeof tableScaleZ> = {
|
|
155
|
+
type: "table",
|
|
156
|
+
preScaledVals: [],
|
|
157
|
+
scaledVals: [],
|
|
158
|
+
preScaledUnits: "Volts",
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
export const noScaleZ = z.object({
|
|
162
|
+
type: z.literal("none"),
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
export const ZERO_NO_SCALE: z.infer<typeof noScaleZ> = {
|
|
166
|
+
type: "none",
|
|
167
|
+
};
|
|
168
|
+
|
|
169
|
+
export const scaleZ = z.union([linScaleZ, mapScaleZ, tableScaleZ, noScaleZ]);
|
|
170
|
+
export type Scale = z.infer<typeof scaleZ>;
|
|
171
|
+
export type ScaleType = Scale["type"];
|
|
172
|
+
|
|
173
|
+
export const ZERO_SCALES: Record<ScaleType, Scale> = {
|
|
174
|
+
linear: ZERO_LIN_SCALE,
|
|
175
|
+
map: ZERO_MAP_SCALE,
|
|
176
|
+
table: ZERO_TABLE_SCALE,
|
|
177
|
+
none: ZERO_NO_SCALE,
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
export const SCALE_SCHEMAS: Record<ScaleType, z.ZodType<Scale>> = {
|
|
181
|
+
linear: linScaleZ,
|
|
182
|
+
map: mapScaleZ,
|
|
183
|
+
table: tableScaleZ,
|
|
184
|
+
none: noScaleZ,
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
const terminalConfigZ = z.enum(["Cfg_Default", "RSE", "NRSE", "Diff", "PseudoDiff"]);
|
|
188
|
+
|
|
189
|
+
export type TerminalConfig = z.infer<typeof terminalConfigZ>;
|
|
190
|
+
|
|
191
|
+
const excitSourceZ = z.enum(["Internal", "External", "None"]);
|
|
192
|
+
|
|
193
|
+
export type ExcitationSource = z.infer<typeof excitSourceZ>;
|
|
194
|
+
|
|
195
|
+
const baseAIChanZ = z.object({
|
|
196
|
+
name: z.string(),
|
|
197
|
+
key: z.string(),
|
|
198
|
+
channel: z.number().optional(),
|
|
199
|
+
port: z.number(),
|
|
200
|
+
enabled: z.boolean(),
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
const minMaxValZ = z.object({
|
|
204
|
+
minVal: z.number(),
|
|
205
|
+
maxVal: z.number(),
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
export const sensitivityUnitsZ = z.enum(["mVoltsPerG", "VoltsPerG"]);
|
|
209
|
+
|
|
210
|
+
export type AccelSensitivityUnits = z.infer<typeof sensitivityUnitsZ>;
|
|
211
|
+
|
|
212
|
+
export const accelerationUnitsZ = z.enum([
|
|
213
|
+
"g",
|
|
214
|
+
"MetersPerSecondSquared",
|
|
215
|
+
"InchesPerSecondSquared",
|
|
216
|
+
]);
|
|
217
|
+
|
|
218
|
+
export type AccelerationUnits = z.infer<typeof accelerationUnitsZ>;
|
|
219
|
+
|
|
220
|
+
const baseAiAccelChanZ = baseAIChanZ.merge(minMaxValZ).extend({
|
|
221
|
+
terminalConfig: terminalConfigZ,
|
|
222
|
+
sensitivity: z.number(),
|
|
223
|
+
sensitivityUnits: sensitivityUnitsZ,
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
export const forceUnitsZ = z.enum(["Newtons", "Pounds", "KilogramForce"]);
|
|
227
|
+
export type ForceUnits = z.infer<typeof forceUnitsZ>;
|
|
228
|
+
|
|
229
|
+
export const electricalUnitsZ = z.enum(["mVoltsPerVolt", "VoltsPerVolt"]);
|
|
230
|
+
export type ElectricalUnits = z.infer<typeof electricalUnitsZ>;
|
|
231
|
+
|
|
232
|
+
// 1 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaiaccelchan.html
|
|
233
|
+
export const aiAccelChanZ = baseAiAccelChanZ.extend({
|
|
234
|
+
type: z.literal("ai_accel"),
|
|
235
|
+
units: accelerationUnitsZ,
|
|
236
|
+
currentExcitSource: excitSourceZ,
|
|
237
|
+
currentExcitVal: z.number(),
|
|
238
|
+
customScale: scaleZ,
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
export type AIAccelChan = z.infer<typeof aiAccelChanZ>;
|
|
242
|
+
|
|
243
|
+
export const ZERO_AI_ACCEL_CHAN: AIAccelChan = {
|
|
244
|
+
name: "",
|
|
245
|
+
key: "",
|
|
246
|
+
type: "ai_accel",
|
|
247
|
+
channel: 0,
|
|
248
|
+
port: 0,
|
|
249
|
+
units: "g",
|
|
250
|
+
enabled: true,
|
|
251
|
+
minVal: 0,
|
|
252
|
+
maxVal: 1,
|
|
253
|
+
terminalConfig: "Cfg_Default",
|
|
254
|
+
sensitivity: 0,
|
|
255
|
+
sensitivityUnits: "mVoltsPerG",
|
|
256
|
+
currentExcitSource: "Internal",
|
|
257
|
+
currentExcitVal: 0,
|
|
258
|
+
customScale: ZERO_NO_SCALE,
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
// 2 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaiaccel4wiredcvoltagechan.html
|
|
262
|
+
const aiAccel4WireDCVoltageChanZ = baseAiAccelChanZ.extend({
|
|
263
|
+
type: z.literal("ai_accel_4_wire_dc_voltage"),
|
|
264
|
+
units: accelerationUnitsZ,
|
|
265
|
+
voltageExcitSource: excitSourceZ,
|
|
266
|
+
voltageExcitVal: z.number(),
|
|
267
|
+
useExcitForScaling: z.boolean(),
|
|
268
|
+
customScale: scaleZ,
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
export type AIAccel4WireDCVoltageChan = z.infer<typeof aiAccel4WireDCVoltageChanZ>;
|
|
272
|
+
|
|
273
|
+
export const ZERO_AI_ACCEL_4WIRE_DC_VOLTAGE_CHAN: AIAccel4WireDCVoltageChan = {
|
|
274
|
+
name: "",
|
|
275
|
+
key: "",
|
|
276
|
+
type: "ai_accel_4_wire_dc_voltage",
|
|
277
|
+
units: "g",
|
|
278
|
+
channel: 0,
|
|
279
|
+
port: 0,
|
|
280
|
+
enabled: true,
|
|
281
|
+
minVal: 0,
|
|
282
|
+
maxVal: 1,
|
|
283
|
+
terminalConfig: "Cfg_Default",
|
|
284
|
+
sensitivity: 0,
|
|
285
|
+
sensitivityUnits: "mVoltsPerG",
|
|
286
|
+
voltageExcitSource: "Internal",
|
|
287
|
+
voltageExcitVal: 0,
|
|
288
|
+
useExcitForScaling: false,
|
|
289
|
+
customScale: ZERO_NO_SCALE,
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
// 3 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaiaccelchargechan.html
|
|
293
|
+
const aiAccelChargeChanZ = baseAiAccelChanZ.extend({
|
|
294
|
+
type: z.literal("ai_accel_charge"),
|
|
295
|
+
units: accelerationUnitsZ,
|
|
296
|
+
customScale: scaleZ,
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
export type AIAccelChargeChan = z.infer<typeof aiAccelChargeChanZ>;
|
|
300
|
+
|
|
301
|
+
export const ZERO_AI_ACCEL_CHARGE_CHAN: AIAccelChargeChan = {
|
|
302
|
+
name: "",
|
|
303
|
+
key: "",
|
|
304
|
+
type: "ai_accel_charge",
|
|
305
|
+
channel: 0,
|
|
306
|
+
port: 0,
|
|
307
|
+
enabled: true,
|
|
308
|
+
minVal: 0,
|
|
309
|
+
maxVal: 1,
|
|
310
|
+
terminalConfig: "Cfg_Default",
|
|
311
|
+
sensitivity: 0,
|
|
312
|
+
sensitivityUnits: "mVoltsPerG",
|
|
313
|
+
units: "g",
|
|
314
|
+
customScale: ZERO_NO_SCALE,
|
|
315
|
+
};
|
|
316
|
+
|
|
317
|
+
export const bridgeConfigZ = z.enum(["FullBridge", "HalfBridge", "QuarterBridge"]);
|
|
318
|
+
export type BridgeConfig = z.infer<typeof bridgeConfigZ>;
|
|
319
|
+
|
|
320
|
+
// 4 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaibridgechan.html
|
|
321
|
+
const aiBridgeChanZ = baseAIChanZ.extend({
|
|
322
|
+
type: z.literal("ai_bridge"),
|
|
323
|
+
terminalConfig: terminalConfigZ,
|
|
324
|
+
units: electricalUnitsZ,
|
|
325
|
+
minVal: z.number(),
|
|
326
|
+
maxVal: z.number(),
|
|
327
|
+
bridgeConfig: bridgeConfigZ,
|
|
328
|
+
voltageExcitSource: excitSourceZ,
|
|
329
|
+
voltageExcitVal: z.number(),
|
|
330
|
+
nominalBridgeResistance: z.number().refine((val) => val > 0, {
|
|
331
|
+
message: "Value must be greater than 0",
|
|
332
|
+
}),
|
|
333
|
+
customScale: scaleZ,
|
|
334
|
+
});
|
|
335
|
+
|
|
336
|
+
export type AIBridgeChan = z.infer<typeof aiBridgeChanZ>;
|
|
337
|
+
|
|
338
|
+
export const ZERO_AI_BRIDGE_CHAN: AIBridgeChan = {
|
|
339
|
+
name: "",
|
|
340
|
+
key: "",
|
|
341
|
+
type: "ai_bridge",
|
|
342
|
+
units: "mVoltsPerVolt",
|
|
343
|
+
channel: 0,
|
|
344
|
+
port: 0,
|
|
345
|
+
enabled: true,
|
|
346
|
+
minVal: 0,
|
|
347
|
+
maxVal: 1,
|
|
348
|
+
terminalConfig: "Cfg_Default",
|
|
349
|
+
bridgeConfig: "FullBridge",
|
|
350
|
+
voltageExcitSource: "Internal",
|
|
351
|
+
voltageExcitVal: 0,
|
|
352
|
+
nominalBridgeResistance: 1,
|
|
353
|
+
customScale: ZERO_NO_SCALE,
|
|
354
|
+
};
|
|
355
|
+
|
|
356
|
+
// 5 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaichargechan.html
|
|
357
|
+
const aiChargeChan = baseAIChanZ.extend({
|
|
358
|
+
type: z.literal("ai_charge"),
|
|
359
|
+
terminalConfig: terminalConfigZ,
|
|
360
|
+
minVal: z.number(),
|
|
361
|
+
maxVal: z.number(),
|
|
362
|
+
units: z.enum(["C", "uC"]),
|
|
363
|
+
customScale: scaleZ,
|
|
364
|
+
});
|
|
365
|
+
|
|
366
|
+
export type AIChargeChan = z.infer<typeof aiChargeChan>;
|
|
367
|
+
|
|
368
|
+
export const ZERO_AI_CHARGE_CHAN: AIChargeChan = {
|
|
369
|
+
name: "",
|
|
370
|
+
key: "",
|
|
371
|
+
channel: 0,
|
|
372
|
+
type: "ai_charge",
|
|
373
|
+
port: 0,
|
|
374
|
+
enabled: true,
|
|
375
|
+
minVal: 0,
|
|
376
|
+
maxVal: 1,
|
|
377
|
+
terminalConfig: "Cfg_Default",
|
|
378
|
+
units: "C",
|
|
379
|
+
customScale: ZERO_NO_SCALE,
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
const currentUnitsZ = z.enum(["Amps"]);
|
|
383
|
+
|
|
384
|
+
const shuntResistorLocZ = z.enum(["Default", "Internal", "External"]);
|
|
385
|
+
|
|
386
|
+
const shuntResistorValZ = z.number().refine((val) => val > 0, {
|
|
387
|
+
message: "Value must be greater than 0",
|
|
388
|
+
});
|
|
389
|
+
|
|
390
|
+
export type ShuntResistorLoc = z.infer<typeof shuntResistorLocZ>;
|
|
391
|
+
|
|
392
|
+
// 6 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaicurrentchan.html
|
|
393
|
+
const aiCurrentChanZ = baseAIChanZ.extend({
|
|
394
|
+
type: z.literal("ai_current"),
|
|
395
|
+
terminalConfig: terminalConfigZ,
|
|
396
|
+
minVal: z.number(),
|
|
397
|
+
maxVal: z.number(),
|
|
398
|
+
units: currentUnitsZ,
|
|
399
|
+
shuntResistorLoc: shuntResistorLocZ,
|
|
400
|
+
extShuntResistorVal: shuntResistorValZ,
|
|
401
|
+
customScale: scaleZ,
|
|
402
|
+
});
|
|
403
|
+
|
|
404
|
+
export type AICurrentChan = z.infer<typeof aiCurrentChanZ>;
|
|
405
|
+
|
|
406
|
+
export const ZERO_AI_CURRENT_CHAN: AICurrentChan = {
|
|
407
|
+
name: "",
|
|
408
|
+
key: "",
|
|
409
|
+
channel: 0,
|
|
410
|
+
port: 0,
|
|
411
|
+
type: "ai_current",
|
|
412
|
+
enabled: true,
|
|
413
|
+
minVal: 0,
|
|
414
|
+
maxVal: 1,
|
|
415
|
+
terminalConfig: "Cfg_Default",
|
|
416
|
+
units: "Amps",
|
|
417
|
+
shuntResistorLoc: "Default",
|
|
418
|
+
extShuntResistorVal: 1,
|
|
419
|
+
customScale: ZERO_NO_SCALE,
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
// 7 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaicurrentrmschan.html
|
|
423
|
+
const aiCurrentRMSChanZ = baseAIChanZ.extend({
|
|
424
|
+
type: z.literal("ai_current_rms"),
|
|
425
|
+
terminalConfig: terminalConfigZ,
|
|
426
|
+
minVal: z.number(),
|
|
427
|
+
maxVal: z.number(),
|
|
428
|
+
units: currentUnitsZ,
|
|
429
|
+
shuntResistorLoc: shuntResistorLocZ,
|
|
430
|
+
extShuntResistorVal: shuntResistorValZ,
|
|
431
|
+
customScale: scaleZ,
|
|
432
|
+
});
|
|
433
|
+
|
|
434
|
+
export type AICurrentRMSChan = z.infer<typeof aiCurrentRMSChanZ>;
|
|
435
|
+
|
|
436
|
+
export const ZERO_AI_CURRENT_RMS_CHAN: AICurrentRMSChan = {
|
|
437
|
+
name: "",
|
|
438
|
+
key: "",
|
|
439
|
+
channel: 0,
|
|
440
|
+
type: "ai_current_rms",
|
|
441
|
+
port: 0,
|
|
442
|
+
enabled: true,
|
|
443
|
+
minVal: 0,
|
|
444
|
+
maxVal: 1,
|
|
445
|
+
terminalConfig: "Cfg_Default",
|
|
446
|
+
units: "Amps",
|
|
447
|
+
shuntResistorLoc: "Default",
|
|
448
|
+
extShuntResistorVal: 0,
|
|
449
|
+
customScale: ZERO_NO_SCALE,
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
// 8 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaiforcebridgepolynomialchan.html
|
|
453
|
+
const aiForceBridgePolynomialChanZ = baseAIChanZ.extend({
|
|
454
|
+
type: z.literal("ai_force_bridge_polynomial"),
|
|
455
|
+
terminalConfig: terminalConfigZ,
|
|
456
|
+
minVal: z.number(),
|
|
457
|
+
maxVal: z.number(),
|
|
458
|
+
units: forceUnitsZ,
|
|
459
|
+
bridgeConfig: bridgeConfigZ,
|
|
460
|
+
voltageExcitSource: excitSourceZ,
|
|
461
|
+
voltageExcitVal: z.number(),
|
|
462
|
+
nominalBridgeResistance: z.number(),
|
|
463
|
+
forwardCoeffs: z.array(z.number()),
|
|
464
|
+
reverseCoeffs: z.array(z.number()),
|
|
465
|
+
electricalUnits: electricalUnitsZ,
|
|
466
|
+
physicalUnits: forceUnitsZ,
|
|
467
|
+
customScale: scaleZ,
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
export type AIForceBridgePolynomialChan = z.infer<typeof aiForceBridgePolynomialChanZ>;
|
|
471
|
+
|
|
472
|
+
export const ZERO_AI_FORCE_BRIDGE_POLYNOMIAL_CHAN: AIForceBridgePolynomialChan = {
|
|
473
|
+
name: "",
|
|
474
|
+
key: "",
|
|
475
|
+
type: "ai_force_bridge_polynomial",
|
|
476
|
+
channel: 0,
|
|
477
|
+
port: 0,
|
|
478
|
+
enabled: true,
|
|
479
|
+
minVal: 0,
|
|
480
|
+
maxVal: 1,
|
|
481
|
+
terminalConfig: "Cfg_Default",
|
|
482
|
+
units: "Newtons",
|
|
483
|
+
bridgeConfig: "FullBridge",
|
|
484
|
+
voltageExcitSource: "Internal",
|
|
485
|
+
voltageExcitVal: 0,
|
|
486
|
+
nominalBridgeResistance: 0,
|
|
487
|
+
forwardCoeffs: [],
|
|
488
|
+
reverseCoeffs: [],
|
|
489
|
+
electricalUnits: "mVoltsPerVolt",
|
|
490
|
+
physicalUnits: "Newtons",
|
|
491
|
+
customScale: ZERO_NO_SCALE,
|
|
492
|
+
};
|
|
493
|
+
|
|
494
|
+
// 9 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaiforcebridgetablechan.html
|
|
495
|
+
const aiForceBridgeTableChanZ = baseAIChanZ.extend({
|
|
496
|
+
type: z.literal("ai_force_bridge_table"),
|
|
497
|
+
minVal: z.number(),
|
|
498
|
+
maxVal: z.number(),
|
|
499
|
+
units: forceUnitsZ,
|
|
500
|
+
bridgeConfig: bridgeConfigZ,
|
|
501
|
+
voltageExcitSource: excitSourceZ,
|
|
502
|
+
voltageExcitVal: z.number(),
|
|
503
|
+
nominalBridgeResistance: z.number(),
|
|
504
|
+
electricalUnits: electricalUnitsZ,
|
|
505
|
+
electricalVals: z.array(z.number()),
|
|
506
|
+
physicalUnits: forceUnitsZ,
|
|
507
|
+
physicalVals: z.array(z.number()),
|
|
508
|
+
customScale: scaleZ,
|
|
509
|
+
});
|
|
510
|
+
|
|
511
|
+
export type AIForceBridgeTableChan = z.infer<typeof aiForceBridgeTableChanZ>;
|
|
512
|
+
|
|
513
|
+
export const ZERO_AI_FORCE_BRIDGE_TABLE_CHAN: AIForceBridgeTableChan = {
|
|
514
|
+
name: "",
|
|
515
|
+
key: "",
|
|
516
|
+
type: "ai_force_bridge_table",
|
|
517
|
+
channel: 0,
|
|
518
|
+
port: 0,
|
|
519
|
+
enabled: true,
|
|
520
|
+
minVal: 0,
|
|
521
|
+
maxVal: 1,
|
|
522
|
+
units: "Newtons",
|
|
523
|
+
bridgeConfig: "FullBridge",
|
|
524
|
+
voltageExcitSource: "Internal",
|
|
525
|
+
voltageExcitVal: 0,
|
|
526
|
+
nominalBridgeResistance: 0,
|
|
527
|
+
electricalUnits: "mVoltsPerVolt",
|
|
528
|
+
electricalVals: [],
|
|
529
|
+
physicalUnits: "Newtons",
|
|
530
|
+
physicalVals: [],
|
|
531
|
+
customScale: ZERO_NO_SCALE,
|
|
532
|
+
};
|
|
533
|
+
|
|
534
|
+
// 10 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaiforcebridgetwopointlinchan.html
|
|
535
|
+
const aiForceBridgeTwoPointLinChan = baseAIChanZ.extend({
|
|
536
|
+
type: z.literal("ai_force_bridge_two_point_lin"),
|
|
537
|
+
terminalConfig: terminalConfigZ,
|
|
538
|
+
minVal: z.number(),
|
|
539
|
+
maxVal: z.number(),
|
|
540
|
+
units: forceUnitsZ,
|
|
541
|
+
bridgeConfig: bridgeConfigZ,
|
|
542
|
+
voltageExcitSource: excitSourceZ,
|
|
543
|
+
voltageExcitVal: z.number(),
|
|
544
|
+
nominalBridgeResistance: z.number(),
|
|
545
|
+
electricalUnits: electricalUnitsZ,
|
|
546
|
+
physicalUnits: forceUnitsZ,
|
|
547
|
+
firstElectricalVal: z.number(),
|
|
548
|
+
firstPhysicalVal: z.number(),
|
|
549
|
+
secondElectricalVal: z.number(),
|
|
550
|
+
secondPhysicalVal: z.number(),
|
|
551
|
+
customScale: scaleZ,
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
export type AIForceBridgeTwoPointLinChan = z.infer<typeof aiForceBridgeTwoPointLinChan>;
|
|
555
|
+
|
|
556
|
+
export const ZERO_AI_FORCE_BRIDGE_TWO_POINT_LIN_CHAN: AIForceBridgeTwoPointLinChan = {
|
|
557
|
+
name: "",
|
|
558
|
+
key: "",
|
|
559
|
+
type: "ai_force_bridge_two_point_lin",
|
|
560
|
+
channel: 0,
|
|
561
|
+
port: 0,
|
|
562
|
+
enabled: true,
|
|
563
|
+
minVal: 0,
|
|
564
|
+
maxVal: 1,
|
|
565
|
+
terminalConfig: "Cfg_Default",
|
|
566
|
+
units: "Newtons",
|
|
567
|
+
bridgeConfig: "FullBridge",
|
|
568
|
+
voltageExcitSource: "Internal",
|
|
569
|
+
voltageExcitVal: 0,
|
|
570
|
+
nominalBridgeResistance: 0,
|
|
571
|
+
electricalUnits: "mVoltsPerVolt",
|
|
572
|
+
physicalUnits: "Newtons",
|
|
573
|
+
firstElectricalVal: 0,
|
|
574
|
+
firstPhysicalVal: 0,
|
|
575
|
+
secondElectricalVal: 1,
|
|
576
|
+
secondPhysicalVal: 1,
|
|
577
|
+
customScale: ZERO_NO_SCALE,
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
// 11 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaiforceiepechan.html
|
|
581
|
+
const aiForgeIEPEChanZ = baseAIChanZ.extend({
|
|
582
|
+
type: z.literal("ai_force_iepe"),
|
|
583
|
+
terminalConfig: terminalConfigZ,
|
|
584
|
+
minVal: z.number(),
|
|
585
|
+
maxVal: z.number(),
|
|
586
|
+
units: forceUnitsZ,
|
|
587
|
+
sensitivity: z.number(),
|
|
588
|
+
sensitivityUnits: electricalUnitsZ,
|
|
589
|
+
currentExcitSource: excitSourceZ,
|
|
590
|
+
currentExcitVal: z.number(),
|
|
591
|
+
customScale: scaleZ,
|
|
592
|
+
});
|
|
593
|
+
|
|
594
|
+
export type AIForceEPEChan = z.infer<typeof aiForgeIEPEChanZ>;
|
|
595
|
+
|
|
596
|
+
export const ZERO_AI_FORCE_IEPE_CHAN: AIForceEPEChan = {
|
|
597
|
+
name: "",
|
|
598
|
+
key: "",
|
|
599
|
+
type: "ai_force_iepe",
|
|
600
|
+
channel: 0,
|
|
601
|
+
port: 0,
|
|
602
|
+
enabled: true,
|
|
603
|
+
minVal: 0,
|
|
604
|
+
maxVal: 1,
|
|
605
|
+
terminalConfig: "Cfg_Default",
|
|
606
|
+
units: "Newtons",
|
|
607
|
+
sensitivity: 0,
|
|
608
|
+
sensitivityUnits: "mVoltsPerVolt",
|
|
609
|
+
currentExcitSource: "Internal",
|
|
610
|
+
currentExcitVal: 0,
|
|
611
|
+
customScale: ZERO_NO_SCALE,
|
|
612
|
+
};
|
|
613
|
+
|
|
614
|
+
// 12 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaifreqvoltagechan.html
|
|
615
|
+
const aiFreqVoltageChanZ = baseAIChanZ.extend({
|
|
616
|
+
type: z.literal("ai_freq_voltage"),
|
|
617
|
+
minVal: z.number(),
|
|
618
|
+
maxVal: z.number(),
|
|
619
|
+
units: z.enum(["Hz"]),
|
|
620
|
+
thresholdLevel: z.number(),
|
|
621
|
+
hysteresis: z.number(),
|
|
622
|
+
customScale: scaleZ,
|
|
623
|
+
});
|
|
624
|
+
|
|
625
|
+
export type AIFreqVoltageChan = z.infer<typeof aiFreqVoltageChanZ>;
|
|
626
|
+
|
|
627
|
+
export const ZERO_AI_FREQ_VOLTAGE_CHAN: AIFreqVoltageChan = {
|
|
628
|
+
name: "",
|
|
629
|
+
key: "",
|
|
630
|
+
type: "ai_freq_voltage",
|
|
631
|
+
channel: 0,
|
|
632
|
+
port: 0,
|
|
633
|
+
enabled: true,
|
|
634
|
+
minVal: 0,
|
|
635
|
+
maxVal: 1,
|
|
636
|
+
units: "Hz",
|
|
637
|
+
thresholdLevel: 0,
|
|
638
|
+
hysteresis: 0,
|
|
639
|
+
customScale: ZERO_NO_SCALE,
|
|
640
|
+
};
|
|
641
|
+
|
|
642
|
+
// 13 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaimicrophonechan.html
|
|
643
|
+
const aiMicrophoneChanZ = baseAIChanZ.extend({
|
|
644
|
+
type: z.literal("ai_microphone"),
|
|
645
|
+
terminalConfig: terminalConfigZ,
|
|
646
|
+
micSensitivity: z.number(),
|
|
647
|
+
maxSndPressLevel: z.number(),
|
|
648
|
+
currentExcitSource: excitSourceZ,
|
|
649
|
+
currentExcitVal: z.number(),
|
|
650
|
+
units: z.enum(["Pascals"]),
|
|
651
|
+
customScale: scaleZ,
|
|
652
|
+
});
|
|
653
|
+
|
|
654
|
+
export type AIMicrophoneChan = z.infer<typeof aiMicrophoneChanZ>;
|
|
655
|
+
|
|
656
|
+
export const ZERO_AI_MICROPHONE_CHAN: AIMicrophoneChan = {
|
|
657
|
+
name: "",
|
|
658
|
+
key: "",
|
|
659
|
+
type: "ai_microphone",
|
|
660
|
+
channel: 0,
|
|
661
|
+
port: 0,
|
|
662
|
+
enabled: true,
|
|
663
|
+
terminalConfig: "Cfg_Default",
|
|
664
|
+
micSensitivity: 0,
|
|
665
|
+
maxSndPressLevel: 0,
|
|
666
|
+
currentExcitSource: "Internal",
|
|
667
|
+
currentExcitVal: 0,
|
|
668
|
+
units: "Pascals",
|
|
669
|
+
customScale: ZERO_NO_SCALE,
|
|
670
|
+
};
|
|
671
|
+
|
|
672
|
+
export const pressureUnitsZ = z.enum(["PoundsPerSquareInch", "Pascals", "Bar"]);
|
|
673
|
+
export type PressureUnits = z.infer<typeof pressureUnitsZ>;
|
|
674
|
+
|
|
675
|
+
// 14 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaipressurebridgepolynomialchan.html
|
|
676
|
+
const aiPressureBridgePolynomialChanZ = baseAIChanZ.extend({
|
|
677
|
+
type: z.literal("ai_pressure_bridge_polynomial"),
|
|
678
|
+
minVal: z.number(),
|
|
679
|
+
maxVal: z.number(),
|
|
680
|
+
units: pressureUnitsZ,
|
|
681
|
+
bridgeConfig: bridgeConfigZ,
|
|
682
|
+
voltageExcitSource: excitSourceZ,
|
|
683
|
+
voltageExcitVal: z.number(),
|
|
684
|
+
nominalBridgeResistance: z.number(),
|
|
685
|
+
forwardCoeffs: z.array(z.number()),
|
|
686
|
+
reverseCoeffs: z.array(z.number()),
|
|
687
|
+
electricalUnits: electricalUnitsZ,
|
|
688
|
+
physicalUnits: pressureUnitsZ,
|
|
689
|
+
customScale: scaleZ,
|
|
690
|
+
});
|
|
691
|
+
|
|
692
|
+
export type AIPressureBridgePolynomialChan = z.infer<
|
|
693
|
+
typeof aiPressureBridgePolynomialChanZ
|
|
694
|
+
>;
|
|
695
|
+
|
|
696
|
+
export const ZERO_AI_PRESSURE_BRIDGE_POLYNOMIAL_CHAN: AIPressureBridgePolynomialChan = {
|
|
697
|
+
name: "",
|
|
698
|
+
key: "",
|
|
699
|
+
type: "ai_pressure_bridge_polynomial",
|
|
700
|
+
channel: 0,
|
|
701
|
+
port: 0,
|
|
702
|
+
enabled: true,
|
|
703
|
+
minVal: 0,
|
|
704
|
+
maxVal: 1,
|
|
705
|
+
units: "PoundsPerSquareInch",
|
|
706
|
+
bridgeConfig: "FullBridge",
|
|
707
|
+
voltageExcitSource: "Internal",
|
|
708
|
+
voltageExcitVal: 0,
|
|
709
|
+
nominalBridgeResistance: 0,
|
|
710
|
+
forwardCoeffs: [],
|
|
711
|
+
reverseCoeffs: [],
|
|
712
|
+
electricalUnits: "mVoltsPerVolt",
|
|
713
|
+
physicalUnits: "PoundsPerSquareInch",
|
|
714
|
+
customScale: ZERO_NO_SCALE,
|
|
715
|
+
};
|
|
716
|
+
|
|
717
|
+
// 15 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaipressurebridgetablechan.html
|
|
718
|
+
const aiPressureBridgeTableChanZ = baseAIChanZ.extend({
|
|
719
|
+
type: z.literal("ai_pressure_bridge_table"),
|
|
720
|
+
minVal: z.number(),
|
|
721
|
+
maxVal: z.number(),
|
|
722
|
+
units: pressureUnitsZ,
|
|
723
|
+
bridgeConfig: bridgeConfigZ,
|
|
724
|
+
voltageExcitSource: excitSourceZ,
|
|
725
|
+
voltageExcitVal: z.number(),
|
|
726
|
+
nominalBridgeResistance: z.number(),
|
|
727
|
+
electricalUnits: electricalUnitsZ,
|
|
728
|
+
electricalVals: z.array(z.number()),
|
|
729
|
+
physicalUnits: pressureUnitsZ,
|
|
730
|
+
physicalVals: z.array(z.number()),
|
|
731
|
+
customScale: scaleZ,
|
|
732
|
+
});
|
|
733
|
+
|
|
734
|
+
export type AIPressureBridgeTableChan = z.infer<typeof aiPressureBridgeTableChanZ>;
|
|
735
|
+
|
|
736
|
+
export const ZERO_AI_PRESSURE_BRIDGE_TABLE_CHAN: AIPressureBridgeTableChan = {
|
|
737
|
+
name: "",
|
|
738
|
+
key: "",
|
|
739
|
+
type: "ai_pressure_bridge_table",
|
|
740
|
+
channel: 0,
|
|
741
|
+
port: 0,
|
|
742
|
+
enabled: true,
|
|
743
|
+
minVal: 0,
|
|
744
|
+
maxVal: 1,
|
|
745
|
+
units: "PoundsPerSquareInch",
|
|
746
|
+
bridgeConfig: "FullBridge",
|
|
747
|
+
voltageExcitSource: "Internal",
|
|
748
|
+
voltageExcitVal: 0,
|
|
749
|
+
nominalBridgeResistance: 0,
|
|
750
|
+
electricalUnits: "mVoltsPerVolt",
|
|
751
|
+
electricalVals: [],
|
|
752
|
+
physicalUnits: "PoundsPerSquareInch",
|
|
753
|
+
physicalVals: [],
|
|
754
|
+
customScale: ZERO_NO_SCALE,
|
|
755
|
+
};
|
|
756
|
+
|
|
757
|
+
// 16 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaipressurebridgetwopointlinchan.html
|
|
758
|
+
const aiPressureBridgeTwoPointLinChanZ = baseAIChanZ.extend({
|
|
759
|
+
type: z.literal("ai_pressure_bridge_two_point_lin"),
|
|
760
|
+
terminalConfig: terminalConfigZ,
|
|
761
|
+
minVal: z.number(),
|
|
762
|
+
maxVal: z.number(),
|
|
763
|
+
units: pressureUnitsZ,
|
|
764
|
+
bridgeConfig: bridgeConfigZ,
|
|
765
|
+
voltageExcitSource: excitSourceZ,
|
|
766
|
+
voltageExcitVal: z.number(),
|
|
767
|
+
nominalBridgeResistance: z.number(),
|
|
768
|
+
electricalUnits: electricalUnitsZ,
|
|
769
|
+
physicalUnits: pressureUnitsZ,
|
|
770
|
+
firstElectricalVal: z.number(),
|
|
771
|
+
firstPhysicalVal: z.number(),
|
|
772
|
+
secondElectricalVal: z.number(),
|
|
773
|
+
secondPhysicalVal: z.number(),
|
|
774
|
+
customScale: scaleZ,
|
|
775
|
+
});
|
|
776
|
+
|
|
777
|
+
export type AIPressureBridgeTwoPointLinChan = z.infer<
|
|
778
|
+
typeof aiPressureBridgeTwoPointLinChanZ
|
|
779
|
+
>;
|
|
780
|
+
|
|
781
|
+
export const ZERO_AI_PRESSURE_BRIDGE_TWO_POINT_LIN_CHAN: AIPressureBridgeTwoPointLinChan =
|
|
782
|
+
{
|
|
783
|
+
name: "",
|
|
784
|
+
key: "",
|
|
785
|
+
type: "ai_pressure_bridge_two_point_lin",
|
|
786
|
+
channel: 0,
|
|
787
|
+
port: 0,
|
|
788
|
+
enabled: true,
|
|
789
|
+
minVal: 0,
|
|
790
|
+
maxVal: 1,
|
|
791
|
+
terminalConfig: "Cfg_Default",
|
|
792
|
+
units: "PoundsPerSquareInch",
|
|
793
|
+
bridgeConfig: "FullBridge",
|
|
794
|
+
voltageExcitSource: "Internal",
|
|
795
|
+
voltageExcitVal: 0,
|
|
796
|
+
nominalBridgeResistance: 0,
|
|
797
|
+
electricalUnits: "mVoltsPerVolt",
|
|
798
|
+
physicalUnits: "PoundsPerSquareInch",
|
|
799
|
+
firstElectricalVal: 0,
|
|
800
|
+
firstPhysicalVal: 0,
|
|
801
|
+
secondElectricalVal: 1,
|
|
802
|
+
secondPhysicalVal: 1,
|
|
803
|
+
customScale: ZERO_NO_SCALE,
|
|
804
|
+
};
|
|
805
|
+
|
|
806
|
+
export const resistanceConfigZ = z.enum(["2Wire", "3Wire", "4Wire"]);
|
|
807
|
+
export type ResistanceConfig = z.infer<typeof resistanceConfigZ>;
|
|
808
|
+
|
|
809
|
+
// 17 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateairesistancechan.html
|
|
810
|
+
const aiResistanceChanZ = baseAIChanZ.extend({
|
|
811
|
+
type: z.literal("ai_resistance"),
|
|
812
|
+
terminalConfig: terminalConfigZ,
|
|
813
|
+
minVal: z.number(),
|
|
814
|
+
maxVal: z.number(),
|
|
815
|
+
units: z.enum(["Ohms"]),
|
|
816
|
+
resistanceConfig: resistanceConfigZ,
|
|
817
|
+
currentExcitSource: excitSourceZ,
|
|
818
|
+
currentExcitVal: z.number(),
|
|
819
|
+
customScale: scaleZ,
|
|
820
|
+
});
|
|
821
|
+
|
|
822
|
+
export type AIResistanceChan = z.infer<typeof aiResistanceChanZ>;
|
|
823
|
+
|
|
824
|
+
export const ZERO_AI_RESISTANCE_CHAN: AIResistanceChan = {
|
|
825
|
+
name: "",
|
|
826
|
+
key: "",
|
|
827
|
+
type: "ai_resistance",
|
|
828
|
+
channel: 0,
|
|
829
|
+
port: 0,
|
|
830
|
+
enabled: true,
|
|
831
|
+
minVal: 0,
|
|
832
|
+
maxVal: 1,
|
|
833
|
+
terminalConfig: "Cfg_Default",
|
|
834
|
+
units: "Ohms",
|
|
835
|
+
resistanceConfig: "2Wire",
|
|
836
|
+
currentExcitSource: "Internal",
|
|
837
|
+
currentExcitVal: 0,
|
|
838
|
+
customScale: ZERO_NO_SCALE,
|
|
839
|
+
};
|
|
840
|
+
|
|
841
|
+
// 18 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateairosettestraingagechan.html
|
|
842
|
+
const aiRosetteStrainGageChanZ = baseAIChanZ.extend({
|
|
843
|
+
type: z.literal("ai_rosette_strain_gage"),
|
|
844
|
+
terminalConfig: terminalConfigZ,
|
|
845
|
+
minVal: z.number(),
|
|
846
|
+
maxVal: z.number(),
|
|
847
|
+
rosetteType: z.enum(["RectangularRosette", "DeltaRosette", "TeeRosette"]),
|
|
848
|
+
gageOrientation: z.number(),
|
|
849
|
+
rosetteMeasTypes: z.array(
|
|
850
|
+
z.enum([
|
|
851
|
+
"PrincipleStrain1",
|
|
852
|
+
"PrincipleStrain2",
|
|
853
|
+
"PrincipleStrainAngle",
|
|
854
|
+
"CartesianStrainX",
|
|
855
|
+
"CartesianStrainY",
|
|
856
|
+
"CartesianShearStrainXY",
|
|
857
|
+
"MaxShearStrain",
|
|
858
|
+
"MaxShearStrainAngle",
|
|
859
|
+
]),
|
|
860
|
+
),
|
|
861
|
+
strainConfig: z.enum([
|
|
862
|
+
"FullBridgeI",
|
|
863
|
+
"FullBridgeII",
|
|
864
|
+
"FullBridgeIII",
|
|
865
|
+
"HalfBridgeI",
|
|
866
|
+
"HalfBridgeII",
|
|
867
|
+
"QuarterBridgeI",
|
|
868
|
+
"QuarterBridgeII",
|
|
869
|
+
]),
|
|
870
|
+
units: z.enum(["strain"]),
|
|
871
|
+
voltageExcitSource: excitSourceZ,
|
|
872
|
+
voltageExcitVal: z.number(),
|
|
873
|
+
nominalGageResistance: z.number(),
|
|
874
|
+
poissonRatio: z.number(),
|
|
875
|
+
leadWireResistance: z.number(),
|
|
876
|
+
gageFactor: z.number(),
|
|
877
|
+
});
|
|
878
|
+
|
|
879
|
+
export type AIRosetteStrainGageChan = z.infer<typeof aiRosetteStrainGageChanZ>;
|
|
880
|
+
|
|
881
|
+
export const ZERO_AI_ROSETTE_STRAIN_GAGE_CHAN: AIRosetteStrainGageChan = {
|
|
882
|
+
name: "",
|
|
883
|
+
key: "",
|
|
884
|
+
type: "ai_rosette_strain_gage",
|
|
885
|
+
channel: 0,
|
|
886
|
+
port: 0,
|
|
887
|
+
enabled: true,
|
|
888
|
+
minVal: 0,
|
|
889
|
+
maxVal: 1,
|
|
890
|
+
terminalConfig: "Cfg_Default",
|
|
891
|
+
rosetteType: "RectangularRosette",
|
|
892
|
+
strainConfig: "FullBridgeI",
|
|
893
|
+
gageOrientation: 0,
|
|
894
|
+
rosetteMeasTypes: [],
|
|
895
|
+
units: "strain",
|
|
896
|
+
voltageExcitSource: "Internal",
|
|
897
|
+
voltageExcitVal: 0,
|
|
898
|
+
nominalGageResistance: 0,
|
|
899
|
+
poissonRatio: 0,
|
|
900
|
+
leadWireResistance: 0,
|
|
901
|
+
gageFactor: 0,
|
|
902
|
+
};
|
|
903
|
+
|
|
904
|
+
export const temperatureUnitsZ = z.enum(["DegC", "DegF", "Kelvins", "DegR"]);
|
|
905
|
+
export type TemperatureUnits = z.infer<typeof temperatureUnitsZ>;
|
|
906
|
+
|
|
907
|
+
// 19 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateairtdchan.html
|
|
908
|
+
const aiRTDChanZ = baseAIChanZ.extend({
|
|
909
|
+
type: z.literal("ai_rtd"),
|
|
910
|
+
minVal: z.number(),
|
|
911
|
+
maxVal: z.number(),
|
|
912
|
+
units: temperatureUnitsZ,
|
|
913
|
+
rtdType: z.enum([
|
|
914
|
+
"Pt3750",
|
|
915
|
+
"Pt3851",
|
|
916
|
+
"Pt3911",
|
|
917
|
+
"Pt3916",
|
|
918
|
+
"Pt3920",
|
|
919
|
+
"Pt3928",
|
|
920
|
+
"Pt3850",
|
|
921
|
+
]),
|
|
922
|
+
resistanceConfig: resistanceConfigZ,
|
|
923
|
+
currentExcitSource: excitSourceZ,
|
|
924
|
+
currentExcitVal: z.number(),
|
|
925
|
+
r0: z.number(),
|
|
926
|
+
});
|
|
927
|
+
|
|
928
|
+
export type AIRTDChan = z.infer<typeof aiRTDChanZ>;
|
|
929
|
+
|
|
930
|
+
export const ZERO_AI_RTD_CHAN: AIRTDChan = {
|
|
931
|
+
name: "",
|
|
932
|
+
key: "",
|
|
933
|
+
channel: 0,
|
|
934
|
+
type: "ai_rtd",
|
|
935
|
+
port: 0,
|
|
936
|
+
enabled: true,
|
|
937
|
+
minVal: 0,
|
|
938
|
+
maxVal: 1,
|
|
939
|
+
units: "DegC",
|
|
940
|
+
rtdType: "Pt3750",
|
|
941
|
+
resistanceConfig: "2Wire",
|
|
942
|
+
currentExcitSource: "Internal",
|
|
943
|
+
currentExcitVal: 0,
|
|
944
|
+
r0: 0,
|
|
945
|
+
};
|
|
946
|
+
|
|
947
|
+
// 20 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaistraingagechan.html
|
|
948
|
+
const aiStrainGageChan = baseAIChanZ.extend({
|
|
949
|
+
type: z.literal("ai_strain_gauge"),
|
|
950
|
+
terminalConfig: terminalConfigZ,
|
|
951
|
+
minVal: z.number(),
|
|
952
|
+
maxVal: z.number(),
|
|
953
|
+
units: z.enum(["strain"]),
|
|
954
|
+
strainConfig: z.enum([
|
|
955
|
+
"full-bridge-I",
|
|
956
|
+
"full-bridge-II",
|
|
957
|
+
"full-bridge-III",
|
|
958
|
+
"half-bridge-I",
|
|
959
|
+
"half-bridge-II",
|
|
960
|
+
"quarter-bridge-I",
|
|
961
|
+
"quarter-bridge-II",
|
|
962
|
+
]),
|
|
963
|
+
voltageExcitSource: excitSourceZ,
|
|
964
|
+
voltageExcitVal: z.number(),
|
|
965
|
+
gageFactor: z.number(),
|
|
966
|
+
initialBridgeVoltage: z.number(),
|
|
967
|
+
nominalGageResistance: z.number(),
|
|
968
|
+
poissonRatio: z.number(),
|
|
969
|
+
leadWireResistance: z.number(),
|
|
970
|
+
customScale: scaleZ,
|
|
971
|
+
});
|
|
972
|
+
|
|
973
|
+
export type AIStrainGageChan = z.infer<typeof aiStrainGageChan>;
|
|
974
|
+
|
|
975
|
+
export const ZERO_AI_STRAIN_GAGE_CHAN: AIStrainGageChan = {
|
|
976
|
+
name: "",
|
|
977
|
+
key: "",
|
|
978
|
+
type: "ai_strain_gauge",
|
|
979
|
+
channel: 0,
|
|
980
|
+
port: 0,
|
|
981
|
+
enabled: true,
|
|
982
|
+
minVal: 0,
|
|
983
|
+
maxVal: 1,
|
|
984
|
+
terminalConfig: "Cfg_Default",
|
|
985
|
+
units: "strain",
|
|
986
|
+
strainConfig: "full-bridge-I",
|
|
987
|
+
voltageExcitSource: "Internal",
|
|
988
|
+
voltageExcitVal: 0,
|
|
989
|
+
gageFactor: 0,
|
|
990
|
+
initialBridgeVoltage: 0,
|
|
991
|
+
nominalGageResistance: 0,
|
|
992
|
+
poissonRatio: 0,
|
|
993
|
+
leadWireResistance: 0,
|
|
994
|
+
customScale: ZERO_NO_SCALE,
|
|
995
|
+
};
|
|
996
|
+
|
|
997
|
+
// 21 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaitempbuiltinsensorchan.html
|
|
998
|
+
const aiTempBuiltInChanZ = baseAIChanZ.extend({
|
|
999
|
+
type: z.literal("ai_temp_builtin"),
|
|
1000
|
+
units: temperatureUnitsZ,
|
|
1001
|
+
});
|
|
1002
|
+
|
|
1003
|
+
export type AITempBuiltInChan = z.infer<typeof aiTempBuiltInChanZ>;
|
|
1004
|
+
|
|
1005
|
+
export const ZERO_AI_TEMP_BUILTIN_CHAN: AITempBuiltInChan = {
|
|
1006
|
+
name: "",
|
|
1007
|
+
key: "",
|
|
1008
|
+
type: "ai_temp_builtin",
|
|
1009
|
+
channel: 0,
|
|
1010
|
+
port: 0,
|
|
1011
|
+
enabled: true,
|
|
1012
|
+
units: "DegC",
|
|
1013
|
+
};
|
|
1014
|
+
|
|
1015
|
+
// 22 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaithrmcplchan.html
|
|
1016
|
+
const aiThermocoupleChanZ = baseAIChanZ
|
|
1017
|
+
.extend({
|
|
1018
|
+
key: z.string(),
|
|
1019
|
+
type: z.literal("ai_thermocouple"),
|
|
1020
|
+
minVal: z.number(),
|
|
1021
|
+
maxVal: z.number(),
|
|
1022
|
+
units: temperatureUnitsZ,
|
|
1023
|
+
thermocoupleType: z.enum(["J", "K", "N", "R", "S", "T", "B", "E"]),
|
|
1024
|
+
cjcSource: z.enum(["BuiltIn", "ConstVal", "Chan"]),
|
|
1025
|
+
cjcVal: z.number(),
|
|
1026
|
+
cjcPort: z.number(),
|
|
1027
|
+
})
|
|
1028
|
+
.refine(
|
|
1029
|
+
(v) => {
|
|
1030
|
+
if (v.cjcSource === "ConstVal") return v.cjcVal !== undefined;
|
|
1031
|
+
return true;
|
|
1032
|
+
},
|
|
1033
|
+
{
|
|
1034
|
+
path: ["cjcVal"],
|
|
1035
|
+
message: "CJC Value must be defined when CJC Source is ConstVal",
|
|
1036
|
+
},
|
|
1037
|
+
)
|
|
1038
|
+
.refine(
|
|
1039
|
+
(v) => {
|
|
1040
|
+
if (v.cjcSource === "Chan") return v.cjcPort !== undefined;
|
|
1041
|
+
return true;
|
|
1042
|
+
},
|
|
1043
|
+
{
|
|
1044
|
+
path: ["cjcPort"],
|
|
1045
|
+
message: "CJC Port must be defined when CJC Source is ConstVal",
|
|
1046
|
+
},
|
|
1047
|
+
);
|
|
1048
|
+
|
|
1049
|
+
export type AIThermocoupleChan = z.infer<typeof aiThermocoupleChanZ>;
|
|
1050
|
+
|
|
1051
|
+
export const ZERO_AI_THERMOCOUPLE_CHAN: AIThermocoupleChan = {
|
|
1052
|
+
name: "",
|
|
1053
|
+
key: "",
|
|
1054
|
+
type: "ai_thermocouple",
|
|
1055
|
+
channel: 0,
|
|
1056
|
+
port: 0,
|
|
1057
|
+
enabled: true,
|
|
1058
|
+
minVal: 0,
|
|
1059
|
+
maxVal: 1,
|
|
1060
|
+
units: "DegC",
|
|
1061
|
+
thermocoupleType: "J",
|
|
1062
|
+
cjcSource: "BuiltIn",
|
|
1063
|
+
cjcVal: 0,
|
|
1064
|
+
cjcPort: 0,
|
|
1065
|
+
};
|
|
1066
|
+
|
|
1067
|
+
// 23 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaithrmstrchaniex.html
|
|
1068
|
+
const aiThermistorChanIex = baseAIChanZ.extend({
|
|
1069
|
+
key: z.string(),
|
|
1070
|
+
type: z.literal("ai_thermistor_iex"),
|
|
1071
|
+
minVal: z.number(),
|
|
1072
|
+
maxVal: z.number(),
|
|
1073
|
+
units: temperatureUnitsZ,
|
|
1074
|
+
resistanceConfig: resistanceConfigZ,
|
|
1075
|
+
currentExcitSource: excitSourceZ,
|
|
1076
|
+
currentExcitVal: z.number(),
|
|
1077
|
+
a: z.number(),
|
|
1078
|
+
b: z.number(),
|
|
1079
|
+
c: z.number(),
|
|
1080
|
+
});
|
|
1081
|
+
|
|
1082
|
+
export type AIThermistorChanIex = z.infer<typeof aiThermistorChanIex>;
|
|
1083
|
+
|
|
1084
|
+
export const ZERO_AI_THERMISTOR_CHAN_IEX: AIThermistorChanIex = {
|
|
1085
|
+
name: "",
|
|
1086
|
+
key: "",
|
|
1087
|
+
type: "ai_thermistor_iex",
|
|
1088
|
+
channel: 0,
|
|
1089
|
+
port: 0,
|
|
1090
|
+
enabled: true,
|
|
1091
|
+
minVal: 0,
|
|
1092
|
+
maxVal: 1,
|
|
1093
|
+
units: "DegC",
|
|
1094
|
+
resistanceConfig: "2Wire",
|
|
1095
|
+
currentExcitSource: "Internal",
|
|
1096
|
+
currentExcitVal: 0,
|
|
1097
|
+
a: 0,
|
|
1098
|
+
b: 0,
|
|
1099
|
+
c: 0,
|
|
1100
|
+
};
|
|
1101
|
+
|
|
1102
|
+
// 24 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaitorquebridgepolynomialchan.html
|
|
1103
|
+
const aiThermistorChanVex = baseAIChanZ.extend({
|
|
1104
|
+
key: z.string(),
|
|
1105
|
+
type: z.literal("ai_thermistor_vex"),
|
|
1106
|
+
minVal: z.number(),
|
|
1107
|
+
maxVal: z.number(),
|
|
1108
|
+
units: temperatureUnitsZ,
|
|
1109
|
+
resistanceConfig: resistanceConfigZ,
|
|
1110
|
+
voltageExcitSource: excitSourceZ,
|
|
1111
|
+
voltageExcitVal: z.number(),
|
|
1112
|
+
a: z.number(),
|
|
1113
|
+
b: z.number(),
|
|
1114
|
+
c: z.number(),
|
|
1115
|
+
r1: z.number(),
|
|
1116
|
+
});
|
|
1117
|
+
|
|
1118
|
+
export type AIThermistorChanVex = z.infer<typeof aiThermistorChanVex>;
|
|
1119
|
+
|
|
1120
|
+
export const ZERO_AI_THERMISTOR_CHAN_VEX: AIThermistorChanVex = {
|
|
1121
|
+
name: "",
|
|
1122
|
+
key: "",
|
|
1123
|
+
channel: 0,
|
|
1124
|
+
type: "ai_thermistor_vex",
|
|
1125
|
+
port: 0,
|
|
1126
|
+
enabled: true,
|
|
1127
|
+
minVal: 0,
|
|
1128
|
+
maxVal: 1,
|
|
1129
|
+
units: "DegC",
|
|
1130
|
+
resistanceConfig: "2Wire",
|
|
1131
|
+
voltageExcitSource: "Internal",
|
|
1132
|
+
voltageExcitVal: 0,
|
|
1133
|
+
a: 0,
|
|
1134
|
+
b: 0,
|
|
1135
|
+
c: 0,
|
|
1136
|
+
r1: 0,
|
|
1137
|
+
};
|
|
1138
|
+
|
|
1139
|
+
export const torqueUnitsZ = z.enum(["NewtonMeters", "InchOunces", "FootPounds"]);
|
|
1140
|
+
export type TorqueUnits = z.infer<typeof torqueUnitsZ>;
|
|
1141
|
+
|
|
1142
|
+
// 25 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaitorquebridgepolynomialchan.html
|
|
1143
|
+
const aiTorqueBridgePolynomialChanZ = baseAIChanZ.extend({
|
|
1144
|
+
key: z.string(),
|
|
1145
|
+
type: z.literal("ai_torque_bridge_polynomial"),
|
|
1146
|
+
minVal: z.number(),
|
|
1147
|
+
maxVal: z.number(),
|
|
1148
|
+
units: torqueUnitsZ,
|
|
1149
|
+
bridgeConfig: bridgeConfigZ,
|
|
1150
|
+
voltageExcitSource: excitSourceZ,
|
|
1151
|
+
voltageExcitVal: z.number(),
|
|
1152
|
+
nominalBridgeResistance: z.number(),
|
|
1153
|
+
forwardCoeffs: z.array(z.number()),
|
|
1154
|
+
reverseCoeffs: z.array(z.number()),
|
|
1155
|
+
electricalUnits: electricalUnitsZ,
|
|
1156
|
+
physicalUnits: torqueUnitsZ,
|
|
1157
|
+
customScale: scaleZ,
|
|
1158
|
+
});
|
|
1159
|
+
|
|
1160
|
+
export type AITorqueBridgePolynomialChan = z.infer<
|
|
1161
|
+
typeof aiTorqueBridgePolynomialChanZ
|
|
1162
|
+
>;
|
|
1163
|
+
|
|
1164
|
+
export const ZERO_AI_TORQUE_BRIDGE_POLYNOMIAL_CHAN: AITorqueBridgePolynomialChan = {
|
|
1165
|
+
name: "",
|
|
1166
|
+
key: "",
|
|
1167
|
+
type: "ai_torque_bridge_polynomial",
|
|
1168
|
+
channel: 0,
|
|
1169
|
+
port: 0,
|
|
1170
|
+
enabled: true,
|
|
1171
|
+
minVal: 0,
|
|
1172
|
+
maxVal: 1,
|
|
1173
|
+
units: "NewtonMeters",
|
|
1174
|
+
bridgeConfig: "FullBridge",
|
|
1175
|
+
voltageExcitSource: "Internal",
|
|
1176
|
+
voltageExcitVal: 0,
|
|
1177
|
+
nominalBridgeResistance: 0,
|
|
1178
|
+
forwardCoeffs: [],
|
|
1179
|
+
reverseCoeffs: [],
|
|
1180
|
+
electricalUnits: "mVoltsPerVolt",
|
|
1181
|
+
physicalUnits: "NewtonMeters",
|
|
1182
|
+
customScale: ZERO_NO_SCALE,
|
|
1183
|
+
};
|
|
1184
|
+
|
|
1185
|
+
// 26 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaitorquebridgetablechan.html
|
|
1186
|
+
const aiTorqueBridgeTableChanZ = baseAIChanZ.extend({
|
|
1187
|
+
key: z.string(),
|
|
1188
|
+
type: z.literal("ai_torque_bridge_table"),
|
|
1189
|
+
minVal: z.number(),
|
|
1190
|
+
maxVal: z.number(),
|
|
1191
|
+
units: torqueUnitsZ,
|
|
1192
|
+
bridgeConfig: bridgeConfigZ,
|
|
1193
|
+
voltageExcitSource: excitSourceZ,
|
|
1194
|
+
voltageExcitVal: z.number(),
|
|
1195
|
+
nominalBridgeResistance: z.number(),
|
|
1196
|
+
electricalUnits: electricalUnitsZ,
|
|
1197
|
+
electricalVals: z.array(z.number()),
|
|
1198
|
+
physicalUnits: torqueUnitsZ,
|
|
1199
|
+
physicalVals: z.array(z.number()),
|
|
1200
|
+
customScale: scaleZ,
|
|
1201
|
+
});
|
|
1202
|
+
|
|
1203
|
+
export type AITorqueBridgeTableChan = z.infer<typeof aiTorqueBridgeTableChanZ>;
|
|
1204
|
+
|
|
1205
|
+
export const ZERO_AI_TORQUE_BRIDGE_TABLE_CHAN: AITorqueBridgeTableChan = {
|
|
1206
|
+
name: "",
|
|
1207
|
+
key: "",
|
|
1208
|
+
type: "ai_torque_bridge_table",
|
|
1209
|
+
channel: 0,
|
|
1210
|
+
port: 0,
|
|
1211
|
+
enabled: true,
|
|
1212
|
+
minVal: 0,
|
|
1213
|
+
maxVal: 1,
|
|
1214
|
+
units: "NewtonMeters",
|
|
1215
|
+
bridgeConfig: "FullBridge",
|
|
1216
|
+
voltageExcitSource: "Internal",
|
|
1217
|
+
voltageExcitVal: 0,
|
|
1218
|
+
nominalBridgeResistance: 0,
|
|
1219
|
+
electricalUnits: "mVoltsPerVolt",
|
|
1220
|
+
electricalVals: [],
|
|
1221
|
+
physicalUnits: "NewtonMeters",
|
|
1222
|
+
physicalVals: [],
|
|
1223
|
+
customScale: ZERO_NO_SCALE,
|
|
1224
|
+
};
|
|
1225
|
+
|
|
1226
|
+
// 27 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaitorquebridgetwopointlinchan.html
|
|
1227
|
+
const aiTorqueBridgeTwoPointLinChanZ = baseAIChanZ.extend({
|
|
1228
|
+
key: z.string(),
|
|
1229
|
+
type: z.literal("ai_torque_bridge_two_point_lin"),
|
|
1230
|
+
minVal: z.number(),
|
|
1231
|
+
maxVal: z.number(),
|
|
1232
|
+
units: torqueUnitsZ,
|
|
1233
|
+
bridgeConfig: bridgeConfigZ,
|
|
1234
|
+
voltageExcitSource: excitSourceZ,
|
|
1235
|
+
voltageExcitVal: z.number(),
|
|
1236
|
+
nominalBridgeResistance: z.number(),
|
|
1237
|
+
electricalUnits: electricalUnitsZ,
|
|
1238
|
+
physicalUnits: torqueUnitsZ,
|
|
1239
|
+
firstElectricalVal: z.number(),
|
|
1240
|
+
firstPhysicalVal: z.number(),
|
|
1241
|
+
secondElectricalVal: z.number(),
|
|
1242
|
+
secondPhysicalVal: z.number(),
|
|
1243
|
+
customScale: scaleZ,
|
|
1244
|
+
});
|
|
1245
|
+
|
|
1246
|
+
export type AITorqueBridgeTwoPointLinChan = z.infer<
|
|
1247
|
+
typeof aiTorqueBridgeTwoPointLinChanZ
|
|
1248
|
+
>;
|
|
1249
|
+
|
|
1250
|
+
export const ZERO_AI_TORQUE_BRIDGE_TWO_POINT_LIN_CHAN: AITorqueBridgeTwoPointLinChan = {
|
|
1251
|
+
name: "",
|
|
1252
|
+
key: "",
|
|
1253
|
+
type: "ai_torque_bridge_two_point_lin",
|
|
1254
|
+
channel: 0,
|
|
1255
|
+
port: 0,
|
|
1256
|
+
enabled: true,
|
|
1257
|
+
minVal: 0,
|
|
1258
|
+
maxVal: 1,
|
|
1259
|
+
units: "NewtonMeters",
|
|
1260
|
+
bridgeConfig: "FullBridge",
|
|
1261
|
+
voltageExcitSource: "Internal",
|
|
1262
|
+
voltageExcitVal: 0,
|
|
1263
|
+
nominalBridgeResistance: 0,
|
|
1264
|
+
electricalUnits: "mVoltsPerVolt",
|
|
1265
|
+
physicalUnits: "NewtonMeters",
|
|
1266
|
+
firstElectricalVal: 0,
|
|
1267
|
+
firstPhysicalVal: 0,
|
|
1268
|
+
secondElectricalVal: 1,
|
|
1269
|
+
secondPhysicalVal: 1,
|
|
1270
|
+
customScale: ZERO_NO_SCALE,
|
|
1271
|
+
};
|
|
1272
|
+
|
|
1273
|
+
export const velocityUnitsZ = z.enum(["MetersPerSecond", "InchesPerSecond"]);
|
|
1274
|
+
export type VelocityUnits = z.infer<typeof velocityUnitsZ>;
|
|
1275
|
+
|
|
1276
|
+
export const velocitySensitivityUnitsZ = z.enum([
|
|
1277
|
+
"MillivoltsPerMillimeterPerSecond",
|
|
1278
|
+
"MilliVoltsPerInchPerSecond",
|
|
1279
|
+
]);
|
|
1280
|
+
export type VelocitySensitivityUnits = z.infer<typeof velocitySensitivityUnitsZ>;
|
|
1281
|
+
|
|
1282
|
+
// 28 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaivelocityiepechan.html
|
|
1283
|
+
const aiVelocityIEPEChanZ = baseAIChanZ.extend({
|
|
1284
|
+
key: z.string(),
|
|
1285
|
+
type: z.literal("ai_velocity_iepe"),
|
|
1286
|
+
terminalConfig: terminalConfigZ,
|
|
1287
|
+
minVal: z.number(),
|
|
1288
|
+
maxVal: z.number(),
|
|
1289
|
+
units: velocityUnitsZ,
|
|
1290
|
+
sensitivity: z.number(),
|
|
1291
|
+
sensitivityUnits: velocitySensitivityUnitsZ,
|
|
1292
|
+
currentExcitSource: excitSourceZ,
|
|
1293
|
+
currentExcitVal: z.number(),
|
|
1294
|
+
customScale: scaleZ,
|
|
1295
|
+
});
|
|
1296
|
+
|
|
1297
|
+
export type AIVelocityEPEChan = z.infer<typeof aiVelocityIEPEChanZ>;
|
|
1298
|
+
|
|
1299
|
+
export const ZERO_AI_VELOCITY_EPE_CHAN: AIVelocityEPEChan = {
|
|
1300
|
+
name: "",
|
|
1301
|
+
key: "",
|
|
1302
|
+
type: "ai_velocity_iepe",
|
|
1303
|
+
channel: 0,
|
|
1304
|
+
port: 0,
|
|
1305
|
+
enabled: true,
|
|
1306
|
+
terminalConfig: "Cfg_Default",
|
|
1307
|
+
minVal: 0,
|
|
1308
|
+
maxVal: 1,
|
|
1309
|
+
units: "MetersPerSecond",
|
|
1310
|
+
sensitivity: 0,
|
|
1311
|
+
sensitivityUnits: "MillivoltsPerMillimeterPerSecond",
|
|
1312
|
+
currentExcitSource: "Internal",
|
|
1313
|
+
currentExcitVal: 0,
|
|
1314
|
+
customScale: ZERO_NO_SCALE,
|
|
1315
|
+
};
|
|
1316
|
+
|
|
1317
|
+
// 29 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaivoltagechan.html
|
|
1318
|
+
const aiVoltageChanZ = baseAIChanZ.extend({
|
|
1319
|
+
key: z.string(),
|
|
1320
|
+
type: z.literal("ai_voltage"),
|
|
1321
|
+
terminalConfig: terminalConfigZ,
|
|
1322
|
+
port: z.number(),
|
|
1323
|
+
channel: z.number(),
|
|
1324
|
+
enabled: z.boolean(),
|
|
1325
|
+
minVal: z.number(),
|
|
1326
|
+
maxVal: z.number(),
|
|
1327
|
+
units: z.enum(["Volts"]),
|
|
1328
|
+
customScale: scaleZ,
|
|
1329
|
+
});
|
|
1330
|
+
|
|
1331
|
+
export type AIVoltageChan = z.infer<typeof aiVoltageChanZ>;
|
|
1332
|
+
|
|
1333
|
+
export const ZERO_AI_VOLTAGE_CHAN: AIVoltageChan = {
|
|
1334
|
+
name: "",
|
|
1335
|
+
key: "",
|
|
1336
|
+
type: "ai_voltage",
|
|
1337
|
+
terminalConfig: "Cfg_Default",
|
|
1338
|
+
channel: 0,
|
|
1339
|
+
port: 0,
|
|
1340
|
+
enabled: true,
|
|
1341
|
+
minVal: 0,
|
|
1342
|
+
maxVal: 1,
|
|
1343
|
+
units: "Volts",
|
|
1344
|
+
customScale: ZERO_NO_SCALE,
|
|
1345
|
+
};
|
|
1346
|
+
|
|
1347
|
+
// 30 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaivoltagermschan.html
|
|
1348
|
+
const aiVoltageRMSChanZ = baseAIChanZ.extend({
|
|
1349
|
+
key: z.string(),
|
|
1350
|
+
type: z.literal("ai_voltage_rms"),
|
|
1351
|
+
terminalConfig: terminalConfigZ,
|
|
1352
|
+
minVal: z.number(),
|
|
1353
|
+
maxVal: z.number(),
|
|
1354
|
+
units: z.enum(["V", "mV"]),
|
|
1355
|
+
customScale: scaleZ,
|
|
1356
|
+
});
|
|
1357
|
+
|
|
1358
|
+
export type AIVoltageRMSChan = z.infer<typeof aiVoltageRMSChanZ>;
|
|
1359
|
+
|
|
1360
|
+
export const ZERO_AI_VOLTAGE_RMS_CHAN: AIVoltageRMSChan = {
|
|
1361
|
+
name: "",
|
|
1362
|
+
key: "",
|
|
1363
|
+
type: "ai_voltage_rms",
|
|
1364
|
+
channel: 0,
|
|
1365
|
+
port: 0,
|
|
1366
|
+
enabled: true,
|
|
1367
|
+
terminalConfig: "Cfg_Default",
|
|
1368
|
+
minVal: 0,
|
|
1369
|
+
maxVal: 1,
|
|
1370
|
+
units: "V",
|
|
1371
|
+
customScale: ZERO_NO_SCALE,
|
|
1372
|
+
};
|
|
1373
|
+
|
|
1374
|
+
// 31 - https://www.ni.com/docs/en-US/bundle/ni-daqmx-c-api-ref/page/daqmxcfunc/daqmxcreateaivoltagechanwithexcit.html
|
|
1375
|
+
const aiVoltageChanWithExcitZ = baseAIChanZ.extend({
|
|
1376
|
+
type: z.literal("ai_voltage_with_excit"),
|
|
1377
|
+
terminalConfig: terminalConfigZ,
|
|
1378
|
+
minVal: z.number(),
|
|
1379
|
+
maxVal: z.number(),
|
|
1380
|
+
units: z.enum(["V", "mV"]),
|
|
1381
|
+
bridgeConfig: z.enum(["full", "half", "quarter", "none"]),
|
|
1382
|
+
voltageExcitSource: excitSourceZ,
|
|
1383
|
+
voltageExcitVal: z.number(),
|
|
1384
|
+
useExcitForScaling: z.boolean(),
|
|
1385
|
+
customScale: scaleZ,
|
|
1386
|
+
});
|
|
1387
|
+
|
|
1388
|
+
export type AIVoltageChanWithExcit = z.infer<typeof aiVoltageChanWithExcitZ>;
|
|
1389
|
+
|
|
1390
|
+
export const ZERO_AI_VOLTAGE_CHAN_WITH_EXCIT: AIVoltageChanWithExcit = {
|
|
1391
|
+
name: "",
|
|
1392
|
+
key: "",
|
|
1393
|
+
type: "ai_voltage_with_excit",
|
|
1394
|
+
channel: 0,
|
|
1395
|
+
port: 0,
|
|
1396
|
+
enabled: true,
|
|
1397
|
+
terminalConfig: "Cfg_Default",
|
|
1398
|
+
minVal: 0,
|
|
1399
|
+
maxVal: 1,
|
|
1400
|
+
units: "V",
|
|
1401
|
+
bridgeConfig: "full",
|
|
1402
|
+
voltageExcitSource: "Internal",
|
|
1403
|
+
voltageExcitVal: 0,
|
|
1404
|
+
useExcitForScaling: false,
|
|
1405
|
+
customScale: ZERO_NO_SCALE,
|
|
1406
|
+
};
|
|
1407
|
+
|
|
1408
|
+
export const aiChan = z.union([
|
|
1409
|
+
aiAccelChanZ,
|
|
1410
|
+
aiBridgeChanZ,
|
|
1411
|
+
aiCurrentChanZ,
|
|
1412
|
+
aiForceBridgeTableChanZ,
|
|
1413
|
+
aiForceBridgeTwoPointLinChan,
|
|
1414
|
+
aiForgeIEPEChanZ,
|
|
1415
|
+
aiMicrophoneChanZ,
|
|
1416
|
+
aiPressureBridgeTableChanZ,
|
|
1417
|
+
aiPressureBridgeTwoPointLinChanZ,
|
|
1418
|
+
aiResistanceChanZ,
|
|
1419
|
+
aiRTDChanZ,
|
|
1420
|
+
aiStrainGageChan,
|
|
1421
|
+
aiTempBuiltInChanZ,
|
|
1422
|
+
aiThermocoupleChanZ,
|
|
1423
|
+
aiTorqueBridgeTableChanZ,
|
|
1424
|
+
aiTorqueBridgeTwoPointLinChanZ,
|
|
1425
|
+
aiVelocityIEPEChanZ,
|
|
1426
|
+
aiVoltageChanZ,
|
|
1427
|
+
]);
|
|
1428
|
+
|
|
1429
|
+
export type AIChan = z.infer<typeof aiChan>;
|
|
1430
|
+
export type AIChanType = AIChan["type"];
|
|
1431
|
+
|
|
1432
|
+
export const AI_CHANNEL_SCHEMAS: Record<AIChanType, z.ZodType<AIChan>> = {
|
|
1433
|
+
ai_accel: aiAccelChanZ,
|
|
1434
|
+
ai_bridge: aiBridgeChanZ,
|
|
1435
|
+
ai_current: aiCurrentChanZ,
|
|
1436
|
+
ai_force_bridge_table: aiForceBridgeTableChanZ,
|
|
1437
|
+
ai_force_bridge_two_point_lin: aiForceBridgeTwoPointLinChan,
|
|
1438
|
+
ai_force_iepe: aiForgeIEPEChanZ,
|
|
1439
|
+
ai_microphone: aiMicrophoneChanZ,
|
|
1440
|
+
ai_pressure_bridge_table: aiPressureBridgeTableChanZ,
|
|
1441
|
+
ai_pressure_bridge_two_point_lin: aiPressureBridgeTwoPointLinChanZ,
|
|
1442
|
+
ai_resistance: aiResistanceChanZ,
|
|
1443
|
+
ai_rtd: aiRTDChanZ,
|
|
1444
|
+
ai_strain_gauge: aiStrainGageChan,
|
|
1445
|
+
ai_temp_builtin: aiTempBuiltInChanZ,
|
|
1446
|
+
ai_thermocouple: aiThermocoupleChanZ,
|
|
1447
|
+
ai_torque_bridge_table: aiTorqueBridgeTableChanZ,
|
|
1448
|
+
ai_torque_bridge_two_point_lin: aiTorqueBridgeTwoPointLinChanZ,
|
|
1449
|
+
ai_velocity_iepe: aiVelocityIEPEChanZ,
|
|
1450
|
+
ai_voltage: aiVoltageChanZ,
|
|
1451
|
+
};
|
|
1452
|
+
|
|
1453
|
+
export const ZERO_AI_CHANNELS: Record<AIChanType, AIChan> = {
|
|
1454
|
+
ai_accel: ZERO_AI_ACCEL_CHAN,
|
|
1455
|
+
ai_bridge: ZERO_AI_BRIDGE_CHAN,
|
|
1456
|
+
ai_current: ZERO_AI_CURRENT_CHAN,
|
|
1457
|
+
ai_force_bridge_table: ZERO_AI_FORCE_BRIDGE_TABLE_CHAN,
|
|
1458
|
+
ai_force_bridge_two_point_lin: ZERO_AI_FORCE_BRIDGE_TWO_POINT_LIN_CHAN,
|
|
1459
|
+
ai_force_iepe: ZERO_AI_FORCE_IEPE_CHAN,
|
|
1460
|
+
ai_microphone: ZERO_AI_MICROPHONE_CHAN,
|
|
1461
|
+
ai_pressure_bridge_table: ZERO_AI_PRESSURE_BRIDGE_TABLE_CHAN,
|
|
1462
|
+
ai_pressure_bridge_two_point_lin: ZERO_AI_PRESSURE_BRIDGE_TWO_POINT_LIN_CHAN,
|
|
1463
|
+
ai_resistance: ZERO_AI_RESISTANCE_CHAN,
|
|
1464
|
+
ai_rtd: ZERO_AI_RTD_CHAN,
|
|
1465
|
+
ai_strain_gauge: ZERO_AI_STRAIN_GAGE_CHAN,
|
|
1466
|
+
ai_temp_builtin: ZERO_AI_TEMP_BUILTIN_CHAN,
|
|
1467
|
+
ai_thermocouple: ZERO_AI_THERMOCOUPLE_CHAN,
|
|
1468
|
+
ai_torque_bridge_table: ZERO_AI_TORQUE_BRIDGE_TABLE_CHAN,
|
|
1469
|
+
ai_torque_bridge_two_point_lin: ZERO_AI_TORQUE_BRIDGE_TWO_POINT_LIN_CHAN,
|
|
1470
|
+
ai_velocity_iepe: ZERO_AI_VELOCITY_EPE_CHAN,
|
|
1471
|
+
ai_voltage: ZERO_AI_VOLTAGE_CHAN,
|
|
1472
|
+
};
|
|
1473
|
+
|
|
1474
|
+
export const AI_CHANNEL_TYPE_NAMES: Record<AIChanType, string> = {
|
|
1475
|
+
ai_voltage: "Voltage",
|
|
1476
|
+
ai_thermocouple: "Thermocouple",
|
|
1477
|
+
ai_rtd: "RTD",
|
|
1478
|
+
ai_pressure_bridge_two_point_lin: "Pressure Bridge Two-Point Linear",
|
|
1479
|
+
ai_accel: "Accelerometer",
|
|
1480
|
+
ai_bridge: "Bridge",
|
|
1481
|
+
ai_current: "Current",
|
|
1482
|
+
ai_force_bridge_table: "Force Bridge Table",
|
|
1483
|
+
ai_force_bridge_two_point_lin: "Force Bridge Two-Point Linear",
|
|
1484
|
+
ai_force_iepe: "Force IEPE",
|
|
1485
|
+
ai_microphone: "Microphone",
|
|
1486
|
+
ai_pressure_bridge_table: "Pressure Bridge Table",
|
|
1487
|
+
ai_resistance: "Resistance",
|
|
1488
|
+
ai_strain_gauge: "Strain Gauge",
|
|
1489
|
+
ai_temp_builtin: "Temperature Built-In",
|
|
1490
|
+
ai_torque_bridge_table: "Torque Bridge Table",
|
|
1491
|
+
ai_torque_bridge_two_point_lin: "Torque Bridge - Two-Point Linear",
|
|
1492
|
+
ai_velocity_iepe: "Velocity IEPE",
|
|
1493
|
+
};
|
|
1494
|
+
|
|
1495
|
+
export type AnalogInputVoltageChannel = z.infer<typeof aiVoltageChanZ>;
|
|
1496
|
+
|
|
1497
|
+
const doChanZ = z.object({
|
|
1498
|
+
key: z.string(),
|
|
1499
|
+
type: z.literal("digital_output"),
|
|
1500
|
+
enabled: z.boolean(),
|
|
1501
|
+
cmdChannel: z.number(),
|
|
1502
|
+
stateChannel: z.number(),
|
|
1503
|
+
port: z.number(),
|
|
1504
|
+
line: z.number(),
|
|
1505
|
+
});
|
|
1506
|
+
|
|
1507
|
+
export const ZERO_DO_CHAN: DOChan = {
|
|
1508
|
+
key: "",
|
|
1509
|
+
type: "digital_output",
|
|
1510
|
+
enabled: true,
|
|
1511
|
+
cmdChannel: 0,
|
|
1512
|
+
stateChannel: 0,
|
|
1513
|
+
port: 0,
|
|
1514
|
+
line: 0,
|
|
1515
|
+
};
|
|
1516
|
+
|
|
1517
|
+
export type DOChan = z.infer<typeof doChanZ>;
|
|
1518
|
+
export type DOChanType = DOChan["type"];
|
|
1519
|
+
|
|
1520
|
+
const diChanZ = z.object({
|
|
1521
|
+
key: z.string(),
|
|
1522
|
+
type: z.literal("digital_input"),
|
|
1523
|
+
enabled: z.boolean(),
|
|
1524
|
+
port: z.number(),
|
|
1525
|
+
line: z.number(),
|
|
1526
|
+
channel: z.number(),
|
|
1527
|
+
});
|
|
1528
|
+
export const ZERO_DI_CHAN: DIChan = {
|
|
1529
|
+
key: "",
|
|
1530
|
+
type: "digital_input",
|
|
1531
|
+
enabled: true,
|
|
1532
|
+
port: 0,
|
|
1533
|
+
line: 0,
|
|
1534
|
+
channel: 0,
|
|
1535
|
+
};
|
|
1536
|
+
|
|
1537
|
+
export type DIChan = z.infer<typeof diChanZ>;
|
|
1538
|
+
export type DIChanType = DIChan["type"];
|
|
1539
|
+
|
|
1540
|
+
const deviceKeyZ = device.deviceKeyZ.min(1, "Must specify a device");
|
|
1541
|
+
|
|
1542
|
+
export const analogReadTaskConfigZ = z
|
|
1543
|
+
.object({
|
|
1544
|
+
device: deviceKeyZ,
|
|
1545
|
+
sampleRate: z.number().min(0).max(50000),
|
|
1546
|
+
streamRate: z.number().min(0).max(50000),
|
|
1547
|
+
channels: z.array(aiChan),
|
|
1548
|
+
dataSaving: z.boolean(),
|
|
1549
|
+
})
|
|
1550
|
+
.refine(
|
|
1551
|
+
(c) =>
|
|
1552
|
+
// Ensure that the stream Rate is lower than the sample rate
|
|
1553
|
+
c.sampleRate >= c.streamRate,
|
|
1554
|
+
{
|
|
1555
|
+
path: ["streamRate"],
|
|
1556
|
+
message: "Stream rate must be less than or equal to the sample rate",
|
|
1557
|
+
},
|
|
1558
|
+
)
|
|
1559
|
+
.superRefine((cfg, ctx) => {
|
|
1560
|
+
const ports = new Map<number, number>();
|
|
1561
|
+
cfg.channels.forEach(({ port }) => ports.set(port, (ports.get(port) ?? 0) + 1));
|
|
1562
|
+
cfg.channels.forEach((channel, i) => {
|
|
1563
|
+
if ((ports.get(channel.port) ?? 0) < 2) return;
|
|
1564
|
+
ctx.addIssue({
|
|
1565
|
+
code: z.ZodIssueCode.custom,
|
|
1566
|
+
path: ["channels", i, "port"],
|
|
1567
|
+
message: `Port ${channel.port} has already been used`,
|
|
1568
|
+
});
|
|
1569
|
+
});
|
|
1570
|
+
})
|
|
1571
|
+
.superRefine((cfg, ctx) => {
|
|
1572
|
+
const channels = new Map<number, number>();
|
|
1573
|
+
cfg.channels.forEach(({ channel }) => {
|
|
1574
|
+
if (channel === 0 || channel == null) return;
|
|
1575
|
+
channels.set(channel, (channels.get(channel) ?? 0) + 1);
|
|
1576
|
+
});
|
|
1577
|
+
cfg.channels.forEach((cfg, i) => {
|
|
1578
|
+
if (cfg.channel === 0 || cfg.channel == null) return;
|
|
1579
|
+
if ((channels.get(cfg.channel) ?? 0) < 2) return;
|
|
1580
|
+
ctx.addIssue({
|
|
1581
|
+
code: z.ZodIssueCode.custom,
|
|
1582
|
+
path: ["channels", i, "channel"],
|
|
1583
|
+
message: `Channel has already been used on port ${cfg.port}`,
|
|
1584
|
+
});
|
|
1585
|
+
});
|
|
1586
|
+
});
|
|
1587
|
+
|
|
1588
|
+
export type AnalogReadTaskConfig = z.infer<typeof analogReadTaskConfigZ>;
|
|
1589
|
+
|
|
1590
|
+
export const baseAnalogReadStateDetailsZ = z.object({
|
|
1591
|
+
running: z.boolean(),
|
|
1592
|
+
message: z.string(),
|
|
1593
|
+
});
|
|
1594
|
+
|
|
1595
|
+
export const errorAnalogReadStateDetailZ = baseAnalogReadStateDetailsZ.extend({
|
|
1596
|
+
errors: z.array(
|
|
1597
|
+
z.object({
|
|
1598
|
+
message: z.string(),
|
|
1599
|
+
path: z.string(),
|
|
1600
|
+
}),
|
|
1601
|
+
),
|
|
1602
|
+
});
|
|
1603
|
+
|
|
1604
|
+
type BaseAnalogReadStateDetails = z.infer<typeof baseAnalogReadStateDetailsZ>;
|
|
1605
|
+
type ErrorAnalogReadStateDetails = z.infer<typeof errorAnalogReadStateDetailZ>;
|
|
1606
|
+
|
|
1607
|
+
export type AnalogReadStateDetails =
|
|
1608
|
+
| BaseAnalogReadStateDetails
|
|
1609
|
+
| ErrorAnalogReadStateDetails;
|
|
1610
|
+
export type AnalogReadTaskState = task.State<AnalogReadStateDetails>;
|
|
1611
|
+
|
|
1612
|
+
export const ANALOG_READ_TYPE = "ni_analog_read";
|
|
1613
|
+
export type AnalogReadType = typeof ANALOG_READ_TYPE;
|
|
1614
|
+
|
|
1615
|
+
export const ZERO_ANALOG_READ_CONFIG: AnalogReadTaskConfig = {
|
|
1616
|
+
device: "",
|
|
1617
|
+
sampleRate: 10,
|
|
1618
|
+
streamRate: 5,
|
|
1619
|
+
channels: [],
|
|
1620
|
+
dataSaving: true,
|
|
1621
|
+
};
|
|
1622
|
+
export type AnalogRead = task.Task<
|
|
1623
|
+
AnalogReadTaskConfig,
|
|
1624
|
+
AnalogReadStateDetails,
|
|
1625
|
+
AnalogReadType
|
|
1626
|
+
>;
|
|
1627
|
+
export type AnalogReadPayload = task.Payload<
|
|
1628
|
+
AnalogReadTaskConfig,
|
|
1629
|
+
AnalogReadStateDetails,
|
|
1630
|
+
AnalogReadType
|
|
1631
|
+
>;
|
|
1632
|
+
export const ZERO_ANALOG_READ_PAYLOAD: AnalogReadPayload = {
|
|
1633
|
+
key: "",
|
|
1634
|
+
name: "NI Analog Read Task",
|
|
1635
|
+
config: ZERO_ANALOG_READ_CONFIG,
|
|
1636
|
+
type: ANALOG_READ_TYPE,
|
|
1637
|
+
};
|
|
1638
|
+
|
|
1639
|
+
export type DigitalWriteConfig = z.infer<typeof digitalWriteConfigZ>;
|
|
1640
|
+
export const DIGITAL_WRITE_TYPE = "ni_digital_write";
|
|
1641
|
+
export type DigitalWriteType = typeof DIGITAL_WRITE_TYPE;
|
|
1642
|
+
export const digitalWriteConfigZ = z.object({
|
|
1643
|
+
device: deviceKeyZ,
|
|
1644
|
+
channels: z.array(doChanZ),
|
|
1645
|
+
stateRate: z.number().min(0).max(50000),
|
|
1646
|
+
dataSaving: z.boolean(),
|
|
1647
|
+
});
|
|
1648
|
+
|
|
1649
|
+
export const digitalWriteStateDetailsZ = z.object({
|
|
1650
|
+
running: z.boolean(),
|
|
1651
|
+
});
|
|
1652
|
+
export type DigitalWriteStateDetails = z.infer<typeof digitalWriteStateDetailsZ>;
|
|
1653
|
+
export type DigitalWrite = task.Task<
|
|
1654
|
+
DigitalWriteConfig,
|
|
1655
|
+
DigitalWriteStateDetails,
|
|
1656
|
+
DigitalWriteType
|
|
1657
|
+
>;
|
|
1658
|
+
export type DigitalWritePayload = task.Payload<
|
|
1659
|
+
DigitalWriteConfig,
|
|
1660
|
+
DigitalWriteStateDetails,
|
|
1661
|
+
DigitalWriteType
|
|
1662
|
+
>;
|
|
1663
|
+
export const ZERO_DIGITAL_WRITE_CONFIG: DigitalWriteConfig = {
|
|
1664
|
+
device: "",
|
|
1665
|
+
stateRate: 10,
|
|
1666
|
+
channels: [],
|
|
1667
|
+
dataSaving: true,
|
|
1668
|
+
};
|
|
1669
|
+
export const ZERO_DIGITAL_WRITE_PAYLOAD: DigitalWritePayload = {
|
|
1670
|
+
key: "",
|
|
1671
|
+
name: "NI Digital Write Task",
|
|
1672
|
+
config: ZERO_DIGITAL_WRITE_CONFIG,
|
|
1673
|
+
type: DIGITAL_WRITE_TYPE,
|
|
1674
|
+
};
|
|
1675
|
+
|
|
1676
|
+
const digitalReadChannelZ = diChanZ;
|
|
1677
|
+
export const digitalReadConfigZ = z.object({
|
|
1678
|
+
device: deviceKeyZ,
|
|
1679
|
+
sampleRate: z.number().min(0).max(50000),
|
|
1680
|
+
streamRate: z.number().min(0).max(50000),
|
|
1681
|
+
dataSaving: z.boolean(),
|
|
1682
|
+
channels: z.array(digitalReadChannelZ),
|
|
1683
|
+
});
|
|
1684
|
+
export type DigitalReadConfig = z.infer<typeof digitalReadConfigZ>;
|
|
1685
|
+
export const DIGITAL_READ_TYPE = "ni_digital_read";
|
|
1686
|
+
export type DigitalReadType = typeof DIGITAL_READ_TYPE;
|
|
1687
|
+
export const digitalReadStateDetailsZ = z.object({
|
|
1688
|
+
running: z.boolean(),
|
|
1689
|
+
});
|
|
1690
|
+
export type DigitalReadStateDetails = z.infer<typeof digitalReadStateDetailsZ>;
|
|
1691
|
+
export type DigitalRead = task.Task<
|
|
1692
|
+
DigitalReadConfig,
|
|
1693
|
+
DigitalReadStateDetails,
|
|
1694
|
+
DigitalReadType
|
|
1695
|
+
>;
|
|
1696
|
+
export type DigitalReadPayload = task.Payload<
|
|
1697
|
+
DigitalReadConfig,
|
|
1698
|
+
DigitalReadStateDetails,
|
|
1699
|
+
DigitalReadType
|
|
1700
|
+
>;
|
|
1701
|
+
export const ZERO_DIGITAL_READ_CONFIG: DigitalReadConfig = {
|
|
1702
|
+
device: "",
|
|
1703
|
+
channels: [],
|
|
1704
|
+
sampleRate: 50,
|
|
1705
|
+
streamRate: 25,
|
|
1706
|
+
dataSaving: true,
|
|
1707
|
+
};
|
|
1708
|
+
export const ZERO_DIGITAL_READ_PAYLOAD: DigitalReadPayload = {
|
|
1709
|
+
key: "",
|
|
1710
|
+
name: "NI Digital Read Task",
|
|
1711
|
+
config: ZERO_DIGITAL_READ_CONFIG,
|
|
1712
|
+
type: DIGITAL_READ_TYPE,
|
|
1713
|
+
};
|
|
1714
|
+
|
|
1715
|
+
export type Task = AnalogRead | DigitalWrite | DigitalRead;
|
|
1716
|
+
export type Chan = DIChan | AIChan | DOChan;
|