-
-
April 11, 2025 at 6:11 pm
Md_Salem
SubscriberHello, everyone,
I am using ANSYS 25 R1 to simulate PID vibration controller of a cantilever plate. The sensors measuring STRIAN and the actuators are piezoelectric patches attached to the surface of the plate. I used coupled field transient module to do the simulation. I input 20 N impact force at t=0.0005 s, and the simulation continued until t=0.1 s. I then used the next APDL macro at the solution section to simulate the controller :
"/post1
set,LAST
ex1=1675 ! element at which X-strain sensor 1
ex2=1680 ! element at which X-strain sensor 2
ey1=1153 ! element at which Y-strain sensor 1
ey2=1165 ! element at which Y-strain sensor 2
! Weights update at each time step based on strain magnitudes
*SET, fhigher, 185 ! Highest frequency (Hz)
DT = 1/(20*fhigher) ! Time step
*SET, TS , 0.1 ! Simulation time
*SET, integ , 0 ! Integral term
*SET, de , 0 ! Previous error
*SET, uL , -150
*SET, uH , 150 ! Voltage clamps
*SET, eps , 1e-12 ! Small value to avoid division by zero
*DO, t, DT, TS, DT
! --- Measure strains ---
*GET,StrainX1,ELEM,1675,EPTO,X ! X-strain sensor 1
*GET,StrainX2,ELEM,1680,EPTO,X ! X-strain sensor 2
*GET,StrainY1,ELEM,1153,EPTO,Y ! Y-strain sensor 1
*GET,StrainY2,ELEM,1165,EPTO,Y ! Y-strain sensor 2
! --- Compute dynamic weights based on absolute strains ---
*SET, absX1 = ABS(StrainX1)
*SET, absX2 = ABS(StrainX2)
*SET, absY1 = ABS(StrainY1)
*SET, absY2 = ABS(StrainY2)
*SET, total = absX1 + absX2 + absY1 + absY2 + eps
*SET, wX1 = absX1 / total ! Weight for X-sensor 1
*SET, wX2 = absX2 / total ! Weight for X-sensor 2
*SET, wY1 = absY1 / total ! Weight for Y-sensor 1
*SET, wY2 = absY2 / total ! Weight for Y-sensor 2
! --- Combine errors with dynamic weights ---
x = wX1*StrainX1 + wX2*StrainX2 + wY1*StrainY1 + wY2*StrainY2
! --- PID control ---
*SET,kp =1e3
*SET,ki =1e2
*SET,kd =1e1
*SET,kd =kd(0.00005/0.000263)
*SET,integ = 0
*SET, prev_err = 0
integ = integ + x*DT ! Integral term
diff = (x - de)/DT! Derivative term
U = kp*x + ki*integ + kd*diff ! Control voltage
! Clamp voltage
*IF, U, LT, uL, THEN, U = uL
*ELSEIF, U, GT, uH, THEN, U = uH
*ENDIF ! Apply voltage to PZT patch
ESEL,S,ENAME,,226 NSEL,R,LOC,Z,1e-3
D,ALL,VOLT,U
ALLSEL
de = x ! Update previous error
TIME, t
SOLVE
*ENDDO "
The first part of the simulation (the impact force effect) was done properly, and I could see the deformed shape in the solution section. But the previous code didn't run. When I look in the "solution information" section, I find an error.
*** ERROR *** CP = 1.812 TIME= 17:40:29 Unknown label in field 5 ( EPTO ) of GET command. Line= GET,StrainX1,ELEM,1675,EPTO,X The *GET command is ignored.
And then, the rest of the code didn't run. I need help to fix that error, please.
Regards
-
April 14, 2025 at 10:37 am
Stella Peloni
Ansys EmployeeHello,
Indeed, this issue/Error comes from the fact that *GET command for elements (ELEM) does not support EPTO (total strain). In the Documentation, in this link, in Table 161,you can check all the valid Items for Elements, when using *GET commnand. EPTO item is valif as averaged nodal result on selected elements as follows:
*GET,name,NODE, Node_Number,EPTO,X
To be more precise, you need to select prior issuing *get command, the element of interest and then select the node of this element to *get the EPTO value.
Thank you and have a great week ahead!
Kind Regards,
Stella
-
April 14, 2025 at 6:26 pm
ravef63622
SubscriberIf you are looking for a reliable casino https://www.casino-sistersite.co.uk/jackpotmobile/ with good returns, this is the place to go. I've been playing here for a few months now, and everything works stably. I often win small amounts, but the main thing - honestly and without cheating. Bonuses come regularly, especially nice to get personalized ones. Suitable for beginners and pros alike.
-
- You must be logged in to reply to this topic.
-
3266
-
1031
-
1004
-
859
-
798
© 2025 Copyright ANSYS, Inc. All rights reserved.