Page 1 of 1

Validation Maximum Question

PostPosted: Tue Jul 18, 2023 6:25 am
by t8fanning
I'm new to M1 Build, so sorry if this question is basic. I'm trying to significantly increase the time constant for the voltage filter of the fuel tank level sensor. I have an old stock fuel level sensor that has a lot of filtering (~30s) in
the stock circuit and am trying to emulate that.

I've adjusted the voltage filter validation maximum to what I want, but keep getting the following error:

Error 1138: "Validation Maximum" must be <= 10 [s].
The "Validation Maximum" on this object must be <= System Maximum 10 [s].

Where is the System Maximum defined? I can't seem to find it. Is there a reason validation maximums are limited to 10s? Is it because of the event rate?

Thank you for any input.

Re: Validation Maximum Question

PostPosted: Mon Jul 24, 2023 10:16 am
by David Ferguson
I think your issue is the object "Fuel Tank Level Sensor" is a pre-built object, and the voltage element under it has a defined Filter maximum of 10s (10000ms which is the base unit). So that is the most you can filter the sensor voltage.

However, the "Fuel Tank Level" object uses the channel "Fuel Tank Level Value", and this is set in the "Fuel Tank Level Update" Scheduled Function. I suggest you added additional filtering using a first order filter like:

Value = Filter.FirstOrder(Sensor, 30.0);

or better yet, make the time constant argument be a parameter called "FilterTimeConstant", so you end up with something like this:

Value = Filter.FirstOrder(Sensor, FilteredTimeConstant);

Note the following comment from the Filter function:
The range of time constants depends on the sample rate of the filter. Recommended time constants fall in the range (1/fs, 1/fs * 100] seconds. There is no upper limit on tc, but calculation accuracy may be reduced for excessively large values.

So you might have the change the timing of the Update Scheduled Function to be 1Second to allow up to 100 second filtering, or use 5hz with a maximum filtering of 20 seconds.

Re: Validation Maximum Question

PostPosted: Sat Jul 29, 2023 2:20 am
by t8fanning
Thanks David! You are an invaluable resource on this forum.

I applied the first order filter with additional input parameter to the update function. It seems to be filtering the signal as expected, but I think I need to do some more signal conditioning as it can still result in some undesired outputs.

Thank you again for your input. It helps a novice like me better understand how to think about M1 Build.