Dear all
For a long time I’m trying again to implement a new rule. However I miserably fail. I guess I mess up with the data types (e.g. long, int etc). In any case the below rule (not the full rule but the part which does not work, in case you ask yourself what I want to achieve with it) does not work:
var long LastUpdate = now.toInstant.toEpochMilli
var Time_low = 0
var Count = 0
val P_Warme = 3000
val Hysterese_P = 300
val Hysterese_T = 5
val Delta = -(32.77-31.15)/(31.15-22.4)/(1+(32.77-31.15)/(31.15-22.4))
rule "Steuerung"
when
Time cron "0/5 * * * * ? *"
then
val currentTime = now.toInstant.toEpochMilli
val timeElapsed = (currentTime - LastUpdate)/1000
if (Leistung.state > (Delta * P_Warme + Hysterese_P)){
if (Count == 0){
Time_low = timeElapsed + Time_low
}
Count = 0
Time_high = 0
if (Time_low > Hysterese_T){
}
}
end
I get following errors:
2024-01-21 18:55:29.792 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'Steuerung-1' failed: An error occurred during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.LongExtensions.operator_plus(long,int) on instance: null in Steuerung
2024-01-21 18:55:35.599 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'Steuerung-1' failed: An error occurred during the script execution: Could not invoke method: org.eclipse.xtext.xbase.lib.LongExtensions.operator_minus(long,long) on instance: null in Steuerung
2024-01-21 18:55:35.990 [ERROR] [internal.handler.ScriptActionHandler] - Script execution of rule with UID 'Steuerung-1' failed: An error occurred during the script execution: Couldn't invoke 'assignValueTo' for feature JvmVoid: (eProxyURI: Steuerung.rules#|::0.2.0.2.0.2.1.0.2::0::/1) in Steuerung
Sorry to bother, but can anybody help to unmess the rule?
Thanks a lot in advance