示例#1
0
 public void testMFC(MFC mfc, float flowrate)
 {
     ushort[] valves = mfc.valvesToOpen;
     for (int i = 0; i < valves.Length; i++)
     {
         openValve(valves[i]);
     }
     setFlow(mfc.slaveId, flowrate);
     System.Threading.Thread.Sleep(delayMsec);
     getCurrentFlow(mfc.slaveId);
 }
示例#2
0
        private byte _currentSlave;    // slave id of the last mfc read

        public ModbusMaster()
        {
            _modbusMaster = new FTDI();
            valves        = new Valve(Constants.valves_slaveId);
            for (int i = 0; i < 6; i++)
            {
                bool valveState = isValveOpen(i + 1);
                valves.setValveState(i + 1, valveState);
            }
            mfcs[0] = new MFC(Constants.mfc500_slaveId, Constants.mfc500_calibrationPoints, Constants.mfc500Valves, Constants.mfc500_FlowmeterRange, Constants.mfc500_maxDeviation, Constants.mfc500_maxDifference);// add stability check conditions here...
            mfcs[0].delayBetweenCalibrationPts = Constants.mfc500_delayBetweenCalPts;
            mfcs[1] = new MFC(Constants.mfc50_slaveId, Constants.mfc50_calibrationPoints, Constants.mfc50Valves, Constants.mfc50_FlowmeterRange, Constants.mfc50_maxDeviation, Constants.mfc50_maxDifference);
            mfcs[1].delayBetweenCalibrationPts = Constants.mfc50_delayBetweenCalPts;
            mfcs[2] = new MFC(Constants.mfc10_slaveId, Constants.mfc10_calibrationPoints, Constants.mfc10Valves, Constants.mfc10_FlowmeterRange, Constants.mfc10_maxDeviation, Constants.mfc10_maxDifference);
            mfcs[2].delayBetweenCalibrationPts = Constants.mfc500_delayBetweenCalPts;
            _currentSlave = mfcs[0].slaveId;
            _currentFlow  = 0f;
        }