Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7703195
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:24:08+00:00 2026-05-31T23:24:08+00:00

How to implement Software in the Loop for control systems design with Modelica (OpenModelica,

  • 0

How to implement Software in the Loop for control systems design with Modelica (OpenModelica, jModelica) for a plant and C/C++ routine for a controller. What approaches you can suggest?
I thought external C Functions would help but seems they have some restrictions such that they should obey reference transparancy property ie return the same values for the same inputs (should not have internal states).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T23:24:09+00:00Added an answer on May 31, 2026 at 11:24 pm

    In that case, the issue with calling external C functions does not apply. It is true that Modelica restricts the use of functions in the continuous equations such that the function must return the same value for the same arguments. In those cases, you must find a way to pass the state into the function and have it return the new state (if you want to satisfy this “purity” requirement). This is obviously quite tedious to do with C code (you would have to pass in the state, assign all state variables (probably globals) run your code, then extract the values of all the state variables and return them).

    Fortunately for you, you don’t need to worry about this. The reason is because your function only needs to be called from within a when clause. If you are triggering your when clause based on time (e.g. using the sample(…) function), I’m pretty sure you are guaranteed that the function will only be invoked once at each time.

    Basically, your setup would be something like this:

    algorithm
      when sample(0, sample_rate) then
        u := controllerEvaluation(x, y, t);
      end when;
    

    In this way, you can pass time, the necessary states, x, and inputs, y (or u, depending on your perspective), into the controller and you get back the controller command to the plant, u.

    In this context, the when clause is a representation of your scheduler and because it doesn’t include any state events (like you would have, for example, with a tooth wheel encoder or other asynchronous interrupt) the simulator can schedule all these function invocations without any risk of having to repeat them.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone know how software fault tolerance is implemented in Air Traffic Control Systems?
I want design and implement an enterprise software with silverlight.I use sql server database
Both OOD (Object-Oriented-Design) and MVC (Model-View-Controller) architectures have become staples of modern software design.
I wish to implement my software on a shareware basis, so that the user
I am trying to implement a software Null Modem . Any suggestion how to
I want implement in my software solution an VBA editor but in c# 3.0.
Looking for a RAM disk API (or equivalent set of software to implement) to
Is there any open-source software that is trying to implement and emulate the human
I am taking a software engineering course and we use Java to implement some
i have just received a task to implement a software that paints over pictures

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.