Fuzzy control problem:(1)input 2 expects a value in range [-1.5 1.5], but has a value of 4.36559e+24;
47 次查看(过去 30 天)
显示 更早的评论
Ke
2024-5-14
In 'EV_Thermal_Management_wendukongzhi_zhileng/Controls/Compressor Control/ÿÿÿÿ/Fuzzy Logic
Controller', input 2 expects a value in range [-1.5 1.5], but has a value of 4.36559e+24.
取消组合 1025 相似
显示堆栈跟踪
组件:Simulink | 类别:Model 警告
In 'EV_Thermal_Management_wendukongzhi_zhileng/Controls/Compressor Control/ÿÿÿÿ/Fuzzy Logic
Controller', no rules fired for Output 1. Defuzzified output value set to its mean range value 0.
取消组合 3075 相似
7 个评论
Sam Chak
2024-5-14
Hi @柯
Based on the image you provided, it seems that the 'input 2' to the Fuzzy Logic Controller block is derived from the derivative signal. The very high value you're observing is likely caused by a sudden surge in the signal due to a setpoint jump. This phenomenon is commonly referred to as "derivative kick due to setpoint jump".
The Fuzzy Logic Controller you designed expects the derivative signal to be within the range of . However, it appears that the Saturation block is unable to effectively constrain the input signal to the upper saturation value. I recommend verifying if the observations I described align with the actual behavior of the system.
Sam Chak
2024-5-15
编辑:Sam Chak
2024-5-15
Hi @柯
In order to investigate the issue further, I will need to thoroughly examine both the Simulink model and the Fuzzy Inference System (FIS) files.
If possible, could you please share the Simulink file and the FIS file with me? Please ensure that the '.fis' file is first archived or zipped before sharing it. If you encounter any difficulties in doing so, you can also open the fis file and copy/paste its contents to share them with me.
[System]
Name='Fuzzy_Logic'
Type='sugeno'
Version=2.0
NumInputs=1
NumOutputs=1
NumRules=2
AndMethod='prod'
OrMethod='probor'
ImpMethod='prod'
AggMethod='sum'
DefuzzMethod='wtaver'
[Input1]
Name='input1'
Range=[-0.04 0.04]
NumMFs=2
MF1='mf1':'zmf',[-0.04 0.04]
MF2='mf2':'smf',[-0.04 0.04]
[Output1]
Name='output1'
Range=[0 1]
NumMFs=2
MF1='mf1':'constant',[-1]
MF2='mf2':'constant',[1]
[Rules]
1, 1 (1) : 1
2, 2 (1) : 1
Ke
2024-5-15
编辑:Walter Roberson
2024-5-17
I've committed the code content of the simulink file and the fis file. Can you help me see what the problem is?
fis file :
[System]
Name='mhPID'
Type='mamdani'
Version=2.0
NumInputs=2
NumOutputs=3
NumRules=49
AndMethod='min'
OrMethod='max'
ImpMethod='min'
AggMethod='max'
DefuzzMethod='centroid'
[Input1]
Name='e'
Range=[-3 3]
NumMFs=7
MF1='NB':'trimf',[-4.275 -3 -2]
MF2='NM':'trimf',[-3 -2 -1]
MF3='NS':'trimf',[-2 -1 0]
MF4='ZO':'trimf',[-1 0 1]
MF5='PS':'trimf',[0 1 2]
MF6='PM':'trimf',[1 2 3]
MF7='PB':'trimf',[2 3 4.055]
[Input2]
Name='ec'
Range=[-1.5 1.5]
NumMFs=7
MF1='NB':'trimf',[-2 -1.5 -0.9999]
MF2='NM':'trimf',[-1.5 -0.9999 -0.5001]
MF3='NS':'trimf',[-0.9999 -0.5001 0]
MF4='ZO':'trimf',[-0.5001 0 0.5001]
MF5='PS':'trimf',[0 0.5001 0.9999]
MF6='PM':'trimf',[0.5001 0.9999 1.5]
MF7='PB':'trimf',[0.9999 1.5 2.001]
[Output1]
Name='kp'
Range=[-5 5]
NumMFs=7
MF1='NB':'trimf',[-6.667 -5 -3.333]
MF2='NM':'trimf',[-5 -3.333 -1.667]
MF3='NS':'trimf',[-3.333 -1.667 2.22e-16]
MF4='ZO':'trimf',[-1.667 -5.551e-17 1.667]
MF5='PS':'trimf',[2.22e-16 1.667 3.333]
MF6='PM':'trimf',[1.667 3.333 5]
MF7='PB':'trimf',[3.333 5 6.667]
[Output2]
Name='ki'
Range=[-2 2]
NumMFs=7
MF1='NB':'trimf',[-2.667 -2 -1.333]
MF2='NM':'trimf',[-2 -1.333 -0.6667]
MF3='NS':'trimf',[-1.333 -0.6667 -1.11e-16]
MF4='ZO':'trimf',[-0.6667 0 0.6667]
MF5='PS':'trimf',[-1.11e-16 0.6667 1.333]
MF6='PM':'trimf',[0.6667 1.333 2]
MF7='PB':'trimf',[1.333 2 2.667]
[Output3]
Name='kd'
Range=[-1 1]
NumMFs=7
MF1='NB':'trimf',[-1.333 -1 -0.6667]
MF2='NM':'trimf',[-1 -0.6667 -0.3333]
MF3='NS':'trimf',[-0.6667 -0.3333 -5.551e-17]
MF4='ZO':'trimf',[-0.3333 0 0.3333]
MF5='PS':'trimf',[-5.551e-17 0.3333 0.6667]
MF6='PM':'trimf',[0.3333 0.6667 1]
MF7='PB':'trimf',[0.6667 1 1.333]
[Rules]
1 1, 7 1 5 (1) : 1
1 2, 7 1 3 (1) : 1
1 3, 6 2 1 (1) : 1
1 4, 6 2 1 (1) : 1
1 5, 5 3 1 (1) : 1
1 6, 4 4 2 (1) : 1
1 7, 4 4 5 (1) : 1
2 1, 7 1 5 (1) : 1
2 2, 7 1 3 (1) : 1
2 3, 6 2 1 (1) : 1
2 4, 5 3 2 (1) : 1
2 5, 5 3 3 (1) : 1
2 6, 4 4 3 (1) : 1
2 7, 3 4 4 (1) : 1
3 1, 6 1 4 (1) : 1
3 2, 6 3 2 (1) : 1
3 3, 6 3 2 (1) : 1
3 4, 5 3 2 (1) : 1
3 5, 4 4 3 (1) : 1
3 6, 3 5 3 (1) : 1
3 7, 3 5 4 (1) : 1
4 1, 6 1 4 (1) : 1
4 2, 6 2 3 (1) : 1
4 3, 5 3 3 (1) : 1
4 4, 4 4 3 (1) : 1
4 5, 3 5 3 (1) : 1
4 6, 2 6 3 (1) : 1
4 7, 2 6 4 (1) : 1
5 1, 5 2 4 (1) : 1
5 2, 5 3 4 (1) : 1
5 3, 4 4 4 (1) : 1
5 4, 3 5 4 (1) : 1
5 5, 3 5 4 (1) : 1
5 6, 2 6 4 (1) : 1
5 7, 2 7 4 (1) : 1
6 1, 5 4 7 (1) : 1
6 2, 4 4 3 (1) : 1
6 3, 3 5 5 (1) : 1
6 4, 2 5 5 (1) : 1
6 5, 2 6 5 (1) : 1
6 6, 2 7 5 (1) : 1
6 7, 1 7 7 (1) : 1
7 1, 4 4 7 (1) : 1
7 2, 4 4 6 (1) : 1
7 3, 3 5 5 (1) : 1
7 4, 2 5 6 (1) : 1
7 5, 2 6 5 (1) : 1
7 6, 1 7 5 (1) : 1
7 7, 1 7 7 (1) : 1
Sam Chak
2024-5-15
Hi @柯
Since your model was incomplete, I had to make some necessary adjustments to get it up and running. However, I made sure not to alter the design of your Fuzzy Inference System (FIS). Based on my findings, it appears that the Derivative block is causing the problem. To resolve the issue, I suggest removing the troublesome block and connecting a time-derivative signal to the ec port instead.
By making this modification, you should be able to address the issue and achieve the desired results.
Ke
2024-5-15
Thank you very much for your answer, I tried to experiment with the method you provided. Can you share your model with me?
Ke
2024-5-15
Hello, I tried it and found that it still doesn't seem to be ideal, I can't get the rate of change without using the Derivative block.
采纳的回答
Sam Chak
2024-5-15
Hi @柯
If there is no other way to directly measure the time derivative signal from the system, the proposed configuration with a Pre-filter at the Setpoint and a Filtered Derivative transfer function can be used to replace the original Derivative block. This configuration should effectively address the issue of derivative kick caused by setpoint jumps.
In Scope 1, you can see that the maximum value of dedt (the derivative of the error) is less than 1.5, which falls within the range of the fuzzy input 'ec'. This indicates that the proposed configuration successfully manages the derivative kick issue.
Scope 2 demonstrates how the fuzzy PID gains vary over time, maintaining non-negative values throughout the simulation. To achieve this, a small trick using the 'Abs' block is employed. Please note that in your original system, you should remove any additional blocks related to gain adjustment. Only the Pre-filter and the Filtered Derivative are necessary.
Lastly, Scope 3 illustrates the stability achieved by the Double Integrator system. A Simulink model is also attached for your reference and the original FIS file is unchanged.
Scope 1
Scope 2
Scope 3
4 个评论
Sam Chak
2024-5-16
编辑:Sam Chak
2024-5-16
Sure @柯, here is the model saved in an earlier version. If you find the solution to the derivative kick helpful, please consider clicking 'Accept' ✔ on the answer and voting 👍 for it. Your support is greatly appreciated!
Please note that your fuzzy PID controller follows this form:
It is important to consider that all three nominal gains are fixed at 1 and are less than or equal to the absolute value of the fuzzy gains . At some point, the summed control gains may become zero or negative, which can potentially destabilize your original system. This observation was made while attempting to stabilize the Double Integrator (see Scope 2).
The second issue pertains to the membership functions. While I'm not an expert in Mamdani fuzzy systems, I noticed that you designed 7 input membership functions for both 'e' and 'ec' inputs. Since you opted for all possible rules (), ideally, the number of output membership functions should be 13. However, I see that you only have 7 output membership functions for each fuzzy control gain.
The third issue pertains to the Saturation block placed at the output of the PID controller. With the current configuration, you are limiting the output of the controller to a range of 0 to 1. As a result, the controller's output is unidirectional, regardless of whether the error signal is negative or positive.
If you're experiencing performance issues with the designed fuzzy controller, I suggest creating a question for further investigation. This way, we can delve deeper into the specific challenges you're facing and explore potential solutions for the fuzzy control system.
Ke
2024-5-17
移动:Sam Chak
2024-5-17
Hello, I found that the model you built does not seem to initialize the PID parameters, and directly input the output of the fuzzy rules into the PID controller as the values of KP, KI, KD, will this have an impact?
2. In addition, you mentioned that my membership function should be 13, I don't understand this too much, and the output membership function I set is also 7 triangle membership functions with the input.
3. Regarding the unlimited output, I want to control the speed of my compressor to ensure that his speed is within a reasonable range and cannot exceed the maximum range.
Sam Chak
2024-5-17
Hi @柯
Thanks for your feedback. The reason I modified the PID structure is because you didn't supply the Compressor model for me to test. So, I created the simplest unstable model, a Double Integrator system, to run the PID controller.
Next, I needed to rule out the possibility that the Simulink error was caused by the fuzzy system you originally designed. Since I cannot alter anything in your fuzzy system, I can only modify the mechanisms outside of it to produce PID gain values that stabilize the Double Integrator system.
With the Double Integrator now stable, the system output signal fed back to the fuzzy system won't blow up. This allowed me to focus on fixing the "Derivative Kick" issue, and I proposed using the Prefilter (pastel red block) and the Filtered Derivative (pastel blue block). After testing the Double Integrator system again, the "Derivative Kick" issue was resolved.
That's why I mentioned that only the Prefilter and the Filtered Derivative are necessary, and the rest should remain the same as in the original Simulink file "mhkz.slx". Please let me know if the implementation of the Prefilter and the Filtered Derivative has indeed fixed the "Derivative Kick" issue for your system.
更多回答(1 个)
Sam Chak
2024-5-17
Hi @柯
This following issue does not affect the original "derivative kick" problem described in this thread. So, it should be treated separately.
On the reason why the number of output membership functions (MFs) should be ideally 13, first, you need to review the If–Then rulebase (see Fig. 1). Look at the yellow boxes - you'll see that many of the output MFs are reused throughout the 49 rules. This causes the Fuzzy Kp surface in Fig. 2 to look a little strange.
Going back to the rulebase, since there are 2 inputs (e and ec) and each input has 7 MFs, there are 7 rule sets of 7 rules (see the 1st rule set in the orange box). However, there were only 4 output MFs in your original Kp design (see Fig. 3). So, for each rule set, you only have 4 output MFs to fill up the 7 rules, and thus, reusing some MFs is inevitable, making the fuzzy rules inflexible and less unique.
To address this issue, you can add another 3 Positive MFs (mf8, mf9, mf10) on top of the existing 4 output MFs (see Fig. 4). Now there will be enough 7 distinct MFs for the 7 rules in the first rule set. If you add another 3 Negative MFs (mf11, mf12, mf13) on the Negative side for Kp, Ki and Kd, there are just enough MFs for the 7 rule sets (all 49 rules). That's why I mentioned ideally there should be "13 MFs for each output"!
Figure 1: Fuzzy If–Then rulebase.
Figure 2: Fuzzy Kp surface
Figure 3: Original Fuzzy Kp output membership functions
Figure 4: Modified Fuzzy Kp output MFs (positive side for demo only)
36 个评论
Ke
2024-5-17
Thanks for your answer, I roughly understand what you mean, you mean that every input rule must have its corresponding output rule, right? The rules I created were built according to the following rule table, and each input really has only 4 outputs. I found this rule table in the references, can you help me see if this is reasonable?
2. I used the pre-filter and filter derivative to run the model at the beginning of the model and there were still a few warnings with "Derivative Kick", which seemed to disappear in the subsequent calculations, but his simulation results seemed to have a strange phenomenon, fluctuating up and down at the initial temperature.
Sam Chak
2024-5-17
Hi @柯
It is not a "must" to have 13 MFs. There is no right or wrong when designing fuzzy rules because the rules really reflect the human designer's thinking at the time. The fuzzy performance can be either very effective, moderately effective, or less effective. That's why I said "ideally"...
However, it is a relatively common behavior I have seen in many Mamdani Fuzzy Control practitioners, as the unverified fuzzy design knowledge was passed down. You probably created the rules based on a reference (because your research topic is similar), and there is no design work for improvement.
Anyway, no worries at the moment. Please fix the "Derivative Kick" issue. Your Prefilter was placed in the wrong place, and you used my PID controller, which I designed for a Double Integrator. So, I have created a hotfix for you. You can just download, copy and paste the entire fuzzy control model into your Compressor model (which is not shown to me). Hopefully, the "Derivative Kick" issue will be resolved.
Ke
2024-5-20
Hello, thank you for your letter, there are some effects after using your method, but there are some "Derivative Kicks" at the beginning of the simulation. In addition, it may be that the effect of my fuzzy control setting is not ideal, and his speed control feedback effect is not very good, and there are large fluctuations when exposed to external interference.
Sam Chak
2024-5-20
Hi @柯
Do you have the mathematical model or the differential equations of the system that you are trying to control?
Don't blame yourself. Mamdani fuzzy controllers are never easy to design with in the first place. It often requires a lot of fine-tuning on the gains, the membership functions, or the rules. If this is a second-order system model, I'd tend to limit it to 2 MFs and 4 rules, or 3 MFs and 9 rules.
Ke
2024-5-21
移动:Sam Chak
2024-5-21
I don't have his differential equations here, I'm using the compressor components in Simscape and using Simluink to control the speed of the compressor components. The component I'm using is Positive-DisplacementCompressor (2P)。 The transfer function between this is 1/(5s+1). Was this helpful?
Sam Chak
2024-5-21
编辑:Sam Chak
2024-5-21
Hi @柯
Thanks for the info about the Compressor. Since you referred to a pre-designed rule table in a reference, would you be able to provide the document containing that information?
Alternatively, if you cannot share the document directly, could you please provide the title of the document (if it can be searched online), or the DOI number of the publication?
Having access to the relevant source material would greatly assist me in understanding the context and specifics of the rule table you mentioned.
Ke
2024-5-22
Hello, I am more than happy to provide my references, I have selected two documents, as well as one web page that I refer to, the fuzzy rule is the fuzzy rule on the reference web page. But I tried that my document was a bit too big to upload, so I cut the fuzzy part of them, and if you want to see the full text of the document, their file name is their document name, which can be searched in the search tool.
Can you open a web page there?
The web address is: https://cloud.tencent.com/developer/article/2374523.
Sam Chak
2024-5-22
Hi @柯
Thank you for sharing the relevant documents regarding the Battery Thermal Management (BTM) system in Electric Vehicles. I have carefully reviewed the provided two PDFs, but I don't have a Tencent Cloud account.
Upon examination, it appears that the authors have utilized a physical modeling approach with Siemens Amesim rather than a conventional mathematical modeling technique. This is an interesting choice, as thermal dynamics are often represented using first-order differential equations.
Regarding your control block diagram, it seems that your primary control objective is to regulate the temperature of the battery pack, rather than the temperature of the compressor. In this case, the compressor fan speed would likely be the actuated variable, and the fuzzy control output would serve as the commanded signal to the fan speed.
Ke
2024-5-23
Hello, I am looking to control the cabin temperature via compressor speed regulation. Initially, I employed PID control, but due to external disturbances, there have been significant fluctuations in the cabin temperature. Therefore, I am considering adopting fuzzy PID control in order to minimize these temperature fluctuations within the cabin.
Sam Chak
2024-5-23
编辑:Sam Chak
2024-5-23
Hi 柯,
Do you have the corresponding tuned PID gain values for the disturbances?
For instance, in Condition 1 ( minimum operating point), you have the specific PID gain values for compensating the disturbance. Then, in Condition 2 ( maximum operating point), you have another set of PID values.
If you possess these two sets of PID values, then fuzzy logic would be a suitable tool for performing interpolation between the two sets, in order to determine the appropriate PID gains for intermediate operating conditions.
Sam Chak
2024-5-23
Hi @柯
Can you do me a favor? Let me walk through the steps in a clear and structured manner.
- First, remove the Pre-filter and the Filtered Derivative components from the existing control architecture.
- Next, replace the entire fuzzy PID controller with the built-in PID controller, as suggested.
- then click the "Tune" button to initiate the auto-tuning process, which should determine the optimal values for the P, I, D, and N parameters according to the default setting.
- After completing the auto-tuning, provide the following information:
- A block diagram to demonstrate the correct replacement of the control components.
- The values of the auto-tuned P, I, D, and N parameters.
- A plot that compares the Actual Temperature and the Desired Temperature, allowing us to assess the performance of the new control system.
Ke
2024-5-24
Hello, the parameters and results of the automatic adjustment setting using PID control are as follows, but its operating results are a bit unsatisfactory.
I used the PID parameters I set and the running results are as follows.
Do you think these are helpful?
Ke
2024-5-24
Hello, the module output I marked is only plus or minus 1 and 0, which is used to ensure that the input of the PID controller is positive. In addition, I put the input and output of the PID controller in the result diagram below.I've added a saturation limit to the output, limiting the output to a range of 0 to 1.
Sam Chak
2024-5-24
Since the PID controller output is highly constrained between 0 and 1 (60% of the output is 1), and both the Integral and Derivative terms do not significantly contribute to the saturated control action, I suggest trying to replace the PID controller with this nonlinear control function: , where k is a relatively large value, maybe between 100 to 1000.
Sam Chak
2024-5-24
编辑:Sam Chak
2024-5-24
Hi @柯
Ignore the previous suggestion as ec is not needed. Try this one instead. Replace the PID controller with this block configuration: You can say that this is a nonlinear Proportional Controller, almost similar to what you did with the Fuzzy Logic previously.
Let me know the result.
Ke
2024-5-25
Hello, I set his result as you said as follows, he runs slowly when there is an external disturbance in the back, and the output fluctuates greatly.
Sam Chak
2024-5-26
Hi @柯
Thank you for the results. The reason I requested to test the tanh controller is because I wanted to confirm my suspicion that your designed PID Controller block with Internal Saturation [0, 1] may be the culprit that caused the performance bottleneck. The amplitude of a hyperbolic tangent function, tanh(x), is constrained between [-1, 1].
Observation 1:
With both sets of results, I can now compare the Cabin Temperature responses. Both Cabin Temperature responses appear to converge at nearly the same rate, though the response under the tanh controller converged slightly faster.
Observation 2:
In response to the disturbance, the Saturated PID Controller caused the Cabin Temperature to drop lower than the Setpoint (25°C). The occupants inside the Cabin may feel slightly uncomfortable with this offset. Under the tanh Controller, the Cabin Temperature is successfully regulated around the Setpoint (25°C) with very small deviations. The occupants inside the Cabin would likely not have noticed these minor changes in temperature.
Questions:
Before I provide any further recommendations, I would like to better understand the control design requirements.
- Are you satisfied with the Cabin Temperature response converging at around 1,200 seconds?
- If not, what is the desired settling time? For example, would you prefer it to converge around 600 seconds (equivalent to 10 minutes)?
- What is the amplitude of the external disturbance?
Ke
2024-5-27
Hello, I'm quite satisfied with the current convergence time, but what I want to adjust is that when he is disturbed by the outside world, his cabin temperature fluctuations are not too drastic.
1. The reason why I use PID to adjust the temperature below the set 25°C after 1600s is that it is disturbed by the outside world, and the use of tanh also fluctuates after 1600s, but its fluctuation range is small.
2. The external disturbance I mentioned is the sudden increase in the flow of the passenger compartment caused by the sudden closure of the battery circuit in parallel with the passenger compartment, which causes the temperature of the passenger compartment to fluctuate.
Sam Chak
2024-5-27
Hi @柯
This topic is actually called disturbance rejection, and it remains an active area of research due to the various types of disturbances present in many complicated nonlinear systems. Consequently, cost-effective control strategies tailored to different applications are necessary.
Using the integral action in the PID controller to handle external disturbances is akin to treating the symptoms rather than the root cause (治标不治本). If the disturbance load is constant, such as a robot arm picking objects of different fixed weights (), then the integral action tends to perform relatively well.
In contrast, the fast-switching action of the tanh controller relies on its control magnitude (the larger the better) and the switching frequency (how quickly it reacts to changes in the error caused by the disturbance) to overcome the external disturbance. While this approach is effective, as you noticed the fluctuation becomes smaller, it is similar to the Chinese proverb "Kill 1,000 enemy soldiers but lose 800 of your own" (杀敌一千,自损八百). Due to the fast-switching action, some mechanical parts in the control actuator may wear out more quickly and require costly frequent replacement.
Suggestion:
Ideally, if the external disturbance can be accurately measured, either directly or indirectly through observations of changes in the error, then it can be canceled out through the controller. This is treating the the root cause.
Since this is a controlled experiment, it should be possible, at least in simulations, to measure the rapid increase in the positive heat flow into the passenger compartment caused by the sudden closure of the adjacent battery circuit. Once this value is determined, the controller can be used to induce an opposite negative heat flow to counteract the positive heat flow and bring the cabin temperature back to the setpoint (25°C).
Sam Chak
2024-5-28
Hi @柯
I believe your idea of using fuzzy control is feasible, provided you understand the following:
- The estimated mathematical model of the process system being controlled.
- The nature of the disturbance (constant, state-dependent, or time-dependent).
- The strategies employed by controllers to reject the corresponding disturbance.
Unless there are successful examples that you can directly follow, describing the fuzzy controller in the traditional way using Mamdani-type with many triangular membership functions and an abundance of ineffective "human" rules will make it very challenging to achieve the objective of rejecting the disturbance.
For example, dividing the error into 7 regions by creating 7 membership functions is akin to attempting to cut a round cake into 7 equal pieces for 7 people. Unless a special cake-cutting mold is used, an ordinary person cannot precisely cut a round cake into 7 equal pieces. A pastry chef using a 7-piece cake divider tool is analogous to an engineer applying control theory knowledge in fuzzy control design.
Ke
2024-6-26
Hello, Sam Chak
I recently re-adjusted the fuzzy PID controller, and now it can run normally, but his running speed is relatively slow, I haven't found out the reason here, and its effect is not much different from my PID control. But I have some questions right now that I'd like to ask you. The results of my simulation run are shown in the figure below, the picture is circled by me with a red box is the temperature fluctuation caused by the valve closing, I use fuzzy PID control to speed up his adjustment to a certain extent, but I found that his overshoot here is still a bit large, what should I do, followed by my finding that his stable result rain The result I set seems to be still some distance, here I can adjust the I parameter to achieve approximation?
Sam Chak
2024-6-26
@柯: but [the] running speed is relatively slow ... and its effect is not much different from my PID control.
Response: That's because you clamp the max output of the fuzzy controller to 1. In other words, the controller doesn't have enough "power" to cool the cabin's temperature faster. You didn't tap into the nonlinear control power of fuzzy logic. The concept is similar to charging your mobile phone: a high-power adapter delivers fast charging! Use a high-horsepower conditioner, and you should see immediate improvement.
@柯: but I found that [the] overshoot here is still a bit large, what should I do?
Response: I believe that such a response is completely normal when there is a sudden disturbance, and your controller doesn't have much "power" to compensate for it rapidly. You can try increasing the Derivative gain, but there is no guarantee it will work because the output is clamped at the max value of 1.
@柯: The result I set seems to be still some distance, here I can adjust the I parameter to achieve approximation?
Response: If you are referring to the steady-state error (the difference between black and red curves), then such a very small gap is completely normal in simulation as well as in real scenarios. The observation is similar to water tank level control, where the water level cannot be accurately regulated to the perfect desired level. For example, if the desired level is 10, the steady-state water level will probably maintain at 9.99 or 10.01.
Overall, the performance of the designed fuzzy controller looks fine, and it has the capability of rejecting the effects caused by sudden disturbances.
Ke
2024-6-26
Hello, glad to see your reply.
1. As shown in the figure below, I did not initially assign the PID parameters, and my fuzzy controller no longer follows the following form:
Do you think this is okay?
2. As for what you said, I limit its maximum output to 1, because I need to control the maximum speed of the compressor not to exceed the range of its maximum speed, if it is exceeded, the result will be somewhat unreasonable. Is there a reasonable way to guarantee the result without limiting its maximum output?
3. I've tried to adjust his derivative gain, but this will make the model run slower and harder. This model is running slowly, is there any way I can adjust it?
4. If I try to use other algorithms to optimize the quantification factor and scale factor in the future, will there be better results? For example, reducing his overshoot amount and adjusting the speed.
Sam Chak
2024-6-27
Hi @柯
A1: I cannot comment on the technical details of the revised control architecture, as I am unable to look inside the "模糊规则" subsystem. However, given that the cabin response appears to be converging sensibly to the setpoint, I believe your overall control design is acceptable.
A2: Limiting the output in a constrained control problem is considered a practical approach. There is nothing inherently wrong with that. However, you should be mindful of the limitations of what your proposed control architecture can achieve. Additionally, I'm afraid I don't fully understand the statement about the "result being unreasonable."
A3: Since you aim to reduce the overshoot, it would be natural for me to advise you to try increasing the derivative gain. However, the side effect of this approach is that it will cause the response to become slower. Ideally, the designer should seek to find the "best" derivative gain that yields the shortest settling time while producing minimal overshoot.
A4: Yes, and this will be the optimization aim as mentioned in the last sentence of A3.
Ke
2024-6-27
1. This fuzzy rule is still the one I used before, but I have made some changes to the range, and added the S-type membership function at the boundary.
2. The reason why the result is unreasonable is because I need to control my compressor speed within 6000rpm, and if I don't add the limit, his compressor output speed may exceed 6000rpm. I tried adding clipping after the controller, and the model seemed to run a little irrationally, and the adjustment speed became slower.
3. I'm actually more interested in my optimization goal, and I expect to add an optimization calculation to achieve better results; Do you have a recommended algorithm for fuzzy controller optimization?
Sam Chak
2024-6-27
It is now an optimization problem. I believe that MATLAB's built-in fmincon(), ga(), particleswarm() should work in your case. fmincon uses a sequential quadratic programming (SQP) method; ga uses the Genetic Algorithm; and particleswarm uses the PSO algorithm.
Try finding the best value for a single, most influential control parameter first. If successful, then gradually increase the number of parameters that you believe will improve the performance. Why? Because I have seen some inexperienced PhD researchers and postdocs attempt to optimize all parameters of the fuzzy membership functions (both inputs and outputs) at once, with a click of a button, and let the PC run for days.
Imagine one triangular MF has three parameters, thus seven MFs have 21, and two inputs (E & EC) have 42 parameters, excluding the output MFs and other Master PID gains.
If including the full-combination 13 MFs for each fuzzy output (Kfp, Kfi, Kfd) and the Master PID gains, then there will a total of
7*3*2 + 13*3*3 + 3
ans = 162
parameters to be optimized.
Ke
2024-6-28
Your proposal is very helpful to me, because I don't know much about Simulink, I don't know how to start at the moment, for example, after programming in MATLAB to get the optimal solution, import the results of the optimal solution into Simulink to run, or do I need to create a S-function in Simlink for co-simulation with Simulink? In addition, the most important thing is that I used to control the nonlinear PID control and his mathematical relationship is not particularly clear, so it seems that it is difficult for me to establish the objective function, so what should I do here?
Sam Chak
2024-6-28
Hi @柯
I would suggest that you start by taking the self-paced Optimization Onramp course, which is available at the following link:
This course should help you familiarize yourself with the basics of solving optimization problems in MATLAB. It covers topics such as defining optimization variables, implementing objective functions, and solving both unconstrained and constrained optimization problems.
If you encounter any technical issues in your optimization problem with Simulink, I would recommend posting a new, focused question. This will help prevent the current discussion on the fuzzy control topic from becoming an overly lengthy thread.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Fuzzy Logic in Simulink 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!发生错误
由于页面发生更改,无法完成操作。请重新加载页面以查看其更新后的状态。
您也可以从以下列表中选择网站:
如何获得最佳网站性能
选择中国网站(中文或英文)以获得最佳网站性能。其他 MathWorks 国家/地区网站并未针对您所在位置的访问进行优化。
美洲
- América Latina (Español)
- Canada (English)
- United States (English)
欧洲
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom(English)
亚太
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)