I am trying to use a variable type time in straton but this variable didn’t appear in zenon editor,
Note that all other type appear without problem
I am trying to use a variable type time in straton but this variable didn’t appear in zenon editor,
Note that all other type appear without problem
Hi Jonny,
You can convert the data type DINT into TIME format via VBA.
Another possibility is to modyfy the DINT-value in straton in order to be able to show h, min, sec in zenon. Like this:
diTime := any_to_dint (tTimeBasic);
rTimeS := trunc( (any_to_real(diTime)/1000.0 )); //truncate millisconds
diTimeSec := any_to_dint (rTimeS) - diTimeMin * 60 - diTimeHr * 3600; //calculation of seconds
diTimeMin := (any_to_dint (rTimeS / 60.0)) - diTimeHr * 60; //calculation of minutes
diTimeHr := any_to_dint (rTimeS / 3600.0); //calculation of hours
//with that you can show three numerical values in zenon
strTime := any_to_string(diTimeHr) + 'h' + any_to_string(diTimeMin)
+ 'min' + any_to_string(diTimeSec) + 's'; //concatanate in a string
//with that you can show the time in a Link text element in zenon
With these variable definitions:
VAR
tTimeBasic : TIME := T#12h13m14s ;
strTime : STRING(15) ;
rTimeS : REAL ;
diTimeSec : DINT ;
diTimeMin : DINT ;
diTimeHr : DINT ;
diTime : DINT ;
END_VAR
Best regards,
Jürgen