This component class implements a sine wave generation function.
Use this class to create parts in Canvas Views to form an equation model that requires damped or undamped sine wave as input values. Parts derived from this class have only output links; no input link is allowed.
When there are multiple output links, all will have the same resulting value after evaluation.
Current Angle (fAngle): registers the current angle. The user can initialize it to any angle before starting a simulation run. It does not have to start from 0. During simulation, the value will be increased by the Angle Increment value below.
Angle Increment (fDelta): indicates the angle increment for Current Angle at each simulation cycle advancement.
Damping Factor (fDamp): contains a damping factor for the sine wave generation. It is, by default, set to 0 for no damping at all. The value can be from 0 to 1. The damping factor stays constant in each sine wave cycle. If you enter 0.2, for example, the amplitude of the sine wave generated for each cycle will be reduced to 80% of that of the previous cycle, starting from the second cycle.
Period Register (iPeriod): registers the 0-based period of the current angle from the start for calculating the damped sine wave. We use this attribute to demonstrate how a hidden attribute is created and supported. You can enter a Service Session to see this attribute being displayed in an Object or a Part Properties dialog. The password for Visual Calculator is Calc. It is case-sensitive.
Evaluation (SG_xEval): calculates the amplitude of the damped sine function of the Current Angle and places the resulting value in all the output links.
The regular sine function in the mathematical library is called to obtain the undamped sine value of the Current Angle. In Visual Calculator version 1.0, the value is further multiplied by a scaling factor, (1.0-fDamp)^iPeriod, to obtain a damped result. With this method, however, the curve generated will not be smooth at the joint between any adjacent circular cycles because there is an abrupt change of the scaling factor at the left side and the right side of the curve. In Version 1.1, we interpolate the scaling factor linearly within a cycle so that it will be reduced constantly until it meets the starting point of the next cycle. Please see the source code for implementation details.
Port 2: connects to an output link that receives the resulting value. It can be linked multiple times.
Visual Calculator for SansGUI Version 1.1
Copyright © 2001-2003 ProtoDesign, Inc. All rights reserved.