FUNCTION derive_dimensional_exponents

(* SCHEMA STRUCTURAL_FRAME_SCHEMA; *)

FUNCTION derive_dimensional_exponents
 		(x : unit) : dimensional_exponents;
 		
 	LOCAL
 		i : INTEGER;
 		result : dimensional_exponents := 
 		dimensional_exponents(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); 
 	END_LOCAL;
 		
 		IF 'STRUCTURAL_FRAME_SCHEMA.DERIVED_UNIT' IN
 			TYPEOF(x) THEN            (* x is a derived unit *)
 	REPEAT i := LOINDEX(x.elements) TO HIINDEX(x.elements);
 		
 		result.length_exponent := 
 			result.length_exponent + 
 			(x.elements[i].exponent * x.elements[i].unit.dimensions.length_exponent);
 		
 		result.mass_exponent := 
 			result.mass_exponent + 
 			(x.elements[i].exponent * x.elements[i].unit.dimensions.mass_exponent);
 		
 		result.time_exponent := 
 			result.time_exponent + 
 			(x.elements[i].exponent * x.elements[i].unit.dimensions.time_exponent); 
 		
 		result.electric_current_exponent := 
 			result.electric_current_exponent + 
 			(x.elements[i].exponent * x.elements[i].unit.dimensions.electric_current_exponent);
 		
 		result.thermodynamic_temperature_exponent :=
 			result.thermodynamic_temperature_exponent + 
 			(x.elements[i].exponent *
 			 x.elements[i].unit.dimensions.thermodynamic_temperature_exponent);
 		
 		result.amount_of_substance_exponent :=
 			result.amount_of_substance_exponent + 
 			(x.elements[i].exponent *
 			 x.elements[i].unit.dimensions.amount_of_substance_exponent);
 		
 		result.luminous_intensity_exponent := 
 			result.luminous_intensity_exponent + 
 			(x.elements[i].exponent *
 			 x.elements[i].unit.dimensions.luminous_intensity_exponent);
 		
 	END_REPEAT;
 		ELSE	(* x is a unitless or a named unit *)
 		result := x.dimensions;
 		END_IF;
 	RETURN (result);
END_FUNCTION; (* based on STEP Part 41 2nd edition *)

Referenced By

Defintion derive_dimensional_exponents is references by the following definitions:
DefinitionType
 valid_units FUNCTION


[Top Level Definitions] [Exit]

Generated by STEP Tools® EXPRESS to HTML Converter
2023-03-25T00:11:39-04:00