AI가 작성한 제어 코드를 5단계 검수 절차를 통해 안전하게 검증
I want you to act as a strict reviewer of PLC code written by an AI, before it is downloaded to a controller. Platform: ${Platform and version}. Language: ${Language}. Below are my numbered requirements, then the code.
Do a review in five passes and report each as a table. Do not rewrite the code.
Pass 1, requirements: Requirement | Where it is met (block/line) | Met / Partly / Not met | Why
Pass 2, instructions: every instruction or function used | Exists on my platform and version? (Yes / No / UNSURE) | Correct parameters and units?
Pass 3, structure: timers or edge detectors called inside IFs or conditional branches, reused instances, outputs written in more than one place, latches with no reset.
Pass 4, behaviour: what happens on first scan, power cycle, download, mode change, and when an input is stuck or a sensor fails.
Pass 5, gaps: anything the code does that no requirement asked for, and requirements with no code at all.
Finish with findings ranked by impact: Finding | Block/line | What goes wrong on the machine | Test that would prove it.
=== REQUIREMENTS ===
${Paste numbered requirements}
=== CODE ===
${Paste code}당신은 AI가 작성한 PLC 코드가 컨트롤러에 다운로드되기 전 이를 엄격하게 검수하는 리뷰어입니다. 플랫폼: [플랫폼 및 버전], 언어: [언어]. 아래 요구사항과 코드를 바탕으로 5단계 리뷰를 수행하고 각 단계를 표로 보고하세요. 코드를 새로 작성하지 마십시오. Pass 1(요구사항): 요구사항 | 충족 위치 | 충족 여부 | 이유 Pass 2(명령어): 사용된 모든 명령/함수 | 해당 플랫폼 지원 여부 | 매개변수 및 단위 정확성 Pass 3(구조): IF문 내 타이머 호출, 인스턴스 재사용, 출력 중복 작성, 리셋 없는 래치 등 확인 Pass 4(동작): 첫 스캔, 전원 사이클, 모드 변경, 센서 고장 시 동작 분석 Pass 5(간극): 요구되지 않은 기능이나 누락된 요구사항 확인 마지막으로 영향도 순으로 발견 사항을 정리하세요: 발견 사항 | 위치 | 기계에서 발생할 문제 | 증명 테스트 방법 === 요구사항 === [요구사항 붙여넣기] === 코드 === [코드 붙여넣기]
출처 · prompts.chat · AI-Generated PLC Code Reviewer — 원문은 출처에 게시된 그대로이며, 권리는 원작자에게 있습니다.
Gemini로 실행한 결과입니다. 입력 항목에는 국내 환경의 예시값을 적용했습니다(AI 생성 — 사실 확인 필요).
I want you to act as a strict reviewer of PLC code written by an AI, before it is downloaded to a controller. Platform: Siemens TIA Portal V17. Language: Structured Text (SCL). Below are my numbered requirements, then the code.
Do a review in five passes and report each as a table. Do not rewrite the code.
Pass 1, requirements: Requirement | Where it is met (block/line) | Met / Partly / Not met | Why
Pass 2, instructions: every instruction or function used | Exists on my platform and version? (Yes / No / UNSURE) | Correct parameters and units?
Pass 3, structure: timers or edge detectors called inside IFs or conditional branches, reused instances, outputs written in more than one place, latches with no reset.
Pass 4, behaviour: what happens on first scan, power cycle, download, mode change, and when an input is stuck or a sensor fails.
Pass 5, gaps: anything the code does that no requirement asked for, and requirements with no code at all.
Finish with findings ranked by impact: Finding | Block/line | What goes wrong on the machine | Test that would prove it.
=== REQUIREMENTS ===
1. StartBtn(I0.0)이 눌리면 Motor(Q0.0)가 가동된다.
2. StopBtn(I0.1)이 눌리면 Motor가 즉시 정지한다.
3. Motor 가동 중 Sensor(I0.2) 신호 없이 10초가 경과하면 Motor를 정지시키고 Alarm(Q0.1)을 출력한다.
=== CODE ===
IF "StartBtn" AND NOT "StopBtn" THEN
"Motor" := TRUE;
ELSIF "StopBtn" THEN
"Motor" := FALSE;
END_IF;
"TON_Instance"(IN:="Motor" AND NOT "Sensor", PT:=T#10s);
IF "TON_Instance".Q THEN
"Motor" := FALSE;
"Alarm" := TRUE;
END_IF;제시된 SCL 코드에 대한 5단계 검토 결과입니다.
Pass 1: 요건 충족 확인
| 요건 | 위치 | 상태 | 이유 |
|---|---|---|---|
| 1 | L1-2 | Met | 시작 조건 충족 |
| 2 | L3-4 | Met | 정지 조건 충족 |
| 3 | L7-11 | Met | 타이머 후 정지 및 알람 출력 |
Pass 2: 명령어 유효성
| 명령어 | TIA V17? | 파라미터/단위 |
|---|---|---|
| IF/ELSIF | Yes | 정상 |
| TON | Yes | T#10s (정상) |
Pass 3: 구조적 결함
Pass 4: 동작 특성
Pass 5: 갭(Gap) 분석
최종 결과 요약 (영향도 순)
| Finding | Block/line | 기계에 미치는 영향 | 증명 테스트 |
|---|---|---|---|
| 이중 출력 | L2,4 vs L9 | PLC 스캔 주기에 따라 Motor가 비정상적으로 떨리거나 오작동함 | 운전 중 타이머 조건을 강제로 트리거하여 Motor 상태 확인 |
| 알람 리셋 부재 | L10 | 알람 발생 후 장비를 재가동할 수 없음 | 타이머 조건 만족 후 StopBtn을 눌러도 Alarm이 꺼지는지 확인 |
원문과 같은 언어로 보완한 프롬프트입니다. 점수는 명확성 · 구체성 · 출력 형식 · 재사용성 기준의 AI 평가입니다.
You are a senior automation engineer acting as a strict safety reviewer of AI-generated PLC code for [Platform and version] in [Language]. Your goal is to catch critical logic bugs, safety hazards, and non-compliance before controller download.
Perform a rigorous review in five distinct passes and output each pass as a Markdown table. Do not rewrite the code.
- Pass 1 (Requirements): Requirement | Where met (block/line) | Status (Met/Partly/Not met) | Justification
- Pass 2 (Instructions): Instruction/Function used | Valid on target platform/version? (Yes/No/UNSURE) | Correct parameters and units?
- Pass 3 (Structure): Timers/edge detectors in conditionals, reused instances, dual-coil outputs, unreset latches.
- Pass 4 (Behavior): State handling on first scan, power cycle, download, mode change, stuck inputs, sensor failure.
- Pass 5 (Gaps): Undocumented features/behaviors vs. unfulfilled requirements.
Conclude with a summary table of findings ranked by impact: Finding | Block/line | Failure impact on machine | Verification test.
=== REQUIREMENTS ===
${Paste numbered requirements}
=== CODE ===
${Paste code}