Deadband | Arduino library to stabilize noisy analog inputs
kandi X-RAY | Deadband Summary
kandi X-RAY | Deadband Summary
An Arduino library to stabilize noisy analog inputs by giving them deadband (sometimes called hysteresis). Installation: Drag the Deadband folder into $HOME/Documents/Arduino/libraries/, and then restart Arduino.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of Deadband
Deadband Key Features
Deadband Examples and Code Snippets
Community Discussions
Trending Discussions on Deadband
QUESTION
Currently, I'm building a dashboard for my home where I get temperature values from the Honeywell API. I'm trying to loop through a complex JSON that I got from the API to get all the device current temperatures.
Since I'm quite new to Python I have no clue how to get this sorted. Here is an example response:
...ANSWER
Answered 2022-Jan-03 at 20:35Looks like you've got a list containing one big dictionary. That dictionary has a devices
key-value pair, where the value is a list of dictionaries, one for each device. If data
is your JSON structure, you can iterate through the device-dictionaries in the following way:
QUESTION
I use Q1 and Q2 to control T1, so as to realize the simulation scenario of multi-controls. I want to adjust the parameters to achieve which MV has more action, as shown in the figure. I found that I couldn’t achieve the effect I wanted by adjusting the cost of the MV, can anyone give me some suggestions? thanks!
Here is my code:
...ANSWER
Answered 2021-Nov-14 at 13:05There are a many ways to preferentially select one MV over another with additional resources on the course website with Control Objectives and Control Tuning.
- COST (minimize or maximize use of MV)
- DCOST (change penalty)
- DMAX (move change constraint)
- TIER (for strong decoupling)
For this particular problem, it appears that the two MVs (Manipulated Variables) Q1 and Q2 values should be a ratio and there is only one CV (Controlled Variable). An easy way to accomplish this is to add another equation such as:
QUESTION
everyone and Professor John
We are using gekko to do MPC on tclab simulation model. We try to emulate the situation that on site the actuator deviates from MV calculated by gekko because of the problems of actuator.
If the deviation is in the fixed pattern, for example a quite big constant deviation happens for a long time and may come back then work well for a long time. We can deal with it by extra logic to detect deviation and add the deviation value to the mv calculated by gekko.
one day, I noticed that there could be meas for MV when fstatus = 1. So I gave it a try. I hope gekko could deal with the deviation by itself. for example, if mv from gekko is 10 and the measurement is 5 and the pattern continues, gekko may spit out a higher MV value than 10, for example 15 and measurement is 10.
In the simulation, when I set MV's fstatus=1, the MV's curve becomes to :
q1a is the q1 with manual deviation. In the above pic, q1a == q1. It looks like gekko takes one more step thinking about the MV's effect.
In the below pic, there are two times range, one with "q1a == q1+20" and the other with "q1a == q1 -20". q1a's value is fed to tclab and mv(q1)'s meas.
I do not understand why the q1 calculated by gekko is going up or going down when meas deviates despite the t1 is going far away from sp.
Edit: Example Code
See the screen shot below from "normal" HMI. The sluggish MV disappeared, so it maybe caused by bug in my code. But the up-going or down-going could still be seen. See my code below:
...ANSWER
Answered 2021-Sep-03 at 18:20Is the FSTATUS
also ON for the CVs such as t1.FSTATUS=1
? If you update the measurement such as:
QUESTION
Below is an OPC Client written in VBA. It is using the OPC Foundation DA libraries. I am able to get the current value of the item (I can read it in locals window), but it is not assigning the value to myValue = theItem.Value
Hovering over theItem.Value
during a break shows the value as well.
Any thoughts?
...ANSWER
Answered 2021-May-26 at 15:23After review/trouble shooting.
The OPCItem object provides methods to read the current value of the item in the server and write a new value to the item. I have included these facilities into this dialog. The read method provided on an OPCItem object performs a synchronous read from the server and can be configured to read either from cache or from the device. To read from cache both the group and item should be active, but synchronous read operations directly from the device do not depend on the active state of either the group or item.
Adding the following code allowed me to assign to variable.
QUESTION
I recently try to control my TCLab Arduino through a state space model. I refer to State Space Models and transform a first order linear system (without time delay) into state space form, the control effect is pretty good. Now I want to use first order plus dead time model to control the lab, but I don't know how to transform FOPDT model into state space form. How to add time delay in state space model?
Here is the code:
...ANSWER
Answered 2021-Mar-18 at 15:27Use the delay
function in Gekko to add time delay. Here is an example. To add it to a state space model you can either delay the input mv
or output cv
. Here is the state space model with the delay on the output.
QUESTION
I put the result of Gekko's calculation into the queue, after a delay, write the first value of the queue to TCLab Arduino. I use this method to simulate a factory large time delay system, then I optimize Gekko parameters to achieve better control effect. When I add a delay=1 in the model, I got a pretty good prediction curve:
The final control effect is also pretty good:
But when I set delay=80, no other parameters are modified, the prediction curve is not ideal:
The final control effect is also bad:
Why the delay parameter affects the prediction curve? I think the reference trajectory should also shift with time delay. How could I solve this problem?
Here is the code:
...ANSWER
Answered 2021-Feb-23 at 15:17The controller is working as intended. The problem is a well-known issue with model mismatch and delay. Classical control methods are to use a Smith Predictor to compensate for the delay. With MPC, the delay is built into the model, similar to the function of the Smith Predictor. If you change the model to:
QUESTION
I put the result of Gekko's calculation into the queue, after 80s, write the first value of the queue to TCLab Arduino. I use this method to simulate a factory large time delay system, then I optimize Gekko parameters to achieve better control effect. When I add a delay in the model, I got a oscillative curve:
I adjust the DCOST and DMAX, then I got a better curve. But this is not an ideal curve.
I think the ideal curve is like this curve.
Here is the code.
...ANSWER
Answered 2021-Jan-13 at 05:04If an MPC application is giving unexpected results, it can typically be diagnosed by showing the unbiased and biased model predictions and the reference trajectory. Here are a couple things that you should consider with you model.
- Change the equation to be in deviation variable form. The steady state point for temperature is
TC1=TC1_ss
andQ1d=0
. The updated equation is:
QUESTION
GEKKO
is optimization software for mixed-integer and differential algebraic equations. It is coupled with large-scale solvers
for linear, quadratic, nonlinear
, and mixed integer programming (LP, QP, NLP, MILP, MINLP
).
I use gekko
to control my TCLab Arduino
, but when I give a disturbance, no matter how I adjust the parameters, there will be a overshoot temperature. How can I solve this problem?
Here is my code:
...ANSWER
Answered 2020-Dec-19 at 12:36When you add the disturbance (such as turn on the other heater), the apparent system gain increases because the temperature rises higher than anticipated by the controller. That means you start to go left on the mismatch plot (leads to worst control performance).
This is Figure 14 in Hedengren, J. D., Eaton, A. N., Overview of Estimation Methods for Industrial Dynamic Systems, Optimization and Engineering, Springer, Vol 18 (1), 2017, pp. 155-178, DOI: 10.1007/s11081-015-9295-9.
One of the reasons for the overshoot is because of model mismatch. Here are a few ways to deal with this:
- Increase your model gain
K
(maybe to 1) or decrease your modeltau
(maybe to 120) so that the controller becomes less aggressive. You may also want to re-identify your model so that it better reflects your TCLab system dynamics. Here is a tutorial on getting a first order or second order model. A higher order ARX model also works well for the TCLab. - Change the reference trajectory to be less aggressive with
TC.TAU=50
and include the reference trajectory on the plot so that you can observe what the controller is planning. I also like to include the unbiased model on the plot to show how the model is performing. - Check out this Control Tuning page for help with other MV and CV tuning options. The Jupyter notebook widget can help give you an intuitive understanding of those options.
QUESTION
Aiming to get alerts, only possible in Studies, I've created a Study from a Strategy where I purposely don't use pyramiding. Alerts are set to execute Once Per Bar Close.
Because Studies don't have pyramiding options, I've programmed in the Study a similar functionality to avoid pyramiding as follows:
- Initialize boolean variables
Last_is_long
andLast_is_short
to store whether the last move was a long or a short - Check the boolean as part of the complete
longCondition
and as part of the completeshortCondition
- I make an
alertcondition()
based on such complete conditions, which include the booleans, thus
Something like:
...ANSWER
Answered 2020-Jan-09 at 22:17Your code logic seems sound and alerts work fine here. Perhaps you could try validating your states at your end using debugging code like the one included here:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Deadband
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page