Student Lounge

Sharing technical and real-life examples of how students can use MATLAB and Simulink in their everyday projects #studentsuccess

Simulink Model Componentization with University of Alabama EcoCAR: Part 2

今天的来宾帖子是第2部分,第2部分Brandon Stevens。Brandon is a ECE graduate student who serves as the Propulsion Controls and Modeling lead for theUniversity of Alabama (UA) EcoCAR Mobility Challenge team。这个竞赛挑战11北美大学旨在制定和制定省油原型混合动力和SAE level 2autonomous vehicle. If you missed our first post with Brandon, check it outhere。In that post he covers how his team has set up their workflow around MATLAB projects: today he’ll be covering how their integration with Git helps them break down development tasks.

版本控制工作流程

我们的团队能够在校园和全国各地的学校休息时分配得很好。Git和Mathworks图形比较工具的使用,让我们简单地查看每个提交中的变化,并在分布时继续运行良好。
这使我们能够开始改进软件项目跟踪和模型评论的过程。我们的每个软件任务都可以在特定模型文件上实现一个明确的目标。一旦完成,首席团队成员就可以使用MATLAB项目版本控制GUI查看和批准更改。这有助于我们对系统/模型建立信心。此版本控制GUI还​​使我们能够非常轻松地恢复更改,因此,如果一个开发人员想要快速简便地重新启动,则可以轻松地将一个开发人员重新删除。我们还能够将更改藏起来,以使它们摆脱困境,但不能永久地启用易于探索和原型制作。知道这是可能的,为我们提供了鼓励原型制作和尝试新事物的真正简单方法。
我们的团队与主要开发分支,功能分支和释放分支合作。功能分支是将新代码添加到主分支中,并且功能分支上的所有提交都被“压缩”到一个分支中,然后合并以保持易于阅读的git历史记录。
When we move to test and use a new controller code onto the real vehicle, we make a release candidate branch via a semantic versioned Git tag. This special branch is a set of code that can be tested thoroughly via our hardware-in-the-loop vehicle simulator before being integrated into our prototype vehicle. Any critical fixes can also be made just for that release which is considered our end product. All versions of the code and code generated artefacts that is placed into the vehicle is therefore forever kept via GitLab Releases based on these special branches and can easily be compared in MATLAB through the version control GUI. This process has made our code safer and much easier for developers to get involved in writing their own new features or tests that get integrated into our main development branch.
在竞争的最后一年,我们已经使用了此过程,现在在任何给定时间对我们的代码都充满信心。我们在主要开发分支机构上创建了100多个投入,使用这些工具完成了大约40个功能分支,并审查了同行。

Componentization

真正帮助使这些生产力提高s is the re-factoring of our models into an improved modular and componentized form. Instead of one giant model file we now have many different types of models throughout which are each developed, simulated, and tested on their own. Each file is separated by different functional pieces of code similar to a modern software design practice. We had to think about how our system would work and first diagrammed out what the flow of our data and control logic would look like through the different pieces of our controller. Modernizing our code was not a one day task and did require learning the concepts plus the different MathWorks tools that will be discussed below, and applying them to our existing model. MathWorksComponent-Based Modeling Guidelines在决定做什么时对我们有很大的帮助。在我们项目开始时使用组件将是帮助计划我们的系统并与更大的团队运行的好方法。
Model referenceswere the biggest way we split up our control code into multiple models. A functional piece is stored as its own block and independent model reference file that provided a hierarchical form from our top-level controller to our lower level features. We converted our existing subsystems to model references using the模型参考转换顾问which helped us get up and running with them quickly. We already had a good idea what kind of signals would flow from model to model, so model references seemed like the best idea for us in making our controller model modular. Each system then can be worked on separately without causing Git merge issues and the clear interfaces between these models makes it easier to understand the necessary inputs and outputs for new features. Our code generation step also sped up significantly, saving us a lot of time waiting for it to compile or build.
除了分裂我们的模型外,我们还使用了子系统参考throughout our code. We have some different functions that we repeat throughout our model, such as a conversion between the torque our motor produces to that same torque that would be delivered at the vehicle wheels. Instead of copying and pasting a subsystem every time, we instead use this subsystem reference model which is version controlled as its own Simulink file. In addition our subsystem references may get edited often. If we change how this system works like improving our model of the efficiency of the relevant differential, then we can change one model file instead of manually changing each subsystem it’s used in.
我们不经常使用的另一个选项是将模型组成linked subsystem blocks。They are blocks linked to a separate library file and can have the same reuse and version control benefits as subsystem references. However, they do involve needing to manage our team library and the links for the blocks to it so we found model references and subsystem references to work better for our team.
Finally we also usevariant subsystemsas an easy way to experiment non-destructively with new features and make it easy to try out different solutions while testing in simulation and on our prototype vehicle. For example, we have three different ways to implement our regenerative braking strategy, and this can then be swapped simply while experimenting in our different test environments. All stored in a model reference and each containing subsystem references!
通过拥有25种不同的模型而不是1个模型,我们能够通过避免版本控制冲突来更好地作为团队合作,因为只有一个开发人员或对可以一次在文件上工作。开发一次解决或优化一个步骤的模型也更容易,例如一个模型来确定供应到另一个的驱动程序请求,以开始优化如何满足该请求。通过具有更简单和更容易理解的清晰功能和代码来创建开发任务来分发开发任务更容易。

Conclusion

Learning and implementing these strategies have been huge for our team and really helped us build better software that is not just easier to handle in the long run, but also built better by more members with less software bugs. It did take time for our original members to learn some of these software principles and apply them with these MathWorks tools, but that cost has shown great dividends of benefits in return. The UA team is excited to continue to leverage these MathWorks tools together as they blaze forwards towards the final year of the competition.
|
  • 打印
  • send email

コメント

コメントを残すには、ここをクリックして MathWorks アカウントにサインインするか新しい MathWorks アカウントを作成します。