Amogh Kulkarni
Amogh Kulkarni

Reputation: 153

How to use strict datatypes for params and unknowns in OpenMDAO 1.x.x?

In the early versions of OpenMDAO (pre 0.13.0), we could use ports with different datatypes than float, like Int, Str, Bool etc. Link given below -

http://openmdao.org/releases/0.13.0/docs/basics/variables.html

Right now I am using the latest version and would like to use Enum type input (i.e. param) port to my Component in order to restrict the value it takes to the values I specify. Is there an equivalent way to do the same in the newer versions of OpenMDAO (1.x.x) wherein you can explicitly mention the datatype of a port of a component?

Upvotes: 0

Views: 54

Answers (1)

Justin Gray
Justin Gray

Reputation: 5710

unfortunately, Enum is the one data-type that we didn't port over to 1.x from the older code. We couldn't find a use-case for it as a variable that got passed between components.

However, if you just want an input that has ENUM for some kind of user set parameters/setting we do have that.

We made an Option object that you can add to any component. We use it a lot for drivers. One of the ways you can use that is to specify values when you add an option which makes it function like an Enum. That will hopefully work for you.

Upvotes: 2

Related Questions