Jump to content

PWM Output based on DI Input and Timer


Grant Baker

Recommended Posts

Hi

I'm trying to produce a GP PWM output that does the following based on a single DI Input:

When DI is on, output of the GP PWM to be 75% for 0.4s, then return to 50%

When DI is switched off, the output of the GP PWM to be 25% for 0.4s, then return to 50%.

So default state of PWM is 50%. 

It's actually being transmitted via CAN to a JTI Mini Expansion Unit and the MEU is controlling a DC Motor, which is an Exhaust noise regulator.

I've been thinking of setting the GP PWM table to have DI State vs Timer 1 and then the output when DI1 "On" from 0-0.4S to be 75%, then 0.5S to 1S to be 50%. And then DI1 "off"  from 0-0.4S to be 25%, then 0.5S to 1S to be 50%What would the PWM change to when the timer is stopped though??

Also, what would "reset" the timer as if it's reset when on, it won't also reset and allow 25% for 0.4S... You can reset on "change of state", but you have to specify which change rather than "any" change.

Any guidance would be appreciated.

 

Link to comment
Share on other sites

There are also virtual aux outputs that can be sent over CAN. I'm still learning the not-as-intuitive-as-I-think-it-should-be PClink software, but I'm sure there's a way of doing this. We don't need to send PWM, per se, over CAN, just the required duty as a % that can be scaled in the CAN transmit.

Link to comment
Share on other sites

1 hour ago, Grant Baker said:

Bump!

Adam - any chance of some guidance on how to do this strategy with FP Duty so we can send this over CAN?

I'm still waiting for you to tell me what you want to do....  What to you want to control?  What inputs do you want the output based on?  Can it be open loop or does it need feedback?

 

41 minutes ago, Tim Hardisty said:

There are also virtual aux outputs that can be sent over CAN. I'm still learning the not-as-intuitive-as-I-think-it-should-be PClink software, but I'm sure there's a way of doing this. We don't need to send PWM, per se, over CAN, just the required duty as a % that can be scaled in the CAN transmit.

You still need to generate that %DC using a function in the ECU though.  You will notice most of the functions that can be assigned to a virtual aux are just on/off type functions, not DC.  FP Speed may be a possibility but it is tightly integrated into the general Fuel pump strategy so has many limitations (will only work when engine is running, closed loop it can only reference fuel pressure, etc...).

Link to comment
Share on other sites

1 minute ago, Adamw said:

I'm still waiting for you to tell me what you want to do....  What to you want to control?  What inputs do you want the output based on?  Can it be open loop or does it need feedback?

 

You still need to generate that %DC using a function in the ECU though.  You will notice most of the functions that can be assigned to a virtual aux are just on/off type functions, not DC.  FP Speed may be a possibility but it is tightly integrated into the general Fuel pump strategy so has many limitations (will only work when engine is running, closed loop it can only reference fuel pressure, etc...).

I need to control a simple exhaust flap in an exhaust pipe. 

I need to send a signal by CAN to the JTI MEU to control it. 

It needs to open when a DI is active and close when the DI is de activated. 

The flap has no feedback and takes 0.4s to open or close. 

Tim has said that the MEU will need to see 50% when “idle “ and 25% to shut the flap and 75% to open it.

So, Output (any output that can be sent by CAN) needs to sit at 50% until the DI is active and then send 75% for 0.4s, then go back to 50%. When DI drops / deactivates the output needs to go to 25% for 0.4s, then go back to 50%. 

Link to comment
Share on other sites

If it helps with creative solutions, the expander can be configured as a full bridge or pair of half bridges. I'm wondering if it would be easier to use a pair of virtual on/off functions to drive the half bridges - to open the flap one output, and hence bridge, could be driven on and the other off; vice versa to close it; and both off to stop movement.

If the on/off was scaled in the CAN transmit setup so that "on" sent the value needed for 100% duty, and "off" sent as 0, then this might work?

I know I said to send 50% duty when no movement is required, as for a full bridge that gets us a net 0% drive, but with half bridges that's not necessary (and, as an aside, a 0% duty request to the full bridge will actually cause it to shut down, for DBW safety reasons, but no in half bridge mode).

Link to comment
Share on other sites

16 minutes ago, Tim Hardisty said:

If it helps with creative solutions, the expander can be configured as a full bridge or pair of half bridges. I'm wondering if it would be easier to use a pair of virtual on/off functions to drive the half bridges - to open the flap one output, and hence bridge, could be driven on and the other off; vice versa to close it; and both off to stop movement.

Yep, this would be the ticket.  I just had a brief play to see if we could do the 25/50/100% option but with the complication of the timer needing to be part of the function we dont have a way to do that in the present firmware.  I think your suggested two half bridges would be piss easy.  

Set up below would do what you propose.  When DI1 gets switched on Byte 0 will go to 100 for 0.4sec, then return to zero.  When you switch off DI1 Byte 1 will go to 100 for 0.4sec then return to zero.  Note the VA's internal value is off = 1, on =2 (0 & 3 are used for error conditions) so that is why I have the odd -100 offset.  If you only wanted to send out say "75%" instead of 100 then you would use a multiplier of 75 and offset of -75.

You may have to add other conditions to the Virtual auxiliaries if for instance you always want to start up in some default state etc but I dont know what you are doing so I will leave that to you to decide.

 

SyPt20C.png

Link to comment
Share on other sites

Just to be awkward, 100% duty needs to be sent as 8192, so we need to change that multiplier (and offset, I think). Then Grant will need to make sure the expander unit is set to have a pair of half bridges, and to make sure the CAN ID's tie up etc. But I think we're there :)

Link to comment
Share on other sites

12 hours ago, Tim Hardisty said:

Just to be awkward, 100% duty needs to be sent as 8192, so we need to change that multiplier (and offset, I think). Then Grant will need to make sure the expander unit is set to have a pair of half bridges, and to make sure the CAN ID's tie up etc. But I think we're there :)

I'll give you a shout tomorrow or Friday Tim :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...