PID Controller Design for Ventilator...

On 8/15/2020 9:01 PM, Ricketty C wrote:
On Saturday, August 15, 2020 at 11:07:10 PM UTC-4, Don Y wrote:
On 8/15/2020 6:44 PM, Ricketty C wrote:
I understand the basics of PID design, but if you can\'t describe the
thing being controlled, how can you design the controller other than
trial and error?

The \"plant\" is a motor on a tall reducing gear (~300:1) turning an arm
that presses on a bag producing an air flow with the loop controlled by
a pressure measurement.

YOu (they) are controlling the current to a motor. The motor is driving a
mechanism. The mechanism integrates the action of the motor. The mechanism
pushes (?) air into the lungs via some sort of function that maps
mechanism position to air volume \"pushed\".

No idea what you are *measuring* -- and how it fits into the above.

Presumably, what you are wanting to control is the RATE of air being
pushed into the lungs (with possible clamps on the total volume expelled)

But, you\'re only CONTROLLING the current to the motor.

(Do you see all of the \"transfer functions\" that are involved in mapping
the current to the \"flow rate\"?)

One issue I\'m seeing discussed is a tradeoff on the PWM resolution vs.
frequency. Presently they are using 3.6 kHz with 8 bit PWM control. I
kinda wonder if a sigma-delta might be better, but that might require
some external logic. They seem to be shy of pushing the CPU too much
even after changing from an Arduino CPU at 20 MHz to an ARM CM4F at 80
MHz.

The big concern is the overshoot when ramping up the pressure between
exhale and inhale. In general, would it be better to simply jump the
pressure set point at once and let the PID controller do its thing,
optimizing the response time as best as possible controlling overshoot
-or- would it be better to run up the pressure set point over a period
of time which would seem to place less demand on the PID controller?

The model of the lung seems to include a spring constant (I think of
this as a capacitor) in parallel with a dissipative element (a dashpot
or resistor in electronics). The motor is highly geared to a relatively
lightweight arm pushing on a bag with air passing through a tube of
relatively low restriction. So initially the dominate opposition to
flow will be the dissipation/resistor, i.e. proportional to the rate of
airflow. This in turn is proportional to the arm speed (although not
constant through the stroke due to the bag geometry). The arm speed is
what is controlled by the PWM (approximately).

The lung model shows the dashpot and spring in parallel, but I\'m not
sure that\'s appropriate. The response to air entering the lung will be
the sum of the airway resistance (dashpot) and the lung compliance
(spring) which would be a series combination to obtain the resulting air
pressure. Well, maybe that is right for the mechanical model, but in
the electrical equivalent if pressure is the same as voltage it would be
a series arrangement.

Anyway, the lung would seem to be a capacitor and a resistor. So if
driven by a P only controller, is there any way it could ring? I was
shown data measured that showed huge ringing from an initial step
function in the set point.

I watched some videos and it seems they use both pressure regulated and
flow regulated cycles. I expect to see similar results with either
method.

Interesting


First, no, the current to the motor is not controlled, the voltage is
controlled.

Gee, silly me! I\'d have thought you\'d have driven the mechanism with a
FORCE necessary to overcome the losses in the mechanism and not exceed the
patient\'s airway capability. Let the motor attain whatever SPEED it
needs to use up that available current and do so at a rate limited
by it\'s -- and the mechanism\'s - dynamics... without being hindered
by the control loop\'s performance.

[You do realize you\'ll have to ensure you don\'t command the motor to
change speed faster than it/mechanism can support? Otherwise your
analysis of the control system will fall apart]

I\'ve already thought about the \"transfer functions\" which you seem to want
to make complex.

Because they ALWAYS are when there\'s anything more than a \"motorshaft with
an encoder on it\". Mechanisms and \'real world applications\" invariably
introduce lag. Lag leads to oscillation -- or, highly overdamped tuning.

> They are rather simple at a first approximation. The

Which means you\'re likely missing many of the \"little things\" that will
conspire to make tuning harder and loop performance far from ideal.
I.e., why have a loop if you don\'t expect to GAIN something from it?

You have some capture delay for the sensed variable. If it\'s a flash
converter, that can be near instantaneous. But, in practice, there\'s
likely some signal conditioning in front that limits the sensor\'s
response (adds delay).

There\'s the location of the sensor wrt the actuator. (Also, wrt the
actual field variable). You\'re inevitably measuring something that
isn\'t the same (instantaneous) thing as what you are controlling/influencing.
(And, isn\'t really the same as the field variable that you REALLY
want to be dealing with!)

There\'s some delay in bringing about the actuator\'s action. Some
of this is related to the drive interface while some is inherent
in the capabilities (limitations) of the actuator. The mechanism
coupling the actuator to the process may have nonlinearities and
delays (backlash in gearboxes is a common foe).

There\'s a delay in the processing required to decide how to
drive the actuator, \"now\".

How each of these respond over their operating ranges and within
a particular \"cycle\" need to be analyzed BEFORE you can dismiss them
as being irrelevant (*if* you can dismiss them). Otherwise, you\'ll
scratch your head wondering why the loop performs like crap.

motor PWM drive controls the force on the bag which to a first approximation
is the pressure in the bag. It will vary some through the stroke because of
the bag geometry, more at first, less after the initial portion. So I\'ll
say the pressure into a constant resistance to air flow is proportional to
the PWM drive.

The lung (as I\'ve said) is the pneumatic equivalent of an RC series
arrangement. Initially the counter force is all dissipative (air flow
resistance) and the effect of the capacitor (lung elastance) is minimal in
comparison. As the lung inflates the elastance becomes a larger factor.

And the \"lung\" will vary from one individual to the next. Concentrate on
the things you have control over, first -- the product\'s design. If there
are variables in its performance, figure out how to compensate for them
BEFORE you add the variable that is the \"lung\" (or, the provider operating
the device!)

The only part that is at issue is the initial response to the step function
of the control variable. That would seem to be dominated by proportional
effects.

I do see that there is little about my explanation that you understand. If
you have questions I would be happy to answer, but you seem to be
overwhelmed by it all.

(sigh) True to form, you underestimate the complexity of the problem and
dismiss folks who have experience solving similar problems because they
say things that you don\'t want to hear (e.g., FDA approval process) or
ask questions that you can\'t answer (\"That\'s not important\").

[The FDA process would have told you that you should PROVE those things to
be unimportant -- instead of hand-waving them away in \"first-order
approximations\".]

Classic example of Dunning-Kruger Effect.

If I said I\'ve designed and implemented 50 PID loops, I\'d probably be low by
a factor of 5! And, yours is \"trivial\", by comparison! It\'s not interacting
with 6 or 7 other loops, simultaneously.

For example:

Noticing a higher than desired ejection force for a tabletting station (35-75
in operation concurrently) would lead the associated controller to move the
formation of the tablet *up* in the die. This requires updating the upper
punch penetration and lower punch penetration settings (mechanisms!)
in-synchrony to ensure the distance between punch tips remains unchanged.
(heaven forbid you let the punch tips TOUCH -- crunch!). Of course, the
mechanisms for each are different so the mechanical gains and dynamics of
their mechanisms differ. I.e., the control loops governing their \"positions\"
(at the end of motorized mechanisms; revolutions becomes tenths of thousandths
of inches) differ and can\'t be assumed to travel (adjust) at identical rates.

Less distance to travel between it\'s formation and ejection AND likely out of
any \"barreled\" portion of the die (even steel wears when subjected to 10T
events at 200Hz day in and day out).

