UAV Guidance Model 블록을 사용하여 고충실도 UAV 모델 근사하기
시뮬레이션 모델은 개발 단계에 따라 다른 수준의 충실도가 필요한 경우가 많습니다. 신속 프로토타이핑 단계 중에는 다양한 자율 알고리즘을 테스트하기 위해 파라미터를 빠르게 실험하고 조정해야 할 수 있습니다. 프로덕션 개발 단계에서는 충실도가 증가하는 모델에 대해 알고리즘을 검증해야 할 수 있습니다.
이 예제에서는 Guidance Model 블록을 사용하여 고충실도 모델을 근사하고 이를 사용하여 웨이포인트 추종 내비게이션 시스템을 프로토타이핑하고 조정하는 방법을 보여줍니다. Tuning Waypoint Following Controller for Fixed-Wing UAV 항목을 참조하십시오. 동일한 내비게이션 시스템을 고충실도 모델과 비교 테스트하여 성능을 검증합니다.
예제 모델에서는 플랜트 모델과 중간 수준의 내장된 오토파일럿으로 구성된 고충실도 UAV(무인 항공기) 모델을 사용합니다. 이 모델에는 1,000개에 가까운 블록이 포함되어 있으며 이 모델로 작업하는 것은 상당히 복잡합니다. 개발 프로세스의 첫 번째 단계로 이 고충실도 모델과 UAV Guidance Model 블록 간에 전환할 수 있는 Variant 시스템을 만들었습니다. 이 고충실도 모델은 File Exchange 항목, Simulink Drone Reference Application에서 추출된 것입니다.
다양한 충실도의 UAV 모델
uavModel = 'FixedWingModel.slx';
open_system(uavModel);이 모델과 연결된 데이터 사전에 저장되어 있는 MATLAB® 변수 값을 변경하여 저충실도 모델과 고충실도 모델 간에 전환할 수 있습니다.
plantDataDictionary = Simulink.data.dictionary.open('pathFollowingData.sldd'); plantDataSet = getSection(plantDataDictionary,'Design Data'); % Switch to high-fidelity model assignin(plantDataSet,'useHighFidelity',1);

% Switch to low-fidelity model assignin(plantDataSet,'useHighFidelity',0);

저충실도 유도 모델을 사용하여 고충실도 고정익 모델 근사하기
UAV Guidance Model 블록을 사용하여 고충실도 모델을 근사하려면 모델에 입력할 계단 제어 신호를 만들고 RollAngle 명령, Height 명령, AirSpeed 명령에 대한 계단 응답을 관찰합니다.
stepModel = 'stepResponse';
open_system(stepModel)
우선, 롤 각도를 변경하도록 명령합니다.
controlBlock = get_param('stepResponse/Step Control Input','Object'); controlBlock.StepControl = 'RollAngle Step Control'; assignin(plantDataSet,'useHighFidelity',1); sim(stepModel);
### Searching for referenced models in model 'stepResponse'. ### Total of 2 models to build. ### Starting serial model build. ### Model reference simulation target for PlantModel is up to date. ### Model reference simulation target for FixedWingModel is up to date. Build Summary 0 of 2 models built (2 models already up to date) Build duration: 0h 0m 19.999s
highFidelityRollAngle = RollAngle.Data(:); highFidelityTime = RollAngle.Time; figure() plot(highFidelityTime, highFidelityRollAngle,'--r'); title('Roll Angle Step Response')

위의 시뮬레이션 결과를 확대하면 고충실도 모델에 내장된 롤 각도 제어기의 특성을 살펴볼 수 있습니다. 롤 각도의 정착 시간은 2.5초에 가깝습니다.
xlim([75 80]) ylim([-0.1 0.548])

