Discussion:
help in using PID controller block in simulink
(too old to reply)
priya santhanam
2004-09-27 07:20:55 UTC
Permalink
hi
i am creating a control model using matlab/simulink. I am using a
PID controller block for controlling the system output. But for any
value of the derivative gain i give in the PID block, i am getting an
error which goes like this..

Derivative input 1 of block 'system2test/Subsystem/Integrator' at
time 2.450632977396823e-035 is Inf or NaN. Stopping simulation.
There may be a singularity in the solution. If not, try reducing the
step size (either by reducing the fixed step size or by tightening
the error tolerances)

How do i solve this problem?I tried using a saturation block but it
proved futile.

If somebody has a solution to this problem, please help me out.

regds
priya
Abhay Rawal
2004-09-27 14:51:21 UTC
Permalink
Hi
For the derivative part are you using the du/dt block. If you
are that might be causing the error. You can try using a Transfer
function block of the type 30*s/(s+30).
Abhay
Post by priya santhanam
hi
i am creating a control model using matlab/simulink. I am using a
PID controller block for controlling the system output. But for any
value of the derivative gain i give in the PID block, i am getting an
error which goes like this..
Derivative input 1 of block 'system2test/Subsystem/Integrator' at
time 2.450632977396823e-035 is Inf or NaN. Stopping simulation.
There may be a singularity in the solution. If not, try reducing the
step size (either by reducing the fixed step size or by tightening
the error tolerances)
How do i solve this problem?I tried using a saturation block but it
proved futile.
If somebody has a solution to this problem, please help me out.
regds
priya
priya
2004-09-28 09:52:16 UTC
Permalink
abhay, thanks for the suggestion,it helped.
but how does it work.i mean, how is 30*s/(s+30),a substitute for
du/dt. what is the laplace transform of 30*s/(s+30)

regds
priya
Post by Abhay Rawal
Hi
For the derivative part are you using the du/dt block. If
you
are that might be causing the error. You can try using a Transfer
function block of the type 30*s/(s+30).
Abhay
Post by priya santhanam
hi
i am creating a control model using matlab/simulink. I am using a
PID controller block for controlling the system output. But for
any
Post by priya santhanam
value of the derivative gain i give in the PID block, i am
getting
Post by priya santhanam
an
error which goes like this..
Derivative input 1 of block 'system2test/Subsystem/Integrator' at
time 2.450632977396823e-035 is Inf or NaN. Stopping
simulation.
Post by Abhay Rawal
Post by priya santhanam
There may be a singularity in the solution. If not, try
reducing
Post by Abhay Rawal
Post by priya santhanam
the
step size (either by reducing the fixed step size or by
tightening
Post by priya santhanam
the error tolerances)
How do i solve this problem?I tried using a saturation block
but
Post by Abhay Rawal
it
Post by priya santhanam
proved futile.
If somebody has a solution to this problem, please help me out.
regds
priya
Aaron Sarinana
2004-09-28 20:41:05 UTC
Permalink
in fact, tha general equation for the approxiamtion od du/dt is

du/dt ~ s/(s/N + 1) for a large N. A typical value of N could be 200 or so.

In this case N=30 and maybe you should use a larger one.

regards,

-aarón
Post by priya
abhay, thanks for the suggestion,it helped.
but how does it work.i mean, how is 30*s/(s+30),a substitute for
du/dt. what is the laplace transform of 30*s/(s+30)
regds
priya
Post by Abhay Rawal
Hi
For the derivative part are you using the du/dt block. If
you
are that might be causing the error. You can try using a Transfer
function block of the type 30*s/(s+30).
Abhay
Post by priya santhanam
hi
i am creating a control model using matlab/simulink. I am using
a
Post by Abhay Rawal
Post by priya santhanam
PID controller block for controlling the system output. But for
any
Post by Abhay Rawal
Post by priya santhanam
value of the derivative gain i give in the PID block, i am
getting
Post by Abhay Rawal
Post by priya santhanam
an
error which goes like this..
Derivative input 1 of block 'system2test/Subsystem/Integrator'
at
Post by Abhay Rawal
Post by priya santhanam
time 2.450632977396823e-035 is Inf or NaN. Stopping
simulation.
Post by Abhay Rawal
Post by priya santhanam
There may be a singularity in the solution. If not, try
reducing
Post by Abhay Rawal
Post by priya santhanam
the
step size (either by reducing the fixed step size or by
tightening
Post by Abhay Rawal
Post by priya santhanam
the error tolerances)
How do i solve this problem?I tried using a saturation block
but
it
Post by Abhay Rawal
Post by priya santhanam
proved futile.
If somebody has a solution to this problem, please help me out.
regds
priya
Kelvin Hales
2004-10-01 08:41:00 UTC
Permalink
Post by priya
abhay, thanks for the suggestion,it helped.
but how does it work.i mean, how is 30*s/(s+30),a substitute for
du/dt. what is the laplace transform of 30*s/(s+30)
30*s/(s+30) *is* in Laplace Transform Transfer-Function format.

You should be aware that in real world (practical) PID controllers, the derivative action is
implemented as either Td.s/(1+a.Td.S) or as (1+Td.s)/(1+a.Td.S).

A pure differentiating action: d/dt, == Laplace s operator, is a mathematical concept that cannot
exist in the real world for many reasons; most notably because the gain increases without bound
at high frequencies. In any case one does not want the increasing high-frequency gain of
derivative to amplify noise in a real system. The derivative action is therefore always
restricted to a limited bandwidth. For example, in a Honeywell TDC Basic Controller, the transfer
function for derivative action is of the form: (1+Td.s)/(1+a.Td.S); where a=0.125.

To implement this in Simulink, use the basic model for a 1st-order lag; i.e. -ve feedback around
an integrator; but take the output not from the integrator; but from somewhere in the forward
path of the signal into the integrator - which is, by definition, the derivative signal in that
loop. Try it and see. I leave you (homework exercise) to work out the Transfer Function details.
See the example below:

Model {
Name "Derivative"
Version 5.1
SaveDefaultBlockParams on
SampleTimeColors off
LibraryLinkDisplay "none"
WideLines on
ShowLineDimensions off
ShowPortDataTypes on
ShowLoopsOnError on
IgnoreBidirectionalLines off
ShowStorageClass off
SortedOrder off
RecordCoverage off
CovPath "/"
CovSaveName "covdata"
CovMetricSettings "dw"
CovNameIncrementing off
CovHtmlReporting on
covSaveCumulativeToWorkspaceVar on
CovSaveSingleToWorkspaceVar on
CovCumulativeVarName "covCumulativeData"
CovCumulativeReport off
DataTypeOverride "UseLocalSettings"
MinMaxOverflowLogging "UseLocalSettings"
MinMaxOverflowArchiveMode "Overwrite"
BlockNameDataTip off
BlockParametersDataTip off
BlockDescriptionStringDataTip off
ToolBar on
StatusBar on
BrowserShowLibraryLinks on
BrowserLookUnderMasks on
Created "Fri Oct 01 09:39:20 2004"
UpdateHistory "UpdateHistoryNever"
ModifiedByFormat "%<Auto>"
LastModifiedBy "Kelvin"
ModifiedDateFormat "%<Auto>"
LastModifiedDate "Fri Oct 01 09:39:49 2004"
ModelVersionFormat "1.%<AutoIncrement:2>"
ConfigurationManager "None"
SimParamPage "Solver"
LinearizationMsg "none"
Profile off
ParamWorkspaceSource "MATLABWorkspace"
AccelSystemTargetFile "accel.tlc"
AccelTemplateMakefile "accel_default_tmf"
AccelMakeCommand "make_rtw"
TryForcingSFcnDF off
ExtModeMexFile "ext_comm"
ExtModeBatchMode off
ExtModeTrigType "manual"
ExtModeTrigMode "normal"
ExtModeTrigPort "1"
ExtModeTrigElement "any"
ExtModeTrigDuration 1000
ExtModeTrigHoldOff 0
ExtModeTrigDelay 0
ExtModeTrigDirection "rising"
ExtModeTrigLevel 0
ExtModeArchiveMode "off"
ExtModeAutoIncOneShot off
ExtModeIncDirWhenArm off
ExtModeAddSuffixToVar off
ExtModeWriteAllDataToWs off
ExtModeArmWhenConnect on
ExtModeSkipDownloadWhenConnect off
ExtModeLogAll on
ExtModeAutoUpdateStatusClock on
BufferReuse on
RTWExpressionDepthLimit 5
SimulationMode "normal"
Solver "ode15s"
SolverMode "Auto"
StartTime "0.0"
StopTime "10.0"
MaxOrder 5
MaxStep "auto"
MinStep "auto"
MaxNumMinSteps "-1"
InitialStep "auto"
FixedStep "auto"
RelTol "1e-3"
AbsTol "auto"
OutputOption "RefineOutputTimes"
OutputTimes "[]"
Refine "1"
LoadExternalInput off
ExternalInput "[t, u]"
LoadInitialState off
InitialState "xInitial"
SaveTime on
TimeSaveName "tout"
SaveState off
StateSaveName "xout"
SaveOutput on
OutputSaveName "yout"
SaveFinalState off
FinalStateName "xFinal"
SaveFormat "Array"
Decimation "1"
LimitDataPoints on
MaxDataPoints "1000"
SignalLoggingName "sigsOut"
ConsistencyChecking "warning"
ArrayBoundsChecking "none"
AlgebraicLoopMsg "warning"
BlockPriorityViolationMsg "warning"
MinStepSizeMsg "warning"
InheritedTsInSrcMsg "warning"
DiscreteInheritContinuousMsg "warning"
MultiTaskRateTransMsg "error"
SingleTaskRateTransMsg "none"
CheckForMatrixSingularity "none"
IntegerOverflowMsg "warning"
Int32ToFloatConvMsg "warning"
ParameterDowncastMsg "error"
ParameterOverflowMsg "error"
ParameterPrecisionLossMsg "warning"
UnderSpecifiedDataTypeMsg "none"
UnnecessaryDatatypeConvMsg "none"
VectorMatrixConversionMsg "none"
InvalidFcnCallConnMsg "error"
SignalLabelMismatchMsg "none"
UnconnectedInputMsg "warning"
UnconnectedOutputMsg "warning"
UnconnectedLineMsg "warning"
SfunCompatibilityCheckMsg "none"
RTWInlineParameters off
BlockReductionOpt on
BooleanDataType on
ConditionallyExecuteInputs on
ParameterPooling on
OptimizeBlockIOStorage on
ZeroCross on
AssertionControl "UseLocalSettings"
ProdHWDeviceType "Microprocessor"
ProdHWWordLengths "8,16,32,32"
RTWSystemTargetFile "grt.tlc"
RTWTemplateMakefile "grt_default_tmf"
RTWMakeCommand "make_rtw"
RTWGenerateCodeOnly off
RTWRetainRTWFile off
TLCProfiler off
TLCDebug off
TLCCoverage off
TLCAssertion off
BlockDefaults {
Orientation "right"
ForegroundColor "black"
BackgroundColor "white"
DropShadow off
NamePlacement "normal"
FontName "Helvetica"
FontSize 10
FontWeight "normal"
FontAngle "normal"
ShowName on
}
BlockParameterDefaults {
Block {
BlockType Gain
Gain "1"
Multiplication "Element-wise(K.*u)"
ShowAdditionalParam off
ParameterDataTypeMode "Same as input"
ParameterDataType "sfix(16)"
ParameterScalingMode "Best Precision: Matrix-wise"
ParameterScaling "2^0"
OutDataTypeMode "Same as input"
OutDataType "sfix(16)"
OutScaling "2^0"
LockScale off
RndMeth "Floor"
SaturateOnIntegerOverflow on
}
Block {
BlockType Inport
Port "1"
PortDimensions "-1"
ShowAdditionalParam off
LatchInput off
DataType "auto"
OutDataType "sfix(16)"
OutScaling "2^0"
SignalType "auto"
SamplingMode "auto"
Interpolate on
}
Block {
BlockType Integrator
ExternalReset "none"
InitialConditionSource "internal"
InitialCondition "0"
LimitOutput off
UpperSaturationLimit "inf"
LowerSaturationLimit "-inf"
ShowSaturationPort off
ShowStatePort off
AbsoluteTolerance "auto"
ZeroCross on
}
Block {
BlockType Outport
Port "1"
OutputWhenDisabled "held"
InitialOutput "[]"
}
Block {
BlockType SubSystem
ShowPortLabels on
Permissions "ReadWrite"
RTWSystemCode "Auto"
RTWFcnNameOpts "Auto"
RTWFileNameOpts "Auto"
SimViewingDevice off
DataTypeOverride "UseLocalSettings"
MinMaxOverflowLogging "UseLocalSettings"
}
Block {
BlockType Sum
IconShape "rectangular"
Inputs "++"
ShowAdditionalParam off
InputSameDT on
OutDataTypeMode "Same as first input"
OutDataType "sfix(16)"
OutScaling "2^0"
LockScale off
RndMeth "Floor"
SaturateOnIntegerOverflow on
}
}
AnnotationDefaults {
HorizontalAlignment "center"
VerticalAlignment "middle"
ForegroundColor "black"
BackgroundColor "white"
DropShadow off
FontName "Helvetica"
FontSize 10
FontWeight "normal"
FontAngle "normal"
}
LineDefaults {
FontName "Helvetica"
FontSize 9
FontWeight "normal"
FontAngle "normal"
}
System {
Name "Derivative"
Location [480, 93, 1087, 222]
Open on
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
ZoomFactor "100"
ReportName "simulink-default.rpt"
Block {
BlockType SubSystem
Name "Derivative"
Ports [1, 1]
Position [50, 35, 100, 85]
NamePlacement "alternate"
ShowPortLabels off
TreatAsAtomicUnit off
MaskType "Lag"
MaskDescription "1st-Order Lag"
MaskPromptString "Derivative Action Time, Td (s):|Integrator Init"
"ial condition:"
MaskStyleString "edit,edit"
MaskTunableValueString "on,on"
MaskCallbackString "|"
MaskEnableString "on,on"
MaskVisibilityString "on,on"
MaskToolTipString "on,on"
MaskVarAliasString ","
MaskVariables "Td=@1;ic=@2;"
MaskDisplay "dpoly([Td 1],[0.125*Td 1])"
MaskIconFrame on
MaskIconOpaque on
MaskIconRotate "none"
MaskIconUnits "autoscale"
MaskValueString "48|0"
System {
Name "Derivative"
Location [337, 505, 636, 660]
Open off
ModelBrowserVisibility off
ModelBrowserWidth 200
ScreenColor "white"
PaperOrientation "landscape"
PaperPositionMode "auto"
PaperType "A4"
PaperUnits "centimeters"
ZoomFactor "100"
Block {
BlockType Inport
Name "in_1"
Position [20, 50, 40, 70]
}
Block {
BlockType Gain
Name "Gain1"
Position [120, 55, 140, 75]
Gain "1/(0.125*Td)"
}
Block {
BlockType Gain
Name "Gain2"
Position [185, 20, 205, 40]
Gain "Td"
}
Block {
BlockType Integrator
Name "Integrator"
Ports [1, 1]
Position [170, 55, 190, 75]
InitialCondition "ic"
}
Block {
BlockType Sum
Name "Sum1"
Ports [2, 1]
Position [225, 20, 245, 40]
NamePlacement "alternate"
IconShape "round"
Inputs "|++"
OutDataTypeMode "Inherit via internal rule"
}
Block {
BlockType Sum
Name "Sum2"
Ports [2, 1]
Position [70, 55, 90, 75]
Inputs "+-"
}
Block {
BlockType Outport
Name "out_1"
Position [265, 20, 285, 40]
}
Line {
SrcBlock "Integrator"
SrcPort 1
Points [40, 0]
Branch {
Points [0, 45; -180, 0]
DstBlock "Sum2"
DstPort 2
}
Branch {
Points [0, 0]
DstBlock "Sum1"
DstPort 2
}
}
Line {
SrcBlock "in_1"
SrcPort 1
DstBlock "Sum2"
DstPort 1
}
Line {
SrcBlock "Gain1"
SrcPort 1
Points [5, 0]
Branch {
DstBlock "Integrator"
DstPort 1
}
Branch {
Points [0, -35]
DstBlock "Gain2"
DstPort 1
}
}
Line {
SrcBlock "Sum2"
SrcPort 1
DstBlock "Gain1"
DstPort 1
}
Line {
SrcBlock "Gain2"
SrcPort 1
DstBlock "Sum1"
DstPort 1
}
Line {
SrcBlock "Sum1"
SrcPort 1
DstBlock "out_1"
DstPort 1
}
}
}
}
}



Kelvin B. Hales
Kelvin Hales Associates Limited
Consulting Control Engineers
Web: www.khace.com
m***@gmail.com
2013-02-03 06:54:08 UTC
Permalink
Post by priya santhanam
hi
i am creating a control model using matlab/simulink. I am using a
PID controller block for controlling the system output. But for any
value of the derivative gain i give in the PID block, i am getting an
error which goes like this..
Derivative input 1 of block 'system2test/Subsystem/Integrator' at
time 2.450632977396823e-035 is Inf or NaN. Stopping simulation.
There may be a singularity in the solution. If not, try reducing the
step size (either by reducing the fixed step size or by tightening
the error tolerances)
How do i solve this problem?I tried using a saturation block but it
proved futile.
If somebody has a solution to this problem, please help me out.
regds
priya
Hi guys,
I have same problem but in integrator(1/s)
in a generator.please help me?

Loading...