11
13693261870
2024-11-11 138b959cc11dc9a73b0c766030b99ba1180d8650
src/main/java/com/se/simu/domain/dto/ConfigDto.java
@@ -1,48 +1,29 @@
package com.se.simu.domain.dto;
import com.se.simu.config.PropertiesConfig;
import com.se.simu.helper.WebHelper;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
 * uwsolver配置类
 *
 * @author WWW
 * @date 2024-09-26
 */
@SuppressWarnings("ALL")
public class ConfigDto {
    public static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss");
    // 案例文件夹,必须指定,可以是相对路径,默认在求解器当前目录下
    private String casedir = "case";
    // 地形文件,仅需指定文件名(同下),无需指定路径,默认路径在案例文件夹下
    private String terrain_file = "DEM4548.tif";
    // 网格文件,在不提供的情况下默认通过studyzone_file进行生成
    private String mesh_file = "tongzhou-mini.msh";
    // 演算区域文件,在不提供网格文件的前提下必须指定
    private String studyzone_file = "studyzone_difference.shp";
    // 细化区域文件,通过studyzone_file生成网格文件时使用,可不提供,则默认均匀网格尺寸
    private String refinezones_file = "refinezones.shp";
    // 建筑区域文件,通过studyzone_file生成网格文件时使用,可不提供
    private String buildings_file = "buildings_inside.shp";
    // 管网节点文件,必须指定,用于生成求解文件
    private String nodes_file = "pipeline-demo-point.shp";
    // 管网管段文件,必须指定,用于生成求解文件
    private String links_file = "pipeline-demo-conduit.shp";
    // 管网集水点文件,即具有汇集一定范围内降水的雨水箅、雨水井等,必须指定,用于生成求解文件
    private String junctions_file = "pipeline-demo-point-junctions.shp";
    // 降雨文件,必须指定,用于生成求解文件
    private String raingage_file = "RainGage.dat";
    // 防洪障碍物文件,可不提供
    private String barrier_file = "barrier.shp";
    // 排水系统结果文件,用于保存管段/管点的水位、流量等信息
    private String drainage_outfile = "tongzhou-mini-drainage.h5";
    // 地面水位结果文件,用于保存地面水位信息
    private String sww_outfile = "tongzhou-mini.sww";
    // 流量单位,仅提供LPS(升/秒)、CMS(立方米/秒)、CFS(立方英尺/秒)三种单位
    private String flow_units = "LPS";
    private String infiltration = "HORTON";
    private String link_offsets = "DEPTH";
@@ -50,15 +31,10 @@
    private String allow_ponding = "NO";
    private String skip_steady_state = "NO";
    private String flow_routing = "DYNWAVE";
    // 演算开始时刻
    private String start_datetime = "06/12/2024 12:00:00";
    // 演算结束时刻
    private String end_datetime = "06/12/2024 13:00:00";
    // 结果保存的起始时刻
    private String report_start_datetime = "06/12/2024 00:00:00";
    // 结果保存时间间隔
    private String report_step = "00:01:00";
    // 排水管网演算时间步长,默认单位为s
    private String routing_step = "00:00:10";
    private String inertial_damping = "PARTIAL";
    private String normal_flow_limited = "BOTH";
@@ -79,12 +55,10 @@
    private Double friction = 0.01;
    private Double terrain_smoothing = 0.1;
    private String flow_algorithm = "DE1";
    // 网格单元最大面积,默认单位为m
    private Integer mesh_size = 5;
    // 结果保存频率,相对report_step来说,比如save_step=3就表示每间隔2个report_step保存一次结果
    private Integer save_step = 1;
    public void setProperties(String dirName, Integer minutes, PropertiesConfig config) {
    public void setProperties(String dirName, Date startTime, Integer minutes, PropertiesConfig config) {
        this.casedir = dirName;
        this.terrain_file = config.getDemFile();
        this.studyzone_file = config.getZoneName();
@@ -97,12 +71,13 @@
        this.drainage_outfile = dirName + ".h5";
        this.sww_outfile = dirName + ".sww";
        this.flow_units = config.getFlowUnits();
        this.threads = WebHelper.getCpuCores();
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(new Date());
        calendar.set(Calendar.HOUR, 0);
        calendar.set(Calendar.MINUTE, 0);
        calendar.set(Calendar.SECOND, 0);
        calendar.setTime(startTime);
        //calendar.set(Calendar.HOUR_OF_DAY, 0);
        //calendar.set(Calendar.MINUTE, 0);
        //calendar.set(Calendar.SECOND, 0);
        calendar.set(Calendar.MILLISECOND, 0);
        String start = DATE_FORMAT.format(calendar.getTime());