What other channel properties do I need to configure for my app to run?

1 view (last 30 days)
In my code, I try to get a reading from a thermocuple on Ch11. Whenever I use Ch11, the rest of my values from other channels are skewed.
ch11=addinput(dq,'Board0','Ai11','Voltage'); %Intake Before Intercooler
ch11.TerminalConfig="SingleEnded";
%Manifold AirTemperature
MAT = mean(Volts.Board0_Ai11, "all")*20;
app.IntakeManifoldTempCEditField.Value = MAT;
So when I comment Ai11 out and use Ai4 for example, the weight of my bucket and voltage from Ai5 are correct. When I tried to use Ai11 for a manifold air temperature reading, I get negative weights or my bucket through Ai5.
ch4=addinput(dq,'Board0','Ai4','Voltage'); %Intake Manifold Pressure tranducer 0-5V
ch4.TerminalConfig="SingleEnded";
%Manifold AirTemperature
MAT = mean(Volts.Board0_Ai4, "all")*20;
app.IntakeManifoldTempCEditField.Value = MAT;
Its important to note that I need the thermocouple of Ai11 to be used instead of the pressure trandsucer. The code runs fine when ch11 is commented out. Even if i use Ai4 for the code and Ai11 is not commented out - I get errors.
Here is where I configure all of my devices.
ch0=addinput(dq,'Board0','Ai0','Voltage'); %LFE Thermocouple 0-10V
ch1=addinput(dq,'Board0','Ai1','Voltage'); %City Water Inlet 0-10V
ch2=addinput(dq,'Board0','Ai2','Voltage'); %City Water Outlet 0-10V
ch3=addinput(dq,'Board0','Ai3','Voltage'); %Engine Coolant IN 0-10V
ch4=addinput(dq,'Board0','Ai4','Voltage'); %Intake Manifold Pressure tranducer 0-5V
%ch7=addinput(dq,'Board0','Ai7','Voltage'); %Intake AfterIntercooler 0-10V
%ch8=addinput(dq,'Board0','Ai8','Voltage'); %Engine Coolant out 0-10V
%ch9=addinput(dq,'Board0','Ai9','Voltage'); % Turbine Inlet 0-10V
%ch10=addinput(dq,'Board0','Ai10','Voltage'); %TurbineOutlet 0-10V
%ch11=addinput(dq,'Board0','Ai11','Voltage'); %Intake Before Intercooler
% fuel measurement system [B]
ch5=addinput(dq,'Board0','Ai5','Voltage'); %Desiel Fuel load cell
ch6=addinput(dq,'Board0','Ai6','Voltage'); %Biodeisel Fuel load cell
ch0.TerminalConfig="SingleEnded"; %IMPORTANT TO HAVE THIS BECAUSE WE DISCOVERED
ch1.TerminalConfig="SingleEnded"; %THAT IF YOU DON'T DO THIS IN MATLAB
ch2.TerminalConfig="SingleEnded"; %THEN IT DOES NOT MATTER IF YOU USE INSTACAL TO SET IT UP
ch3.TerminalConfig="SingleEnded"; %AND MATLAB WILL AUTOMATICALLY ASSUME DIFFERENTIAL TERMINALS
ch4.TerminalConfig="SingleEnded";
ch5.TerminalConfig="SingleEnded";
ch6.TerminalConfig="SingleEnded";
ch7.TerminalConfig="SingleEnded";
ch8.TerminalConfig="SingleEnded";
ch9.TerminalConfig="SingleEnded";
ch10.TerminalConfig="SingleEnded";
ch11.TerminalConfig="SingleEnded";
If I use Ai1 for the input, it works fine. For some reason Ai7 throguh Ai11 give me errors.
When I comment any of these out.. I get errors
%ch7=addinput(dq,'Board0','Ai7','Voltage'); %Intake AfterIntercooler 0-10V
%ch8=addinput(dq,'Board0','Ai8','Voltage'); %Engine Coolant out 0-10V
%ch9=addinput(dq,'Board0','Ai9','Voltage'); % Turbine Inlet 0-10V
%ch10=addinput(dq,'Board0','Ai10','Voltage'); %TurbineOutlet 0-10V
%ch11=addinput(dq,'Board0','Ai11','Voltage'); %Intake Before Intercooler
  3 Comments
Walter Roberson
Walter Roberson on 12 Feb 2025
It would be interesting to reconfigure the different inputs onto different pins -- such as rewiring pin 11 to be City Water Outlet 0-10V and pin 2 to be Intake Before Intercooler
Ian
Ian on 12 Feb 2025
When I rearrange the pin for Inatake Before Intercooler to be on pin 2 and City Water Outlet to be on Pin 11. The voltages read just fine. It seems that I need to have all my channels numerically ordered.
Thanks for the troubleshooting help. See below - when the channels are ordered numerically. Everything reads fine.
ch0=addinput(dq,'Board0','Ai0','Voltage'); %LFE Thermocouple 0-10V
ch1=addinput(dq,'Board0','Ai1','Voltage'); %City Water Inlet 0-10V
ch2=addinput(dq,'Board0','Ai2','Voltage'); %City Water Outlet 0-10V
ch3=addinput(dq,'Board0','Ai3','Voltage'); %Engine Coolant IN 0-10V
ch4=addinput(dq,'Board0','Ai4','Voltage'); %Intake Manifold Pressure tranducer 0-5V
% fuel measurement system [B]
ch5=addinput(dq,'Board0','Ai5','Voltage'); %Desiel Fuel load cell
ch6=addinput(dq,'Board0','Ai6','Voltage'); %Biodeisel Fuel load cell
ch7=addinput(dq,'Board0','Ai7','Voltage'); %Intake AfterIntercooler 0-10V
ch8=addinput(dq,'Board0','Ai8','Voltage'); %Engine Coolant out 0-10V
ch9=addinput(dq,'Board0','Ai9','Voltage'); % Turbine Inlet 0-10V
ch10=addinput(dq,'Board0','Ai10','Voltage'); %TurbineOutlet 0-10V
ch11=addinput(dq,'Board0','Ai11','Voltage'); %Intake Before Intercooler 0-10V
ch0.TerminalConfig="SingleEnded"; %IMPORTANT TO HAVE THIS BECAUSE WE DISCOVERED
ch1.TerminalConfig="SingleEnded"; %THAT IF YOU DON'T DO THIS IN MATLAB
ch2.TerminalConfig="SingleEnded"; %THEN IT DOES NOT MATTER IF YOU USE INSTACAL TO SET IT UP
ch3.TerminalConfig="SingleEnded"; %AND MATLAB WILL AUTOMATICALLY ASSUME DIFFERENTIAL TERMINALS
ch4.TerminalConfig="SingleEnded";
ch5.TerminalConfig="SingleEnded";
ch6.TerminalConfig="SingleEnded";
ch7.TerminalConfig="SingleEnded";
ch8.TerminalConfig="SingleEnded";
ch9.TerminalConfig="SingleEnded";
ch10.TerminalConfig="SingleEnded";
ch11.TerminalConfig="SingleEnded";
ch0.Range = [0.0 10.0];
ch1.Range = [0.0 10.0];
ch2.Range = [0.0 10.0];
ch3.Range = [0.0 10.0];
ch4.Range = [0.0 5.0];
ch5.Range = [0.0 10.0];
ch6.Range = [0.0 10.0];
ch7.Range = [0.0 10.0];
ch8.Range = [0.0 10.0];
ch9.Range = [0.0 10.0];
ch10.Range = [0.0 10.0];
ch11.Range = [0.0 10.0];

Sign in to comment.

Answers (0)

Products


Release

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!