EE308_Lab1-2

Knightmare212 Knightmare212 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区

EE308_Lab1-2

The Link Your Class

https://bbs.csdn.net/forums/MUEE308FZU202201

The Link of Requirement of This Assignment

https://bbs.csdn.net/topics/608734907

The Aim of This Assignment

Programming&Keywords Capturing

MU STU ID and FZU STU ID

832001101_20122225

Personal Software Process Stages

Estimated Time/minutes

Completed Time/minutes

Planning

30

30

Estimate

20

30

Development

30

30

Analysis

50

60

Design Spec

60

70

Design Review

30

30

Coding Standard

30

30

Design

30

30

Coding

60

70

Code Review Planning

40

40

Test

40

30

Reporting

40

50

Test Report

20

30

Size Measurement

30

40

Postmortem & Process Improvement

30

40

total

540610

3. Ideas to slove the Lab

1. Import the file and save each line of sample code to the array for future search and comparison.

2. Store all keyword categories in an array

3. Compare the sample code array with the keyword group to count the number of code keywords.

4. Understand the relationship between switches and cases, and correctly count the number of switches and cases in each segment

5. Find out the relationship between if, else if and else, design an appropriate algorithm, and calculate the quantity correctly.

4. Design and implementation process

#include <string>
#include <iostream>
#include <fstream>
using namespace std;
the_keyword = ["auto", "break", "case", "char", "levelst", "leveltinue", "default", "do",
                 "double", "else", "enum", "extern", "float", "for", "goto", "if",
                 "int", "long", "register", "return", "short", "signed", "sizeof", "stastic",
                 "struct", "switch", "typedef", "union", "unsigned", "void", "else-if", "while"]
f = open(path, "r")

Key Code Explanation

1.Establish the variables to store value:

now_line = f.readline()
now_line = now_line[:-1]
the_keywords_length = 32
num_a = 0
num_b = []
flag_if = 0
flag_else_if = 0
num_if_else = 0
num_if_else_if_else = 0
sentences = []
x_len = 100000
count = np.zeros(the_keywords_length, dtype=int)

2.Code for level 1 and level 2:

while now_line:
    now_line = f.readline()
    now_line = now_line[:-1]
    now_line = now_line.replace("else if", "else-if")   ## it's convenient for searching
    x = re.split(' |\(|\;|\\t|\:|\{|\/\/', now_line)##split the words from  sentences
 
    for i in x:
        if (i == "if" or i == "else" or i == "else-if"):
            sentences.append(x)
            continue
    for i in x:
        for j in range(32):
            if (i == the_keyword[j]):
                if (i == "switch"):
                    num_b.append(num_a)
                    num_a = 0
                if (i == "case"):
                    num_a += 1
                count[j] += 1
 
f.close()##close the file
num_b.append(num_a) 
sum = 0
for i in range(32):
    if (count[i] != 0):
        sum += count[i]
        if (i == 30):
            sum += count[i]

3.Code for level 3 and level 4:

for i in sentences:
    if (len(i) < x_len):
        x_len = len(i)
 
 
for j in range(x_len):
    for i in sentences:
        if (i[j] == "if"):
            flag_if = 1
        if (i[j] == "else-if"):
            flag_else_if = 1
        if (i[j] == "else"):
            if (flag_else_if == 1):
                num_if_else_if_else += 1
            elif (flag_if == 1):
                num_if_else += 1
            flag_else_if = 0
            flag_else = 0

4.Print the result:

    print("sum : ", sum)  # 1
    print(the_keyword[25], " num : ", count[25])  # 2
    print("case num", num_b[1:3])  # 2
    print("if-else num:", num_if_else)   # 3
    print("if-elseif-else num:", num_if_else_if_else)   # 4

5.Unit test screenshots and description

6.Unit test coverage optimization and performance testing

7.Summarize this assignment.

This experiment was my first introduction to Github. I don't know anything about many of the features. There are some difficulties in the specific operation. So, I searched a lot of information and spent a lot of time.
I need to improve my ability to combine theory with practice. I hope to make more progress in the practical operation in the future.

 

...全文

相关推荐

EE-308 LAB4 final version.7z

这是本次实验的压缩包

晨起剪桃花

高校技术转移办公室人员如何精准识别高质量可转化专利?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

BIZKEEN

chromedriver-win64-159.0.8137.0(Canary).zip

chromedriver-win64-159.0.8137.0(Canary).zip

LCG元

风光储协同并网发电系统仿真(Simulink仿真实现)

内容概要:本文系统介绍了风光储协同并网发电系统的Simulink仿真资源,聚焦于风力、光伏与储能系统在交直流微电网环境下的集成建模与一体化协调控制策略仿真。内容涵盖MPPT最大功率点跟踪、储能变流器(PCS)控制、下垂控制、虚拟同步机(VSG)技术、并网PQ控制、孤岛运行、能量管理及混合储能(如蓄电池与超级电容)的功率分配等关键技术模块。资源提供完整的Simulink模型文件、详细的说明文档、参考文献及SCI论文复现资料,支持从理论建模到仿真验证的全流程科研实践,适用于微电网并网特性分析、系统稳定性研究与先进控制算法验证。; 适合人群:电力系统、新能源发电、微电网控制及相关方向的研究生、科研人员和工程技术人员,尤其适合具备MATLAB/Simulink操作基础和电力电子、自动控制背景的专业人士; 使用场景及目标:①开展风光储多能互补系统的建模与仿真研究;②完成学术论文复现、课程设计或学位课题开发;③深入掌握微电网中储能协调控制、并网逆变器控制、VSG动态响应等核心技术的实现机制; 阅读建议:建议结合所提供的参考文献与建模报告,按照资源目录顺序循序渐进地学习,优先运行仿真模型并调整关键控制参数,通过对比不同工况下的系统响应,深入理解控制逻辑与动态性能,全面提升科研仿真能力与工程应用水平。

ssswww56

国央企创新负责人在推动科技成果转化时如何实现全流程闭环管理?.docx

国央企创新负责人在推动科技成果转化时如何实现全流程闭环管理?

BIZKEEN
评论
收藏 已收藏
分享
返回顶部