# Renewable Energy Plant System Application This is a Scala program to simulate a renewable energy plant. ## Use Cases The program can be used to simulate the following use cases: - The system is designed to monitor and control the power plant's renewable energy sources, including wind turbines, hydroelectric power plants, and nuclear power plants. The system can display and modify the number of active power plants. ```mermaid sequenceDiagram participant User participant System participant File User->>System: Monitor power plants System-->>User: Display number of active power plants User->>System: Modify number of active power plants System->>File: Update number of active power plants ``` - The system is capable of collecting data related to the energy generated by renewable sources and storing it in a file. ```mermaid sequenceDiagram participant User participant System participant Fingrid API participant Files User->>System: Collect data System->>Fingrid API: Get data Fingrid API-->>System: Return data System->>Files: Store data in files ``` - The system provides a view of the power plant's energy generation and storage capacity, allowing operators to adjust the power plant's operation as needed. This view shows the data stored in the file. ```mermaid sequenceDiagram participant User participant System participant Files User->>System: View data System->>Files: Read data from files System-->>User: Ask for filters and sorting User->>System: Provide filters and sorting System->>System: Filter and sort data System-->>User: Display data ``` - The system can analyze the data collected from renewable sources. It can filter the data on an hourly, daily, weekly and monthly basis. It can sort the data where possible. User can search for required data stored in the system. Data Analysis includes: - Mean - Median - Mode - Range - Midrange ```mermaid sequenceDiagram participant User participant System participant Files User->>System: Analyze data System->>Files: Read data from files System-->>User: Ask for filters System->>System: Filter data System->>System: Analyze data System-->>User: Display results ``` - The system should be able to detect and handle issues with renewable energy sources, such as low energy output, and generating alerts for the operators accordingly. ```mermaid sequenceDiagram participant User participant System participant Files System->>Files: Read data from Files System->>User: Alert user ``` ## Class Diagram ```mermaid classDiagram Main <|-- Date Main <|-- URL Main <|-- HttpURLConnection Main <|-- Paths Main <|-- Files Main <|-- SimpleDateFormat Main <|-- Try Main <|-- readLine Main <|-- Source Main <|-- ListMap Main <|-- PrintWriter class Main{ +String API_KEY +Map[Int, String] dataSources +String energySources +Double alertThreshold +collectData() +modifySources(lines: List[String], newValue: String, sourceType: String) +readSources(modificationFn: (List[String], String, String) => List[String]) +analyzeData(data: Map[Date, Double]) +compareTime(lastTimestamp: Date, data: List[String], filter: Int, format: SimpleDateFormat) +filterData(data: List[String], compareFn: (Date, List[String], Int, SimpleDateFormat) => Map[Date, Double]) +readData() +sortData(data: Map[Date, Double]) +printData(data: Map[Date, Double]) +searchData(data: List[String]) +alertUser() +scanSystem(data: List[String]) } ```