cancel
Showing results for 
Search instead for 
Did you mean: 
SOLVED

Variable loosing its status

Variable loosing its status

alink
New Contributor

Hello,

there is a strange behavior of variables.

There is a animation of analog clock. For that, system time is split in seconds, minutes, hours. With that and a factor, clockhands are simulated in a Visu (inner rotation of a line).

If using the global variable iSekundenAnzeige (used for the angle to display 0...360°) it doesn't work (since some days, before it worked). 

alink_1-1681455573882.png

When debugging with breakpoint the variable is written. But with next cycle of program it starts with 0. Then written again but with next cycle 0 again. At the end it keeps on 0.

The variable is read / written just one time, so there is no conflict

alink_2-1681456563274.png

Renaming the variable it works.

alink_0-1681455508005.png

Variable keeps its value.

Going back to the old name it doesn't work. Variable doesn't keep its value within one PLC cycle.

The issue is the same again as written above.

 

A similar issue was with a funciton block. Status of variables (input/output) were lost with each cycle. After renaming the instance name of function block it works.

Such isseus are very annoying and it would be helpful to know what to do.

-Clearing / clear all in editor doesn't help.

-Restarting ctrlX doesn't help.

-Shutting off and on ctrlX doesn't help.

 

Such unreliability of the system reduces the confidence and is very disappointing.

2 REPLIES 2

TheCodeCaptain
Community Moderator
Community Moderator

Hi alink,

could you provide an example project with this error and tell us your version?

You do not write the values from somewhere else(eg. Datalayer), or have any pointers with memory access writing in this section?
You may use Checkbounds etc. to verify it.

Hi,

tried to make a sample project. But then it works with this variable (within a simulation and just this part of program).

The Date/Time is from SystemTimeRTC.

This is then splitted into date and time.

The time into seconds, minutes and hours. => this all works fine!

Then, just for animation of my own clock

alink_0-1681477961162.png

lines for second, minute and hour are rotating.

To get and set the current angle the seconds are multiplied with 6 => 0 sec 360°/0° and 59 sec = 354°

For minutes the same and for hours it is multiplied with 30 to get it rotateted twice a day...

So, the issue is when the current seconds are multiplied with 6 and written into the variable for the angle.

With the name 'GVL_VISU.iSekundenAnzeige' the value is lost. With another name, just of this one variable, it works.

I use a ctrlX with 1.18 and ctrlXWorks 1.18

alink_1-1681478520166.png

alink_2-1681478553961.png

It's a very strange issue. And as written, something similar with a own function block.

My first though, instance name has too much characters (about 20) because with less it works.

An issue I never had before, neither with ctrlX nor with MLD and XM I worked with.

Icon--AD-black-48x48Icon--address-consumer-data-black-48x48Icon--appointment-black-48x48Icon--back-left-black-48x48Icon--calendar-black-48x48Icon--center-alignedIcon--Checkbox-checkIcon--clock-black-48x48Icon--close-black-48x48Icon--compare-black-48x48Icon--confirmation-black-48x48Icon--dealer-details-black-48x48Icon--delete-black-48x48Icon--delivery-black-48x48Icon--down-black-48x48Icon--download-black-48x48Ic-OverlayAlertIcon--externallink-black-48x48Icon-Filledforward-right_adjustedIcon--grid-view-black-48x48IC_gd_Check-Circle170821_Icons_Community170823_Bosch_Icons170823_Bosch_Icons170821_Icons_CommunityIC-logout170821_Icons_Community170825_Bosch_Icons170821_Icons_CommunityIC-shopping-cart2170821_Icons_CommunityIC-upIC_UserIcon--imageIcon--info-i-black-48x48Icon--left-alignedIcon--Less-minimize-black-48x48Icon-FilledIcon--List-Check-grennIcon--List-Check-blackIcon--List-Cross-blackIcon--list-view-mobile-black-48x48Icon--list-view-black-48x48Icon--More-Maximize-black-48x48Icon--my-product-black-48x48Icon--newsletter-black-48x48Icon--payment-black-48x48Icon--print-black-48x48Icon--promotion-black-48x48Icon--registration-black-48x48Icon--Reset-black-48x48Icon--right-alignedshare-circle1Icon--share-black-48x48Icon--shopping-bag-black-48x48Icon-shopping-cartIcon--start-play-black-48x48Icon--store-locator-black-48x48Ic-OverlayAlertIcon--summary-black-48x48tumblrIcon-FilledvineIc-OverlayAlertwhishlist