osate / osate2

Open Source AADL2 Tool Environment
http://osate.org
Eclipse Public License 2.0
36 stars 8 forks source link

Constant property declaration using user-defined property set is not working #286

Closed AliShirazi closed 11 years ago

AliShirazi commented 11 years ago

Hi,

I am currently developing with AADL in Eclipse using the osate2 libraries, and am using the official reference book. The following code segment below would not allow me to declare a constant property called Max_Power, despite the correct syntax being used. The code is the following:

property set Physical_Properties is
  Power_Units: type units
  (W,
   KW  => W * 1000,
   MW  => KW * 1000,
   GW  => MW * 1000,
   TW  => GW * 1000);

Max_Power: constant Physical_Properties::Power_Units => 1000 W;

end Physical_Properties;

The following errors are given:

-Assigning Integer value to property 'Physical_Properties::Max_Power' of type 'UnitsType' physical_properties.aadl/aram/physical_properties.aadl Xtext Check (fast)

-Couldn't resolve reference to UnitLiteral 'W'.

juli1 commented 11 years ago

Hello,

The property set would be rather the following : property set Physical_Properties is Power_Units: type units (W, KW => W * 1000, MW => KW * 1000, GW => MW * 1000, TW => GW * 1000); Power: type aadlinteger 0 W .. Max_Time units Physical_Properties::Power_Units;

Max_Power: constant Physical_Properties::Power => 1000 W;

end Physical_Properties;

Can you tell me if that addresses your issue ?

Regards.

juli1 commented 11 years ago

No feedback. I assume this is fixed.

reteprelief commented 11 years ago

Your original constant was defined for the property type units Power_Units.

Julien showed how to introduce the Power type. Power: type aadlinteger units Physical_Properties::Power_Units;

You can also define it as shown below, i.e., by specifying the type in place rather than a separate property type. property set Physical_Properties is Power_Units: type units (W, KW => W * 1000, MW => KW * 1000, GW => MW * 1000, TW => GW * 1000);

Max_Power: constant aadlinteger units Physical_Properties::Power_Units => 1000 W; end Physical_Properties;

reteprelief commented 11 years ago

second usage example