Simcenter Amesim How can I use conditional statements in Global Parameters?

2024-08-01T00:22:59.000-0600
Simcenter Amesim Automation Connect Simcenter System Simulation Client for Git Simcenter Amesim Teamcenter Share

Summary

In this Knowledge Base Article you will learn how to set conditional statements in Global Parameters using matching syntaxis.


Details

In Simcenter Amesim, you cannot create conditional statements using the If-then(-else) terminology. However, you can use conditions based on Global Parameters values and matching syntax (e.g. x==1 or x!=1).

For example, let's consider setting the solar irradiation value based on the hour of the day:

 

  • Between 8 pm and 8 am: 0 W/m**2
  • Between 8 am and 12 am: 1000 W/m**2
  • Between 12 am and 4 pm: 1500 W/m**2
  • Between 4 pm and 8 pm: 1000 W/m**2

 

To achieve this, first define the daytime in hours and then set the conditions based on this time in the irradiance global parameter using the following expression:

(Time<=8 || Time>20)*0 + (Time>8 && Time<=12  || Time>16 && Time<=20)*1000 + (Time>12 && Time<=16)*1500

Now, depending on the daytime you input, the irradiation will be set based on the rules defined in the expression above:

Day time: 6 hours

Day time: 10 hours

Day time: 14 hours

KB Article ID# KB000133973_EN_US

Contents

SummaryDetails

Associated Components

Amesim Automation Connect