Skip to content

Commit

Permalink
CapControl: handle phase checks better
Browse files Browse the repository at this point in the history
  • Loading branch information
PMeira committed Apr 16, 2024
1 parent 87d85c2 commit b9bc87b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 30 deletions.
6 changes: 6 additions & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@

# Versions 0.14.x

## Version 0.14.6

*not released*

- CapControl: handle phase checks better in `PTPhase` and `CTPhase`.

## Version 0.14.5 (2024-03-29)

Minor release:
Expand Down
61 changes: 31 additions & 30 deletions src/Controls/CapControl.pas
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ function TCapControl.NewObject(const ObjName: String; Activate: Boolean): Pointe
procedure TCapControlObj.PropertySideEffects(Idx: Integer; previousIntVal: Integer; setterFlags: TDSSPropertySetterFlags);
begin
// PF Controller changes
if ControlType = PFCONTROL then // TODO: check -- is this correct for all below??
if ControlType = PFCONTROL then
with ControlVars do
case Idx of
ord(TProp.typ):
Expand Down Expand Up @@ -403,38 +403,39 @@ procedure TCapControlObj.PropertySideEffects(Idx: Integer; previousIntVal: Integ
DoSimpleMsg('Invalid PF OFF value for "%s"', [FullName], 35301);
end;
end;
ord(TProp.CTPhase):
if FCTPhase > FNphases then
begin
DoSimpleMsg('Error: Monitored phase (%d) must be less than or equal to number of phases (%d). ', [FCTPhase, FNphases], 35302);
FCTPhase := 1;
end;
ord(TProp.PTPhase):
if FPTPhase > FNphases then
begin
DoSimpleMsg('Error: Monitored phase (%d) must be less than or equal to number of phases (%d). ', [FPTPhase, FNphases], 35303);
FPTPhase := 1;
end;
end;

case Idx of
ord(TProp.Capacitor):
if ControlledElement <> NIL then
ControlVars.CapacitorName := ControlledElement.FullName;
ord(TProp.VBus):
begin
ControlVars.VOverrideBusName := AnsiLowerCase(ControlVars.VOverrideBusName);
ControlVars.VoverrideBusSpecified := TRUE;
end;
ord(TProp.UserModel):
begin
UserModel.Name := UserModelNameStr; // Connect to user written model
IsUserModel := UserModel.Exists;
with ControlVars do
case Idx of
ord(TProp.CTPhase):
if FCTPhase > FNphases then
begin
DoSimpleMsg('Error: Monitored phase (%d) must be less than or equal to number of phases (%d). ', [FCTPhase, FNphases], 35302);
FCTPhase := 1;
end;
ord(TProp.PTPhase):
if FPTPhase > FNphases then
begin
DoSimpleMsg('Error: Monitored phase (%d) must be less than or equal to number of phases (%d). ', [FPTPhase, FNphases], 35303);
FPTPhase := 1;
end;
ord(TProp.Capacitor):
if ControlledElement <> NIL then
ControlVars.CapacitorName := ControlledElement.FullName;
ord(TProp.VBus):
begin
ControlVars.VOverrideBusName := AnsiLowerCase(ControlVars.VOverrideBusName);
ControlVars.VoverrideBusSpecified := TRUE;
end;
ord(TProp.UserModel):
begin
UserModel.Name := UserModelNameStr; // Connect to user written model
IsUserModel := UserModel.Exists;
end;
ord(TProp.UserData):
if UserModel.Exists then
UserModel.Edit(UserModelEditStr); // Send edit string to user model
end;
ord(TProp.UserData):
if UserModel.Exists then
UserModel.Edit(UserModelEditStr); // Send edit string to user model
end;

if IsUserModel then
ControlType := USERCONTROL;
Expand Down

0 comments on commit b9bc87b

Please sign in to comment.