Kkula
Browse Questions » SIMATIC WinCC (TIA Portal): Who Is Able To fix the script?

About User

Questions Asked: 37.9K

Answers Given: 32

0
  • Open

SIMATIC WinCC (TIA Portal): Who Is Able To fix the script?

Who can fix the script?
somehow tag "temperatura" rounded to 1?!
and it is necessary to be in the format of 99.9
(tag "temperatura" Real)
fputs("Temperature: ",fpFile);
sprintf(buffer, "%d",GetTagSDWord("temperatura"));
fputs(buffer,fpFile);
fputs(" C",fpFile);
fputs("\n\r",fpFile);

0 Likes 0 Favourites 0 Followers 0 Comments
Answers(1)

Regarding Script Issue - Temperature Tag Rounding

The script currently displays the "temperatura" tag as an integer, leading to the rounding issue. To fix this and ensure the format "99.9" for a Real tag, modify the sprintf line.

Solution: Replace

sprintf(buffer, "%d",GetTagSDWord("temperatura"));

with

sprintf(buffer, "%.1f",GetTagReal("temperatura"));

Explanation:

  • GetTagReal("temperatura"): Correctly retrieves the "temperatura" tag as a Real (floating-point) value.
  • %.1f: This format specifier ensures the output is a floating-point number with one digit after the decimal point.

Who can fix this?

This script modification can be performed by someone with scripting knowledge within your team familiar with the Siemens environment and access to the script editor. If internal resources are unavailable, consider engaging a Siemens support engineer or a qualified system integrator. You can find support options and partners through SiePortal.

0