Skip to content

Commit 0d7adc4

Browse files
committed
Fixed up processing, added example sheet
1 parent 4269085 commit 0d7adc4

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

archive/cli/testing.xlsx

-9.53 KB
Binary file not shown.

daq/main3.py

+6-5
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,27 @@
1313

1414
def main():
1515
# input_excel(r"C:\Users\ruchi\mcnugget\archive\cli\testing.xlsx", NUMBER_OF_ITEMS) #change to take in input and then put into the function
16-
data = input_excel("/Users/evanhekman/mcnugget/daq/VLV.xlsx")
16+
# data = input_excel("/Users/evanhekman/mcnugget/daq/VLV.xlsx")
17+
data = input_excel("daq/example_test.xlsx")
1718
analog_task, digital_task, analog_card = create_tasks()
1819
process_excel(data, analog_task, digital_task, analog_card)
19-
client.hardware.tasks.configure(digital_task)
20-
client.hardware.tasks.configure(analog_task)
20+
client.hardware.tasks.configure(task=digital_task, timeout=5)
21+
client.hardware.tasks.configure(task=analog_task, timeout=60) # long timeout cause our NI hardware is dumb
2122
print("jubilate")
2223

2324

2425
def create_tasks():
2526
analog_card = client.hardware.devices.retrieve(name="Analog")
2627
digital_card = client.hardware.devices.retrieve(name="Digital")
2728
analog_task = ni.AnalogReadTask(
28-
name="Analog Read Task",
29+
name="Analog Input",
2930
sample_rate=sy.Rate.HZ * 50,
3031
stream_rate=sy.Rate.HZ * 10,
3132
data_saving=True,
3233
channels=[],
3334
)
3435
digital_task = ni.DigitalWriteTask(
35-
name="Digital Read/Write Task",
36+
name="Valve Control",
3637
device=digital_card.key,
3738
state_rate=sy.Rate.HZ * 50,
3839
data_saving=True,

daq/processing.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ def process_pt(row: pd.Series, analog_task: ni.AnalogReadTask, analog_card: sy.D
6363
device=analog_card.key,
6464
port=row["Channel"] - 1,
6565
custom_scale=ni.LinScale(
66-
slope=((row["Max Output Voltage"] - row["Calibration Offset (V)"]) * 1000)
67-
/ row["Max Pressure"],
68-
y_intercept=row["Calibration Offset (V)"],
66+
slope= ((row["Max Pressure"]) / (row["Max Output Voltage"] - row["Calibration Offset (V)"])),
67+
y_intercept= (-(row["Max Pressure"]) / (row["Max Output Voltage"] - row["Calibration Offset (V)"])) * row["Calibration Offset (V)"],
6968
pre_scaled_units="Volts",
7069
scaled_units="PoundsPerSquareInch",
7170
),
7271
terminal_config="RSE",
72+
max_val=row["Max Pressure"],
7373
)
7474
analog_task.config.channels.append(pt_channel)
7575
print("PT channel created.")

0 commit comments

Comments
 (0)