Rate of Change calc...
 
Notifications
Clear all

Rate of Change calculations?

1 Posts
1 Users
0 Reactions
32 Views
(@jlefort)
New Member
Joined: 1 week ago
Posts: 1
Topic starter  

(Apologies if this has been asked and answered or if it is common knowledge, but I can't find what I am looking for)

What I would like to do is know the rate of change for pedals / steering wheel input on a dashboard and display a status. I would like to see when I am pressing the throttle too hard or releasing the brake too quickly or turning the steering wheel too fast.

The general formula for this would be:

(CurrentInputState - PreviousInputState) / Elapsed Time = Result

With a general validation of:

If Result > MaximumInputChange Then DisplayBadStatusNotifier

Where I am falling down (and I admit it's likely because I am very new to SimHub) is that I don't seem to be able to reset the value for 'PreviousInputState'. Normally, I would:

code a variable for PreviousInputState and set its initial value

(loop start)
  Gather CurrentInputState in realtime
  Run the formula
  Validate the Result
  Assign CurrentInputState value to PreviousInputState
(repeat loop)

It appears that I can assign a variable and initial value to PreviousInputState with an ini file in the NCalcScripts folder (ref: removed link ) and I can run the formula and evaluate the result in the binding engine (ref: removed link ---Introduction), but then I fall down on the PreviousInputState reassignment... How does one assign a new value to a  variable in NCalc / SimHub? Any help would be appreciated!


   
Quote
Topic Tags
Share: