&
Các loại động cơ một chiều
Động cơ một chiều được ứng dụng rộng rãi trong rất nhiều lĩnh vực. Các đề tài về thiết kế bộ điều khiển cho động cơ một chiều cũng được đề cập rất nhiều trong các sách, báo, tạp chí và trên Internet. Trong nhiều tài liệu, bài toán điều khiển động cơ điện một chiều thường được dùng để minh họa cho các ví dụ thiết kế vì tính đơn giản và khá thiết thực. Mô hình toán động cơ điện một chiều khá đơn giản mà lại có thể minh họa bài toán điều khiển với nhiều mạch vòng.
                
              
                                            
                                
            
 
            
                 58 trang
58 trang | 
Chia sẻ: huongnhu95 | Lượt xem: 692 | Lượt tải: 1 
              
            Tóm tắt tài liệu Giáo trình Các loại động cơ một chiều, để xem tài liệu hoàn chỉnh bạn click vào nút DOWNLOAD ở trên
Tài liệu này cũng không nằm ngoài mục đích kể trên. Chúng ta sẽ áp dụng lý thuyết điều khiển cơ bản theo từng bước một thông qua bài toán điều khiển tốc độ động cơ một chiều. Công cụ Matlab/Simulink được sử dụng trong thiết kế vừa giúp chúng ta nhanh chóng tìm ra được mô hình cần thiết nhờ các hàm toán học mạnh mẽ của Matlab vừa minh họa cho các lệnh của Matlab thông qua Control system toolbox. Với mục tiêu là không những có thể giải quyết một cách thấu đáo bài toán điều khiển tốc độ động cơ một chiều trên không gian trạng thái mà còn thông qua đó làm sáng tỏ thêm phần lý thuyết cơ bản trong một ứng dụng cụ thể. Chính vì lý do đó nên phần phân tích và thiết kế nói chung sẽ được thực hiện nhiều trên nền các lệnh của Matlab. Đồng thời phần Simulink cũng được sử dụng một cách thích hợp để kiểm chứng phần lý thuyết.
Do bài toán điều khiển tốc độ động cơ một chiều có thể được mở rộng ra, sử dụng nhiều loại điều khiển khác nhau như PID tương tự, PID số, điều khiển theo phương pháp đặt cực, quan sát trạng thái, điều khiển tối ưu, LQG... nên không thể hoàn thành sớm ngay được tất cả các phần theo mong muốn. Do đó tài liệu này sẽ được cập nhật, sửa chữa và bổ sung thường xuyên. Thậm chí cả cấu trúc của tài liệu cũng sẽ được thay đổi cho phù hợp.
1. Mô hình hóa và khảo sát các đặc tính của động cơ một chiều
Mô hình không gian trạng thái của động cơ một chiều
Các phương trình động học cơ bản
- Phương trình cân bằng điện áp phần ứng
(1)
- Sức điện động phần ứng
(2)
- Phương trình chuyển động
Trong đó:
. là mômen điện từ.
(3)
. là mômen cản của tải.
. là tốc độ góc của rotor.
. là mômen quán tính của động cơ.
Mặt khác, do (n tính theo vòng/giây), nên ta có thể viết
(1)
- Hằng số động cơ
(5)
Xem [MATSIM01]Tr.291.
Hệ phương trình không gian trạng thái
Từ các phương trình cơ bản trên ta có thể viết hệ phương trình mô tả không gian trạng thái của động cơ một chiều như sau:
(2)
Hệ phương trình này có hai biến trạng thái và n. Các tín hiệu vào là điện áp và mômen cản của tải . 
Giả sử các biến trạng thái và n là đo được, viết lại hệ phương trình trên dưới dạng ma trận ta có
(3)
Hay dưới dạng ngắn gọn
(4)
Trong đó
(5)
(6)
(7)
(8)
Biến trạng thái , tín hiệu vào .
Các đặc tính vòng hở trong miền thời gian
Từ các phương trình (001) hay (002) ta có thể viết lệnh Matlab mô tả không gian trạng thái của động cơ một chiều như sau:
Ra = 0.25;
La = 0.004;
Phi = 0.04;
J = 0.012;
Km = 38.2;
Ke = 2*pi*Km;
A_m = [-Ra/La -Ke*Phi/La; Km*Phi/2/pi/J 0];
B_m = [1/La 0; 0 -1/2/pi/J];
C_m = [1 0; 0 1];
D_m = [0 0; 0 0];
G_m = ss(A_m, B_m, C_m, D_m);
minfo(G_m)
Khi chạy m-file này, Matlab sẽ tạo ra mô hình không gian trạng thái của động cơ một chiều được lưu ở biến G_m qua lệnh:
G_m = ss(A_m, B_m, C_m, D_m);
Lệnh minfo(G_m) cho biết thông tin về mô hình đối tượng
MATLAB ss object: 2 states 2 outputs 2 inputs 
Hình 1: Mô hình G_m của động cơ một chiều
Ta có thể sử dụng các lệnh sau để vẽ đáp ứng bước nhảy và phân phố các điểm cực của hệ
 matlab code
figure(1);
step(G_m);
figure(2);
plot(eig(G_m),'r*');
grid on;
Các đặc tính vòng hở trong miền tần số
Với mô hình không gian trạng thái đã lập, mô hình của DCM có thể được vẽ như sau
Như vậy, nó là một hệ hai đầu vào, hai đầu ra. Đầu vào thứ nhất là điện áp phần ứng U_a, đầu vào thứ hai là mômen tải T_L, đầu ra thứ nhất là dòng điện phần ứng I_a và đầu ra thứ hai chính là tốc độ n.
Trong cú pháp của biểu đồ Bode
--bodemag(G_m(1,1),'r',G_m(1,2),'b', G_m(2,1),'g',G_m(2,2),'m', logspace(-1,5,500));--
thì:
- G_m là mô hình trạng thái của đối tượng.
- Viết G_m(out, in) nghĩa là biểu đồ Bode được vẽ cho đáp ứng của đầu ra --out-- đối với đầu vào --in--. Như vậy
G_m(2,1) là đáp ứng đầu ra số 2 (tốc độ n) đối với đầu vào số 1 (điện áp phần ứng U_a).
- Các chữ cái --r--, --b--, --g--, --m-- là chỉ màu của các đường vẽ.
- Lệnh --logspace(-1,5,500)-- để biểu diễn trục tần số theo Logarit từ 10^{-1} đến 10^5 với 500 điểm vẽ.
--Ý nghĩa của biểu đồ Bode--
Biểu đồ Bode phản ánh mối quan hệ giữa tần số - biên độ và cả pha nữa nếu vẽ đầy đủ (cái này để sau) nên còn gọi là đặc tính tần-biên-pha.
Ví dụ, --bodemag(G_m(2,1))-- cho biết biên độ của tín hiệu ra ở kênh 2 theo tần số ở đầu vào kênh 1. Nghĩa là sự phụ thuộc của tốc độ đầu ra theo tần số của tín hiệu điều khiển U_a ở đầu vào số 1.
Đó chính là ý nghĩa của biểu đồ Bode. Nó có vai trò rất quan trọng trong việc khảo sát hệ.
matlab code
 1. Ra = 0.25;
 2. La = 0.004;
 3. Phi = 0.04;
 4. J = 0.012;
 5. Km = 38.2;
 6. Ke = 2*pi*Km;
 7.
 8. A_m = [-Ra/La -Ke*Phi/La; Km*Phi/2/pi/J 0];
 9. B_m = [1/La 0; 0 -1/2/pi/J];
 10. C_m = [1 0; 0 1];
 11. D_m = [0 0; 0 0];
 12.
 13. G_m = ss(A_m, B_m, C_m, D_m);
 14. minfo(G_m)
 15.
 16. figure(1);
 17. bodemag(G_m(1,1),'r--',G_m(1,2),'b--', logspace(-1,5,500));
 18. title('Bieu do bien do Bode - He tuong tu');
 19. legend('Ua - n', 'T_L - n', 3);
 20. grid on,
 21.
 22. T = 0.0025; %SamplingTime
 23.
 24. U = eye(2);
 25.
 26. A_md = U + A_m*T;
 27. B_md = B_m*T;
 28. C_md = C_m;
 29. D_md = D_m;
 30.
 31. G_md = ss(A_md, B_md, C_md, D_md);
 32. minfo(G_md);
 33.
 34. figure(2);
 35. bodemag(G_md(1,1),'r--',G_md(1,2),'b--', logspace(-1,5,500));
 36. title('Bieu do bien do Bode - He roi rac');
 37. legend('Ua - n', 'T_L - n', 3);
 38. grid on
