PSCAD, Matlab interfacing
조회 수: 14 (최근 30일)
이전 댓글 표시
I have simulation program called PSCAD which contains PID controller. I put Kp as a variable that get its value from matlab file(.m). The matlab file contains if and for loops (bacterial foraging algorithm) to determine the value of Kp. The time step for pscad execution the simulation is 0.001 sec, i.e (every 0.001 sec the program call the matlab file to get Kp) to run the simulation. All i want to know that how to make matlab file time step is 0.001 sec to be equal to pscad time step.
댓글 수: 1
Mohsen Arzani
2021년 2월 25일
Dear Mohamed,
I am doing the same research with the PSCAD and MATLAB interface. The problem is that the PSCAD can not detect any version of the installed MATLAB. I would appreciate if you could help me at:
moh.arzani@gmail.com
Thanks a lot. :))
답변 (3개)
D S Acharya
2023년 10월 14일
I hope the following links will be of some help to you in solving issues related to MATLAB-PSACAD interfacing:
댓글 수: 0
MULI
2024년 11월 8일 5:46
Hi Mohamed,
To synchronize the timing of your MATLAB script with the PSCAD simulation, you need to ensure that your MATLAB code runs and updates the ‘Kp’ value every 0.001 seconds.
- Implement a timing mechanism in your MATLAB script to ensure that each iteration of updating ‘Kp’ is completed within the specified time step.
- Use ‘tic’ and ‘toc’ to measure execution time, ensuring that the function execution aligns with the 0.001-second interval.
Here is an example which demonstrates the updating of Kp value at every 0.001 sec
function Kp = getUpdatedKp()
persistent iteration;
persistent Kp;
if isempty(iteration)
iteration = 1;
Kp = 1; % Initial Kp value
end
tic; % Start timing
% Perform the bacterial foraging algorithm or other updates to Kp
Kp = Kp + 0.1 * randn; % Example update
% Enforce the 0.001-second time step
while toc < 0.001
% Busy-wait until 0.001 seconds have elapsed
end
iteration = iteration + 1;
end
For more information on using tic and toc, you can refer to the following links
댓글 수: 0
ahmed ali
2024년 11월 18일 15:14
Hi Mohamed /Mohsen,
CAn you please follow the below link, hopefully it answers your query
I will quote from the PSCAD manual the following for your convenince
"To try and speed up the MATLAB solution, it is often a good idea to try and use a larger time step when invoking MATLAB components (wherever possible or practical). An enable/disable switch can also be implemented, so as to allow PSCAD to operate at close to full speed".
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Power and Energy Systems에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!