
This article describes the function block to control heating/cooling outputs with PWM for temperature control using PID

Ten artykuł opisuje blok funkcyjny do sterowania wyjściami grzania/chłodzenia wykorzystując PWM dla kontroli temperatury poprzez regulator PID

"Copyright © Mitsubishi Electric Europe B.V.
IMPORTANT !
These Function Blocks are demo
versions that are only intended to demonstrate program functions and
provide general orientation for your software choices. They are not
suitable for use in real applications! "
"Improper use of demo
versions in applications can lead to serious malfunctions and damage!
Programs for real applications must always be configured for the
individual application by trained staff and tested thoroughly before
being used.
Mitsubishi Electric cannot assume
any liability if these examples are used in real applications."
1. Function block
1.1 Description
This function block for iQ-F PLC is used to control binary heating/cooling outputs using PWM when using PID regulator for temperature regulation but also can be used as standalone PWM controller.
Input/output | Data type | Description |
i_iEnable | Bit | Enable signal |
i_ibUse_Cooling | Bit | To use (TRUE) or not to use (FALSE) cooling output |
i_iPWM_Cycle_time | Word (Signed) | Length of PWM cycle in miliseconds |
i_iPWM_Minimum_Width_time | Word (Signed) | Minimum width time in one cycle in miliseconds |
i_iPWM_Maximum_Output_Value | Word (Signed) | Maximum value of Manipulated Value (Mv) from PID |
i_iPWM_Minimum_Output_Value | Word (Signed) | Minimum value of Manipulated Value (Mv) from PID |
i_fSet_Value | Float | Set Value of temperature (Sv) |
i_iPID_Value | Word (Signed) | Manipulated Value from PID (Mv) |
o_bHeating_Output | Bit | Output for heating |
o_bCooling_Output | Bit | Output for cooling |
o_bError | Bit | Error signalization |
2. Operation types
2.1 Operation without cooling output
When operating with
Use_Cooling input set to
FALSE, controller use only heating output. Output pulse width is calculated from range

but when calculated width is smaller then minimum width time, heating output will remain off for this cycle. Width time is calculated from formula:
2.2 Operation with cooling output
When
Use_Cooling input set to TRUE and value from the PID regulator is greater then Set Value controller operates using formula from above to control heating output. When Manipulated value is from range
width time of cooling output is calculated from formula:
3. Application
3.1 Setting PWM cycle parameters
3.1.1 Cycle time
PWM cycle time should be set with lifespan of relays in mind - 2s to 5s is a good value. Also PID Sampling time should be set to the same value.
3.1.2 Minimum width time
This value should be set to be greater then transistor output response time and also minimum switch time of a SSR relay.
3.1.3 PID output Manipulated Value range
This range should be set to be the same as Upper Limit Value and Lower Limit Value of PID
3.1.4 Set Value and Manipulated Value
Set value should be the same variable as the set value in PID. Manipulated value from PID should be directly connected to PID_Value input of this function block.
4. Monitoring
In attachment there is a "log_viewer_monitor_settings" file for monitoring regulation in GX LogViewer for example project:
To open this file while starting log viewer you need to select: