Simscape Library | HIL testing Simulation in Simulink | Simscape blocks and their application in Simulink | MATLAB/Simulink based simulated HIL testing

  

Source: MathWorks Website 

Simscape Blocks Libraries

According to MATLAB/Simulink documentation, the Simscape contains all those blocks that have some physical parameters that exist in real life for dynamic modelling of systems. For example we have electrical elements like transformer, diode, MOSFETs, whose transfer functions or state space modelling is not always possible. For that purpose Simulink provide a library with such blocks to model.

It is generally divided into 5 main parts comprising of Electrical and Mechanical basic bodies of simulation. They are:

  1.  Electrical
  2.  Fluids
  3.  Driveline
  4.  Multibody
  5.  Utilities
  6.  Foundation Library
These are further divided into many more categories but majority of the simulation verification of physical environment can be done by Foundation Library. This is again divided into the categories given in below image.

Examples of some basic physical system

1. Spring Mass Damper System

Let's have a spring mass damper system as shown in below figure.

Source: Wikipedia
In any control system, there is always a modelling of physical system which can be mechanical or electrical or electro-mechanical accordingly. Here this is a spring mass damper system in space. 

It is very easy to determine the transfer function of this system but for a complicated system, it becomes very very tedious job for a person who do not know mathematical modelling so, for that I tried to implement this in Simulink as model and also verified the transfer function (LINKoutput of this system with input as step function. 

So, if the block is moved x in the given direction, and the transfer function comes out to be

 

Transfer Function with some units

The below figure is the simulation of this system using Simscape blocks.


The configuration setting should not be changed for the simulation as it may lead to some error while simulation. The Solver Configuration (f(x) = 0) block is one of the most important element of this simulation as it connects the solver to the Simscape blocks and must be connected to reference points (either electrical ground or mechanical reference). The below figure shows the scope output which confirms the accurate modelling of this system.

Scope Output

2. Electrical Circuit

Electrical Circuit with given units
Calculated transfer function of this system is given by

H(s) = s/(s² + s + 1)
     Now input u꧐(t) = Step





Simscape simulation of the this circuit is shown in below figure
Simulink Modelling of Electrical Circuit

3. PID Control of Motor using Simscape



As it can be observed how everything is connected in line. The PID controller (LINK) and it's tuning (LINKalready done with reference rpm of 100 is from code itself but everything in blue and green are from physical model. All the motor parameters is been taken from a motor datasheet freely available on different source. From the scope, and display block it can be verified that how accurately it would work in physical system too. The below image is of scope output of RPM of motor and PWM signal to control the motor.
Speed in RPM


PWM Signal to H-bridge


Advantages of using Simscape

  1.  Easy to use.
  2.  Easy modelling of physical system.
  3.  High coverage of different complex system.
  4.  Can verify Hardware-In-Loop testing on simulation.
  5.  More nearer to hardware approximation and hardware simulation.
  6.  Large community for help in many systems.
  7.  Thermal modelling support of physical systems.
  8.  Inter-domain modelling ease of use.

Disadvantages

  1.  Still in developing phase with some blocks.
  2.  Lack of some PSPICE modelling blocks support.
  3.  Slow response and Solver configuration errors.
  4.  Conversion of continuous to discrete system is also very cumbersome job.

Conclusion

The pros and cons evaluation was done after implementing these circuits and analyzing them with general transfer system approach. These blocks can be new answers to HIL testing without hardware if implemented considering all the constraints. It can be said after going after SIL testing, and before integration in actual hardware, it would be better to test it on Simscape blocks and observe the general behavior of the model/algorithm and after this dSpace, Arduino, TIVA or other evaluation boards could be used for integration testing. People from research and development can be considered as most benefitted from this library as it is not always possible for them to have physical hardware.




Message from me

Hello folks! I hope you all would have got an idea regarding these simulations and workings. I will be updating soon with more electronics related stuffs till then please let me know your feedback about this blog 😀✌✌

 
Sincerely

- Curious Silly Yours

Comments

Post a Comment

Popular posts from this blog

PID Controller in MATLAB/Simulink using Transfer Function approach | PID Controller in MATLAB | How to simulate PID Controller in Simulink

Introduction to Control System | Application of Control System | Open Loop and Closed System | Types of Feedback systems