Adamkse Posted December 14, 2017 Report Posted December 14, 2017 Hi, I have a PID function block with an embedded PWM function which should turn a heater on and off with a duty cycle. However it is always set on (1). When I monitor the PID UDFB the output from the PWM is 0 but the main ladder has it as a 1. If i drill down further in the PWM UDFB then that is also 0. I don't understand what is happening. Any help would be great.
Adamkse Posted December 15, 2017 Author Report Posted December 15, 2017 Noticed that my PID_HLT output was called "PID Output bit" and not "PID Output" as I had. Still the same problem but the oposite way round "HLT1 OUT" is always 0 even if "PID Output bit" is changing.
Saragani Posted December 25, 2017 Report Posted December 25, 2017 Without having the project and debugging it, and seeing on own eyes, no one will be able to help you.
MVP 2023 Ausman Posted December 25, 2017 MVP 2023 Report Posted December 25, 2017 What's happening in the real world at the actual heater? Perhaps it is pulsing very rapidly and the "limited" bandwidth for monitoring is not keeping up? Aus
Adamkse Posted December 31, 2017 Author Report Posted December 31, 2017 Hi all I figured it out. In real life the heater was off as the code suggested. The issue was related to the set/reset coils not functioning properly. The do not work as local, function in or function out tags. Only global tags.
Saragani Posted January 1, 2018 Report Posted January 1, 2018 Hi. Value types, like integers, Bits, Real, are being passed by value (Meaning, their value is being passed to the function, and not the pointer to the value) when used in a function-in. So any attempt to change their value within a function code will only affect the value inside the function. Arrays and structs are being passed by Reference, so if you change a value of a bit or a number inside it from a function code, then it will affect the value outside the function. You have 2 options: Passing an array/ struct, or pass the number / bit as a function-out (which means that it will be passed as a reference). I hope this information helps. 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now