Welcome to the TRNSYS Users Forum.

The forum is a place where people can interact and have discussions about different topics involving the use of the TRNSYS software package. Here you can post topics for discussion or questions on using TRNSYS and get advice from other users or TRNSYS experts. This forum is not intended for detailed technical support. Users should contact their distributor’s hotline for such assistance.

Some tips for success on using the forum:

  • Follow the Forum Rules posted in Forum Administration.
  • There are categories for different types of topics and questions. Post your topic or question into the proper category.
  • Before posting a topic or question search the existing topics  (and the TRNSYS Users listserv archive or Post archive) to see if a similar topic or question has already been answered.
  • Use a descriptive topic name. Don’t use attention getting subjects, they don’t get attention and only annoy people.
  • State the version of TRNSYS and which add-ons your are using.
  • Include enough specific details for your topic of question to be answered. Just posting “Why am I getting an error?” without describing the specific error and what you are trying to do when you get the error will not receive a response that fixes your issue.
  • Remember when people help you, they are doing you a favor. Be patient, help people out by posting good descriptions of what you need help with, and be polite even if a response does not solve your issue.
  • Moderators may edit your post for clarity or move your topic to a more appropriate category.

Notifications
Clear all

[Solved] How to solve a system of two equations

3 Posts
3 Users
0 Reactions
1,132 Views
0
Topic starter

Hello everyone,

My name is Henrique, and I'm currently working on my master's thesis using TRNSYS.

I'm facing a challenge with solving a system of two equations within the simulation. Initially, I attempted to use MATLAB to solve it, but after several unsuccessful attempts to establish a connection between MATLAB and TRNSYS, I spoke with my thesis mentor and he suggested there might be a simpler way to handle the equations directly in TRNSYS.

 

The system of equations is as follows:

1) m_oa + m_ia = m_ar

2) 0.009 * m_ar = (m_ar - m_ia) * Woa + m_ia * Wia

In this case, m_ar, Woa, and Wia are known values provided as inputs.

 

I’d appreciate any suggestions on how to solve this directly within TRNSYS or using a simple method. Thanks in advance for your help!

Best regards,
Henrique

2 Answers
0

@henriquesousa16

Henrique, the TRNSYS equation solver isn't clever enough to be able to solve equations simultaneously. You will need to handle that by writing a new Type for TRNSYS. The Matlab route should work if you are familiar with coding already in Matlab; you might reach out to your distributor for help in getting TRNSYS and Matlab to communicate. Another alternative is a component that calls Python or of course you can write a Type in Fortran using the built-in TypeStudio compiler and the existing source code as a guide.

~david

HenriqueSousa16 Topic starter 22/04/2025 2:21 pm

@davidbradley thank you for you help.

0

If you apply some algebra to the equations you specified, they can be solved directly:

m_ia = m_ar(0.009 - Woa)/(Wia-Woa) and m_oa = m_ar - m_ia

These equations can be entered into an equation block and solved during the simulation.

Share: