Dear Community User! We have started the migration process.
This community is now in READ ONLY mode.
Read more: Important information on the platform change.

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

PLC Variable in PLC Engineering and read through data layer doesn´t fit

PLC Variable in PLC Engineering and read through data layer doesn´t fit

maurusbien
Established Member

Hello,

One customer has a really fancy behavivour:

He has a variable inside his PLC Project calling "Position" which reads the actual position of an Axis via the PLC. Inside the PLC Project while the customer is logged on, the variable value is 74.6:

maurusbien_0-1604590041550.png

The customer is also reading this variable via an C++ App:

maurusbien_1-1604590083068.png

maurusbien_2-1604590106588.png

and writes out the result into the logbook:

maurusbien_3-1604590140150.png

but as you can see, the values doesn´t match. How could this be? What is done wrong here?

 

 

 

 

2 REPLIES 2

Jochen_Mueller
Community Moderator
Community Moderator

Hello Maurus

We need to reduce the possible error situations. The error can occur at

  • The actual position provided by the PLC
    • Please read the value from the web-interface or over REST (is it 74,6??)
  • the value read by the C++ App
    • please check the value in debug mode of the c++ App
    • alternative write the value to a customer node at the datalayer and check the value
  • the value written in the logbook
    • if the value is correct at the upper points, it seems that either the writting in the logbook is not correct
    • or the logbook display the value not correct

 

Please check the different points.

Regards

Jochen

 

bostroemc
Occasional Contributor

The variant class includes some helpful conversion operators.  In the SDK (1.5.0),  see include/comm.datalayer/comm/datalayer/variant.h.

I was able to read PLC variable Position (defined as REAL), using the following:

result = client->readSync(temp, &value);

float f = float(value);

Bildschirmfoto von 2020-11-09 16-12-56.png

Untitled.png

Bildschirmfoto von 2020-11-09 16-09-55.png

 

(In your case, with Position defined as LREAL, you'll need to use double, but the principle should be the same...) 

 

 

 

 

 

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