Simulating Strokes


mkgrier5

Recommended Posts

I have two sequences running, and when I go to turn them off or adjust the number of times to run the seq. a minute, they make the computer freeze up. Here they are:

While (1)
   If (Pump_1_Simulation_On(0) >= 1)
	  Total_Strokes++
	  DrillStrokes++
	  LagStrokes++
	  Delay(60/Pump_1(0))
   EndIf
EndWhile

While (Pump_2_Simulation_On(0) >= 1)
   Total_Strokes++
   DrillStrokes++
   LagStrokes++
   Delay(60/Pump_2(0))
EndWhile

What am I doing wrong?

Link to comment
Share on other sites

First, it should be [0] after your channel names, not (0). () means function, [] means subset, and channels aren't functions. The system currently automatically corrects this, but there is no guarantee in future revisions that it will do so, plus it is confusing when viewing your code.

Second, the issue is that your delay() in the first sequence is inside the if(). If the if() evaluates to false, then the loop reduces down to just:

while(1)

endwhile

This will hang DAQFactory if the priority of the sequence is 2 or higher.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.