2차 PD 제어기에서 임계 감쇠 시스템을 사용하여 이 정착 시간을 달성하려면 다음 이득을 사용하여 UAV 모델의 저충실도 Variant 내부에 UAV Guidance Model 블록을 구성해야 합니다. 이 예제에서는 여러 실행의 속도를 높이기 위해 코드 생성을 사용하여 UAV Guidance Model 블록을 시뮬레이션합니다. 블록 파라미터를 참조하십시오.
zeta = 1.0; % critically damped ts = 2.5; % 2 percent settling time wn = 5.8335/(ts*zeta); newRollPD = [wn^2 2*zeta*wn];
새 이득을 설정하고 저충실도 모델에 대한 계단 응답을 시뮬레이션합니다. 이를 원래 응답과 비교합니다.
load_system(uavModel) set_param('FixedWingModel/FixedWingModel/LowFidelity/Fixed Wing UAV Guidance Model',... 'PDRollFixedWing',strcat('[',num2str(newRollPD),']')) save_system(uavModel) assignin(plantDataSet, 'useHighFidelity', 0); sim(stepModel);
### Searching for referenced models in model 'stepResponse'. ### Total of 1 models to build. ### Starting serial model build. ### Successfully updated the model reference simulation target for: FixedWingModel Build Summary Model reference simulation targets: Model Build Reason Status Build Duration ====================================================================================================== FixedWingModel Model or library FixedWingModel changed. Code generated and compiled. 0h 0m 24.619s 1 of 1 models built (0 models already up to date) Build duration: 0h 0m 25.204s
lowFidelityRollAngle = RollAngle.Data(:); lowFidelityTime = RollAngle.Time; hold on; plot(lowFidelityTime, lowFidelityRollAngle,'-b'); legend('High-Fidelity Response', 'Low-Fidelity Response', 'Location','southeast');

저충실도 모델은 유사한 계단 응답을 달성합니다. 마찬가지로, 다른 두 제어 채널인 Height와 AirSpeed를 조정할 수 있습니다. 여기에서는 제어 응답을 시각적으로 검토하는 대신 더 정교한 방법을 사용하여 제어 이득을 최적화할 수 있습니다. 고충실도 UAV 모델 동작에 대한 추가 분석을 수행하려면 System Identification Toolbox®를 사용해 보십시오.
controlBlock.StepControl = 'AirSpeed Step Control'; assignin(plantDataSet, 'useHighFidelity', 0); sim(stepModel);
### Searching for referenced models in model 'stepResponse'. ### Total of 1 models to build. ### Starting serial model build. ### Model reference simulation target for FixedWingModel is up to date. Build Summary 0 of 1 models built (1 models already up to date) Build duration: 0h 0m 1.7137s
lowFidelityAirSpeed = AirSpeed.Data(:);
lowFidelityTime = AirSpeed.Time;
assignin(plantDataSet, 'useHighFidelity', 1);
sim(stepModel);### Searching for referenced models in model 'stepResponse'. ### Total of 2 models to build. ### Starting serial model build. ### Model reference simulation target for PlantModel is up to date. VarDim N, SF N, concat N, TLC YVarDim N, SF N, concat N, TLC YVarDim N, SF N, concat N, TLC YVarDim N, SF N, concat N, TLC Y### Successfully updated the model reference simulation target for: FixedWingModel Build Summary Model reference simulation targets: Model Build Reason Status Build Duration ==================================================================================================================================== FixedWingModel Variant control useHighFidelity == 1 value changed from false to true. Code generated and compiled. 0h 0m 31.406s 1 of 2 models built (1 models already up to date) Build duration: 0h 0m 38.299s
highFidelityAirSpeed = AirSpeed.Data(:); highFidelityTime = AirSpeed.Time; figure() plot(lowFidelityTime, lowFidelityAirSpeed,'-b'); hold on; plot(highFidelityTime, highFidelityAirSpeed,'--r'); legend('Low-Fidelity Response', 'High-Fidelity Response', 'Location','southeast'); title('Air Speed Step Response') xlim([70 80]) ylim([17.5 19.2])