Ah, but that means EVERY tabletting station will now form a tablet at that
new displacement! (And, stations are forming tablets WHILE THE PUNCHES
PENETRATIONS ARE \"IN MOTION\"!) What if some other station NOW exhibits a
higher ejection force? Do you move the tablet up even further in the die?
Do you ignore the \"problem\"? Coerce the previous station to tolerate a
compromise position?

How many tablets do you end up discarding for each tradeoff? When do you
halt the process and signal the operator to change the tooling (punches/die)
because the process has moved out of your control region?

While the punches are in motion, tablets are being formed. The forces they
experience in their formation is approximately (nonlinearly!) related to the
weight (mass) of the tablet thus formed. This is intuitive -- a \"fixed\"
amount of material being compressed to a particular \"final size\".

So, if there is any variation between punch-tip-to-punch-tip distance WHILE
UNDER ADJUSTMENT, it manifests as \"weight variation\" (though you can\'t deduce
whether a high force means an overweight tablet or an underweight tablet
because you don\'t know the dimensions of the actual tablet!).

So, the control loop that adjust the amount of material to install in each
die sees that it needs to compensate (even though it might be operating
at the ideal point IF THE PUNCHES HAD SETTLED INTO THEIR CORRECT PLACES).
As a result, it alters the fill -- and, thus, weights -- of the other
tabletting stations that haven\'t experienced this disturbance -- yet!

I.e., the loop can make WORSE product than if it hadn\'t been in place!
[Do you remember that threee-letter agency, begins with an F?]

As the tablet is formed higher in the die, there is increased opportunity
for material (\"tablet powder... \'granulation\') to incompletely fill the
die (it is gravity fed). This will likely affect ALL tabletting
stations so you want to pool the observations of all of the control
loops before deciding that you have a \"fill problem\".

If so, you tweek the setpoint of the hopper controllers -- which then
feeds back into the mechanical processing of all of the tabletting
stations served by that hopper (typically two hoppers per machine).

All of these changes affect real physical characteristics of the
tablets produced: weight, hardness, friability, dissolution time,
etc.

Thus, there are \"offline\" tests performed by manufacturing staff to
test these parameters and tweek the press based on their results.
But, these tests often take on the order of minutes or fractional
hours... the machine is no longer in the same configuration it
was when the tablets sampled were produced!

So, you have to keep track of which tablets were actually sampled,
along with the observations made during their formulation, in
order to apply the desired corrections to the CURRENT process.

This is ONE product. With *dozens* of interacting control loops
manufacturing product (at 200 completed items per second) for a
regulated (FDA) industry.

Would you like to discuss using control theory to assist in
autopilot navigation? Or, controlling temperature/humidity/flow
in a process air handler? Or controling the intensity of a lamp
to ensure it accurately detects the \"color\" of a blood assay?
Or, controlling the formulation of a \"candy shell\" on a small,
oval piece of chocolate?? :>

But, hey, I\'m clearly \"overwhelmed\" by a paddle pushing on an Ambubag.

Yeah, that.
 
On 8/16/2020 8:33 AM, Lasse Langwadt Christensen wrote:
søndag den 16. august 2020 kl. 17.14.22 UTC+2 skrev

I wonder how many old ladies ricky\'s team plans to kill, trying to learn
PIDs and stuff.

I very much doubt they\'ll be allowed to hook anything living up to a
ventilator hacked together by amateurs, no matter how well-meaning they are

seems like an exercise in feeling like they are \"doing something\"

That had been DONE more than a decade ago (by at least one college student
without the \"benefit\" of an international team of \"experts\"). And, more
recently, by REAL PROFESSIONALS (with assets that could be claimed in
litigation!).

Wow! I\'m jealous! I wish I had all of that free (unpaid) time to throw away!
I try hard to make my /pro bono/ efforts bear fruit as I\'m not keen on
throwing away hours of my life, pointlessly (developed a machine to
test/assess, catalog and install software -- OS+apps -- on 1000 donated
laptops for \"underprivileged\" kids for this coming school year)
 
On 8/16/2020 9:46 AM, bitrex wrote:
On 8/16/2020 11:14 AM, jlarkin@highlandsniptechnology.com wrote:
On Sun, 16 Aug 2020 07:53:41 -0700 (PDT), Lasse Langwadt Christensen
langwadt@fonz.dk> wrote:

søndag den 16. august 2020 kl. 16.31.14 UTC+2 skrev Jan Panteltje:
On a sunny day (Sat, 15 Aug 2020 22:46:45 -0700 (PDT)) it happened Ricketty C
gnuarm.deletethisbit@gmail.com> wrote in
d2d879c1-cf13-42f8-9727-8ef27dc2dc65o@googlegroups.com>:


He shows the only difference between patient triggered and machine triggered
waveforms is the negative pressure from the patient trying to draw air in
at the very start of the cycle. His diagrams are pretty poor with no
registration
between the various points on different parameters, but he gets across
the main points. You can do a Google search to find other much better
diagrams. I don\'t think there are any new concepts to an engineer.

No experience with these things
but from _my_ life I know breathing is related to oxygen level in the blood.

not really, your breathing is mostly related to the amount of CO2 in your lungs
that\'s why breathing something like pure nitrogen will kill you without you
even noticing

I wonder how many old ladies ricky\'s team plans to kill, trying to
learn PIDs and stuff.




The Bird Mark 8 was a pretty simple, totally hydro-mechanical gizmo. 1940s
tech, used in hospitals in the US well into the 1970s and probably longer
elsewhere.

\"This is not an exact science, probably at best a guess\":

https://youtu.be/SG3zlpRSfWE?t=102

Still, probably saved way more old ladies than it killed.

Some device like OP is talking about with an electronically-controlled
squeeze-bag seems to intrinsically limit the potential hazardous failure modes.
You only have so much air to work with and the mechanical \"squeezer\" can only
physically move so fast.

I can\'t find the original alumni newsletter but a web search turns up an
indirect reference:

\"At MIT, the MIT Emergency Ventilator Project, is dedicated to creating an
open-source, low-cost ventilator, based on a project that was completed in
a MIT engineering class back in 2010. Students made a ventilator prototype
using less than $200 of materials, which is much cheaper than the typical
ventilator that can cost as much as $30,000. Today, these materials would
cost close to $400 or $500.\"

Note \"class back in 2010\".

<https://www.cnbc.com/2020/04/22/mit-volunteers-created-open-source-low-cost-ventilator-for-covid-19.html>

It\'s important to note that MIT expressly indicated it would NOT approach
the FDA for approvals!

Next, we can invent a conveyance to transport people and goods without
the need for horses!!
 
On 8/16/2020 4:01 PM, Tom Del Rosso wrote:
bitrex wrote:

In Singapore they just hang the condemned; it\'s quick and cheap and
they don\'t worry too much about whether when they violate some
Abrahamic commandment, which they don\'t have, that they should at
least be nicer about breaking it, so they may go about their business
afterwards secure in the knowledge they are still good Christians in
the eyes of God. like the first Commandment actually says \"Thou shalt
not kill, except if...\"

What it actually says is thou shall not commit murder. The commandment
against \"false witness\" is also misinterpreted as a commandment against
lying in general.

Interpreting it as \"thou shalt not murder\" which may be closer to the
original Hebrew meaning, 5000 years ago, adds an escape route. what\'s a
murder? \"killing of an innocent person.\" Well what\'s an innocent person.
Someone who isn\'t guilty. Who convicts people and determines if they\'re
guilty? Humans do. Based on what. On what their particular ideas of what
is \"moral\" in a particular situation.

This (otherwise not bad) NR article doesn\'t really go far enough. _all_
use of the Ten Commandments to justify actions of the state cheapen the
Ten Commandments.

<https://www.nationalreview.com/2014/12/you-can-kill-dont-murder-dennis-prager/>
 
Am 16.08.20 um 23:28 schrieb bitrex:
On 8/16/2020 4:01 PM, Tom Del Rosso wrote:
bitrex wrote:

In Singapore they just hang the condemned; it\'s quick and cheap and
they don\'t worry too much about whether when they violate some
Abrahamic commandment, which they don\'t have, that they should at
least be nicer about breaking it, so they may go about their business
afterwards secure in the knowledge they are still good Christians in
the eyes of God. like the first Commandment actually says \"Thou shalt
not kill, except if...\"

What it actually says is thou shall not commit murder.  The commandment
against \"false witness\" is also misinterpreted as a commandment against
lying in general.




Interpreting it as \"thou shalt not murder\" which may be closer to the
original Hebrew meaning, 5000 years ago, adds an escape route. what\'s a
murder? \"killing of an innocent person.\" Well what\'s an innocent person.
Someone who isn\'t guilty. Who convicts people and determines if they\'re
guilty? Humans do. Based on what. On what their particular ideas of what
is \"moral\" in a particular situation.

< https://www.youtube.com/watch?v=CE8ooMBIyC8&t=396s >

Carlin got it right. Murder is at 5:00

Gerhard
 
On Saturday, August 15, 2020 at 6:44:08 PM UTC-7, Ricketty C wrote:
I understand the basics of PID design, but if you can\'t describe the thing being controlled, how can you design the controller other than trial and error?

The \"plant\" is a motor on a tall reducing gear (~300:1) turning an arm that presses on a bag producing an air flow with the loop controlled by a pressure measurement.

One issue I\'m seeing discussed is a tradeoff on the PWM resolution vs. frequency. Presently they are using 3.6 kHz with 8 bit PWM control. I kinda wonder if a sigma-delta might be better, but that might require some external logic. They seem to be shy of pushing the CPU too much even after changing from an Arduino CPU at 20 MHz to an ARM CM4F at 80 MHz.

The big concern is the overshoot when ramping up the pressure between exhale and inhale. In general, would it be better to simply jump the pressure set point at once and let the PID controller do its thing, optimizing the response time as best as possible controlling overshoot -or- would it be better to run up the pressure set point over a period of time which would seem to place less demand on the PID controller?

The model of the lung seems to include a spring constant (I think of this as a capacitor) in parallel with a dissipative element (a dashpot or resistor in electronics). The motor is highly geared to a relatively lightweight arm pushing on a bag with air passing through a tube of relatively low restriction. So initially the dominate opposition to flow will be the dissipation/resistor, i.e. proportional to the rate of airflow. This in turn is proportional to the arm speed (although not constant through the stroke due to the bag geometry). The arm speed is what is controlled by the PWM (approximately).

The lung model shows the dashpot and spring in parallel, but I\'m not sure that\'s appropriate. The response to air entering the lung will be the sum of the airway resistance (dashpot) and the lung compliance (spring) which would be a series combination to obtain the resulting air pressure. Well, maybe that is right for the mechanical model, but in the electrical equivalent if pressure is the same as voltage it would be a series arrangement.

Anyway, the lung would seem to be a capacitor and a resistor. So if driven by a P only controller, is there any way it could ring? I was shown data measured that showed huge ringing from an initial step function in the set point.

I watched some videos and it seems they use both pressure regulated and flow regulated cycles. I expect to see similar results with either method.

Interesting

--

Rick C.

- Get 1,000 miles of free Supercharging
- Tesla referral code - https://ts.la/richard11209

Here is a cheap, patented ventilator that doesn\'t need PID control (volume of air delivered is regulated mechanically by the angular motion of a cam):

https://foro.coronavirusmakers.org/uploads/516/FADE0V3E2AAI.pdf
 
On 8/16/2020 6:54 PM, Gerhard Hoffmann wrote:
Am 16.08.20 um 23:28 schrieb bitrex:
On 8/16/2020 4:01 PM, Tom Del Rosso wrote:
bitrex wrote:

In Singapore they just hang the condemned; it\'s quick and cheap and
they don\'t worry too much about whether when they violate some
Abrahamic commandment, which they don\'t have, that they should at
least be nicer about breaking it, so they may go about their business
afterwards secure in the knowledge they are still good Christians in
the eyes of God. like the first Commandment actually says \"Thou shalt
not kill, except if...\"

What it actually says is thou shall not commit murder.  The commandment
against \"false witness\" is also misinterpreted as a commandment against
lying in general.




Interpreting it as \"thou shalt not murder\" which may be closer to the
original Hebrew meaning, 5000 years ago, adds an escape route. what\'s
a murder? \"killing of an innocent person.\" Well what\'s an innocent
person. Someone who isn\'t guilty. Who convicts people and determines
if they\'re guilty? Humans do. Based on what. On what their particular
ideas of what is \"moral\" in a particular situation.

  https://www.youtube.com/watch?v=CE8ooMBIyC8&t=396s   

Carlin got it right. Murder is at 5:00

Gerhard

\"Only God can judge. However God seems unavailable at the moment to take
this particular case, so I, as God\'s lawfully-authorized acting
representative, hereby declare your execution as an obvious criminal to
be God-sanctioned.\"
 
On 8/16/2020 6:54 PM, Gerhard Hoffmann wrote:
Am 16.08.20 um 23:28 schrieb bitrex:
On 8/16/2020 4:01 PM, Tom Del Rosso wrote:
bitrex wrote:

In Singapore they just hang the condemned; it\'s quick and cheap and
they don\'t worry too much about whether when they violate some
Abrahamic commandment, which they don\'t have, that they should at
least be nicer about breaking it, so they may go about their business
afterwards secure in the knowledge they are still good Christians in
the eyes of God. like the first Commandment actually says \"Thou shalt
not kill, except if...\"

What it actually says is thou shall not commit murder.  The commandment
against \"false witness\" is also misinterpreted as a commandment against
lying in general.




Interpreting it as \"thou shalt not murder\" which may be closer to the
original Hebrew meaning, 5000 years ago, adds an escape route. what\'s
a murder? \"killing of an innocent person.\" Well what\'s an innocent
person. Someone who isn\'t guilty. Who convicts people and determines
if they\'re guilty? Humans do. Based on what. On what their particular
ideas of what is \"moral\" in a particular situation.

  https://www.youtube.com/watch?v=CE8ooMBIyC8&t=396s   

Carlin got it right. Murder is at 5:00

Gerhard

Nothing is more respectable than a humble man who acts with full
conviction he is doing God\'s work.
 
On Sunday, August 16, 2020 at 11:45:57 AM UTC-4, Ricketty C wrote:
On Sunday, August 16, 2020 at 11:33:16 AM UTC-4, Lasse Langwadt Christensen wrote:
søndag den 16. august 2020 kl. 17.14.22 UTC+2 skrev jla...@highlandsniptechnology.com:
On Sun, 16 Aug 2020 07:53:41 -0700 (PDT), Lasse Langwadt Christensen
lang...@fonz.dk> wrote:

sųndag den 16. august 2020 kl. 16.31.14 UTC+2 skrev Jan Panteltje:
On a sunny day (Sat, 15 Aug 2020 22:46:45 -0700 (PDT)) it happened Ricketty C
gnuarm.del...@gmail.com> wrote in
d2d879c1-cf13-42f8...@googlegroups.com>:


He shows the only difference between patient triggered and machine triggered
waveforms is the negative pressure from the patient trying to draw air in
at the very start of the cycle. His diagrams are pretty poor with no registration
between the various points on different parameters, but he gets across
the main points. You can do a Google search to find other much better
diagrams. I don\'t think there are any new concepts to an engineer..

No experience with these things
but from _my_ life I know breathing is related to oxygen level in the blood.

not really, your breathing is mostly related to the amount of CO2 in your lungs
that\'s why breathing something like pure nitrogen will kill you without you
even noticing

I wonder how many old ladies ricky\'s team plans to kill, trying to
learn PIDs and stuff.


I very much doubt they\'ll be allowed to hook anything living up to a ventilator hacked together by amateurs, no matter how well-meaning they are

seems like an exercise in feeling like they are \"doing something\"
There are a couple of companies we are talking to about running the design through a certification process and into manufacturing. So that will be covered. When we hit certain bumps in the road the solution is to not worry about it since the company taking it over will be redoing that anyway. This is not a rational to take technical shortcuts, more procedural things. So the documentation will be sparse I expect.

That is my single biggest issue with the process. They are not doing a proper requirements analysis. This means many aspects of the design are not planned out properly and various sections have been redesigned several times and may be again in the future as we find bends in the road.

Oh well, keeps me off the streets. I need to design a high side current monitor since the one in the motor controller has very poor accuracy. There is a nominal current ratio, but at lower currents the tolerance is worse than ±34%.

--

Rick C.

-++ Get 1,000 miles of free Supercharging
-++ Tesla referral code - https://ts.la/richard11209

hmmm running it through certification process with \'documentation is rather sparse\'?
My suggestion is to get the documentation as it will be part of the assurance case that will be made to the FDA (or whoever). Ultimately, the FDA certifies the as-built system and will need to see proper design docs and *rational* that when reasoned about, can make the argument that the system will behave as required and is safe.
Understanding PID controllers is one thing. Writing a discrete version of the PID control law is something else. Understanding the system dynamics and developing is control loop goes beyond understanding a PID controller.
I know nothing about how a ventilator works. I do know a bit about developing control systems. From the number of posts and your \'wondering\' of what the control variable is, it sounds like one need to make a model of the system in order to better understand the components and linkages and develop a realistic transfer function. I am quite surprised that the system is characterized as a simple first order system.
For a voltage controlled DC motor the rotational speed/torque transfer function is first order. Closed loop control rotational speed/voltage is always a second order system - in fact, it is the quintessential example in any first control theory course. And there is a \'simplifying assumption\' - if one assumes the time constant of the electrical circuit is much smaller than the time constant of the load dynamics, the transfer function may be reduced to a first order transfer function. Not clear that this simplifying assumption is applicable in this case.

So, don\'t know the open loop transfer function of the system? run a frequency test and measure the response. Create a simulink model. Understand where the poles and zeros of the system are and determine the natural frequency of the system.
Once one understands what they are dealing with then one can think about an effective control approach...there is usually more to it than throwing a PID controller at the system.
Gee, what happens if noise gets coupled into the system? Does your design compensate for that (hardware and digitally) You should also consider doing stability analysis to see if your controlled introduced an oscillation.
With all due respect, this is not a design problem for amateurs (no insinuation about your skills or experience - just a lesson learned from spending lots of time in the control and certification domain (both FDA and Mil) ).
 
On Sunday, August 16, 2020 at 4:32:20 PM UTC-4, Don Y wrote:
On 8/15/2020 9:01 PM, Ricketty C wrote:
On Saturday, August 15, 2020 at 11:07:10 PM UTC-4, Don Y wrote:
On 8/15/2020 6:44 PM, Ricketty C wrote:
I understand the basics of PID design, but if you can\'t describe the
thing being controlled, how can you design the controller other than
trial and error?

The \"plant\" is a motor on a tall reducing gear (~300:1) turning an arm
that presses on a bag producing an air flow with the loop controlled by
a pressure measurement.

YOu (they) are controlling the current to a motor. The motor is driving a
mechanism. The mechanism integrates the action of the motor. The mechanism
pushes (?) air into the lungs via some sort of function that maps
mechanism position to air volume \"pushed\".

No idea what you are *measuring* -- and how it fits into the above.

Presumably, what you are wanting to control is the RATE of air being
pushed into the lungs (with possible clamps on the total volume expelled)

But, you\'re only CONTROLLING the current to the motor.

(Do you see all of the \"transfer functions\" that are involved in mapping
the current to the \"flow rate\"?)

One issue I\'m seeing discussed is a tradeoff on the PWM resolution vs.
frequency. Presently they are using 3.6 kHz with 8 bit PWM control. I
kinda wonder if a sigma-delta might be better, but that might require
some external logic. They seem to be shy of pushing the CPU too much
even after changing from an Arduino CPU at 20 MHz to an ARM CM4F at 80
MHz.

The big concern is the overshoot when ramping up the pressure between
exhale and inhale. In general, would it be better to simply jump the
pressure set point at once and let the PID controller do its thing,
optimizing the response time as best as possible controlling overshoot
-or- would it be better to run up the pressure set point over a period
of time which would seem to place less demand on the PID controller?

The model of the lung seems to include a spring constant (I think of
this as a capacitor) in parallel with a dissipative element (a dashpot
or resistor in electronics). The motor is highly geared to a relatively
lightweight arm pushing on a bag with air passing through a tube of
relatively low restriction. So initially the dominate opposition to
flow will be the dissipation/resistor, i.e. proportional to the rate of
airflow. This in turn is proportional to the arm speed (although not
constant through the stroke due to the bag geometry). The arm speed is
what is controlled by the PWM (approximately).

The lung model shows the dashpot and spring in parallel, but I\'m not
sure that\'s appropriate. The response to air entering the lung will be
the sum of the airway resistance (dashpot) and the lung compliance
(spring) which would be a series combination to obtain the resulting air
pressure. Well, maybe that is right for the mechanical model, but in
the electrical equivalent if pressure is the same as voltage it would be
a series arrangement.

Anyway, the lung would seem to be a capacitor and a resistor. So if
driven by a P only controller, is there any way it could ring? I was
shown data measured that showed huge ringing from an initial step
function in the set point.

I watched some videos and it seems they use both pressure regulated and
flow regulated cycles. I expect to see similar results with either
method.

Interesting


First, no, the current to the motor is not controlled, the voltage is
controlled.

Gee, silly me! I\'d have thought you\'d have driven the mechanism with a
FORCE necessary to overcome the losses in the mechanism and not exceed the
patient\'s airway capability. Let the motor attain whatever SPEED it
needs to use up that available current and do so at a rate limited
by it\'s -- and the mechanism\'s - dynamics... without being hindered
by the control loop\'s performance.

[You do realize you\'ll have to ensure you don\'t command the motor to
change speed faster than it/mechanism can support? Otherwise your
analysis of the control system will fall apart]

I\'ve already thought about the \"transfer functions\" which you seem to want
to make complex.

Because they ALWAYS are when there\'s anything more than a \"motorshaft with
an encoder on it\". Mechanisms and \'real world applications\" invariably
introduce lag. Lag leads to oscillation -- or, highly overdamped tuning.

They are rather simple at a first approximation. The

Which means you\'re likely missing many of the \"little things\" that will
conspire to make tuning harder and loop performance far from ideal.
I.e., why have a loop if you don\'t expect to GAIN something from it?

You have some capture delay for the sensed variable. If it\'s a flash
converter, that can be near instantaneous. But, in practice, there\'s
likely some signal conditioning in front that limits the sensor\'s
response (adds delay).

There\'s the location of the sensor wrt the actuator. (Also, wrt the
actual field variable). You\'re inevitably measuring something that
isn\'t the same (instantaneous) thing as what you are controlling/influencing.
(And, isn\'t really the same as the field variable that you REALLY
want to be dealing with!)

There\'s some delay in bringing about the actuator\'s action. Some
of this is related to the drive interface while some is inherent
in the capabilities (limitations) of the actuator. The mechanism
coupling the actuator to the process may have nonlinearities and
delays (backlash in gearboxes is a common foe).

There\'s a delay in the processing required to decide how to
drive the actuator, \"now\".

How each of these respond over their operating ranges and within
a particular \"cycle\" need to be analyzed BEFORE you can dismiss them
as being irrelevant (*if* you can dismiss them). Otherwise, you\'ll
scratch your head wondering why the loop performs like crap.

Good thing I\'ve considered all the above which I believe in every case is trivial and not a factor that needs any special consideration.


motor PWM drive controls the force on the bag which to a first approximation
is the pressure in the bag. It will vary some through the stroke because of
the bag geometry, more at first, less after the initial portion. So I\'ll
say the pressure into a constant resistance to air flow is proportional to
the PWM drive.

The lung (as I\'ve said) is the pneumatic equivalent of an RC series
arrangement. Initially the counter force is all dissipative (air flow
resistance) and the effect of the capacitor (lung elastance) is minimal in
comparison. As the lung inflates the elastance becomes a larger factor.

And the \"lung\" will vary from one individual to the next. Concentrate on
the things you have control over, first -- the product\'s design. If there
are variables in its performance, figure out how to compensate for them
BEFORE you add the variable that is the \"lung\" (or, the provider operating
the device!)

You are showing your ignorance of the situation. There is a trained operator to specifically address issues like differences between patients. It is not up to the machine to magically know the characteristics of the patient it is connected to.


The only part that is at issue is the initial response to the step function
of the control variable. That would seem to be dominated by proportional
effects.

I do see that there is little about my explanation that you understand. If
you have questions I would be happy to answer, but you seem to be
overwhelmed by it all.

(sigh) True to form, you underestimate the complexity of the problem and
dismiss folks who have experience solving similar problems because they
say things that you don\'t want to hear (e.g., FDA approval process) or
ask questions that you can\'t answer (\"That\'s not important\").

[The FDA process would have told you that you should PROVE those things to
be unimportant -- instead of hand-waving them away in \"first-order
approximations\".]

Classic example of Dunning-Kruger Effect.

If I said I\'ve designed and implemented 50 PID loops, I\'d probably be low by
a factor of 5! And, yours is \"trivial\", by comparison! It\'s not interacting
with 6 or 7 other loops, simultaneously.

For example:

Noticing a higher than desired ejection force for a tabletting station (35-75
in operation concurrently) would lead the associated controller to move the
formation of the tablet *up* in the die. This requires updating the upper
punch penetration and lower punch penetration settings (mechanisms!)
in-synchrony to ensure the distance between punch tips remains unchanged.
(heaven forbid you let the punch tips TOUCH -- crunch!). Of course, the
mechanisms for each are different so the mechanical gains and dynamics of
their mechanisms differ. I.e., the control loops governing their \"positions\"
(at the end of motorized mechanisms; revolutions becomes tenths of thousandths
of inches) differ and can\'t be assumed to travel (adjust) at identical rates.

Less distance to travel between it\'s formation and ejection AND likely out of
any \"barreled\" portion of the die (even steel wears when subjected to 10T
events at 200Hz day in and day out).

Ah, but that means EVERY tabletting station will now form a tablet at that
new displacement! (And, stations are forming tablets WHILE THE PUNCHES
PENETRATIONS ARE \"IN MOTION\"!) What if some other station NOW exhibits a
higher ejection force? Do you move the tablet up even further in the die?
Do you ignore the \"problem\"? Coerce the previous station to tolerate a
compromise position?

How many tablets do you end up discarding for each tradeoff? When do you
halt the process and signal the operator to change the tooling (punches/die)
because the process has moved out of your control region?

While the punches are in motion, tablets are being formed. The forces they
experience in their formation is approximately (nonlinearly!) related to the
weight (mass) of the tablet thus formed. This is intuitive -- a \"fixed\"
amount of material being compressed to a particular \"final size\".

So, if there is any variation between punch-tip-to-punch-tip distance WHILE
UNDER ADJUSTMENT, it manifests as \"weight variation\" (though you can\'t deduce
whether a high force means an overweight tablet or an underweight tablet
because you don\'t know the dimensions of the actual tablet!).

So, the control loop that adjust the amount of material to install in each
die sees that it needs to compensate (even though it might be operating
at the ideal point IF THE PUNCHES HAD SETTLED INTO THEIR CORRECT PLACES).
As a result, it alters the fill -- and, thus, weights -- of the other
tabletting stations that haven\'t experienced this disturbance -- yet!

I.e., the loop can make WORSE product than if it hadn\'t been in place!
[Do you remember that threee-letter agency, begins with an F?]

As the tablet is formed higher in the die, there is increased opportunity
for material (\"tablet powder... \'granulation\') to incompletely fill the
die (it is gravity fed). This will likely affect ALL tabletting
stations so you want to pool the observations of all of the control
loops before deciding that you have a \"fill problem\".

If so, you tweek the setpoint of the hopper controllers -- which then
feeds back into the mechanical processing of all of the tabletting
stations served by that hopper (typically two hoppers per machine).

All of these changes affect real physical characteristics of the
tablets produced: weight, hardness, friability, dissolution time,
etc.

Thus, there are \"offline\" tests performed by manufacturing staff to
test these parameters and tweek the press based on their results.
But, these tests often take on the order of minutes or fractional
hours... the machine is no longer in the same configuration it
was when the tablets sampled were produced!

So, you have to keep track of which tablets were actually sampled,
along with the observations made during their formulation, in
order to apply the desired corrections to the CURRENT process.

This is ONE product. With *dozens* of interacting control loops
manufacturing product (at 200 completed items per second) for a
regulated (FDA) industry.

Would you like to discuss using control theory to assist in
autopilot navigation? Or, controlling temperature/humidity/flow
in a process air handler? Or controling the intensity of a lamp
to ensure it accurately detects the \"color\" of a blood assay?
Or, controlling the formulation of a \"candy shell\" on a small,
oval piece of chocolate?? :

But, hey, I\'m clearly \"overwhelmed\" by a paddle pushing on an Ambubag.

Yeah, that.

Are you offering to participate in the PID design for this product?

--

Rick C.

--- Get 1,000 miles of free Supercharging
--- Tesla referral code - https://ts.la/richard11209
 
On Sunday, August 16, 2020 at 7:12:06 PM UTC-4, Flyguy wrote:
On Saturday, August 15, 2020 at 6:44:08 PM UTC-7, Ricketty C wrote:
I understand the basics of PID design, but if you can\'t describe the thing being controlled, how can you design the controller other than trial and error?

The \"plant\" is a motor on a tall reducing gear (~300:1) turning an arm that presses on a bag producing an air flow with the loop controlled by a pressure measurement.

One issue I\'m seeing discussed is a tradeoff on the PWM resolution vs. frequency. Presently they are using 3.6 kHz with 8 bit PWM control. I kinda wonder if a sigma-delta might be better, but that might require some external logic. They seem to be shy of pushing the CPU too much even after changing from an Arduino CPU at 20 MHz to an ARM CM4F at 80 MHz.

The big concern is the overshoot when ramping up the pressure between exhale and inhale. In general, would it be better to simply jump the pressure set point at once and let the PID controller do its thing, optimizing the response time as best as possible controlling overshoot -or- would it be better to run up the pressure set point over a period of time which would seem to place less demand on the PID controller?

The model of the lung seems to include a spring constant (I think of this as a capacitor) in parallel with a dissipative element (a dashpot or resistor in electronics). The motor is highly geared to a relatively lightweight arm pushing on a bag with air passing through a tube of relatively low restriction. So initially the dominate opposition to flow will be the dissipation/resistor, i.e. proportional to the rate of airflow. This in turn is proportional to the arm speed (although not constant through the stroke due to the bag geometry). The arm speed is what is controlled by the PWM (approximately).

The lung model shows the dashpot and spring in parallel, but I\'m not sure that\'s appropriate. The response to air entering the lung will be the sum of the airway resistance (dashpot) and the lung compliance (spring) which would be a series combination to obtain the resulting air pressure. Well, maybe that is right for the mechanical model, but in the electrical equivalent if pressure is the same as voltage it would be a series arrangement.

Anyway, the lung would seem to be a capacitor and a resistor. So if driven by a P only controller, is there any way it could ring? I was shown data measured that showed huge ringing from an initial step function in the set point.

I watched some videos and it seems they use both pressure regulated and flow regulated cycles. I expect to see similar results with either method.

Interesting

--

Rick C.

- Get 1,000 miles of free Supercharging
- Tesla referral code - https://ts.la/richard11209

Here is a cheap, patented ventilator that doesn\'t need PID control (volume of air delivered is regulated mechanically by the angular motion of a cam):

https://foro.coronavirusmakers.org/uploads/516/FADE0V3E2AAI.pdf

The volume of air is not what is controlled by the PID.

--

Rick C.

--+ Get 1,000 miles of free Supercharging
--+ Tesla referral code - https://ts.la/richard11209
 
On Sunday, August 16, 2020 at 8:09:27 PM UTC-4, Three Jeeps wrote:
On Sunday, August 16, 2020 at 11:45:57 AM UTC-4, Ricketty C wrote:
On Sunday, August 16, 2020 at 11:33:16 AM UTC-4, Lasse Langwadt Christensen wrote:
søndag den 16. august 2020 kl. 17.14.22 UTC+2 skrev jla...@highlandsniptechnology.com:
On Sun, 16 Aug 2020 07:53:41 -0700 (PDT), Lasse Langwadt Christensen
lang...@fonz.dk> wrote:

sųndag den 16. august 2020 kl. 16.31.14 UTC+2 skrev Jan Panteltje:
On a sunny day (Sat, 15 Aug 2020 22:46:45 -0700 (PDT)) it happened Ricketty C
gnuarm.del...@gmail.com> wrote in
d2d879c1-cf13-42f8...@googlegroups.com>:


He shows the only difference between patient triggered and machine triggered
waveforms is the negative pressure from the patient trying to draw air in
at the very start of the cycle. His diagrams are pretty poor with no registration
between the various points on different parameters, but he gets across
the main points. You can do a Google search to find other much better
diagrams. I don\'t think there are any new concepts to an engineer.

No experience with these things
but from _my_ life I know breathing is related to oxygen level in the blood.

not really, your breathing is mostly related to the amount of CO2 in your lungs
that\'s why breathing something like pure nitrogen will kill you without you
even noticing

I wonder how many old ladies ricky\'s team plans to kill, trying to
learn PIDs and stuff.


I very much doubt they\'ll be allowed to hook anything living up to a ventilator hacked together by amateurs, no matter how well-meaning they are

seems like an exercise in feeling like they are \"doing something\"
There are a couple of companies we are talking to about running the design through a certification process and into manufacturing. So that will be covered. When we hit certain bumps in the road the solution is to not worry about it since the company taking it over will be redoing that anyway. This is not a rational to take technical shortcuts, more procedural things. So the documentation will be sparse I expect.

That is my single biggest issue with the process. They are not doing a proper requirements analysis. This means many aspects of the design are not planned out properly and various sections have been redesigned several times and may be again in the future as we find bends in the road.

Oh well, keeps me off the streets. I need to design a high side current monitor since the one in the motor controller has very poor accuracy. There is a nominal current ratio, but at lower currents the tolerance is worse than ±34%.

--

Rick C.

-++ Get 1,000 miles of free Supercharging
-++ Tesla referral code - https://ts.la/richard11209

hmmm running it through certification process with \'documentation is rather sparse\'?
My suggestion is to get the documentation as it will be part of the assurance case that will be made to the FDA (or whoever). Ultimately, the FDA certifies the as-built system and will need to see proper design docs and *rational* that when reasoned about, can make the argument that the system will behave as required and is safe.
Understanding PID controllers is one thing. Writing a discrete version of the PID control law is something else. Understanding the system dynamics and developing is control loop goes beyond understanding a PID controller.
I know nothing about how a ventilator works. I do know a bit about developing control systems. From the number of posts and your \'wondering\' of what the control variable is, it sounds like one need to make a model of the system in order to better understand the components and linkages and develop a realistic transfer function. I am quite surprised that the system is characterized as a simple first order system.
For a voltage controlled DC motor the rotational speed/torque transfer function is first order. Closed loop control rotational speed/voltage is always a second order system - in fact, it is the quintessential example in any first control theory course. And there is a \'simplifying assumption\' - if one assumes the time constant of the electrical circuit is much smaller than the time constant of the load dynamics, the transfer function may be reduced to a first order transfer function. Not clear that this simplifying assumption is applicable in this case.

So, don\'t know the open loop transfer function of the system? run a frequency test and measure the response. Create a simulink model. Understand where the poles and zeros of the system are and determine the natural frequency of the system.
Once one understands what they are dealing with then one can think about an effective control approach...there is usually more to it than throwing a PID controller at the system.
Gee, what happens if noise gets coupled into the system? Does your design compensate for that (hardware and digitally) You should also consider doing stability analysis to see if your controlled introduced an oscillation.
With all due respect, this is not a design problem for amateurs (no insinuation about your skills or experience - just a lesson learned from spending lots of time in the control and certification domain (both FDA and Mil) )..

I would love to do something more rigorous, but I can\'t even get them to do a proper requirements analysis. \"We don\'t have time.\" So instead we have a hardware \"check list\".

Yeah, I know. I think I\'ve already said I will stick around to get see that a design review is done on the next board rev, then I am out.

I did design a high side current sensor today. The motor controller has a current sensor circuit but at lower current the tolerance is terrible ±33%. The high side sensor should be within 5% even using 1% resistors throughout. I used a very small sense resistor to minimize voltage drop and the first amp stage drops that to a third, so a second amp is used to get to a 3V range. The amount of signal conditioning circuitry is adding up. We are also out of I/Os on the MCU. They are talking about needing to add LEDs for alarms, but no indication of how many or what color... oh, there are requirements for flash rate to indicate severity along with the color. I can get one I/O back from the interface to the battery charge chip and maybe another elsewhere. Two I/Os and an I2C chip will get you a lot more I/Os as long as you don\'t require them to set interrupts.

--

Rick C.

-+- Get 1,000 miles of free Supercharging
-+- Tesla referral code - https://ts.la/richard11209
 
Am 17.08.20 um 01:25 schrieb bitrex:
On 8/16/2020 6:54 PM, Gerhard Hoffmann wrote:
Am 16.08.20 um 23:28 schrieb bitrex:
On 8/16/2020 4:01 PM, Tom Del Rosso wrote:

Interpreting it as \"thou shalt not murder\" which may be closer to the
original Hebrew meaning, 5000 years ago, adds an escape route. what\'s
a murder? \"killing of an innocent person.\" Well what\'s an innocent
person. Someone who isn\'t guilty. Who convicts people and determines
if they\'re guilty? Humans do. Based on what. On what their particular
ideas of what is \"moral\" in a particular situation.

  https://www.youtube.com/watch?v=CE8ooMBIyC8&t=396s   

Carlin got it right. Murder is at 5:00

Gerhard

Nothing is more respectable than a humble man who acts with full
conviction he is doing God\'s work.

Yeah, $GOD would do exactly the same if he knew all those little facts
and if HE would not hide carefully behind the humble man\'s broad
shoulders.

The average god is an asshole, and we admire HIM because he gets away
with it (just like Trump). For example the idea of killing your son on
the altar, fucking everyone who\'s not on a tree when count==3 like Zeus
or taking a blood bath every other day like these meso-american gods.

The nordic gods proved to be assholes when they betrayed the giant who
built their castle on the Heidubreit in Iceland. Promising the sun and
Freya, the deity of fertility (== Venus) were a stake really bad to loose.

One of them, Loki, a male deity, seduced the horse of the giant to keep
it from working when the giant was close to declare \"DONE\", and Loki
even gave birth later to a six-legged horse named Sleipnir from this
adventure who served well for Odin.
In a homophobic warrior society you could not sink any deeper. Just
impossible.

That the nordic gods declared war to the Giants over a huge brewing
kettle is harmless in comparison, even Jörg might possibly forgive them.
:)

Cheers, Gerhard
 
On 8/16/2020 5:54 PM, Ricketty C wrote:
But, hey, I\'m clearly \"overwhelmed\" by a paddle pushing on an Ambubag.

Yeah, that.

Are you offering to participate in the PID design for this product?

Hell no. It looks like a doomed project. I donate my 500+ /pro bono/ hours,
annually (for the past 20+ years) to projects where I know I (and they) can
do some good.

[OTOH, I\'m not entirely altruistic in my choice of projects! I
deliberately pick projects -- and their solutions -- that I can use
to learn about some technology that is of interest to me, at the time.
The last two projects allowed me to experiment with unattended RDBMS
management techniques and self-modifying -- learning -- Expert Systems.]

I\'m merely suggesting why you\'ve missed the boat on how to approach
the *process* and the design -- PID and otherwise.

Get a good book on control system *theory*. Read it. Understand it.
It\'s \"old news\" but many schools don\'t include it in their REQUIRED
curricula. What\'s changed is the move to sampled systems instead of
continuous and electronic/smart control vs. pneumatic/etc. controls.
E.g., Ziegler-Nichols tuning was devised in the 40\'s! The more
practical idea of applying it (and variants) to \"self-tune\" is more
modern.

(No need to bother yourself with more esoteric things like SPC).

Then look for \"control theory for dummies\" examples on the web.
There are also modeling tools available, nowadays, that let you PLAY
with \"systems\" to see what they will do in certain circumstances.
You can see why the systems behave the way they do and \"where\"
the \"issues\" creep into the models.

There are myriad approaches to \"solving\" these issues that have been
developed over the years. Often very specific to particular
application domains. (e.g., how do you control the temperature
in a process vessel where the \"worker\" can periodically open the
vessel -- for whatever reason -- and introduce a large disturbance
to your controller?)

You can use these -- and the Genuine Article -- to see how close your
model is to reality. And, evaluate remedial measures to compensate
for exposed shortcomings.

Instead of asking how the system will respond to a step function,
apply one to the model and WATCH. Use this understanding of the
system (as modeled) to JUSTIFY why your control algorithm is
\"suitable\" (to the regulators).
 
On 8/16/2020 6:09 PM, Ricketty C wrote:

They are talking about needing to add LEDs for
alarms, but no indication of how many or what color... oh, there are
requirements for flash rate to indicate severity along with the color.

And what guidelines are they using to decide these issues?
Having a multicolored flashing christmas tree isn\'t going to
help a provider decide \"what\'s going wrong\".

[And a good fraction of the population suffers from one or more
forms of color-blindness. And, not all colors are readily
discernible in different lighting conditions.]

I went through this exercise, recently, with the design of a large
\"discrete indicator panel\" (if you need a cheat-sheet to understand
what\'s trying to be conveyed, then you\'re failing at that goal!).
 
On 8/16/2020 8:09 PM, Three Jeeps wrote:
On Sunday, August 16, 2020 at 11:45:57 AM UTC-4, Ricketty C wrote:
On Sunday, August 16, 2020 at 11:33:16 AM UTC-4, Lasse Langwadt Christensen wrote:
søndag den 16. august 2020 kl. 17.14.22 UTC+2 skrev jla...@highlandsniptechnology.com:
On Sun, 16 Aug 2020 07:53:41 -0700 (PDT), Lasse Langwadt Christensen
lang...@fonz.dk> wrote:

sųndag den 16. august 2020 kl. 16.31.14 UTC+2 skrev Jan Panteltje:
On a sunny day (Sat, 15 Aug 2020 22:46:45 -0700 (PDT)) it happened Ricketty C
gnuarm.del...@gmail.com> wrote in
d2d879c1-cf13-42f8...@googlegroups.com>:


He shows the only difference between patient triggered and machine triggered
waveforms is the negative pressure from the patient trying to draw air in
at the very start of the cycle. His diagrams are pretty poor with no registration
between the various points on different parameters, but he gets across
the main points. You can do a Google search to find other much better
diagrams. I don\'t think there are any new concepts to an engineer.

No experience with these things
but from _my_ life I know breathing is related to oxygen level in the blood.

not really, your breathing is mostly related to the amount of CO2 in your lungs
that\'s why breathing something like pure nitrogen will kill you without you
even noticing

I wonder how many old ladies ricky\'s team plans to kill, trying to
learn PIDs and stuff.


I very much doubt they\'ll be allowed to hook anything living up to a ventilator hacked together by amateurs, no matter how well-meaning they are

seems like an exercise in feeling like they are \"doing something\"
There are a couple of companies we are talking to about running the design through a certification process and into manufacturing. So that will be covered. When we hit certain bumps in the road the solution is to not worry about it since the company taking it over will be redoing that anyway. This is not a rational to take technical shortcuts, more procedural things. So the documentation will be sparse I expect.

That is my single biggest issue with the process. They are not doing a proper requirements analysis. This means many aspects of the design are not planned out properly and various sections have been redesigned several times and may be again in the future as we find bends in the road.

Oh well, keeps me off the streets. I need to design a high side current monitor since the one in the motor controller has very poor accuracy. There is a nominal current ratio, but at lower currents the tolerance is worse than ±34%.

--

Rick C.

-++ Get 1,000 miles of free Supercharging
-++ Tesla referral code - https://ts.la/richard11209

hmmm running it through certification process with \'documentation is rather sparse\'?
My suggestion is to get the documentation as it will be part of the assurance case that will be made to the FDA (or whoever). Ultimately, the FDA certifies the as-built system and will need to see proper design docs and *rational* that when reasoned about, can make the argument that the system will behave as required and is safe.
Understanding PID controllers is one thing. Writing a discrete version of the PID control law is something else. Understanding the system dynamics and developing is control loop goes beyond understanding a PID controller.
I know nothing about how a ventilator works. I do know a bit about developing control systems. From the number of posts and your \'wondering\' of what the control variable is, it sounds like one need to make a model of the system in order to better understand the components and linkages and develop a realistic transfer function. I am quite surprised that the system is characterized as a simple first order system.
For a voltage controlled DC motor the rotational speed/torque transfer function is first order. Closed loop control rotational speed/voltage is always a second order system - in fact, it is the quintessential example in any first control theory course. And there is a \'simplifying assumption\' - if one assumes the time constant of the electrical circuit is much smaller than the time constant of the load dynamics, the transfer function may be reduced to a first order transfer function. Not clear that this simplifying assumption is applicable in this case.

So, don\'t know the open loop transfer function of the system? run a frequency test and measure the response. Create a simulink model. Understand where the poles and zeros of the system are and determine the natural frequency of the system.
Once one understands what they are dealing with then one can think about an effective control approach...there is usually more to it than throwing a PID controller at the system.
Gee, what happens if noise gets coupled into the system? Does your design compensate for that (hardware and digitally) You should also consider doing stability analysis to see if your controlled introduced an oscillation.
With all due respect, this is not a design problem for amateurs (no insinuation about your skills or experience - just a lesson learned from spending lots of time in the control and certification domain (both FDA and Mil) ).

The simple hydro-mechanical ventilator + lung system is an oscillator,
is it not?

It\'s fed with energy from the compressed air supply, and it
chunk-chunk-chunks in and out like a steam engine.

So in even the simplest case I think the overall system of lungs + vent
has to be at least second order. Sure it can oscillate, that\'s what it\'s
supposed to do when the system is operating normally.
 
On Sunday, August 16, 2020 at 11:25:05 PM UTC-4, Don Y wrote:
On 8/16/2020 6:09 PM, Ricketty C wrote:

They are talking about needing to add LEDs for
alarms, but no indication of how many or what color... oh, there are
requirements for flash rate to indicate severity along with the color.

And what guidelines are they using to decide these issues?
Having a multicolored flashing christmas tree isn\'t going to
help a provider decide \"what\'s going wrong\".

You literally know nothing about this. You ask a question, but it\'s not genuine. You just want to hear something you can maybe trash the project over. So why should anyone bother with you?

This is a case where you are not part of the solution, you are part of the problem.


[And a good fraction of the population suffers from one or more
forms of color-blindness. And, not all colors are readily
discernible in different lighting conditions.]

Sorry, you need to talk to the people who set the standards for traffic lights, and medical ventilators, not me.


I went through this exercise, recently, with the design of a large
\"discrete indicator panel\" (if you need a cheat-sheet to understand
what\'s trying to be conveyed, then you\'re failing at that goal!).

I\'m sure you are very accustomed to failing. Thanks anyway.

--

Rick C.

-++ Get 1,000 miles of free Supercharging
-++ Tesla referral code - https://ts.la/richard11209
 
On 8/16/2020 9:18 PM, Ricketty C wrote:
On Sunday, August 16, 2020 at 11:25:05 PM UTC-4, Don Y wrote:
On 8/16/2020 6:09 PM, Ricketty C wrote:

They are talking about needing to add LEDs for alarms, but no indication
of how many or what color... oh, there are requirements for flash rate
to indicate severity along with the color.

And what guidelines are they using to decide these issues? Having a
multicolored flashing christmas tree isn\'t going to help a provider decide
\"what\'s going wrong\".

You literally know nothing about this. You ask a question, but it\'s not
genuine. You just want to hear something you can maybe trash the project
over. So why should anyone bother with you?

(sigh) AGAIN you assume that I have no first-hand knowledge of the issue.

This is a case where you are not part of the solution, you are part of the
problem.

From here, it seems like your ignorance IS the problem!

Good luck on your upcoming failure!

Clown.
 
On Sunday, August 16, 2020 at 5:56:53 PM UTC-7, Ricketty C wrote:
On Sunday, August 16, 2020 at 7:12:06 PM UTC-4, Flyguy wrote:
On Saturday, August 15, 2020 at 6:44:08 PM UTC-7, Ricketty C wrote:
I understand the basics of PID design, but if you can\'t describe the thing being controlled, how can you design the controller other than trial and error?

The \"plant\" is a motor on a tall reducing gear (~300:1) turning an arm that presses on a bag producing an air flow with the loop controlled by a pressure measurement.

One issue I\'m seeing discussed is a tradeoff on the PWM resolution vs.. frequency. Presently they are using 3.6 kHz with 8 bit PWM control. I kinda wonder if a sigma-delta might be better, but that might require some external logic. They seem to be shy of pushing the CPU too much even after changing from an Arduino CPU at 20 MHz to an ARM CM4F at 80 MHz.

The big concern is the overshoot when ramping up the pressure between exhale and inhale. In general, would it be better to simply jump the pressure set point at once and let the PID controller do its thing, optimizing the response time as best as possible controlling overshoot -or- would it be better to run up the pressure set point over a period of time which would seem to place less demand on the PID controller?

The model of the lung seems to include a spring constant (I think of this as a capacitor) in parallel with a dissipative element (a dashpot or resistor in electronics). The motor is highly geared to a relatively lightweight arm pushing on a bag with air passing through a tube of relatively low restriction. So initially the dominate opposition to flow will be the dissipation/resistor, i.e. proportional to the rate of airflow. This in turn is proportional to the arm speed (although not constant through the stroke due to the bag geometry). The arm speed is what is controlled by the PWM (approximately).

The lung model shows the dashpot and spring in parallel, but I\'m not sure that\'s appropriate. The response to air entering the lung will be the sum of the airway resistance (dashpot) and the lung compliance (spring) which would be a series combination to obtain the resulting air pressure. Well, maybe that is right for the mechanical model, but in the electrical equivalent if pressure is the same as voltage it would be a series arrangement.

Anyway, the lung would seem to be a capacitor and a resistor. So if driven by a P only controller, is there any way it could ring? I was shown data measured that showed huge ringing from an initial step function in the set point.

I watched some videos and it seems they use both pressure regulated and flow regulated cycles. I expect to see similar results with either method.

Interesting

--

Rick C.

- Get 1,000 miles of free Supercharging
- Tesla referral code - https://ts.la/richard11209

Here is a cheap, patented ventilator that doesn\'t need PID control (volume of air delivered is regulated mechanically by the angular motion of a cam):

https://foro.coronavirusmakers.org/uploads/516/FADE0V3E2AAI.pdf
The volume of air is not what is controlled by the PID.

--

Rick C.

--+ Get 1,000 miles of free Supercharging
--+ Tesla referral code - https://ts.la/richard11209

Pressure is a dependent variable, not the controlled variable.
 
On 8/17/2020 12:53 AM, Flyguy wrote:
On Sunday, August 16, 2020 at 5:56:53 PM UTC-7, Ricketty C wrote:
On Sunday, August 16, 2020 at 7:12:06 PM UTC-4, Flyguy wrote:
On Saturday, August 15, 2020 at 6:44:08 PM UTC-7, Ricketty C wrote:
I understand the basics of PID design, but if you can\'t describe the thing being controlled, how can you design the controller other than trial and error?

The \"plant\" is a motor on a tall reducing gear (~300:1) turning an arm that presses on a bag producing an air flow with the loop controlled by a pressure measurement.

One issue I\'m seeing discussed is a tradeoff on the PWM resolution vs. frequency. Presently they are using 3.6 kHz with 8 bit PWM control. I kinda wonder if a sigma-delta might be better, but that might require some external logic. They seem to be shy of pushing the CPU too much even after changing from an Arduino CPU at 20 MHz to an ARM CM4F at 80 MHz.

The big concern is the overshoot when ramping up the pressure between exhale and inhale. In general, would it be better to simply jump the pressure set point at once and let the PID controller do its thing, optimizing the response time as best as possible controlling overshoot -or- would it be better to run up the pressure set point over a period of time which would seem to place less demand on the PID controller?

The model of the lung seems to include a spring constant (I think of this as a capacitor) in parallel with a dissipative element (a dashpot or resistor in electronics). The motor is highly geared to a relatively lightweight arm pushing on a bag with air passing through a tube of relatively low restriction. So initially the dominate opposition to flow will be the dissipation/resistor, i.e. proportional to the rate of airflow. This in turn is proportional to the arm speed (although not constant through the stroke due to the bag geometry). The arm speed is what is controlled by the PWM (approximately).

The lung model shows the dashpot and spring in parallel, but I\'m not sure that\'s appropriate. The response to air entering the lung will be the sum of the airway resistance (dashpot) and the lung compliance (spring) which would be a series combination to obtain the resulting air pressure. Well, maybe that is right for the mechanical model, but in the electrical equivalent if pressure is the same as voltage it would be a series arrangement.

Anyway, the lung would seem to be a capacitor and a resistor. So if driven by a P only controller, is there any way it could ring? I was shown data measured that showed huge ringing from an initial step function in the set point.

I watched some videos and it seems they use both pressure regulated and flow regulated cycles. I expect to see similar results with either method.

Interesting

--

Rick C.

- Get 1,000 miles of free Supercharging
- Tesla referral code - https://ts.la/richard11209

Here is a cheap, patented ventilator that doesn\'t need PID control (volume of air delivered is regulated mechanically by the angular motion of a cam):

https://foro.coronavirusmakers.org/uploads/516/FADE0V3E2AAI.pdf
The volume of air is not what is controlled by the PID.

--

Rick C.

--+ Get 1,000 miles of free Supercharging
--+ Tesla referral code - https://ts.la/richard11209

Pressure is a dependent variable, not the controlled variable.

Here is a summary of the different modes:

<https://www.openanesthesia.org/modes_of_mechanical_ventilation/>

\"a more modern approach describes ventilatory modes based on three
characteristics – the trigger (flow versus pressure), the limit (what
determines the size of the breath), and the cycle (what actually ends
the breath).\"
 

Welcome to EDABoard.com

Sponsor

Back
Top