- Index
- » Users
- » rationalise
- » Profile
Posts
Posts
Page Start Prev 1 Next End
Jun-05-15 04:52:09
How to use enumeration subsets in vectors?
Category:
Programming
Forum:
Modelica Language
Thank you perost. I'm getting more understanding of this part of modelica now.
Jun-04-15 05:15:22
How to use enumeration subsets in vectors?
Category:
Programming
Forum:
Modelica Language
Hi everyone, thanks for looking at my question.
I'm a beginner in Modelica, and encountered an issue with getting a subset of an enumeration vector:
I've 2 enumerations:
Code:
type TComponent = enumeration(A,B,C,Cost);
type TComponentSubset = enumeration(A,B,C);
and 2 vectors based on the enumeration:
Code:
type TComponentVector = Real[TComponent];
type TComponentSubsetVector = Real[TComponentSubset];
Now in a model, how do I go about multiplying a subset of Out with ComponentPrices in the equation section? I cannot get it to work(last line).
Code:
model test
parameter TComponentSubsetVector ComponentPrices;
parameter TComponentVector Out;
equation
Out[TComponent.Cost] = Out[TComponentSubset] * ComponentPrices; //last line : error = illegal subscript TComponentSubset
end test
Similarly, I tried without success:
Code:
Out[TComponent.Cost] = Out[TComponentSubset.A:TComponentSubset.C] * ComponentPrices; //last line : error = illegal subscript TComponentSubset
Could anyone tell me what I am doing wrong? Thanks!
Page Start Prev 1 Next End
- Index
- » Users
- » rationalise
- » Profile