Slow digital output from Sequencer

  • Software
  • Slow digital output from Sequencer
Daniel Shaffer

Posted on 09.11.2020 16:13

I used the Sequencer to design a process that cycles a valve by applying pressure first to the left side of a valve, and then to the right side of the valve, and then repeats this loop a large number of times. The sequence monitors the pressures on both sides of the valve, and vents one side while the other side is filling. We are using a Dewe43a to read pressures and the sync port to control digital output signals.


Unfortunately, when the pressure on one side of the valve crosses the required threshold, it takes almost 200ms for the digital output signal to change. I've tried changing several settings to increase the speed of the digital output, but it doesn't seem to make much of a difference. I've changed the Application Process Priority to High; changed the Sample Rate up to 100k and 200k s/sec; increased the Acquisition Update Rate to 500Hz; and decreased the Display Update Rate so that it doesn't use as much CPU.


Do you have any other recommendations for how to get the digital outputs to react more quickly to changes in the sequencer?


In the attached screenshot of a run, the yellow time bar marks when the digital output should toggle. The green S0_out signal is the actual digital output channel, and is delayed close to 200ms.


See the attached setup file and sequencer file for more information. We ran this setup with the following parameters:

Delay Between Cycles: 0

Actuate Fill Pressure: 95psi

Vent Pressure: 20psi

Deactuate Fill Pressure: 55psi

Primoz Lapi
Customer Support Engineer
Posted on 11.11.2020 11:28

Hi,



the digital out is updated with acquisition loop but not every time. If only one channel is used with one digital out channel, the delay should be between 10-30ms (attached is also a data file).

When the acquisition loop time is set to 500 Hz, Dewesoft will try to loop it 500 times per second but if the setup or PC will not be able, this value will be lowered.

The high CPU load also effects the reaction time of the DO.



You can check the actual loop time and the CPU load on the top right corner of the measure screen.



Could you maybe send us the data file where you can see 200ms delay? It would be also useful if you could record a file with a system monitor channels.



Attached files:
Daniel Shaffer

Posted on 11.11.2020 15:00

I've attached a representative data file that shows delays of around 200ms for some iterations.


The 200ms is the time between when

1) The pressures that the Wait block in the Sequencer is monitoring reach their threshold (<20PSI for the actuation_manifold_press and >55PSI for the deactuation_manifold_press)

and

2) The S0_Out signal which drives the digital output changes


I will add the system monitor to a setup and run that as well.


Attached files:
Daniel Shaffer

Posted on 11.11.2020 16:35

The attached data file adds a system monitor. The digital signals in this file are around 100ms behind.


The thresholds used for this sampling were <40PSI for the actuation_manifold_press and >50PSI for the deactuation_manifold_press


Acquisition rate was set to 500hz.


Attached files:
Primoz Lapi
Customer Support Engineer
Posted on 12.11.2020 09:53

Hi,


if sequencer is used for triggering the digital out, the delay is much larger.

The processing of each block takes at least 20ms.




Is there a possibility to use formula for triggering the DO instead of the sequencer? This would decrease the delay that you are experiencing.

I have checked also the delay on your data file with the condition (with average channels) and there is approximately 30ms of delay.

Daniel Shaffer

Posted on 12.11.2020 14:49
I have checked also the delay on your data file with the condition (with average channels) and there is approximately 30ms of delay.


Actually the data file you analyzed in your screenshot was using thresholds of <40PSI and >50PSI, so the delay was closer to 107ms.


Thank you though for your note that the processing of each block in the Sequencer is at least 20ms, that is very good to know. The last time we ran into this issue I used a comparator chip with a microcontroller to toggle the relays, but that requires external hardware that is not intuitive to most users of our Dewesoft system. I had not thought about using a formula, but was considering a C++ Script since I've used those in Dewesoft when they were first coming out.

I haven't used the C++ Scripts for a year or so, do you know if the C++ Scripts cycle quickly enough to toggle a digital output channel based on a pressure channel in under 50ms or so? I'm thinking something like the psuedo code below:

inline void Module::calculate()
{
	// Procedure which gets called repeatedly whenever
	// DEWESoft has exactly ``Block size'' (or 1, in sample
	// based mode) number of new samples in input channels.
	
	switch (current_state) {
		case FallingPressure:
			if(low_press.getScalar() < LOW_PRESSURE_THRESHOLD){
				myDigitalOutput.addScalar(1);
				current_state = RisingPressure;
			}
			break;
		case RisingPressure:
			if(high_press.getScalar() > HIGH_PRESSURE_THRESHOLD){
				myDigitalOutput.addScalar(0);
				current_state = FallingPressure;
			}
			break;
	}
}
Primoz Lapi
Customer Support Engineer
Posted on 18.11.2020 23:47

Hi,


I have checked with developers and the delay of the C++ script should be similar to formula. I have made a test with formula and c++ script and the delay between the condition and digital output is less then 50ms.



Attached is also a setup file which I used.





Attached files:
Daniel Shaffer

Posted on 19.11.2020 22:22

@Primoz Lapi

Thank you for checking into the scripts and formula, we may use this method in the future. Do you mind uploading the the setup file again? When I try to download the file it was downloaded as a compressed .zip, and didn't contain a setup file.

Primoz Lapi
Customer Support Engineer
Posted on 20.11.2020 08:38

Hi,


attached is the zipped setup file.


Attached files:
Login to reply to this topic. If you don't have account yet, you can signup for free account .