MobileMachinery

Model-Based Development and JCA’s Simulink Block-Set

By February 7, 2019 No Comments

The Growing Complexity of Software

Over the last 20 years, the off-highway vehicle market has seen an exponential growth in the complexity of software running on agriculture and construction equipment.  Initial software applications for these machines where typically only a few 100 lines of code and provided only limited functionality, such as lighting control.  However, today’s applications have grown to be tens of thousands (or even hundreds of thousands) of lines of code which control complex systems such as transmissions, engine power management and autonomous control.

Model-Based Development

In order to address the ever-increasing complexity of software algorithms, the model-based development approach has become commonplace when developing applications for the off-highway market.  Model-based development involves using a graphical approach to developing complex software algorithms; simulation of these graphical designs provides a very high level of confidence in the algorithms.  Many of today’s model-based development tools, such as Mathwork’s Matlab/Simulink tool, provide the ability to automatically generate code from the graphical design.

While providing the ability to solve complex problems, several studies have also shown that using model-based development can result in productivity increases of almost 200% as well as increasing the quality of the code.

JCA’s Simulink Block-Set

While the model-based development approach provides a great many benefits, the automatically generated code still requires integration with the target hardware controller.  As a result, this has required developers to have knowledge of a high-level coding language, such as C, as well as an understanding of the controller’s architecture.  This results in the limitation of rapid-development applications and makes using unfamiliar controllers difficult.

JCA has addressed this issue by developing a custom block-set for use with Mathwork’s Simulink environment.  This custom block-set provides access directly to functions within the JCA family of controllers, allowing developers to work completely within the model environment without having to write C-code and without having to worry about the internals of the controller.  Additionally, simple interfaces make configuring the controller quick and easy.

Upon code generation, the JCA block-set automatically generates code which integrates the model-developed algorithms with the controller hardware.

Making Getting Started Easier

JCA’s Configuration Block makes it easy to get projects started quickly.  When placed into the Simulink model, this block automatically configures all the Simulink parameters to the optimal settings for the JCA controllers.  Additionally, this block provides a simple interface to the controller’s configuration settings, such as the WIFI and J1939 bus settings, thus eliminating the need to spend valuable hours determining how to setup an individual controller.

JCA Configuration Block

 

 

Model/Controller Inputs

JCA’s block-set provides blocks for accessing data external to the controller, whether this be from sensors connected to the controller’s inputs, or from communication busses such as J1939.

The input block is capable of reading analog, digital and frequency inputs from sensors connected to the controller’s inputs.  As well, optional fault detection provides the ability to both monitor and detect out- of-range signals.

The J1939 receive block provides the ability to receive signals from the J1939 bus, with the ability to filter messages based on which bus it was received from and the source address of the message. Optional timestamp monitoring detects the last time the message was received, allowing for detection of loss of communication.

Unique to JCA’s block-set is the ability to simulate the model using the input and J1939 receive blocks.  Interfaces for both blocks allow the developer to enter simulation values during verification of the model.  As a result, this means that changes to the model are not required between simulation and code generation.

 

Model/Controller Outputs

In order to control outputs from the model/controller, JCA’s block-set provides blocks for controlling controller outputs and transmitting J1939 messages.

The controller output block allows the state of each output to be set, either as a digital output or a PWM output.  Additionally, this block can be configured to monitor the state of the output for faults, such as open-circuit faults and short to ground faults.

The J1939 transmit block provides the ability to transmit signals via the J1939 bus.  For each signal, the developer can select which bus is used to transmit the data as well as the destination address for the message.  The developer can also select whether the message is transmitted periodically or through a trigger event generated in the application.

Integration with JCA’s WIND Tool

All JCA’s controllers are capable of communicating with JCA’s WIND tool, which is a web-based tool that communicates with the controller.  The block-set provides three blocks (named Parameter, Live Data, and Event) that interface directly with WIND tool.

The WIND tool Parameter block interacts with the WIND tool, allowing users to modify parameters in the application during runtime.  As parameters are changed, this block stores the new values in non-volatile memory.

The WIND tool Live Data communicates directly with WIND tool, displaying live data from the controller in real-time.

Finally, the WIND tool Event block logs specific events whenever the block’s input is triggered with a rising input.  These event logs can be then downloaded using WIND tool.

Support for Custom Code

Even though JCA’s block-set is designed to allow developers to work completely in the model-based environment, there may be times when it is necessary to write custom code, such as integrating a legacy algorithm.

To support custom code, the JCA block-set provides several software “hooks” where developers can write custom C-code.  There are four software “hooks” that are executed as described below:

  • When the controller initially powers up from the off state
  • Just prior to execution of the model generated code
  • Immediately after execution of the model generated code
  • Prior to the controller shutting down when the ignition input is turned off.

 

Model-Based Development at JCA Electronics

At JCA Electronics, we have the expertise to guide companies in the use of model-based development, whether you are new to the model-based environment or have already developed several applications with this approach.  Using JCA’s block-set, along with JCA’s family of controllers provides an effective way of quickly developing quality applications, thus reducing time to market and the cost of development.