×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Are you an
Engineering professional?
Join Eng-Tips Forums!
• Talk With Other Members
• Be Notified Of Responses
• Keyword Search
Favorite Forums
• Automated Signatures
• Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

#### Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

# How can I create a basic mathematical model from real life systems?

## How can I create a basic mathematical model from real life systems?

(OP)
In college, a simple transfer function was given and we were asked to tune the PID which is what I am trying to do, I cant do this without the transfer function of the real model and I do not know how to get acquire it myself?

I have a degree in ME, and I am struggling to create a mathematical model to simulate a humidifier in an HVAC system.

The final goal is to model the rate of change of humidity going into a room and being returned through the duct knowing the CFM, air changes per hour, max load of the humidifier, and rate of change in the room itself as the humidifier adds moisture to the air in %RH. (Input to the PID is setpoint in %RH, room %RH being read, and output is amount of humidification to add, based on the valve position... which can be assumed %RH to add to the stream)

TL;DR: How do I model a humidifier in an HVAC system with a transfer function to tune the PID controls?

I assumed that 1/(0.1s+1) would be a simple start for the sensor lag back to the controller, but how do i model the humidity being added to the room (i assumed based on volume, max flow rate from the humidifier or current position, and percent of this air being returned through the duct),

Any help is greatly appreciated!

### RE: How can I create a basic mathematical model from real life systems?

(OP)
I could not figure out how to quote your response above as is always done on forums.

Thank you, system identification is the word I need to start using in my googling.

Those links were helpful, now I suppose you take the laplace? i'd love to see some real examples worked out through matlab or similiar, or by hand.

### RE: How can I create a basic mathematical model from real life systems?

I'm assuming the system is already built for the following, as does system identification. If it isn't, you have to model using physics principles, which is much harder, especially since you can't validate the model until the system gets built.
Put your system at the desired operating point in manual mode on all parameters that can affect the humidity - basically air flow and humidity valve position.
In manual on your humidity controller, input a step change in valve position and measure the response of humidity over time until it reaches steady state. The step has to be big enough so you see a response, but not so big you move too far away from your operating point. It might take a couple of attempts to find the right step size. Make sure you're sampling fast enough to see the response curve. Humidity will probably change slowly if the room volume is big enough compared to the input air flow rate, so a slow sampling rate will probably work.
Use that curve to estimate a transfer function model's parameters - a first-order lag plus dead time model will probably suffice. There are a lot of web tutorials now to do this. This TF includes the effects of valve and sensor, so don't worry about modeling those separately.
Use the model parameters to tune the PID according to heuristic tuning rules. Try PI first. Do not use Ziegler-Nichols rules - they might have been first to develop heuristic rules, so they made it into all the textbooks, but their rules are too aggressive and typically lead to a response with too much overshoot and oscillation. I like CHR rules for regulators with 0 % overshoot.
Put all controllers back in auto mode and keep an eye on the humidity over a couple of days. Also keep an eye on the humidity valve position for the same period. If it moves too frequently but humidity is staying in control, detune the controller. You don't want to wear your valve out too fast. If the valve hits its travel limits and humidity goes out of control, make the tuning more aggressive. If PI isn't controlling well, try PID.
If the room volume to flow ratio is too big, it creates a long time constant, and you may have to detune your controller or move on to cascade control.

There are plenty of web tutorials on "PID tuning" if this post didn't help you.

xnuke
"Live and act within the limit of your knowledge and keep expanding it to the limit of your life." Ayn Rand, Atlas Shrugged.
Please see FAQ731-376: Eng-Tips.com Forum Policies for tips on how to make the best use of Eng-Tips.

### RE: How can I create a basic mathematical model from real life systems?

(OP)
Thank you!

I used the a first-order lag plus dead time mode all day and tried to model the room, what it turns out is i figured out i modeled the valve delay opening. which is okay.

I am now trying to add transfer functions to simulate the room (probably in feedback based on RH) and mass flow rate of humidity in, and temperature.. much harder..

### RE: How can I create a basic mathematical model from real life systems?

You need to collect data of the process then find differential equation that responds the way the actual data or PV did.
https://deltamotion.com/peter/py/SysID%20SOPDT.zip
The link above is a python program that will find the PID gains for a temperature control system.
You will need to edit is so it applies to humidity. Your model is a simple first order model without dead time.
I think you will find a closer model will have more parameters.

There is a text file of data called HotRod.txt. The hotrod was a wood burner tool with a temperature sensor on it. A person on PLCs.net used these small temperature systems to train students.
He send me the data in 2005.
The data consists of 3 columns.
Time, % control ouput, PV or feedback data.
The model for the SOPDT process is well known but there are 5 items that must be calculated or estimated.
The open loop gain, two time constants, a dead time, and an offset. The program tries many iterations trying different combinations of these 5 items until the error is reduced to be small.
One the model is know, it is easy to calculate the controller gains.
Install Anaconda and learn how to use it. It is free and can do the same things as Matlab and more.
https://www.anaconda.com/

I also have a YouTube channel on control theory. My channel is not the typical stuff like this gain do this and that gain does that. It is all about how to apply control theory to real world applications. My YouTube is meant for graduate students and practicing engineers. The first two videos you want to watch is
then

In my not so humble opinion, teachers and text books teach control theory wrong.
You can't control what you don't understand.

#### Quote:

I often say that when you can measure what you are speaking about, and express it in numbers, you know something about it; but when you cannot measure it, when you cannot express it in numbers, your knowledge is of a meagre and unsatisfactory kind.
Lord Kelvin
None of the rest of the crap that is learned is worth anything until system identification is first mastered.

BTW, I generally have have a lot of contempt for mechanical engineers because they too often design stuff without consideration of how it is going to be controlled.
It is good that you are starting out right.

Peter Nachtwey
Delta Computer Systems
http://www.deltamotion.com
http://forum.deltamotion.com/

#### Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

#### Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

#### Resources

Low-Volume Rapid Injection Molding With 3D Printed Molds
Learn methods and guidelines for using stereolithography (SLA) 3D printed molds in the injection molding process to lower costs and lead time. Discover how this hybrid manufacturing process enables on-demand mold fabrication to quickly produce small batches of thermoplastic parts. Download Now
Examine how the principles of DfAM upend many of the long-standing rules around manufacturability - allowing engineers and designers to place a partâ€™s function at the center of their design considerations. Download Now
Taking Control of Engineering Documents
This ebook covers tips for creating and managing workflows, security best practices and protection of intellectual property, Cloud vs. on-premise software solutions, CAD file management, compliance, and more. Download Now

Close Box

# Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

• Talk To Other Members
• Notification Of Responses To Questions
• Favorite Forums One Click Access
• Keyword Search Of All Posts, And More...

Register now while it's still free!