controlBlock.StepControl = 'Height Step Control'; assignin(plantDataSet, 'useHighFidelity', 0); sim(stepModel);
### Searching for referenced models in model 'stepResponse'. ### Total of 1 models to build. ### Starting serial model build. ### Successfully updated the model reference simulation target for: FixedWingModel Build Summary Model reference simulation targets: Model Build Reason Status Build Duration ==================================================================================================================================== FixedWingModel Variant control useHighFidelity == 1 value changed from true to false. Code generated and compiled. 0h 0m 19.668s 1 of 1 models built (0 models already up to date) Build duration: 0h 0m 20.106s
lowFidelityHeight = Height.Data(:);
lowFidelityTime = Height.Time;
assignin(plantDataSet, 'useHighFidelity', 1);
sim(stepModel);### Searching for referenced models in model 'stepResponse'. ### Total of 2 models to build. ### Starting serial model build. ### Model reference simulation target for PlantModel is up to date. VarDim N, SF N, concat N, TLC YVarDim N, SF N, concat N, TLC YVarDim N, SF N, concat N, TLC YVarDim N, SF N, concat N, TLC Y### Successfully updated the model reference simulation target for: FixedWingModel Build Summary Model reference simulation targets: Model Build Reason Status Build Duration ==================================================================================================================================== FixedWingModel Variant control useHighFidelity == 1 value changed from false to true. Code generated and compiled. 0h 0m 29.576s 1 of 2 models built (1 models already up to date) Build duration: 0h 0m 36.618s
highFidelityHeight = Height.Data(:); highFidelityTime = Height.Time; figure() plot(lowFidelityTime, lowFidelityHeight,'-b'); hold on; plot(highFidelityTime, highFidelityHeight,'--r'); legend('Low-Fidelity Response', 'High-Fidelity Response', 'Location','southeast'); title('Height Step Response') xlim([70 150]) ylim([49 56])

저충실도 모델을 사용하여 내비게이션 알고리즘 테스트하기
이제 UAV Guidance Model 블록을 사용하여 고충실도 모델을 근사했으므로 이를 Tuning Waypoint Following Controller for Fixed-Wing UAV 예제의 UAV Guidance Model 블록으로 대체해 볼 수 있습니다. 다양한 충실도의 모델에 대해 전방 탐색 거리 이득과 방향 제어 이득의 효과를 테스트합니다.
navigationModel = 'pathFollowing';
open_system(navigationModel);assignin(plantDataSet,'useHighFidelity',0);
sim(navigationModel);### Searching for referenced models in model 'pathFollowing'. ### Total of 1 models to build. ### Starting serial model build. ### Successfully updated the model reference simulation target for: FixedWingModel Build Summary Model reference simulation targets: Model Build Reason Status Build Duration ==================================================================================================================================== FixedWingModel Variant control useHighFidelity == 1 value changed from true to false. Code generated and compiled. 0h 0m 29.41s 1 of 1 models built (0 models already up to date) Build duration: 0h 0m 29.852s
figure visualizeSimStates(simStates);

고충실도 모델을 사용하여 검증하기
assignin(plantDataSet,'useHighFidelity',1);
sim(navigationModel);### Searching for referenced models in model 'pathFollowing'. ### Total of 2 models to build. ### Starting serial model build. ### Model reference simulation target for PlantModel is up to date. VarDim N, SF N, concat N, TLC YVarDim N, SF N, concat N, TLC YVarDim N, SF N, concat N, TLC YVarDim N, SF N, concat N, TLC Y### Successfully updated the model reference simulation target for: FixedWingModel Build Summary Model reference simulation targets: Model Build Reason Status Build Duration ==================================================================================================================================== FixedWingModel Variant control useHighFidelity == 1 value changed from false to true. Code generated and compiled. 0h 0m 44.879s 1 of 2 models built (1 models already up to date) Build duration: 0h 1m 2.9506s
figure visualizeSimStates(simStates);

결론
이 예제에서는 고정익 UAV의 저충실도 추상화를 사용하여 고충실도 모델을 근사하는 방법을 보여줍니다. 반대되는 접근법을 사용하여 고충실도 모델에 대한 오토파일럿 제어 이득을 선택할 수도 있습니다. 먼저 다양한 테스트 시나리오에서 저충실도 모델을 시뮬레이션하여 오토파일럿 제어 응답의 허용 가능한 특성을 결정한 다음, 그에 따라 고충실도 모델 오토파일럿을 조정할 수 있습니다.
discardChanges(plantDataDictionary); clear plantDataSet clear plantDataDictionary close_system(uavModel, 0); close_system(stepModel, 0); close_system(navigationModel, 0);
참고 항목
Guidance Model | fixedwing | multirotor