발전시뮬레이션 계산식 정리
This commit is contained in:
parent
da5b8f9104
commit
972c694588
@ -95,16 +95,15 @@ public class PwrGnrSimService {
|
||||
*/
|
||||
public PwrGnrSimResponse selectPwrGnrSimulation(PwrGnrSimRequest pwrGnrSimRequest) {
|
||||
|
||||
// 데이터가 없어서 오류가 발생한 경우, 빈값으로 리턴
|
||||
// 데이터가 없어서 오류가 발생한 경우, 빈값으로 리턴하기위한 값
|
||||
PwrGnrSimResponse exceptionRes = new PwrGnrSimResponse();
|
||||
double[] dExceptionData = new double[13];
|
||||
String[] strExceptionData = formatAndPrintArray(dExceptionData);
|
||||
String[] strExceptionData = formatAndPrintArray(new double[13]);
|
||||
exceptionRes.setHatsudenryouAll(strExceptionData);
|
||||
exceptionRes.setHatsudenryouAllSnow(strExceptionData);
|
||||
exceptionRes.setHatsudenryouPeakcutAll(strExceptionData);
|
||||
exceptionRes.setHatsudenryouPeakcutAllSnow(strExceptionData);
|
||||
|
||||
// 견적서 정보를 조회한다.
|
||||
// 1. 견적서 정보 조회
|
||||
PwrGnrSimPlanResponse planInfo = pwrGnrSimMapper.selectPlanInfo(pwrGnrSimRequest);
|
||||
|
||||
// 지역이 없으면 계산 불가능
|
||||
@ -113,7 +112,7 @@ public class PwrGnrSimService {
|
||||
return exceptionRes;
|
||||
}
|
||||
|
||||
// 견적서의 지붕재 목록 조회
|
||||
// 2. 견적서 지붕재 목록 조회
|
||||
List<PwrGnrSimRoofResponse> roofList = pwrGnrSimMapper.selectRoofList(pwrGnrSimRequest);
|
||||
int roofLength = roofList.size(); // Set의 크기 = 고유 roofSurfaceId 개수
|
||||
|
||||
@ -123,54 +122,26 @@ public class PwrGnrSimService {
|
||||
return exceptionRes;
|
||||
}
|
||||
|
||||
// 지붕재의 모든 Group 모듈 Item 조회
|
||||
// 3. 지붕재의 모듈 Item 조회 (item No 기준 Group) - 화면용
|
||||
pwrGnrSimRequest.setItemGroup("MODULE_");
|
||||
List<PwrGnrSimRoofResponse> roofGroupModuleList =
|
||||
pwrGnrSimMapper.selectRoofItemList(pwrGnrSimRequest);
|
||||
|
||||
// 전체 모듈에서 SORT 변경 (총용량 DESC)
|
||||
// 모듈 아이템이 없음.
|
||||
if (roofGroupModuleList.isEmpty()) {
|
||||
log.error("모듈 아이템이 없음.");
|
||||
return exceptionRes;
|
||||
}
|
||||
|
||||
// 4. 계산을 위해 order by 변경 (총용량 DESC) -계산용
|
||||
List<PwrGnrSimRoofResponse> moduleGroupList =
|
||||
roofGroupModuleList.stream()
|
||||
.sorted(
|
||||
Comparator.comparingDouble(PwrGnrSimRoofResponse::getTotSpecification)
|
||||
.reversed()) // 내림차순 정렬
|
||||
.collect(Collectors.toList());
|
||||
// .collect(
|
||||
// Collectors.groupingBy(
|
||||
// PwrGnrSimRoofResponse::getItemId, // 첫 번째 그룹화 기준
|
||||
// Collectors.collectingAndThen(
|
||||
// Collectors.toList(),
|
||||
// list -> {
|
||||
// // 그룹화된 첫 번째 요소를 기반으로 새 객체 생성
|
||||
// ObjectMapper mapper = new ObjectMapper();
|
||||
// PwrGnrSimRoofResponse setDto =
|
||||
// mapper.convertValue(list.get(0),
|
||||
// PwrGnrSimRoofResponse.class);
|
||||
//
|
||||
// // specification 합산
|
||||
// double totSpecification =
|
||||
// list.stream()
|
||||
// .mapToDouble(response ->
|
||||
// response.getTotSpecification())
|
||||
// .sum();
|
||||
//
|
||||
// totSpecification = totSpecification / 1000;
|
||||
//
|
||||
// // 합산 결과 설정
|
||||
// setDto.setTotSpecification(totSpecification);
|
||||
//
|
||||
// return setDto;
|
||||
// })))
|
||||
// .values()
|
||||
// .stream()
|
||||
|
||||
// 모듈 아이템이 없음.
|
||||
if (moduleGroupList.isEmpty()) {
|
||||
log.error("모듈 아이템이 없음.");
|
||||
return exceptionRes;
|
||||
}
|
||||
|
||||
// 모든GROUP PCS Group Item 조회
|
||||
// 5. PCS Item 조회
|
||||
List<PwrGnrSimRoofResponse> pcsGroupList =
|
||||
pwrGnrSimMapper.selectRoofPcsGroupList(pwrGnrSimRequest);
|
||||
|
||||
@ -339,7 +310,7 @@ public class PwrGnrSimService {
|
||||
ondo_sonshitsu[10] = 1 - 0.15 * ondo_keisu / 0.5;
|
||||
ondo_sonshitsu[11] = 1 - 0.1 * ondo_keisu / 0.5;
|
||||
|
||||
// PCS1 선택 정보
|
||||
// PCS1, pcs2, pcs3 선택 정보
|
||||
double pcs1_henkankouritsu = pwrGnrSimReq.getPcsCnvEff1() / 100; // 변환 효율
|
||||
double pcs1_youryou = pwrGnrSimReq.getPcsSpecification1(); // 용량 (예시 4.4)
|
||||
double pcs2_henkankouritsu = pwrGnrSimReq.getPcsCnvEff2() / 100;
|
||||
@ -362,9 +333,9 @@ public class PwrGnrSimService {
|
||||
+ (pcs3_youryou * pwrGnrSimReq.getPcsInput3());
|
||||
|
||||
double module1_watt = pwrGnrSimReq.getModuleSpecification1(),
|
||||
module1_watt_flash = module1_watt + 2;
|
||||
module1_watt_flash = module1_watt + 2; // 모듈 1 출력 + 2w (플래시)
|
||||
double module2_watt = pwrGnrSimReq.getModuleSpecification2(),
|
||||
module2_watt_flash = module2_watt + 2; // 모듈 1 출력 + 2w (플래시)
|
||||
module2_watt_flash = module2_watt + 2;
|
||||
double module3_watt = pwrGnrSimReq.getModuleSpecification3(),
|
||||
module3_watt_flash = module3_watt + 2;
|
||||
|
||||
@ -375,7 +346,7 @@ public class PwrGnrSimService {
|
||||
for (int i = 0; i < roofLength; i++) {
|
||||
if (!Double.isNaN(pwrGnrSimReq.getKoubai()[i]) && !Double.isNaN(pwrGnrSimReq.getHoui()[i])) {
|
||||
// 설치면 기울기와 방위가 입력되어 있으면 모듈의 매수를 취득
|
||||
module1_number_total += pwrGnrSimReq.getModuleInput1()[i];
|
||||
module1_number_total += pwrGnrSimReq.getModuleInput1()[i]; // amount
|
||||
module2_number_total += pwrGnrSimReq.getModuleInput2()[i];
|
||||
module3_number_total += pwrGnrSimReq.getModuleInput3()[i];
|
||||
}
|
||||
@ -476,7 +447,6 @@ public class PwrGnrSimService {
|
||||
|
||||
// 설치면 1~4의 합계 발전량
|
||||
for (int j = 0; j < 12; j++) {
|
||||
|
||||
for (int i = 0; i < roofLength; i++) {
|
||||
hatsudenryou_all[j] += hatsudenryou[i][j]; // hatsudenryou[i][j]);
|
||||
hatsudenryou_peakcut_all[j] += hatsudenryou_peakcut[i][j];
|
||||
|
||||
@ -49,7 +49,7 @@
|
||||
SELECT
|
||||
B.ITEM_ID
|
||||
, B.ITEM_NO
|
||||
, MAX(B.AMOUNT) AS AMOUNT
|
||||
, B.AMOUNT
|
||||
, C.CNV_EFF
|
||||
, C.AMP
|
||||
, B.SPECIFICATION
|
||||
@ -59,7 +59,6 @@
|
||||
WHERE C.ITEM_GROUP ='PC_'
|
||||
AND B.OBJECT_NO = #{objectNo}
|
||||
AND B.PLAN_NO = #{planNo}
|
||||
group by B.ITEM_ID, B.ITEM_NO, C.CNV_EFF , C.AMP ,B.SPECIFICATION
|
||||
ORDER BY B.SPECIFICATION
|
||||
/* TODO :: 직렬,병렬 조건 추가필요 */
|
||||
</select>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user