Mô phỏng động cơ một chiều
Bây giờ ta có thể xây dựng mô hình mô phỏng động cơ một chiều chạy không tải (mômen cản của tải T_L=0) dựa trên mô hình vừa xây dựng như sau
Lưu ý nhập các ma trận của mô hình bằng cách kích kép chuột lên khối không gian trạng thái sau đó nhập , , và như hình sau
Model {
 Name	 "dcmdl"
 Version	 6.2
 MdlSubVersion	 0
 GraphicalInterface {
 NumRootInports	 0
 NumRootOutports	 0
 ParameterArgumentNames ""
 ComputedModelVersion "1.50"
 NumModelReferences	 0
 NumTestPointedSignals 0
 }
 SavedCharacterEncoding "ibm-5348_P100-1997"
 SaveDefaultBlockParams on
 SampleTimeColors	 off
 LibraryLinkDisplay	 "none"
 WideLines	 off
 ShowLineDimensions	 on
 ShowPortDataTypes	 off
 ShowLoopsOnError	 on
 IgnoreBidirectionalLines off
 ShowStorageClass	 off
 ShowTestPointIcons	 on
 ShowViewerIcons	 on
 SortedOrder	 off
 ExecutionContextIcon	 off
 ShowLinearizationAnnotations on
 RecordCoverage	 off
 CovPath	 "/"
 CovSaveName	 "covdata"
 CovMetricSettings	 "dw"
 CovNameIncrementing	 off
 CovHtmlReporting	 on
 covSaveCumulativeToWorkspaceVar on
 CovSaveSingleToWorkspaceVar on
 CovCumulativeVarName	 "covCumulativeData"
 CovCumulativeReport	 off
 CovReportOnPause	 on
 ScopeRefreshTime	 0.035000
 OverrideScopeRefreshTime on
 DisableAllScopes	 off
 DataTypeOverride	 "UseLocalSettings"
 MinMaxOverflowLogging	 "UseLocalSettings"
 MinMaxOverflowArchiveMode "Overwrite"
 BlockNameDataTip	 off
 BlockParametersDataTip off
 BlockDescriptionStringDataTip	off
 ToolBar	 on
 StatusBar	 on
 BrowserShowLibraryLinks off
 BrowserLookUnderMasks	 off
 Created	 "Thu Sep 29 12:32:07 2005"
 UpdateHistory	 "UpdateHistoryNever"
 ModifiedByFormat	 "%"
 LastModifiedBy	 "hnguyentien"
 ModifiedDateFormat	 "%"
 LastModifiedDate	 "Thu Mar 16 15:03:08 2006"
 ModelVersionFormat	 "1.%"
 ConfigurationManager	 "None"
 LinearizationMsg	 "none"
 Profile	 off
 ParamWorkspaceSource	 "MATLABWorkspace"
 AccelSystemTargetFile	 "accel.tlc"
 AccelTemplateMakefile	 "accel_default_tmf"
 AccelMakeCommand	 "make_rtw"
 TryForcingSFcnDF	 off
 ExtModeBatchMode	 off
 ExtModeEnableFloating	 on
 ExtModeTrigType	 "manual"
 ExtModeTrigMode	 "normal"
 ExtModeTrigPort	 "1"
 ExtModeTrigElement	 "any"
 ExtModeTrigDuration	 1000
 ExtModeTrigDurationFloating "auto"
 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
 StrictBusMsg	 "None"
 ProdHWDeviceType	 "32-bit Generic"
 ShowModelReferenceBlockVersion off
 ShowModelReferenceBlockIO off
 Array {
 Type	 "Handle"
 Dimension	 1
 Simulink.ConfigSet {
 $ObjectID	 1
 Version	 "1.1.0"
 Array {
	Type	"Handle"
	Dimension	7
	Simulink.SolverCC {
	 $ObjectID	 2
	 Version	 "1.1.0"
	 StartTime	 "0.0"
	 StopTime	 "0.2"
	 AbsTol	 "auto"
	 FixedStep	 "auto"
	 InitialStep	 "auto"
	 MaxNumMinSteps	 "-1"
	 MaxOrder	 5
	 ExtrapolationOrder	 4
	 NumberNewtonIterations 1
	 MaxStep	 "auto"
	 MinStep	 "auto"
	 RelTol	 "1e-3"
	 SolverMode	 "Auto"
	 Solver	 "ode23t"
	 SolverName	 "ode23t"
	 ZeroCrossControl	 "UseLocalSettings"
	 AlgebraicLoopSolver	 "TrustRegion"
	 SolverResetMethod	 "Fast"
	 PositivePriorityOrder	 off
	 AutoInsertRateTranBlk	 off
	 SampleTimeConstraint	 "Unconstrained"
	 RateTranMode	 "Deterministic"
	}
	Simulink.DataIOCC {
	 $ObjectID	 3
	 Version	 "1.1.0"
	 Decimation	 "1"
	 ExternalInput	 "[t, u]"
	 FinalStateName	 "xFinal"
	 InitialState	 "xInitial"
	 LimitDataPoints	 on
	 MaxDataPoints	 "1000"
	 LoadExternalInput	 off
	 LoadInitialState	 off
	 SaveFinalState	 off
	 SaveFormat	 "Array"
	 SaveOutput	 on
	 SaveState	 off
	 SignalLogging	 on
	 SaveTime	 on
	 StateSaveName	 "xout"
	 TimeSaveName	 "tout"
	 OutputSaveName	 "yout"
	 SignalLoggingName	 "logsout"
	 OutputOption	 "RefineOutputTimes"
	 OutputTimes	 "[]"
	 Refine	 "1"
	}
	Simulink.OptimizationCC {
	 $ObjectID	 4
	 Array {
	 Type	 "Cell"
	 Dimension	 5
	 Cell	 "ZeroExternalMemoryAtStartup"
	 Cell	 "ZeroInternalMemoryAtStartup"
	 Cell	 "InitFltsAndDblsToZero"
	 Cell	 "OptimizeModelRefInitCode"
	 Cell	 "NoFixptDivByZeroProtection"
	 PropName	 "DisabledProps"
	 }
	 Version	 "1.1.0"
	 BlockReduction	 on
	 BooleanDataType	 on
	 ConditionallyExecuteInputs on
	 InlineParams	 off
	 InlineInvariantSignals off
	 OptimizeBlockIOStorage on
	 BufferReuse	 on
	 EnforceIntegerDowncast on
	 ExpressionFolding	 on
	 FoldNonRolledExpr	 on
	 LocalBlockOutputs	 on
	 ParameterPooling	 on
	 RollThreshold	 5
	 SystemCodeInlineAuto	 off
	 StateBitsets	 off
	 DataBitsets	 off
	 UseTempVars	 off
	 ZeroExternalMemoryAtStartup on
	 ZeroInternalMemoryAtStartup on
	 InitFltsAndDblsToZero	 on
	 NoFixptDivByZeroProtection off
	 EfficientFloat2IntCast off
	 OptimizeModelRefInitCode off
	 LifeSpan	 "inf"
	 BufferReusableBoundary on
	}
	Simulink.DebuggingCC {
	 $ObjectID	 5
	 Version	 "1.1.0"
	 RTPrefix	 "error"
	 ConsistencyChecking	 "none"
	 ArrayBoundsChecking	 "none"
	 SignalInfNanChecking	 "none"
	 AlgebraicLoopMsg	 "warning"
	 ArtificialAlgebraicLoopMsg "warning"
	 CheckSSInitialOutputMsg on
	 CheckExecutionContextPreStartOutputMsg off
	 CheckExecutionContextRuntimeOutputMsg	off
	 SignalResolutionControl "TryResolveAllWithWarning"
	 BlockPriorityViolationMsg "warning"
	 MinStepSizeMsg	 "warning"
	 SolverPrmCheckMsg	 "warning"
	 InheritedTsInSrcMsg	 "warning"
	 DiscreteInheritContinuousMsg "warning"
	 MultiTaskDSMMsg	 "warning"
	 MultiTaskRateTransMsg	 "error"
	 SingleTaskRateTransMsg "none"
	 TasksWithSamePriorityMsg "warning"
	 CheckMatrixSingularityMsg "none"
	 IntegerOverflowMsg	 "warning"
	 Int32ToFloatConvMsg	 "warning"
	 ParameterDowncastMsg	 "error"
	 ParameterOverflowMsg	 "error"
	 ParameterPrecisionLossMsg "warning"
	 UnderSpecifiedDataTypeMsg "none"
	 UnnecessaryDatatypeConvMsg "none"
	 VectorMatrixConversionMsg "none"
	 InvalidFcnCallConnMsg	 "error"
	 FcnCallInpInsideContextMsg "Use local settings"
	 SignalLabelMismatchMsg "none"
	 UnconnectedInputMsg	 "warning"
	 UnconnectedOutputMsg	 "warning"
	 UnconnectedLineMsg	 "warning"
	 SFcnCompatibilityMsg	 "none"
	 UniqueDataStoreMsg	 "none"
	 BusObjectLabelMismatch "warning"
	 RootOutportRequireBusObject "warning"
	 AssertControl	 "UseLocalSettings"
	 EnableOverflowDetection off
	 ModelReferenceIOMsg	 "none"
	 ModelReferenceVersionMismatchMessage "none"
	 ModelReferenceIOMismatchMessage "none"
	 ModelReferenceCSMismatchMessage "none"
	 ModelReferenceSimTargetVerbose off
	 UnknownTsInhSupMsg	 "warning"
	 ModelReferenceDataLoggingMessage "warning"
	 ModelReferenceSymbolNameMessage "warning"
	 ModelReferenceExtraNoncontSigs "error"
	}
	Simulink.HardwareCC {
	 $ObjectID	 6
	 Version	 "1.1.0"
	 ProdBitPerChar	 8
	 ProdBitPerShort	 16
	 ProdBitPerInt	 32
	 ProdBitPerLong	 32
	 ProdIntDivRoundTo	 "Undefined"
	 ProdEndianess	 "Unspecified"
	 ProdWordSize	 32
	 ProdShiftRightIntArith on
	 ProdHWDeviceType	 "32-bit Generic"
	 TargetBitPerChar	 8
	 TargetBitPerShort	 16
	 TargetBitPerInt	 32
	 TargetBitPerLong	 32
	 TargetShiftRightIntArith on
	 TargetIntDivRoundTo	 "Undefined"
	 TargetEndianess	 "Unspecified"
	 TargetWordSize	 32
	 TargetTypeEmulationWarnSuppressLevel 0
	 TargetPreprocMaxBitsSint 32
	 TargetPreprocMaxBitsUint 32
	 TargetHWDeviceType	 "Specified"
	 TargetUnknown	 off
	 ProdEqTarget	 on
	}
	Simulink.ModelReferenceCC {
	 $ObjectID	 7
	 Version	 "1.1.0"
	 UpdateModelReferenceTargets "IfOutOfDateOrStructuralChange"
	 CheckModelReferenceTargetMessage "error"
	 ModelReferenceNumInstancesAllowed "Multi"
	 ModelReferencePassRootInputsByReference on
	 ModelReferenceMinAlgLoopOccurrences off
	}
	Simulink.RTWCC {
	 $BackupClass	 "Simulink.RTWCC"
	 $ObjectID	 8
	 Array {
	 Type	 "Cell"
	 Dimension	 1
	 Cell	 "IncludeHyperlinkInReport"
	 PropName	 "DisabledProps"
	 }
	 Version	 "1.1.0"
	 SystemTargetFile	 "grt.tlc"
	 GenCodeOnly	 off
	 MakeCommand	 "make_rtw"
	 TemplateMakefile	 "grt_default_tmf"
	 GenerateReport	 off
	 SaveLog	 off
	 RTWVerbose	 on
	 RetainRTWFile	 off
	 ProfileTLC	 off
	 TLCDebug	 off
	 TLCCoverage	 off
	 TLCAssert	 off
	 ProcessScriptMode	 "Default"
	 ConfigurationMode	 "Optimized"
	 ConfigAtBuild	 off
	 IncludeHyperlinkInReport off
	 LaunchReport	 off
	 TargetLang	 "C"
	 Array {
	 Type	 "Handle"
	 Dimension	 2
	 Simulink.CodeAppCC {
	 $ObjectID	 9
	 Array {
	Type	"Cell"
	Dimension	9
	Cell	"IgnoreCustomStorageClasses"
	Cell	"InsertBlockDesc"
	Cell	"SFDataObjDesc"
	Cell	"SimulinkDataObjDesc"
	Cell	"DefineNamingRule"
	Cell	"SignalNamingRule"
	Cell	"ParamNamingRule"
	Cell	"InlinedPrmAccess"
	Cell	"CustomSymbolStr"
	PropName	"DisabledProps"
	 }
	 Version	 "1.1.0"
	 ForceParamTrailComments off
	 GenerateComments	 on
	 IgnoreCustomStorageClasses on
	 IncHierarchyInIds	 off
	 MaxIdLength	 31
	 PreserveName	 off
	 PreserveNameWithParent off
	 ShowEliminatedStatement off
	 IncAutoGenComments off
	 SimulinkDataObjDesc off
	 SFDataObjDesc	 off
	 IncDataTypeInIds	 off
	 PrefixModelToSubsysFcnNames on
	 CustomSymbolStr	 "$R$N$M"
	 MangleLength	 1
	 DefineNamingRule	 "None"
	 ParamNamingRule	 "None"
	 SignalNamingRule	 "None"
	 InsertBlockDesc	 off
	 SimulinkBlockComments on
	 EnableCustomComments off
	 InlinedPrmAccess	 "Literals"
	 ReqsInCode	 off
	 }
	 Simulink.GRTTargetCC {
	 $BackupClass	 "Simulink.TargetCC"
	 $ObjectID	 10
	 Array {
	Type	"Cell"
	Dimension	12
	Cell	"IncludeMdlTerminateFcn"
	Cell	"CombineOutputUpdateFcns"
	Cell	"SuppressErrorStatus"
	Cell	"ERTCustomFileBanners"
	Cell	"GenerateSampleERTMain"
	Cell	"MultiInstanceERTCode"
	Cell	"PurelyIntegerCode"
	Cell	"SupportNonFinite"
	Cell	"SupportComplex"
	Cell	"SupportAbsoluteTime"
	Cell	"SupportContinuousTime"
	Cell	"SupportNonInlinedSFcns"
	PropName	"DisabledProps"
	 }
	 Version	 "1.1.0"
	 TargetFcnLib	 "ansi_tfl_tmw.mat"
	 TargetLibSuffix	 ""
	 TargetPreCompLibLocation ""
	 GenFloatMathFcnCalls "ANSI_C"
	 UtilityFuncGeneration "Auto"
	 GenerateFullHeader on
	 GenerateSampleERTMain off
	 IsPILTarget	 off
	 ModelReferenceCompliant on
	 IncludeMdlTerminateFcn on
	 CombineOutputUpdateFcns off
	 SuppressErrorStatus off
	 IncludeFileDelimiter "Auto"
	 ERTCustomFileBanners off
	 SupportAbsoluteTime on
	 LogVarNameModifier "rt_"
	 MatFileLogging	 on
	 MultiInstanceERTCode off
	 SupportNonFinite	 on
	 SupportComplex	 on
	 PurelyIntegerCode	 off
	 SupportContinuousTime on
	 SupportNonInlinedSFcns on
	 ExtMode	 off
	 ExtModeStaticAlloc off
	 ExtModeTesting	 off
	 ExtModeStaticAllocSize 1000000
	 ExtModeTransport	 0
	 ExtModeMexFile	 "ext_comm"
	 RTWCAPISignals	 off
	 RTWCAPIParams	 off
	 RTWCAPIStates	 off
	 GenerateASAP2	 off
	 }
	 PropName	 "Components"
	 }
	}
	PropName	"Components"
 }
 Name	 "Configuration"
 SimulationMode	 "normal"
 CurrentDlgPage	 "Solver"
 }
 PropName	 "ConfigurationSets"
 }
 Simulink.ConfigSet {
 $PropName	 "ActiveConfigurationSet"
 $ObjectID	 1
 }
 BlockDefaults {
 Orientation	 "right"
 ForegroundColor	 "black"
 BackgroundColor	 "white"
 DropShadow	 off
 NamePlacement	 "normal"
 FontName	 "Helvetica"
 FontSize	 10
 FontWeight	 "normal"
 FontAngle	 "normal"
 ShowName	 on
 }
 BlockParameterDefaults {
 Block {
 BlockType	 Constant
 Value	 "1"
 VectorParams1D	 on
 OutDataTypeMode	 "Inherit from 'Constant value'"
 OutDataType	 "sfix(16)"
 ConRadixGroup	 "Use specified scaling"
 OutScaling	 "2^0"
 SampleTime	 "inf"
 }
 Block {
 BlockType	 Demux
 Outputs	 "4"
 DisplayOption	 "none"
 BusSelectionMode	 off
 }
 Block {
 BlockType	 Gain
 Gain	 "1"
 Multiplication	 "Element-wise(K.*u)"
 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
 SampleTime	 "-1"
 }
 Block {
 BlockType	 Mux
 Inputs	 "4"
 DisplayOption	 "none"
 UseBusObject	 off
 BusObject	 "BusObject"
 NonVirtualBus	 off
 }
 Block {
 BlockType	 Scope
 Floating	 off
 ModelBased	 off
 TickLabels	 "OneTimeTick"
 ZoomMode	 "on"
 Grid	 "on"
 TimeRange	 "auto"
 YMin	 "-5"
 YMax	 "5"
 SaveToWorkspace	 off
 SaveName	 "ScopeData"
 LimitDataPoints	 on
 MaxDataPoints	 "5000"
 Decimation	 "1"
 SampleInput	 off
 SampleTime	 "0"
 }
 Block {
 BlockType	 StateSpace
 A	 "1"
 B	 "1"
 C	 "1"
 D	 "1"
 X0	 "0"
 AbsoluteTolerance	 "auto"
 Realization	 "auto"
 }
 Block {
 BlockType	 Step
 Time	 "1"
 Before	 "0"
 After	 "1"
 SampleTime	 "-1"
 VectorParams1D	 on
 ZeroCross	 on
 }
 Block {
 BlockType	 ToWorkspace
 VariableName	 "simulink_output"
 MaxDataPoints	 "1000"
 Decimation	 "1"
 SampleTime	 "0"
 FixptAsFi	 off
 }
 }
 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	 "dcmdl"
 Location	 [317, 255, 691, 402]
 Open	 on
 ModelBrowserVisibility off
 ModelBrowserWidth	 200
 ScreenColor	 "white"
 PaperOrientation	 "landscape"
 PaperPositionMode	 "auto"
 PaperType	 "A4"
 PaperUnits	 "centimeters"
 ZoomFactor	 "100"
 ReportName	 "simulink-default.rpt"
 Block {
 BlockType	 Constant
 Name	 "Constant"
 Position	 [15, 70, 45, 100]
 Value	 "0"
 }
 Block {
 BlockType	 StateSpace
 Name	 "DCMOTOR"
 Position	 [120, 23, 180, 57]
 BackgroundColor	 "green"
 A	 "A_m"
 B	 "B_m"
 C	 "C_m"
 D	 "D_m"
 }
 Block {
 BlockType	 Demux
 Name	 "Demux"
 Ports	 [1, 2]
 Position	 [210, 21, 215, 59]
 BackgroundColor	 "black"
 ShowName	 off
 Outputs	 "2"
 DisplayOption	 "bar"
 }
 Block {
 BlockType	 Gain
 Name	 "Gain"
 Position	 [260, 38, 285, 62]
 Gain	 "60"
 ParameterDataTypeMode "Inherit via internal rule"
 OutDataTypeMode	 "Inherit via internal rule"
 SaturateOnIntegerOverflow	off
 }
 Block {
 BlockType	 Mux
 Name	 "Mux"
 Ports	 [2, 1]
 Position	 [85, 19, 90, 61]
 ShowName	 off
 Inputs	 "2"
 DisplayOption	 "bar"
 }
 Block {
 BlockType	 Scope
 Name	 "i-n"
 Ports	 [2]
 Position	 [315, 19, 345, 61]
 BackgroundColor	 "gray"
 Location	 [107, 184, 559, 626]
 Open	 on
 NumInputPorts	 "2"
 List {
	ListType	AxesTitles
	axes1	"Dong phan ung (A)"
	axes2	"Toc do (vong/phut)"
 }
 TimeRange	 "0.2"
 YMin	 "-30~0"
 YMax	 "50~600"
 DataFormat	 "StructureWithTime"
 }
 Block {
 BlockType	 ToWorkspace
 Name	 "speed"
 Position	 [315, 84, 345, 116]
 VariableName	 "n"
 MaxDataPoints	 "inf"
 SampleTime	 "-1"
 SaveFormat	 "Structure With Time"
 }
 Block {
 BlockType	 Step
 Name	 "u_a"
 Position	 [15, 15, 45, 45]
 BackgroundColor	 "magenta"
 Time	 "0"
 After	 "50"
 SampleTime	 "0"
 }
 Line {
 SrcBlock	 "Mux"
 SrcPort	 1
 DstBlock	 "DCMOTOR"
 DstPort	 1
 }
 Line {
 SrcBlock	 "u_a"
 SrcPort	 1
 DstBlock	 "Mux"
 DstPort	 1
 }
 Line {
 SrcBlock	 "Constant"
 SrcPort	 1
 Points	 [10, 0; 0, -35]
 DstBlock	 "Mux"
 DstPort	 2
 }
 Line {
 SrcBlock	 "DCMOTOR"
 SrcPort	 1
 DstBlock	 "Demux"
 DstPort	 1
 }
 Line {
 SrcBlock	 "Demux"
 SrcPort	 1
 DstBlock	 "i-n"
 DstPort	 1
 }
 Line {
 SrcBlock	 "Demux"
 SrcPort	 2
 Points	 [15, 0]
 Branch {
	Points	[0, 50]
	DstBlock	"speed"
	DstPort	1
 }
 Branch {
	DstBlock	"Gain"
	DstPort	1
 }
 }
 Line {
 SrcBlock	 "Gain"
 SrcPort	 1
 DstBlock	 "i-n"
 DstPort	 2
 }
 }
}
Kết quả mô phỏng như sau
2. Phương pháp thiết kế
Các mạch vòng điều chỉnh
Sơ đồ khối của các mạch vòng có thể được mô tả như sau:
Trong đó là bộ điều chỉnh tốc độ, là bộ điều chỉnh dòng điện. Như vậy là ta cần phải có hai bộ điều khiển PID cho hai mạch vòng.
Tuy nhiên, ta có thể thiết kế bộ điều khiển cho mạch vòng dòng điện trước, sơ đồ như sau:
Còn để nối các khối với nhau thì ta có thể dùng lệnh
>> help connect
Sau đó chọn 
-- Reference page in Help browser
doc connect--
để xem chi tiết hơn.
Chú ý:
- Bài toán ở đây là điều khiển tốc độ (hay vị trí) của động cơ. Tín hiệu đặt là tốc độ , tín hiệu cần điều khiển là tốc độ thực đầu ra sẽ được phản hồi về so sánh với tốc độ đặt .
- Từ tốc độ, bộ điều khiển tốc độ phải tính ra dòng cần thiết để tạo ra momen quay cho động cơ, dòng này chính là .
- Với dòng điện yêu cầu như trên, bộ điều khiển dòng sẽ tính ra điện áp cần thiết để đặt vào phần ứng (hay chính là điện áp cần cung cấp cho động cơ) để tạo ra dòng điện thực được phản hồi về so sánh với dòng điện đặt do bộ điều khiển tốc độ cung cấp.
Bài toán tổng thể gồm có hai mạch vòng: mạch vòng trong được gọi là mạch vòng dòng điện vì mục đích của nó là để điều chỉnh dòng. Mạch vòng ngoài là mạch vòng tốc độ. Hệ thống điều khiển có dạng như trên gọi là --Cascade-- (điều khiển lồng nhau).
Cách chúng ta đang thực hiện ở đây là thiết kế từng mạch vòng một, từ trong ra ngoài. Thông thường, mạch vòng trong cùng bao giờ cũng phải có đáp ứng nhanh nhất, càng ra ngoài thì tốc độ đáp ứng càng giảm dần.
Thế còn phân biệt thế nào là "--trạng thái--" và "--đầu ra--"? Các trạng thái mang tính tổng quát hơn, nó phản ánh đúng các trạng thái bên trong của đối tượng (ví dụ vui, buồn, giận dữ...). Các biến trạng thái có thể đo được bằng các thiết bị đo thì có thể đưa ra ngoài được nên được gọi là "--đầu ra--". Nếu tất cả các biến trạng thái đều đo được thì "trạng thái" và "đầu ra" là hoàn toàn giống nhau. Còn nếu có các biến trạng thái không đo được thì phải cần đến bài toán nhận dạng, nghĩa là phải dựa trên cơ sở các biến đầu vào và biến đầu ra đo được để tính ra các biến đó.
Xây dựng hệ thống kín
Trong báo cáo này chúng ta sẽ sử dụng lệnh --Connect-- để xây dựng hệ thống kín. Phần mô tả sau đây chúng tôi dịch từ help của Matlab.
Cú pháp của lệnh này như sau:
sysc = connect(sys,Q,inputs,outputs)
Các hệ thống động học phức tạp thường được cho dưới dạng các sơ đồ khối. Ngay cả với các hệ có độ phức tạp vừa phải thì cũng đã rất khó tìm mô hình không gian trạng thái để sử dụng các công cụ phân tích và thiết kế có sẵn. Bắt đầu với mô tả sơ đồ khối, ta có thể sử dụng các lệnh --append-- và --connect-- để xây dựng một mô hình không gian trạng thái của hệ thống.
Trước tiên, dùng
sys = append(sys1,sys2,...,sysN)
o specify each block sysj in the diagram and form a block-diagonal, unconnected LTI model sys of the diagram. 
Next, use
sysc = connect(sys,Q,inputs,outputs)
o connect the blocks together and derive a state-space model sysc for the overall interconnection. The arguments Q, inputs, and outputs have the following purpose: The matrix Q indicates how the blocks on the diagram are connected. It has a row for each input of sys, where the first element of each row is the input number. The subsequent elements of each row specify where the block input gets its summing inputs; negative elements indicate minus inputs to the summing junction. For example, if input 7 gets its inputs from the outputs 2, 15, and 6, where the input from output 15 is negative, the corresponding row of Q is [7 2 -15 6]. Short rows can be padded with trailing zeros (see example below). Given sys and Q, connect computes a state-space model of the interconnection with the same inputs and outputs as sys (that is, the concatenation of all block inputs and outputs). The index vectors inputs and outputs then indicate which of the inputs and outputs in the large unconnected system are external inputs and outputs of the block diagram. For example, if the external inputs are inputs 1, 2, and 15 of sys, and the external outputs are outputs 2 and 7 of sys, then inputs and outputs should be set to
· inputs = [1 2 15]; 
· outputs = [2 7]
he final model sysc has these particular inputs and outputs. 
Since it is easy to make a mistake entering all the data required for a large model, be sure to verify your model in as many ways as you can. Here are some suggestions: Make sure the poles of the unconnected model sys match the poles of the various blocks in the diagram. Check that the final poles and DC gains are reasonable. Plot the step and bode responses of sysc and compare them with your expectations. 
The connect function does not support delays in a reliable way. If you need to work extensively with block diagrams or you need to interconnect models with time delays, Simulink is a much easier and more comprehensive tool for model building.
--Ví dụ--
onsider the following block diagram. 
Given the matrices of the state-space model sys2 
 matlab code
A = [ -9.0201 17.7791 
 -1.6943 3.2138 ];
B = [ -.5112 .5362
 -.002 -1.8470];
C = [ -3.2897 2.4544
 -13.5009 18.0745];
D = [-.5476 -.1410
 -.6459 .2958 ];
Define the three blocks as individual LTI models. 
 matlab code
sys1 = tf(10,[1 5],'inputname','uc')
sys2 = ss(A,B,C,D,'inputname',{'u1' 'u2'},...
 'outputname',{'y1' 'y2'})
sys3 = zpk(-1,-2,2)
Next append these blocks to form the unconnected model sys. 
 matlab code
sys = append(sys1,sys2,sys3)
This produces the block-diagonal model 
 matlab code
sys
a = 
 x1 x2 x3 x4
 x1 -5 0 0 0
 x2 0 -9.0201 17.779 0
 x3 0 -1.6943 3.2138 0
 x4 0 0 0 -2
b = 
 uc u1 u2 ?
 x1 4 0 0 0
 x2 0 -0.5112 0.5362 0
 x3 0 -0.002 -1.847 0
 x4 0 0 0 1.4142
c = 
 x1 x2 x3 x4
 ? 2.5 0 0 0
 y1 0 -3.2897 2.4544 0
 y2 0 -13.501 18.075 0
 ? 0 0 0 -1.4142
d = 
 uc u1 u2 ?
 ? 0 0 0 0
 y1 0 -0.5476 -0.141 0
 y2 0 -0.6459 0.2958 0
 ? 0 0 0 2
Continuous-time system.
Note that the ordering of the inputs and outputs is the same as the block ordering you chose. Unnamed inputs or outputs are denoted b. 
To derive the overall block diagram model from sys, specify the interconnections and the external inputs and outputs. You need to connect outputs 1 and 4 into input 3 (u2), and output 3 (y2) into input 4. The interconnection matrix Q is therefore 
 matlab code
Q = [3 1 -4
 4 3 0];
Note that the second row of Q has been padded with a trailing zero. The block diagram has two external inputs uc and u1 (inputs 1 and 2 of sys), and two external outputs y1 and y2 (outputs 2 and 3 of sys). Accordingly, set inputs and outputs as follows. 
 matlab code
inputs = [1 2];
outputs = [2 3]; 
You can obtain a state-space model for the overall interconnection by typing 
 matlab code
sysc = connect(sys,Q,inputs,outputs)
a = 
 x1 x2 x3 x4
 x1 -5 0 0 0
 x2 0.84223 0.076636 5.6007 0.47644
 x3 -2.9012 -33.029 45.164 -1.6411
 x4 0.65708 -11.996 16.06 -1.6283
b = 
 uc u1
 x1 4 0
 x2 0 -0.076001
 x3 0 -1.5011
 x4 0 -0.57391
c = 
 x1 x2 x3 x4
 y1 -0.22148 -5.6818 5.6568 -0.12529
 y2 0.46463 -8.4826 11.356 0.26283
d = 
 uc u1
 y1 0 -0.66204
 y2 0 -0.40582
Continuous-time system.
Thiết kế bộ điều khiển PID tương tự
Bộ điều khiển PID tương tự
Bây giờ ta tiếp tục với phần thiết kế bộ điều khiển tương tự.
Chúng ta có hai lựa chọn:
- Thiết kế bằng Simulink: Có thể coi là phương pháp thực nghiệm. Phương pháp thiết kế đơn giản, nhanh chóng, mọi thứ đều có sẵn, cứ nối vào nhau rồi xem kết quả -> chọn kết quả tốt nhất.
- Thiết kế bằng Matlab: Đòi hỏi phải hiểu bài toán, lý thuyết và phải biết lập trình một chút -> khó hơn một chút nhưng sẽ hiểu sâu hơn về lý thuyết và cách thực hiện. Cho phép khảo sát nhiều đặc tính hơn ngay trong quá trình thiết kế cũng như hiểu thêm về các lệnh Matlab dùng trong thiết kế.
Hướng thứ hai sẽ có ích cho những người cần hiểu sâu thêm về cách thiết kế bộ điều khiển. Tuy nhiên, khi làm thì ta nên kết hợp cả hai hướng trên để vừa thiết kế theo lý thuyết vừa có cái để kiểm chứng ngay.
Bây giờ chúng ta bắt đầu với bộ điều khiển dòng (vòng lặp trong)
Ở đây ta chưa cần quan tâm đến tốc độ vội, kệ nó, muốn bằng bao nhiêu cũng được, miễn là ta đặt dòng bằng bao nhiêu thì nó phải ra bấy nhiêu!
Để sử dụng hàm --connect-- ta vẽ lại sơ đồ điều khiển, trong đó đánh số thứ tự các đầu vào của các khối trong hình tròn, số thứ tự của các đầu ra của các khối trong hình vuông như hình sau
Trong đó khối là khối ta sẽ đặt hàm truyền bằng 1. Khối này được vào để tiện khai báo đầu vào ra cho cả hệ mà lệnh --connect-- yêu cầu thôi. Trong thuật toán điều khiển vì hàm truyền của nó bằng 1 nên có nó
            Các file đính kèm theo tài liệu này:
 giao_trinh_cac_loai_dong_co_mot_chieu.doc giao_trinh_cac_loai_dong_co_mot_chieu.doc