Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local loop verify #8

Merged
merged 12 commits into from
Oct 1, 2023
Merged

Local loop verify #8

merged 12 commits into from
Oct 1, 2023

Conversation

leijerry888
Copy link
Collaborator

No description provided.

@leijerry888 leijerry888 self-assigned this Sep 25, 2023
@leijerry888 leijerry888 marked this pull request as ready for review September 25, 2023 09:58
self.err = self.df.apply(lambda t: self.err_flag(t), axis=1)
self.result = pd.Series(index=self.df.index)
err_start_time = None
first_flag = True
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

first_flag does not seem to be used.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks good catch

err_start_time = None
err_time = 0

if err_time > 1 and (not self.saturation.loc[cur_time]):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>= 1 instead of > 1?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use > 1 to make it a tiny bit more difficult to fail

points = ["feedback_sensor", "set_point", "cmd", "cmd_max"]

def saturation_flag(self, t):
if 0 <= t["cmd_max"] - t["cmd"] <= 0.01:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the 0.01 be a "user-input" with a default value? Similarly to how we handle tolerances.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any circumstances where the command might be negative for some reason? In other words should we use abs(t["cmd_max"] - t["cmd"])?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for 1), my intention is to require as little user inputs / config as possible, so that 0.01 is used. We can certainly change it to a parameter later;
for 2), if it is negative, I would prefer to fail the verification or raise an error. For now, if it is negative, then this would be considered "not saturated", so it has a larger chance of reporting fail than pass.

return False

def err_flag(self, t):
if t["feedback_sensor"] > t["set_point"]:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same comment as above for the command. I doubt it but still wanted to raise the question in case you think that it might be an issue.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To me this is a different issue from the comment earlier. Because this is a direct acting controller, then saturating towards maximum is the expected behavior when the sensor reading is constantly above the set point, not the other way around.

from checklib import RuleCheckBase


class LocalLoopSaturationDirectActingMin(RuleCheckBase):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to have only one verification that would handle min/max? The logic is essentially the same.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar to above, I think min and max are for sensor reading on two sides of the set points separately.

from checklib import RuleCheckBase


class LocalLoopSaturationReverseActingMax(RuleCheckBase):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question as above for reverse/direct.

class LocalLoopSetPointTracking(RuleCheckBase):
points = ["feedback_sensor", "set_point"]

def error_below_5percent(self, t):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the percentages be defined through parameters (with a default value)?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same intension as the "0.01", we can change it to parameter later for sure.

@leijerry888 leijerry888 merged commit 7f17988 into develop Oct 1, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants