'Engineering external implementation of application behavior

I want to do the following behavior in one delphi application.(10.3+)
I want a user to have the possibility to implement his own logical behavior of a program "saved in options".
Very similar with an arduino logical/program.

For example
I create a program that is keep tracking values about 10 heat sensors. But it can be anything.

The program has a timer and in the on timer event the following actions are taking places.

  1. read the values from sensors
  2. take action if needed

there are 2 types of info saved in this class.
Non Changing informations like ID name etc, and permanent changing (DATA).
here is the example of the base class that hold all the info from one sensor.

type TXXX = class
  private
  public
    // info that are not changing ever
    property ID                         : Integer ...
    property SENSOR_NAME : String   ...
// info that are constantly changing
    property READ_TIMESTAMP : TDateTime ...
    property CURRENT_VALUE   : Double ...
    property VALUE_SUPREMUM  : Double    ...
    property VALUE_INFIMUM       : Double   ...
end

I need to create some sort of options of the program when a user can define his own logical that the program should respond if condition are meet.
for example a user want to say:

if CURRENT_VALUE > 5 and  VALUE_INFIMUM > 0.5 then begin
  "take action 1"
end

and so on...

"take action x" and all the actions are hardcoded. for example close/open a valve.

now these properties are more than 4 are like 50 or so.

anyone can point me some directions?

Regards
Razvan



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source