행에서 단어 추출-열 이름 및 해당 숫자를 열 값으로여러 장치에서 추출한 오류 코드가있는 "Fault"라는 열이 있습니다. 특정 날짜의 오류 코드 중 하나가 아래에 나와 있습니다.
"inverter Inverter 20 under limit : 0.96 Kilowatts / inverter (58.9 % of 1.63 Kilowatts) at 11/30/2019 7:30:00 AM (sun az : 123.4 el : 3.7) 기간 : 4.00 시간 인버터 인버터 23 제한 미만 : 0.95 킬로와트 / 인버터 (1.63 킬로와트의 57.9 %) 2019/11/30 오전 7:30:00 (sun az : 123.4 el : 3.7) 기간 : 3.50 시간 "
다음과 같이 ---- Column name : Value 형식으로 세부 정보를 추출해야합니다.
인버터 : 20
한계 이하 (kW / 인버터) : 0.96
최대 비율 : 58.9 %
날짜 2019.11.30
시간 : 오전 7:30:00
태양 Az : 123.4
고도 : 3.7
소요 시간 (시간) : 4
오류 코드가있는 두 번째 인버터가있는 경우 (위 오류 코드의 두 번째 줄 참조)
인버터 : 23
한계 이하 (kW / 인버터) : 0.95
최대 % : 57.9 %
날짜 2019.11.30
시간 : 오전 7:30:00
태양 Az : 123.4
고도 : 3.7
소요 시간 (시간) : 3.50
때로는 한 줄에 유사한 코드를 제공 할 수있는 5 개 또는 10 개의 인버터 (70 개 중)가있을 수 있습니다.
이 작업을 수행하는 방법을 알려주세요. JSL을 통해서만 가능합니까? 아니면 공식을 사용할 수 있습니까? 어느 쪽이든-도움이 필요합니다.
데이터 테이블스크립팅Re : 행에서 단어 추출-열 이름 및 해당 숫자를 열 값으로공식 편집기를 사용하여 많은 진전을 이룰 수 있어야합니다. WORD 함수를 살펴보십시오.
Re : 행에서 단어 추출-열 이름 및 해당 숫자를 열 값으로데이브,
예, 결함이있는 인버터가 1 개 또는 2 개만 있으면 할 수 있습니다.하지만 예를 들어 단일 날짜에 대해 한 줄에 23 개의 오류 코드가있는 경우 개별적으로 많은 열을 생성 한 다음 각각에 대한 공식을 작성해야합니다. 23 개의 인버터. 내가 귀하의 솔루션을 이해하고 있는지 명확히 할 수 있습니까?또한 추출 후 분석의 목표를 요약하는 또 다른 줄을 추가했습니다.
Re : 행에서 단어 추출-열 이름 및 해당 숫자를 열 값으로저는 이와 같은 데이터를 여러 번 처리해야했습니다.내가 취해야 할 접근 방식은 입력 파일의 모든 데이터를 JMP 데이터 테이블로 읽는 것입니다. 여기서 각 전체 라인은 단일 열로 읽습니다.하나의 열이있는 데이터 테이블과 입력 데이터 테이블의 행 수와 같은 행 수로 끝납니다.
다음으로 레이블, 값 및 선의 3 개 열이있는 새 테이블을 만듭니다.그런 다음 한 열에있는 각 행의 내용을 스캔하는 JSL을 사용하여 새 테이블에 새 행을 만들고 Label (예 : Inverter, Under limit (KW / Inverter) 등), Value (예 : 20)를 채 웁니다. , 0.96 등) 및 현재 행 번호가되는 Line ..... Row ().라인의 첫 번째 인버터 또는 두 번째 인버터 등을 기반으로하는 추가 출력 열이 있어야 할 수도 있습니다.
":"을 구분 기호로 검색하는 Word () 함수와 함께 While () 함수를 사용하여 수행 할 수 있습니다.홀수 단어는 레이블이되고 짝수는 값이됩니다.
이 새 테이블이 생성되면 Tables => Split을 사용하여 인버터 당 한 행으로 쉽게 이동할 수 있습니다.
Re : 행에서 단어 추출-열 이름 및 해당 숫자를 열 값으로짐
제안 해 주셔서 감사합니다. 노력하겠습니다. 스크립팅을 처음 접하기 때문에 예제를 통해 알아볼 것입니다.
Re : 행에서 단어 추출-열 이름 및 해당 숫자를 열 값으로여가 시간이 있었어요 ... 코 비드 -19와 관련이 많지 않았기 때문에 데이터 읽기를 시작하기에 좋은 JSL을 작성했습니다.
Names Default To Here( 1 );
dt = Open(
"Path to the data file",
columns( New Column( "c000001", Character, "Nominal" ) ),
Import Settings(
End Of Line( CRLF, CR, LF ),
End Of Field( CSV( 0 ) ),
Strip Quotes( 1 ),
Use Apostrophe as Quotation Mark( 0 ),
Use Regional Settings( 0 ),
Scan Whole File( 1 ),
Treat empty columns as numeric( 0 ),
CompressNumericColumns( 0 ),
CompressCharacterColumns( 0 ),
CompressAllowListCheck( 0 ),
Labels( 0 ),
Column Names Start( 1 ),
Data Starts( 1 ),
Lines To Read( "All" ),
Year Rule( "20xx" )
)
);
// Create the new output data table
dtLong = New Table( "Long Data",
New Column( "Label", character ),
New Column( "Value", character ),
New Column( "Line" ),
New Column( "Instance" )
);
// A function that returns the next word in the line and
// then removes the word from the front of the target line
getWord = Function( {},
theWord = Trim( Word( 1, target, " " ) );
target = Trim( Substr( target, Length( theWord ) + 1 ) );
theWord;
);
// Loop through all rows in the input data table
For( i = 1, i <= N Rows( dt ), i++,
instance = 0;
target = Column( dt, 1 )[i];
While( Word( 1, target, " " ) != "",
dtLong << add rows( 1 );
dtLong:line[N Rows( dtLong )] = i;
theWord = getWord();
Match( theWord,
"inverter",
instance++;
dtLong:Instance[N Rows( dtLong )] = instance;
dtLong:Label[N Rows( dtLong )] = theWord;
theWord = getWord();
theWord = getword();
dtLong:value[N Rows( dtLong )] = theWord;,
"below",
dtLong:Instance[N Rows( dtLong )] = instance;
dtLong:Label[N Rows( dtLong )] = theWord || " limit (KW/Inverter)";
theWord = getWord();
theWord = getWord();
dtLong:value[N Rows( dtLong )] = theWord;
// Get the % of Max
dtLong << Add Rows( 1 );
dtLong:line[N Rows( dtLong )] = i;
dtLong:Instance[N Rows( dtLong )] = instance;
theWord = getWord();
theWord = getWord();
dtLong:Label[N Rows( dtLong )] = "% of Max";
dtLong:value[N Rows( dtLong )] = Substr( theWord, 2 );
// Skip forward to the Date
For( k = 1, k <= 5, k++,
theWord = getWord()
);
// Get the Date
dtLong << add rows( 1 );
theWord = getWord();
dtLong:Instance[N Rows( dtLong )] = instance;
dtLong:line[N Rows( dtLong )] = i;
dtLong:Label[N Rows( dtLong )] = "Date";
dtLong:value[N Rows( dtLong )] = theWord;
// Get the Time
dtLong << add rows( 1 );
theWord = getWord();
dtLong:Instance[N Rows( dtLong )] = instance;
dtLong:line[N Rows( dtLong )] = i;
dtLong:Label[N Rows( dtLong )] = "Time";
dtLong:value[N Rows( dtLong )] = theWord || getWord();
// Get the Sun Az
dtLong << add rows( 1 );
theWord = getWord();
dtLong:Instance[N Rows( dtLong )] = instance;
dtLong:line[N Rows( dtLong )] = i;
dtLong:Label[N Rows( dtLong )] = Substr( theWord, 2 ) || " " || getWord();
dtLong:value[N Rows( dtLong )] = getWord();
// Get the Elevation
dtLong << add rows( 1 );
theWord = getWord();
dtLong:Instance[N Rows( dtLong )] = instance;
dtLong:line[N Rows( dtLong )] = i;
dtLong:Label[N Rows( dtLong )] = "Elevation";
dtLong:value[N Rows( dtLong )] = Word( -1, getWord(), ")" );,
"Duration:",
dtLong:Instance[N Rows( dtLong )] = instance;
dtLong:Label[N Rows( dtLong )] = theWord || " (hrs)";
dtLong:value[N Rows( dtLong )] = getWord();
theWord = getWord();
)
;
);
);Re : 행에서 단어 추출-열 이름 및 해당 숫자를 열 값으로놀랄 만한! 내 요청을 수행하기 위해이 긴 코드를 작성하는 데 기다려 주셔서 감사합니다. 나는 이것을 다른 경고 코드에 구현하려고 노력하고 있습니다. 정말 감사합니다.