Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:

I want to implement a classical servo-like loop equation. For example, if
A is gain, then:
Af=A/(1-b*A), where Af is the resulting feedback gain, and B is beta, the sampled portion that must be updated to maintain a set point output of the loop's output. The loop could be a controller of room temperature.

What I have tried:

No attempt to code a feedback loop yet.
Posted
Updated 1-Apr-24 19:33pm

We don't usually give people code if they haven't actually attempted anything yet. We will help you if you get stuck with your code, but we won't write it for you. What I will do, is offer you some guidance as to how to solve this. Write a function where you take gain and beta as arguments and check for invalid values: gain cannot be 0 or 1/beta (division by zero or infinite gain). Calculate the resulting feedback gain using the formula Af = gain / (1 - beta * gain). Return that value as your result. This is a simple function to write because you already know the formula. (Hint - use floating point numbers).
 
Share this answer
 
Try some Learn C tutorial. Learn the basics before you start attempting to write some code.

Tip: learn to use the debugger.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900