Exemplo n.º 1
0
        public double ReadTemperature()
        {
            var       niTask      = new NationalInstruments.DAQmx.Task();
            AIChannel analogInput = niTask.AIChannels.CreateVoltageChannel(
                "Dev8/ai0",
                "Temperature",
                AITerminalConfiguration.Rse,
                1,
                5,
                AIVoltageUnits.Volts
                );
            var reader = new AnalogSingleChannelReader(niTask.Stream);

            return(PlantCalculations.CalcTemperature(reader.ReadSingleSample()));
        }
Exemplo n.º 2
0
        public void SetSetPoint(double temperature)
        {
            var gain         = PlantCalculations.CalcTemperatureToVolt(temperature);
            var niTask       = new NationalInstruments.DAQmx.Task();
            var analogOutput = niTask.AOChannels.CreateVoltageChannel(
                "Dev9/ao1",
                "SV",
                1,
                5,
                AOVoltageUnits.Volts
                );
            var writer = new AnalogSingleChannelWriter(niTask.Stream);

            writer.WriteSingleSample(true, Math.Min(Math.Max(gain, 1), 5));
        }