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

Forced Data do not react to Logic

Forced Data do not react to Logic

hundch
Member

Hi , see enclosed i have a condition check .

It works with the real data  , but if i force the data it does not react. 

This works 

hundch_0-1720604591811.png

This does not work : 

hundch_1-1720604628893.png

Any ideas ? 

Best regards 

Christoph 

5 REPLIES 5

Sgilk
Contributor

@hundch ,

This seems to be working on my side. 

Here I have the forced value set to 0.0 and the breakpoint is not hit.

Sgilk_0-1720616749623.png

After forcing a value greater than 0.4, the breakpoint is hit and the logic is executed. 

Sgilk_1-1720616877469.png

 

How are you verifying the logic is not executed?

What version of the PLC runtime application and PLC Engineering are you using?

 

Thanks for checking. 

There is a operating time counter and it only counts if the real value is over 0,4 ( in this case of course). 

I attached a boolaen , to see it more clearly.

hundch_2-1720618216590.png

hundch_3-1720618263484.png

 

 

 

Is it possible you are writing this value earlier in the cycle? For example...

Sgilk_0-1720619356314.png

From the CODESYS documentation,

It is possible that a forced variable temporarily gets a different value in the cycle while the code is being processed because the IEC code performs an assignment. Then the variable receives the forced value again only at the end of the cycle.

 

I tried it how you have done it and it works flawlessly. 

in my case the data are from a pressure sensor. And i want to manipulate the data for simulation tasks. 

Does this mean this is not possible at all or is there a workaround ?

If you are simulating the values, you need to disable the code where the value is written. This is difficult for hardware as it requires excluding the IO from the project.

My suggestion would be to add seperate logic and variables for simulation.

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